rdbms: Log debug message traces as 'exception.trace' instead of 'trace'
[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 !! html+tidy
2293 <blockquote>
2294 <p>Foo <del>bar</del> <ins>baz</ins> quux
2295 </p>
2296 </blockquote>
2297 !! end
2298
2299 !! test
2300 T17491: <ins>/<del> in blockquote (2)
2301 !! wikitext
2302 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2303 </blockquote>
2304 !! html
2305 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2306 </blockquote>
2307
2308 !! html+tidy
2309 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2310 </p></blockquote>
2311 !! end
2312
2313 !! test
2314 <pre> with attributes (T5202)
2315 !! wikitext
2316 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2317 !! html
2318 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2319
2320 !! end
2321
2322 !! test
2323 <pre> with width attribute (T5202)
2324 !! wikitext
2325 <pre width="8">Narrow screen goodies</pre>
2326 !! html
2327 <pre width="8">Narrow screen goodies</pre>
2328
2329 !! end
2330
2331 !! test
2332 <pre> with forbidden attribute (T5202)
2333 !! wikitext
2334 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2335 !! html
2336 <pre width="8">Narrow screen goodies</pre>
2337
2338 !! end
2339
2340 !! test
2341 Entities inside <pre>
2342 !! wikitext
2343 <pre>&lt;</pre>
2344 !! html
2345 <pre>&lt;</pre>
2346
2347 !! end
2348
2349 !! test
2350 <pre> with forbidden attribute values (T5202)
2351 !! wikitext
2352 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2353 !! html
2354 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2355
2356 !! end
2357
2358 !! test
2359 <nowiki> inside <pre> (T15238)
2360 !! wikitext
2361 <pre>
2362 <nowiki>
2363 </pre>
2364 <pre>
2365 <nowiki></nowiki>
2366 </pre>
2367 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2368 !! html
2369 <pre>
2370 &lt;nowiki&gt;
2371 </pre>
2372 <pre>
2373
2374 </pre>
2375 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2376
2377 !! end
2378
2379 !! test
2380 <nowiki> inside of #tag:pre
2381 !! wikitext
2382 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2383 !! html/php
2384 <pre>Foo &#8594;bar</pre>
2385
2386 !! html/parsoid
2387 <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>
2388 !! end
2389
2390 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2391 ## aren't enclosed in nowikis.
2392 !! test
2393 <nowiki> and <pre> preference (first one wins)
2394 !! options
2395 parsoid=wt2html
2396 !! wikitext
2397 <pre>
2398 <nowiki>
2399 </pre>
2400 </nowiki>
2401 </pre>
2402
2403 <nowiki>
2404 <pre>
2405 <nowiki>
2406 </pre>
2407 </nowiki>
2408 </pre>
2409
2410 !! html/php
2411 <pre>
2412 &lt;nowiki&gt;
2413 </pre>
2414 <p>&lt;/nowiki&gt;
2415 &lt;/pre&gt;
2416 </p><p>
2417 &lt;pre&gt;
2418 &lt;nowiki&gt;
2419 &lt;/pre&gt;
2420
2421 &lt;/pre&gt;
2422 </p>
2423 !! html/parsoid
2424 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2425 </pre>
2426 <p>&lt;/nowiki></p>
2427
2428
2429 <p><span typeof="mw:Nowiki">
2430 &lt;pre>
2431 &lt;nowiki>
2432 &lt;/pre>
2433 </span></p>
2434 !! end
2435
2436 !! test
2437 </pre> inside nowiki
2438 !! wikitext
2439 <nowiki></pre></nowiki>
2440 !! html
2441 <p>&lt;/pre&gt;
2442 </p>
2443 !! end
2444
2445 !! test
2446 Empty pre; pre inside other HTML tags (T56946)
2447 !! wikitext
2448 a
2449
2450 <div><pre>
2451 foo
2452 </pre></div>
2453 <pre></pre>
2454 !! html/php+tidy
2455 <p>a
2456 </p>
2457 <div><pre>foo
2458 </pre></div>
2459 <pre></pre>
2460 !! html/parsoid
2461 <p>a</p>
2462
2463 <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
2464 </pre></div>
2465 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2466 !! end
2467
2468 !! test
2469 HTML pre followed by indent-pre
2470 !! wikitext
2471 <pre>foo</pre>
2472 bar
2473 !! html
2474 <pre>foo</pre>
2475 <pre>bar
2476 </pre>
2477 !! end
2478
2479 !! test
2480 Block tag pre
2481 !! wikitext
2482 <p><pre>foo</pre></p>
2483 !! html/php+tidy
2484 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2485 !! html/parsoid
2486 <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>
2487 !! end
2488
2489 !!test
2490 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2491 !! wikitext
2492 {{echo|}}
2493 !! html
2494
2495 !!end
2496
2497 !!test
2498 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2499 !! wikitext
2500 {{echo|
2501 foo}}
2502 !! html
2503 <p>foo
2504 </p>
2505 !!end
2506
2507 !! test
2508 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2509 !! wikitext
2510 {{echo|a
2511 b}}
2512 !! html
2513 <pre>a
2514 </pre>
2515 <p>b
2516 </p>
2517 !!end
2518
2519 !! test
2520 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2521 !! wikitext
2522 {{echo|a
2523 b
2524 c
2525 d
2526 e
2527 }}
2528 !! html
2529 <pre>a
2530 </pre>
2531 <p>b
2532 c
2533 </p>
2534 <pre>d
2535 </pre>
2536 <p>e
2537 </p>
2538 !!end
2539
2540 !!test
2541 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2542 !! wikitext
2543 {{echo| foo}}
2544
2545 {{echo| foo}}{{echo| bar}}
2546
2547 {{echo| foo}}
2548 {{echo| bar}}
2549
2550 {{echo|<!--cmt--> foo}}
2551
2552 <!--cmt-->{{echo| foo}}
2553
2554 {{echo|{{echo| }}bar}}
2555 !! html
2556 <pre>foo
2557 </pre>
2558 <pre>foo bar
2559 </pre>
2560 <pre>foo
2561 bar
2562 </pre>
2563 <pre>foo
2564 </pre>
2565 <pre>foo
2566 </pre>
2567 <pre>bar
2568 </pre>
2569 !!end
2570
2571 !! test
2572 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2573 !! wikitext
2574 {{echo| }}a
2575
2576 {{echo|
2577 }}a
2578
2579 {{echo|
2580 b}}
2581
2582 {{echo|a
2583 }}b
2584
2585 {{echo|a
2586 }} b
2587 !! html
2588 <pre>a
2589 </pre>
2590 <p><br />
2591 </p>
2592 <pre>a
2593 </pre>
2594 <p><br />
2595 </p>
2596 <pre>b
2597 </pre>
2598 <p>a
2599 </p>
2600 <pre>b
2601 </pre>
2602 <p>a
2603 </p>
2604 <pre>b
2605 </pre>
2606 !!end
2607
2608 ## Hmm, should Parsoid rt this?
2609 !! test
2610 Pres with newline attributes
2611 !! options
2612 parsoid=wt2html,html2html
2613 !! wikitext
2614 <pre class="one
2615 two">hi</pre>
2616 !! html/php
2617 <pre class="one two">hi</pre>
2618
2619 !! html/parsoid
2620 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2621 !! end
2622
2623 !! test
2624 Things that look like <pre> tags aren't treated as such
2625 !! wikitext
2626 Barack Obama <President> of the United States
2627 <President></President>
2628 !! html
2629 <p>Barack Obama &lt;President&gt; of the United States
2630 &lt;President&gt;&lt;/President&gt;
2631 </p>
2632 !! end
2633
2634 !! test
2635 Handle broken pre-like tags (T66025)
2636 !! options
2637 parsoid=wt2html
2638 !! wikitext
2639 {{echo|<pre <pre>x</pre>}}
2640
2641 <table><pre </table>
2642 !! html/php
2643 <pre>x</pre>
2644 <table>&lt;pre </table>
2645
2646 !! html/php+tidy
2647 <pre>x</pre>
2648 &lt;pre <table></table>
2649 !! html/parsoid
2650 <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>
2651
2652
2653 <p>&lt;pre </p>
2654
2655 <table></table>
2656 !! end
2657
2658 !! test
2659 Parsoid: handle pre with space after attribute
2660 !! options
2661 parsoid=wt2html
2662 !! wikitext
2663 <pre style="width:50%;" >{{echo|foo}}</pre>
2664 !! html/php
2665 <pre style="width:50%;">{{echo|foo}}</pre>
2666
2667 !! html/parsoid
2668 <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>
2669 !! end
2670
2671 # TODO / maybe: fix wt2wt for this
2672 !! test
2673 Parsoid: Don't paragraph-wrap fosterable content
2674 !! options
2675 parsoid=wt2html
2676 !! wikitext
2677 {|
2678 <td></td>
2679 <td></td>
2680
2681
2682
2683 |}
2684 !! html
2685 <table>
2686
2687 <tbody>
2688 <tr>
2689 <td></td>
2690
2691 <td></td></tr>
2692
2693
2694
2695 </tbody></table>
2696 !! end
2697
2698 !! test
2699 Self-closed pre
2700 !! wikitext
2701 <pre />
2702 !! html/php
2703 <pre></pre>
2704
2705 !! html/parsoid
2706 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2707 !! end
2708
2709 !! test
2710 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2711 !! options
2712 parsoid=wt2html
2713 !! wikitext
2714 {|
2715 <td>
2716 <td>
2717 </td>
2718
2719
2720
2721 |}
2722 !! html
2723 <table>
2724
2725 <tbody>
2726 <tr>
2727 <td></td>
2728
2729 <td>
2730 </td></tr>
2731
2732
2733
2734 </tbody></table>
2735 !! end
2736
2737
2738 #--------------------------------------------------------------------
2739 # Transclusion parameter whitespace stripping tests
2740 # Behavior is different for positional and named parameters
2741 #--------------------------------------------------------------------
2742 !! test
2743 Templates: Strip leading and trailing whitespace from named-param values
2744 !! wikitext
2745 {{echo|1= a }}
2746
2747 {{echo|1= {{echo|b}} }}
2748
2749 {{echo| 1 =
2750 c }}
2751
2752 {{echo| 1 =
2753 * d
2754 }}
2755 !! html
2756 <p>a
2757 </p><p>b
2758 </p><p>c
2759 </p>
2760 <ul><li>d</li></ul>
2761
2762 !! end
2763
2764 !! test
2765 Templates: Don't strip whitespace from positional-param values
2766 !! wikitext
2767 {{echo|a }}
2768
2769 {{echo|{{echo|b}} }}
2770
2771 {{echo| c
2772 }}
2773
2774 {{echo| {{echo|d}}
2775 }}
2776
2777 {{echo|
2778 e}}
2779
2780 {{echo|
2781 *f}}
2782
2783 {{echo|
2784 }}g
2785 !! html
2786 <p>a
2787 </p><p>b
2788 </p>
2789 <pre>c
2790 </pre>
2791 <p><br />
2792 </p>
2793 <pre>d
2794 </pre>
2795 <p><br />
2796 </p>
2797 <pre>e
2798 </pre>
2799 <p><br />
2800 </p>
2801 <ul><li>f</li></ul>
2802 <p><br />
2803 </p>
2804 <pre>g
2805 </pre>
2806 !! end
2807
2808 !! test
2809 Templates: Don't recognize targets split by newlines
2810 !! options
2811 parsoid=wt2html
2812 !! wikitext
2813 {{ech
2814 o|foo}}
2815 !! html/php
2816 <p>{{ech
2817 o|foo}}
2818 </p>
2819 !! html/parsoid
2820 <p>{{ech
2821 o|foo}}</p>
2822 !! end
2823
2824 !! test
2825 Templates: Recognize targets when newlines and comments don't split the target
2826 !! options
2827 parsoid=wt2html
2828 !! wikitext
2829 {{
2830 <!--X--> ech<!--X-->o<!--X-->
2831 <!--X--> <!--X-->
2832
2833 |foo}}
2834 !! html/php
2835 <p>foo
2836 </p>
2837 !! html/parsoid
2838 <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>
2839 !! end
2840
2841 !! test
2842 Templates: Handle empty comment-and-ws-only lines correctly
2843 !! wikitext
2844 {{echo|foo
2845 <!--should be ignored-->
2846 <!--should be ignored as well-->
2847 bar}}
2848 !! html/php
2849 <p>foo
2850 bar
2851 </p>
2852 !! html/parsoid
2853 <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>
2854 !! end
2855
2856 !! test
2857 Templates: Handle comments in the target
2858 !! wikitext
2859 {{echo
2860 <!-- should be ignored -->
2861 |foo}}
2862
2863 {{echo
2864 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2865 |foo}}
2866
2867 {{echo<!-- should be ignored -->
2868 |foo}}
2869
2870 {{echo<!-- should be ignored -->|foo}}
2871
2872 {{<!-- should be ignored -->echo|foo}}
2873 !! html/php
2874 <p>foo
2875 </p><p>foo
2876 </p><p>foo
2877 </p><p>foo
2878 </p><p>foo
2879 </p>
2880 !! html/parsoid
2881 <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>
2882
2883 <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>
2884
2885 <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>
2886
2887 <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>
2888
2889 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2890 !! end
2891
2892 !! test
2893 Templates: Handle comments in parameter names (T69657)
2894 !! wikitext
2895 {{echo|1
2896 <!-- should be ignored -->
2897 =foo}}
2898
2899 {{echo|
2900 <!-- should be ignored -->
2901 1 = foo}}
2902
2903 {{echo|1<!-- should be ignored -->=foo}}
2904
2905 {{echo|<!-- should be ignored -->1=foo}}
2906 !! html/php
2907 <p>foo
2908 </p><p>foo
2909 </p><p>foo
2910 </p><p>foo
2911 </p>
2912 !! html/parsoid
2913 <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>
2914
2915 <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>
2916
2917 <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>
2918
2919 <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>
2920 !! end
2921
2922 !! test
2923 Templates: Other wikitext in parameter names (T69657)
2924 !! wikitext
2925 {{echo|''1''=foo}}
2926 !! html/php
2927 <p>{{{1}}}
2928 </p>
2929 !! html/parsoid
2930 <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>
2931 !! end
2932
2933 !! test
2934 Templates: With colons
2935 !! wikitext
2936 {{With: Colon}}
2937 !! html/php
2938 <p>Template with colon
2939 </p>
2940 !! html/parsoid
2941 <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>
2942 !! end
2943
2944 #--------------------------------------------------------------------
2945 # Transclusion parameter escaping tests
2946 #--------------------------------------------------------------------
2947
2948 !! test
2949 Templates: Parsoid parameter escaping test 1
2950 !! wikitext
2951 {{echo|[foo]|{{echo|[bar]}}}}
2952 !! html/php+tidy
2953 <p>[foo]
2954 </p>
2955 !! html/parsoid
2956 <p about="#mwt1" typeof="mw:Transclusion"
2957 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2958 !! end
2959
2960 !! test
2961 Parsoid: Pipes in external links in template parameter
2962 !! wikitext
2963 {{echo|[{{echo|http://example.com}} link]}}
2964 !! html/php+tidy
2965 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2966 </p>
2967 !! html/parsoid
2968 <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>
2969 !! end
2970
2971 !! test
2972 Parsoid: pipe in transclusion parameter
2973 !! wikitext
2974 {{echo|http://foo.com/a&#124;b}}
2975 !! html/php+tidy
2976 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2977 </p>
2978 !! html/parsoid
2979 <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>
2980 !! end
2981
2982 !! test
2983 Parsoid: Pipe in external link target and content in template parameter
2984 !! options
2985 parsoid=html2wt,wt2wt
2986 !! wikitext
2987 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2988 !! html/php+tidy
2989 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2990 </p>
2991 !! html/parsoid
2992 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2993 typeof="mw:Transclusion"
2994 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2995 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2996 !! end
2997
2998 !! test
2999 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3000 !! options
3001 parsoid
3002 !! wikitext
3003 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3004 !! html
3005 <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>
3006 !! end
3007
3008 !! test
3009 Templates: Don't escape already nowiki-escaped text in template parameters
3010 !! options
3011 parsoid=html2wt,wt2wt
3012 !! wikitext
3013 {{echo|foo<nowiki>|</nowiki>bar}}
3014 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3015 {{echo|<nowiki></nowiki>}}
3016 !! html/php+tidy
3017 <p>foo|bar
3018 &lt;div&gt;
3019
3020 </p>
3021 !! html/parsoid
3022 <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>
3023 <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>
3024 <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>
3025 </p>
3026 !! end
3027
3028 ## T54824
3029 !! test
3030 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3031 !! options
3032 parsoid=html2wt,wt2wt
3033 !! wikitext
3034 {{echo|{{echo|1=bar}}}}
3035 !! html/php+tidy
3036 <p>bar
3037 </p>
3038 !! html/parsoid
3039 <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>
3040 !! end
3041
3042 ## T58733
3043 !! test
3044 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3045 !! wikitext
3046 {{echo|a : b}}
3047 !! html/php+tidy
3048 <p>a&#160;: b
3049 </p>
3050 !! html/parsoid
3051 <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>
3052 !! end
3053
3054 ## T73412
3055 !! test
3056 Templates: Preserve blank parameter names
3057 !! wikitext
3058 {{echo|=foo}}
3059 !! html/php+tidy
3060 <p>{{{1}}}
3061 </p>
3062 !! html/parsoid
3063 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3064 !! end
3065
3066 !! test
3067 Templates: Preserve blank parameter names in other positions
3068 !! wikitext
3069 {{blank_param|bar|=foo}}
3070 !! html/php+tidy
3071 <p>bar
3072 foo
3073 </p>
3074 !! html/parsoid
3075 <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
3076 foo</p>
3077 !! end
3078
3079 ###
3080 ### Parsoid-centric tests for testing RT edge cases for pre
3081 ###
3082
3083 !!test
3084 1a. Indent-Pre and Comments
3085 !! wikitext
3086 a
3087 <!--a-->
3088 c
3089 !! html
3090 <pre>a
3091 </pre>
3092 <p>c
3093 </p>
3094 !!end
3095
3096 !!test
3097 1b. Indent-Pre and Comments
3098 !! wikitext
3099 a
3100 <!--a-->
3101 c
3102 !! html
3103 <pre>a
3104 </pre>
3105 <p>c
3106 </p>
3107 !!end
3108
3109 !!test
3110 1c. Indent-Pre and Comments
3111 !! wikitext
3112 <!--a--> a
3113
3114 <!--a--> a
3115 !! html
3116 <pre> a
3117 </pre>
3118 <pre> a
3119 </pre>
3120 !!end
3121
3122 !!test
3123 1d. Indent-Pre and Comments
3124 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3125 !! wikitext
3126 <!--a--> a
3127
3128 <!--b-->b
3129 !! html
3130 <pre>a
3131 </pre>
3132 <pre>b
3133 </pre>
3134 !!end
3135
3136 !!test
3137 2a. Indent-Pre and tables
3138 !! wikitext
3139 {|
3140 |-
3141 !h1!!h2
3142 |foo||bar
3143 |}
3144 !! html
3145 <table>
3146
3147 <tr>
3148 <th>h1</th>
3149 <th>h2
3150 </th>
3151 <td>foo</td>
3152 <td>bar
3153 </td></tr></table>
3154
3155 !!end
3156
3157 !!test
3158 2b. Indent-Pre and tables
3159 !! wikitext
3160 {|
3161 |-
3162 |foo
3163 |}
3164 !! html
3165 <table>
3166
3167 <tr>
3168 <td>foo
3169 </td></tr></table>
3170
3171 !!end
3172
3173 !!test
3174 2c. Indent-Pre and tables (T44252)
3175 !! wikitext
3176 {|
3177 |+foo
3178 ! |bar
3179 |}
3180 !! html
3181 <table>
3182 <caption>foo
3183 </caption>
3184 <tr>
3185 <th>bar
3186 </th></tr></table>
3187
3188 !!end
3189
3190 !!test
3191 2d. Indent-Pre and tables
3192 !! wikitext
3193 a
3194 {|
3195 |b
3196 |}
3197 !! html/php
3198 <pre>a
3199 </pre>
3200 <table>
3201 <tr>
3202 <td>b
3203 </td></tr></table>
3204
3205 !! html/parsoid
3206 <pre>a</pre>
3207 <table>
3208 <tbody><tr><td> b</td></tr>
3209 </tbody></table>
3210 !!end
3211
3212 !!test
3213 2e. Indent-Pre and table-line syntax
3214 !! wikitext
3215 a
3216 | b
3217 | c
3218 !! html/php
3219 <pre>a
3220 | b
3221 | c
3222 </pre>
3223 !!end
3224
3225 !!test
3226 2f. Indent-pre started by table-line syntax
3227 !! wikitext
3228 a
3229 | b
3230 | c
3231 !! html/php
3232 <p>a
3233 </p>
3234 <pre>| b
3235 | c
3236 </pre>
3237 !! html/parsoid
3238 <p>a</p>
3239 <pre>
3240 | b
3241 | c</pre>
3242 !!end
3243
3244 !! test
3245 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3246 !! wikitext
3247 <table>
3248 <tr>
3249 <td>
3250 Text that should be rendered preformatted
3251 </td>
3252 </tr>
3253 </table>
3254 !! html
3255 <table>
3256 <tr>
3257 <td>
3258 <pre>Text that should be rendered preformatted
3259 </pre>
3260 </td>
3261 </tr>
3262 </table>
3263
3264 !! end
3265
3266 !!test
3267 3a. Indent-Pre and block tags (single-line html)
3268 !! wikitext
3269 a <p> foo </p>
3270 b <div> foo </div>
3271 c <blockquote> foo </blockquote>
3272 <span> foo </span>
3273 !! html
3274 a <p> foo </p>
3275 b <div> foo </div>
3276 c <blockquote> foo </blockquote>
3277 <pre><span> foo </span>
3278 </pre>
3279 !! html/parsoid
3280 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3281 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3282 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3283 <pre><span> foo </span>
3284 </pre>
3285 !! html/php+tidy
3286 <p> a </p><p> foo </p><p>
3287 b </p><div> foo </div><p>
3288 c </p><blockquote><p> foo </p></blockquote>
3289 <pre><span> foo </span>
3290 </pre>
3291 !! end
3292
3293 !!test
3294 3b. Indent-Pre and block tags (multi-line html)
3295 !! wikitext
3296 a <span>foo</span>
3297 b <div> foo </div>
3298 !! html
3299 <pre>a <span>foo</span>
3300 </pre>
3301 b <div> foo </div>
3302
3303 !! html/parsoid
3304 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3305 b <div data-parsoid='{"stx":"html"}'> foo </div>
3306 !! html/php+tidy
3307 <pre>a <span>foo</span>
3308 </pre><p>
3309 b </p><div> foo </div>
3310 !!end
3311
3312 !!test
3313 3c. Indent-Pre and block tags (pre-content on separate line)
3314 !! wikitext
3315 <p>
3316 foo
3317 </p>
3318
3319 <div>
3320 foo
3321 </div>
3322
3323 <center>
3324 foo
3325 </center>
3326
3327 <blockquote>
3328 foo
3329 </blockquote>
3330
3331 <blockquote>
3332 <pre>
3333 foo
3334 </pre>
3335 </blockquote>
3336
3337 <table><tr><td>
3338 foo
3339 </td></tr></table>
3340
3341 <ul><li>
3342 foo
3343 </li></ul>
3344
3345 !! html
3346 <p>
3347 foo
3348 </p>
3349 <div>
3350 <pre>foo
3351 </pre>
3352 </div>
3353 <center>
3354 <pre>foo
3355 </pre>
3356 </center>
3357 <blockquote>
3358 <p> foo
3359 </p>
3360 </blockquote>
3361 <blockquote>
3362 <pre>
3363 foo
3364 </pre>
3365 </blockquote>
3366 <table><tr><td>
3367 <pre>foo
3368 </pre>
3369 </td></tr></table>
3370 <ul><li>
3371 foo
3372 </li></ul>
3373
3374 !!end
3375
3376 !! test
3377 4. Indent-Pre and extension tags
3378 !! wikitext
3379 a <tag />
3380 !! html/php
3381 a <pre>
3382 NULL
3383 array (
3384 )
3385 </pre>
3386
3387 !! html/parsoid
3388 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3389 !! end
3390
3391 !! test
3392 5. Indent-Pre and html pre
3393 !! wikitext
3394 <pre class="123">hi</pre>
3395 !! html/php
3396 <pre class="123">hi</pre>
3397
3398 !! html/parsoid
3399 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3400 !! end
3401
3402 !!test
3403 Render paragraphs when indent-pre is suppressed in blocklevels
3404 !! wikitext
3405 <blockquote>
3406 foo
3407
3408 bar
3409 </blockquote>
3410 !! html
3411 <blockquote>
3412 <p> foo
3413 </p><p> bar
3414 </p>
3415 </blockquote>
3416
3417 !!end
3418
3419 !!test
3420 4. Multiple spaces at start-of-line
3421 !! wikitext
3422 <p> foo </p>
3423 foo
3424 {|
3425 |foo
3426 |}
3427 !! html
3428 <p> foo </p>
3429 <pre> foo
3430 </pre>
3431 <table>
3432 <tr>
3433 <td>foo
3434 </td></tr></table>
3435
3436 !!end
3437
3438 ## NOTE: the leading white-space chars on empty line are significant
3439 !! test
3440 5a. White-space in indent-pre
3441 !! wikitext
3442 a<br />
3443
3444 b
3445 !! html
3446 <pre>a<br />
3447
3448 b
3449 </pre>
3450 !! end
3451
3452 ## NOTE: the leading white-space chars on empty line are significant
3453 !! test
3454 5b. White-space in indent-pre
3455 !! wikitext
3456 a
3457
3458 b
3459
3460
3461 c
3462 !! html
3463 <pre>a
3464
3465 b
3466
3467
3468 c
3469 </pre>
3470 !! end
3471
3472 !! test
3473 5c. White-space in indent-pre
3474 !! wikitext
3475 ''a''
3476 ''b''
3477 ''c''
3478 !! html
3479 <pre><i>a</i>
3480 <i>b</i>
3481 <i>c</i>
3482 </pre>
3483 !! end
3484
3485 !! test
3486 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3487 !! wikitext
3488 a
3489
3490 <!-- continue -->
3491 b
3492
3493 c
3494
3495 d
3496 !! html
3497 <pre>a
3498
3499 b
3500 </pre>
3501 <pre>c
3502
3503 </pre>
3504 <p>d
3505 </p>
3506 !! end
3507
3508 !! test
3509 7a. Indent-pre and category links
3510 !! options
3511 parsoid=wt2html,wt2wt
3512 !! wikitext
3513 [[Category:foo]] <!-- No pre-wrapping -->
3514 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3515 !! html/php+tidy
3516 !! html/parsoid
3517 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3518 <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 -->
3519 !! end
3520
3521 ## We used to, but no longer wt2wt this test since the default serializer
3522 ## will normalize all categories to serialize on their own line.
3523 ## This wikitext usage is going to be fairly uncommon in production and
3524 ## selser will take care of preserving formatting in those scenarios.
3525 !! test
3526 7b. Indent-pre and category links
3527 !! options
3528 parsoid=wt2html
3529 !! wikitext
3530 [[Category:foo]] a
3531 [[Category:foo]] {{echo|b}}
3532 !! html/parsoid
3533 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3534 <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>
3535 !! end
3536
3537 !! test
3538 Indent-Pre: Newlines in comments shouldn't affect sol state
3539 !! wikitext
3540 a <!--
3541 foo
3542 --> b
3543 !! html/php+tidy
3544 <p>a b
3545 </p>
3546 !! html/parsoid
3547 <p>a <!--
3548 foo
3549 --> b</p>
3550 !! end
3551
3552 ###
3553 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3554 ###
3555
3556 !!test
3557 HTML-pre: 1. embedded newlines
3558 !! wikitext
3559 <pre>foo</pre>
3560
3561 <pre>
3562 foo
3563 </pre>
3564
3565 <pre>
3566
3567 foo
3568 </pre>
3569
3570 <pre>
3571
3572
3573 foo
3574 </pre>
3575 !! html/php+tidy
3576 <pre>foo</pre>
3577 <pre>foo
3578 </pre>
3579 <pre>
3580
3581 foo
3582 </pre>
3583 <pre>
3584
3585
3586 foo
3587 </pre>
3588 !! html/parsoid
3589 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3590
3591 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3592 </pre>
3593
3594 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3595
3596 foo
3597 </pre>
3598
3599 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3600
3601
3602 foo
3603 </pre>
3604 !!end
3605
3606 !! test
3607 HTML-pre: big spaces
3608 !! wikitext
3609 <pre>
3610
3611
3612
3613
3614 haha
3615
3616
3617
3618
3619 haha
3620
3621
3622
3623
3624 </pre>
3625 !! html/php+tidy
3626 <pre>
3627
3628
3629
3630
3631 haha
3632
3633
3634
3635
3636 haha
3637
3638
3639
3640
3641 </pre>
3642 !! html/parsoid
3643 <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"}}'>
3644
3645
3646
3647
3648 haha
3649
3650
3651
3652
3653 haha
3654
3655
3656
3657
3658 </pre>
3659 !! end
3660
3661 !!test
3662 HTML-pre: 2: indented text
3663 !! wikitext
3664 <pre>
3665 foo
3666 </pre>
3667 !! html
3668 <pre>
3669 foo
3670 </pre>
3671
3672 !!end
3673
3674 !!test
3675 HTML-pre: 3: other wikitext
3676 !! wikitext
3677 <pre>
3678 * foo
3679 # bar
3680 = no-h =
3681 '' no-italic ''
3682 [[ NoLink ]]
3683 </pre>
3684 !! html/php
3685 <pre>
3686 * foo
3687 # bar
3688 = no-h =
3689 '' no-italic ''
3690 [[ NoLink ]]
3691 </pre>
3692
3693 !! html/parsoid
3694 <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
3695 # bar
3696 = no-h =
3697 '' no-italic ''
3698 [[ NoLink ]]
3699 </pre>
3700 !!end
3701
3702 ###
3703 ### Definition lists
3704 ###
3705 !! test
3706 Simple definition
3707 !! wikitext
3708 ;name :Definition
3709 !! html
3710 <dl><dt>name&#160;</dt>
3711 <dd>Definition</dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition list for indentation only
3717 !! wikitext
3718 :Indented text
3719 !! html
3720 <dl><dd>Indented text</dd></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition list with no space
3726 !! wikitext
3727 ;name:Definition
3728 !! html
3729 <dl><dt>name</dt>
3730 <dd>Definition</dd></dl>
3731
3732 !!end
3733
3734 !! test
3735 Definition list with URL link
3736 !! wikitext
3737 ;http://example.com/ :definition
3738 !! html
3739 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3740 <dd>definition</dd></dl>
3741
3742 !! end
3743
3744 !! test
3745 Definition list with bracketed URL link
3746 !! wikitext
3747 ;[http://www.example.com/ Example]:Something about it
3748 !! html
3749 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3750 <dd>Something about it</dd></dl>
3751
3752 !! end
3753
3754 !! test
3755 Definition list with wikilink containing colon
3756 !! wikitext
3757 ; [[Help:FAQ]]:The least-read page on Wikipedia
3758 !! html
3759 <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>
3760 <dd>The least-read page on Wikipedia</dd></dl>
3761
3762 !! end
3763
3764 # At Brion's and JeLuF's insistence... :)
3765 !! test
3766 Definition list with news link containing colon
3767 !! wikitext
3768 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3769 !! html/php
3770 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3771 <dd>This isn't even a real newsgroup!</dd></dl>
3772
3773 !! html/parsoid
3774 <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>
3775 !! end
3776
3777 !! test
3778 Malformed definition list with colon
3779 !! wikitext
3780 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3781 !! html
3782 <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>
3783
3784 !! end
3785
3786 !! test
3787 Definition lists: colon in external link text
3788 !! wikitext
3789 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3790 !! html
3791 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3792 <dd>OK, I made that up</dd></dl>
3793
3794 !! end
3795
3796 !! test
3797 Definition lists: colon in HTML attribute
3798 !! wikitext
3799 ;<b style="display: inline">bold</b>
3800 !! html
3801 <dl><dt><b style="display: inline">bold</b></dt></dl>
3802
3803 !! end
3804
3805 !! test
3806 Definition lists: self-closed tag
3807 !! wikitext
3808 ;one<br/>two :two-line fun
3809 !! html
3810 <dl><dt>one<br />two&#160;</dt>
3811 <dd>two-line fun</dd></dl>
3812
3813 !! end
3814
3815 !! test
3816 Definition lists: ignore colons inside tags
3817 !! wikitext
3818 ;one <b>two : tag <i>fun:</i>:</b>:def
3819 !! html
3820 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3821 <dd>def</dd></dl>
3822
3823 !! end
3824
3825 !! test
3826 Definition lists: excess closed tags
3827 !! wikitext
3828 ;one</b>two :bad tag fun
3829 !! html/php+tidy
3830 <dl><dt>onetwo&#160;</dt>
3831 <dd>bad tag fun</dd></dl>
3832 !! html/parsoid
3833 <dl>
3834 <dt>onetwo</dt>
3835 <dd>bad tag fun</dd>
3836 </dl>
3837 !! end
3838
3839 !! test
3840 T13748: Literal closing tags
3841 !! wikitext
3842 <dl>
3843 <dt>test 1</dt>
3844 <dd>test test test test test</dd>
3845 <dt>test 2</dt>
3846 <dd>test test test test test</dd>
3847 </dl>
3848 !! html
3849 <dl>
3850 <dt>test 1</dt>
3851 <dd>test test test test test</dd>
3852 <dt>test 2</dt>
3853 <dd>test test test test test</dd>
3854 </dl>
3855
3856 !! end
3857
3858 !! test
3859 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3860 !! wikitext
3861 <ul><li>
3862 ;term :description
3863 *unordered
3864 </li></ul>
3865 !! html
3866 <ul><li>
3867 <dl><dt>term&#160;</dt>
3868 <dd>description</dd></dl>
3869 <ul><li>unordered</li></ul>
3870 </li></ul>
3871
3872 !! end
3873
3874 !! test
3875 Definition list with empty definition and following paragraph
3876 !! wikitext
3877 ;term:
3878
3879 Paragraph text
3880 !! html
3881 <dl><dt>term</dt>
3882 <dd></dd></dl>
3883 <p>Paragraph text
3884 </p>
3885 !! end
3886
3887 !! test
3888 Nested definition lists using html syntax
3889 !! wikitext
3890 <dl><dt>x</dt>
3891 <dd>a</dd>
3892 <dd>b</dd></dl>
3893 !! html
3894 <dl><dt>x</dt>
3895 <dd>a</dd>
3896 <dd>b</dd></dl>
3897
3898 !! end
3899
3900 !! test
3901 Definition Lists: No nesting: Multiple dd's
3902 !! wikitext
3903 ;x
3904 :a
3905 :b
3906 !! html
3907 <dl><dt>x</dt>
3908 <dd>a</dd>
3909 <dd>b</dd></dl>
3910
3911 !! end
3912
3913 !! test
3914 Definition Lists: Indentation: Regular
3915 !! wikitext
3916 :i1
3917 ::i2
3918 :::i3
3919 !! html
3920 <dl><dd>i1
3921 <dl><dd>i2
3922 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3923
3924 !! end
3925
3926 !! test
3927 Definition Lists: Indentation: Missing 1st level
3928 !! wikitext
3929 ::i2
3930 :::i3
3931 !! html
3932 <dl><dd><dl><dd>i2
3933 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3934
3935 !! end
3936
3937 !! test
3938 Definition Lists: Indentation: Multi-level indent
3939 !! wikitext
3940 :::i3
3941 !! html
3942 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3943
3944 !! end
3945
3946 !! test
3947 Definition Lists: Hacky use to indent tables
3948 !! wikitext
3949 ::{|
3950 |foo
3951 |bar
3952 |}
3953 this text
3954 should be left alone
3955 !! html
3956 <dl><dd><dl><dd><table>
3957 <tr>
3958 <td>foo
3959 </td>
3960 <td>bar
3961 </td></tr></table></dd></dl></dd></dl>
3962 <p>this text
3963 should be left alone
3964 </p>
3965 !! end
3966
3967 !! test
3968 Definition Lists: Hacky use to indent tables (with content following table)
3969 !! wikitext
3970 :{|
3971 |foo
3972 |bar
3973 |} <!--c1--> this text should be part of the dl
3974 !! html/php+tidy
3975 <dl><dd><table>
3976 <tbody><tr>
3977 <td>foo
3978 </td>
3979 <td>bar
3980 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
3981 !! html/parsoid
3982 <dl><dd><table>
3983 <tbody><tr>
3984 <td>foo
3985 </td>
3986 <td>bar
3987 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
3988 !! end
3989
3990 !! test
3991 Definition Lists: Hacky use to indent tables, with comments (T65979)
3992 !! wikitext
3993 <!-- foo -->
3994 ::{|
3995 |foo
3996 |bar
3997 |}<!-- bar -->
3998 this text
3999 should be left alone
4000 !! html/parsoid
4001 <!-- foo -->
4002 <dl><dd><dl><dd><table><tr>
4003 <td>foo</td>
4004 <td>bar</td>
4005 </tr></table><!-- bar --></dd></dl></dd></dl>
4006 <p>this text
4007 should be left alone</p>
4008 !! end
4009
4010 !! test
4011 Definition Lists: Hacky use to indent tables, with comment before table
4012 !! wikitext
4013 ::<!-- foo -->{|
4014 |foo
4015 |}
4016 !! html/parsoid
4017 <dl><dd><dl><dd><!-- foo --><table><tr>
4018 <td>foo</td>
4019 </tr></table></dd></dl></dd></dl>
4020 !! end
4021
4022 # The trailing whitespace in this test is to catch a regression in
4023 # Parsoid after T54473.
4024 !! test
4025 Definition Lists: Hacky use to indent tables (WS-insensitive)
4026 !! wikitext
4027 : {|
4028 |a
4029 |}
4030 !! html/php
4031 <dl><dd><table>
4032 <tr>
4033 <td>a
4034 </td></tr></table></dd></dl>
4035
4036 !! html/parsoid
4037 <dl><dd> <table>
4038 <tbody><tr><td>a</td></tr>
4039 </tbody></table> </dd></dl>
4040 !! end
4041
4042 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4043 ## as an empty dt item. It also ignores all but the last ";" when followed
4044 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4045 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4046 ## ";"s.
4047 ##
4048 ## Ex: ";;t2 ::d2" is transformed into:
4049 ##
4050 ## <dl>
4051 ## <dt>t2 </dt>
4052 ## <dd>
4053 ## <dl>
4054 ## <dt></dt>
4055 ## <dd>d2</dd>
4056 ## </dl>
4057 ## </dd>
4058 ## </dl>
4059 ##
4060 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4061 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4062 ##
4063 ## <dl>
4064 ## <dt>
4065 ## <dl>
4066 ## <dt>t2 </dt>
4067 ## <dd>:d2</dd>
4068 ## </dl>
4069 ## </dt>
4070 ## </dl>
4071 ##
4072 ## All Parsoid only definition list tests have this difference.
4073 ##
4074 ## See also: https://phabricator.wikimedia.org/T8569
4075 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4076
4077 !! test
4078 Table / list interaction: indented table with lists in table contents
4079 !! wikitext
4080 :{|
4081 |-
4082 |a
4083
4084 *b
4085 |-
4086 |c
4087
4088 *d
4089 |}
4090 !! html
4091 <dl><dd><table>
4092
4093 <tr>
4094 <td>a
4095 <ul><li>b</li></ul>
4096 </td></tr>
4097 <tr>
4098 <td>c
4099 <ul><li>d</li></ul>
4100 </td></tr></table></dd></dl>
4101
4102 !! end
4103
4104 !!test
4105 Table / list interaction: lists nested in tables nested in indented lists
4106 !! wikitext
4107 :{|
4108 |
4109 :a
4110 :b
4111 |
4112 *c
4113 *d
4114 |}
4115
4116 *e
4117 *f
4118 !! html
4119 <dl><dd><table>
4120 <tr>
4121 <td>
4122 <dl><dd>a</dd>
4123 <dd>b</dd></dl>
4124 </td>
4125 <td>
4126 <ul><li>c</li>
4127 <li>d</li></ul>
4128 </td></tr></table></dd></dl>
4129 <ul><li>e</li>
4130 <li>f</li></ul>
4131
4132 !!end
4133
4134 !! test
4135 Definition Lists: Nesting: Multi-level (Parsoid only)
4136 !! wikitext
4137 ;t1 :d1
4138 ;;t2 ::d2
4139 ;;;t3 :::d3
4140 !! html/parsoid
4141 <dl>
4142 <dt>t1 </dt>
4143 <dd>d1</dd>
4144 <dt>
4145 <dl>
4146 <dt>t2 </dt>
4147 <dd>:d2</dd>
4148 <dt>
4149 <dl>
4150 <dt>t3 </dt>
4151 <dd>::d3</dd>
4152 </dl>
4153 </dt>
4154 </dl>
4155 </dt>
4156 </dl>
4157
4158
4159 !! end
4160
4161
4162 !! test
4163 Definition Lists: Nesting: Test 2
4164 !! wikitext
4165 ;t1
4166 ::d2
4167 !! html+tidy
4168 <dl><dt>t1</dt>
4169 <dd>
4170 <dl><dd>d2</dd></dl></dd></dl>
4171 !! end
4172
4173
4174 !! test
4175 Definition Lists: Nesting: Test 3
4176 !! wikitext
4177 :;t1
4178 ::::d2
4179 !! html+tidy
4180 <dl><dd><dl><dt>t1</dt>
4181 <dd>
4182 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4183 !! end
4184
4185
4186 !! test
4187 Definition Lists: Nesting: Test 4
4188 !! wikitext
4189 ::;t3
4190 :::d3
4191 !! html
4192 <dl><dd><dl><dd><dl><dt>t3</dt>
4193 <dd>d3</dd></dl></dd></dl></dd></dl>
4194
4195 !! end
4196
4197
4198 ## The Parsoid team believes the following three test exposes a
4199 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4200 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4201 ## It also exposes a "misfeature" in tidy, which doesn't like
4202 ## <dl> tags with a single <dt> child; it converts the <dt> into
4203 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4204 !! test
4205 Definition Lists: Mixed Lists: Test 1
4206 !! wikitext
4207 :;*foo
4208 ::*bar
4209 :;baz
4210 !! html/php
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
4215 !! html/php+tidy
4216 <dl><dd><dl><dt><ul><li>foo</li>
4217 <li>bar</li></ul></dt></dl>
4218 <dl><dt>baz</dt></dl></dd></dl>
4219 !! html/parsoid
4220 <dl>
4221 <dd><dl>
4222 <dt><ul>
4223 <li>foo
4224 </li>
4225 </ul></dt>
4226 <dd><ul>
4227 <li>bar
4228 </li>
4229 </ul></dd>
4230 <dt>baz</dt>
4231 </dl></dd>
4232 </dl>
4233 !! end
4234
4235 !! test
4236 Definition Lists: Mixed Lists: Test 2
4237 !! wikitext
4238 *:d1
4239 *:d2
4240 !! html
4241 <ul><li><dl><dd>d1</dd>
4242 <dd>d2</dd></dl></li></ul>
4243
4244 !! end
4245
4246
4247 !! test
4248 Definition Lists: Mixed Lists: Test 3
4249 !! wikitext
4250 *:::d1
4251 *:::d2
4252 !! html
4253 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4254 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4255
4256 !! end
4257
4258
4259 !! test
4260 Definition Lists: Mixed Lists: Test 4
4261 !! wikitext
4262 *;d1 :d2
4263 *;d3 :d4
4264 !! html
4265 <ul><li><dl><dt>d1&#160;</dt>
4266 <dd>d2</dd>
4267 <dt>d3&#160;</dt>
4268 <dd>d4</dd></dl></li></ul>
4269
4270 !! end
4271
4272
4273 !! test
4274 Definition Lists: Mixed Lists: Test 5
4275 !! wikitext
4276 *:d1
4277 *::d2
4278 !! html
4279 <ul><li><dl><dd>d1
4280 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4281
4282 !! end
4283
4284
4285 !! test
4286 Definition Lists: Mixed Lists: Test 6
4287 !! wikitext
4288 #*:d1
4289 #*:::d3
4290 !! html
4291 <ol><li><ul><li><dl><dd>d1
4292 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4293
4294 !! end
4295
4296
4297 !! test
4298 Definition Lists: Mixed Lists: Test 7
4299 !! wikitext
4300 :*d1
4301 :*d2
4302 !! html
4303 <dl><dd><ul><li>d1</li>
4304 <li>d2</li></ul></dd></dl>
4305
4306 !! end
4307
4308
4309 !! test
4310 Definition Lists: Mixed Lists: Test 8
4311 !! wikitext
4312 :*d1
4313 ::*d2
4314 !! html
4315 <dl><dd><ul><li>d1</li></ul>
4316 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4317
4318 !! end
4319
4320
4321 !! test
4322 Definition Lists: Mixed Lists: Test 9
4323 !! wikitext
4324 *;foo :bar
4325 !! html
4326 <ul><li><dl><dt>foo&#160;</dt>
4327 <dd>bar</dd></dl></li></ul>
4328
4329 !! end
4330
4331
4332 !! test
4333 Definition Lists: Mixed Lists: Test 10
4334 !! wikitext
4335 *#;foo :bar
4336 !! html
4337 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4338 <dd>bar</dd></dl></li></ol></li></ul>
4339
4340 !! end
4341
4342 # The Parsoid team disagrees with the PHP parser's seemingly-random
4343 # rules regarding dd/dt on the next few tests. Parsoid is more
4344 # consistent, and recognizes the shared nesting and keeps the
4345 # still-open tags around until the nesting is complete.
4346
4347 # This is a regression test for T175099
4348 !! test
4349 Definition Lists: Mixed Lists: Test 11
4350 !! wikitext
4351 ;a
4352 :*b
4353 !! html/php
4354 <dl><dt>a</dt>
4355 <dd>
4356 <ul><li>b</li></ul></dd></dl>
4357
4358 !! html/parsoid
4359 <dl><dt>a
4360 <dd><ul><li>b</li></ul></dd></dl>
4361 !! end
4362
4363 # FIXME: Maybe get rid of this test?
4364 !! test
4365 Definition Lists: Mixed Lists: Test 12
4366 !! wikitext
4367 *#*#;*;;foo :bar
4368 *#*#;boo :baz
4369 !! html/php
4370 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4371 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4372 <dl><dt>boo&#160;</dt>
4373 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4374
4375 !! html/php+tidy
4376 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4377 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4378 <dl><dt>boo&#160;</dt>
4379 <dd>baz</dd></dl></li></ol></li></ul>
4380 !! html/parsoid
4381 <ul>
4382 <li>
4383 <ol>
4384 <li>
4385 <ul>
4386 <li>
4387 <ol>
4388 <li>
4389 <dl>
4390 <dt>
4391 <ul>
4392 <li>
4393 <dl>
4394 <dt>
4395 <dl>
4396 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4397 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4398 </dl></dt>
4399 </dl></li>
4400 </ul></dt>
4401 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4402 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4403 </dl></li>
4404 </ol></li>
4405 </ul></li>
4406 </ol></li>
4407 </ul>
4408 !! end
4409
4410 # FIXME: Maybe get rid of this test?
4411 # From whitelist:
4412 # * The test is wrong, there are two colons where there should be :;
4413 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4414 !! test
4415 Definition Lists: Weird Ones: Test 1
4416 !! wikitext
4417 *#;*::;;foo :bar (who uses this?)
4418 !! html/php+tidy
4419 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4420 <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>
4421 !! html/parsoid
4422 <ul>
4423 <li>
4424 <ol>
4425 <li>
4426 <dl>
4427 <dt>
4428 <ul>
4429 <li>
4430 <dl>
4431 <dd>
4432 <dl>
4433 <dd>
4434 <dl>
4435 <dt>
4436 <dl>
4437 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4438 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4439 </dl></dt>
4440 </dl></dd>
4441 </dl></dd>
4442 </dl></li>
4443 </ul></dt>
4444 </dl></li>
4445 </ol></li>
4446 </ul>
4447 !! end
4448
4449 !! test
4450 Definition Lists: colons occurring in tags
4451 !! wikitext
4452 ;a:b
4453 ;'''a:b'''
4454 ;<i>a:b</i>
4455 ;<span>a:b</span>
4456 ;<div>a:b</div>
4457 ;<div>a
4458 :b</div>
4459 ;{{echo|a:b}}
4460 ;{{echo|''a:b''}}
4461 ;;;''a:b''
4462 !! html+tidy
4463 <dl><dt>a</dt>
4464 <dd>b</dd>
4465 <dt><b>a:b</b></dt>
4466 <dt><i>a:b</i></dt>
4467 <dt><span>a:b</span></dt>
4468 <dt><div>a:b</div></dt>
4469 <dt><div>a</div></dt>
4470 <dd>b</dd>
4471 <dt>a</dt>
4472 <dd>b</dd>
4473 <dt><i>a:b</i></dt></dl>
4474 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4475 !! html/parsoid
4476 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4477 <dt><b>a:b</b></dt>
4478 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4479 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4480 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4481 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4482 <dd>b</dd>
4483 <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>
4484 <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>
4485 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4486 !! end
4487
4488 # Parsoid's output differs here again because it shares
4489 # nesting between the two lists unlike the PHP parser.
4490 # Unsure which is more desirable.
4491 !! test
4492 Definition Lists: colons and tables 1
4493 !! wikitext
4494 :{|
4495 |x
4496 |}
4497 :{|
4498 |y
4499 |}
4500 !! html/php
4501 <dl><dd><table>
4502 <tr>
4503 <td>x
4504 </td></tr></table></dd></dl>
4505 <dl><dd><table>
4506 <tr>
4507 <td>y
4508 </td></tr></table></dd></dl>
4509
4510 !! html/parsoid
4511 <dl><dd><table>
4512 <tr>
4513 <td>x
4514 </td></tr></table></dd>
4515 <dd><table>
4516 <tr>
4517 <td>y
4518 </td></tr></table></dd></dl>
4519 !! end
4520
4521 # FIXME: Does this need a html/php section?
4522 !! test
4523 Definition Lists: template interaction
4524 !! wikitext
4525 ::{{definition_list}}
4526
4527 :one
4528 ::{{definition_list}}
4529 :::two
4530 :::three
4531 ::four
4532 !! html/parsoid
4533 <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">
4534 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4535
4536 <dl><dd data-parsoid='{}'>one
4537 <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">
4538 </span><dd about="#mwt2">two
4539 <dl><dd>two</dd>
4540 <dd>three</dd></dl></dd>
4541 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4542 !! end
4543
4544
4545 ###
4546 ### External links
4547 ###
4548 !! test
4549 External links: non-bracketed
4550 !! wikitext
4551 Non-bracketed: http://example.com
4552 !! html
4553 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4554 </p>
4555 !! end
4556
4557 # parsoid doesn't explicitly mark autonumbered links, see T55505
4558 !! test
4559 External links: numbered
4560 !! wikitext
4561 Numbered: [http://example.com]
4562 Numbered: [http://example.net]
4563 Numbered: [http://example.com]
4564 !! html/php
4565 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4566 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4567 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4568 </p>
4569 !! html/parsoid
4570 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4571 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4572 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4573 !!end
4574
4575 !! test
4576 External links: specified text
4577 !! wikitext
4578 Specified text: [http://example.com link]
4579 !! html
4580 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4581 </p>
4582 !!end
4583
4584 !! test
4585 External links: trail
4586 !! wikitext
4587 Linktrails should not work for external links: [http://example.com link]s
4588 !! html
4589 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4590 </p>
4591 !! end
4592
4593 !! test
4594 External links: dollar sign in URL
4595 !! wikitext
4596 http://example.com/1$2345
4597 !! html
4598 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4599 </p>
4600 !! end
4601
4602 # parsoid doesn't explicitly mark autonumbered links, see T55505
4603 !! test
4604 External links: dollar sign in URL (autonumber)
4605 !! wikitext
4606 [http://example.com/1$2345]
4607 !! html/php
4608 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4609 </p>
4610 !! html/parsoid
4611 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4612 !!end
4613
4614 !! test
4615 External links: open square bracket forbidden in URL (T6377)
4616 !! options
4617 parsoid=wt2html,wt2wt,html2html
4618 !! wikitext
4619 http://example.com/1[2345
4620 !! html/php
4621 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4622 </p>
4623 !! html/parsoid
4624 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4625 !! end
4626
4627 !! test
4628 External links: open square bracket forbidden in URL (named) (T6377)
4629 !! options
4630 parsoid=wt2html,html2html
4631 !! wikitext
4632 [http://example.com/1[2345]
4633 !! html/php
4634 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4635 </p>
4636 !! html/parsoid
4637 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4638 !!end
4639
4640 # parsoid adds a space before the link name
4641 !! test
4642 External links: open square bracket forbidden in URL (named) (T6377)
4643 Parsoid variant.
4644 !! wikitext
4645 [http://example.com/1 [2345]
4646 !! html
4647 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4648 </p>
4649 !!end
4650
4651 !! test
4652 External links: nowiki in URL link text (T8230)
4653 !! wikitext
4654 [http://example.com/ <nowiki>''example site''</nowiki>]
4655 !! html
4656 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4657 </p>
4658 !! end
4659
4660 !! test
4661 External links: newline forbidden in text (T8230 regression check)
4662 !! wikitext
4663 [http://example.com/ first
4664 second]
4665 !! html
4666 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4667 second]
4668 </p>
4669 !!end
4670
4671 !! test
4672 External links: Pipe char between url and text
4673 !! wikitext
4674 [http://example.com | link]
4675 !! html
4676 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4677 </p>
4678 !!end
4679
4680 !! test
4681 External links: protocol-relative URL in brackets
4682 !! wikitext
4683 [//example.com/ Test]
4684 !! html
4685 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4686 </p>
4687 !! end
4688
4689 # parsoid doesn't explicitly mark autonumbered links, see T55505
4690 !! test
4691 External links: protocol-relative URL in brackets without text
4692 !! wikitext
4693 [//example.com]
4694 !! html/php
4695 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4696 </p>
4697 !! html/parsoid
4698 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4699 !! end
4700
4701 !! test
4702 External links: protocol-relative URL in free text is left alone
4703 !! wikitext
4704 //example.com/Foo
4705 !! html
4706 <p>//example.com/Foo
4707 </p>
4708 !!end
4709
4710 !! test
4711 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4712 !! wikitext
4713 foo//example.com/Foo
4714 !! html
4715 <p>foo//example.com/Foo
4716 </p>
4717 !! end
4718
4719 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4720 !! test
4721 External links: with no contents
4722 !! options
4723 parsoid=wt2html,wt2wt
4724 !! wikitext
4725 [http://en.wikipedia.org/wiki/Foo]
4726
4727 [[wikipedia:Foo|Bar]]
4728
4729 [[wikipedia:Foo|<span>Bar</span>]]
4730 !! html/php
4731 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4732 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4733 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4734 </p>
4735 !! html/parsoid
4736 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4737 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4738 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4739 !! end
4740
4741 !! test
4742 External links: Free with trailing punctuation
4743 !! wikitext
4744 http://example.com,
4745 http://example.com;
4746 http://example.com\
4747 http://example.com.
4748 http://example.com:
4749 http://example.com!
4750 http://example.com?
4751 http://example.com)
4752 http://example.com/url_with_(brackets)
4753 (http://example.com/url_without_brackets)
4754 http://example.com/url_with_entity&amp;
4755 http://example.com/url_with_entity&#x26;
4756 http://example.com/url_with_entity&#038;
4757 http://example.com/url_with_entity&nbsp;
4758 http://example.com/url_with_entity&#xA0;
4759 http://example.com/url_with_entity&#160;
4760 http://example.com/url_with_entity&lt;
4761 http://example.com/url_with_entity&#x3C;
4762 http://example.com/url_with_entity&#60;
4763 !! html/php
4764 <p><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">http://example.com</a>.
4768 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4769 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4770 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4771 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4772 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4773 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4774 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4775 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4776 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4777 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4778 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4779 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4780 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4781 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4782 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4783 </p>
4784 !! html/parsoid
4785 <p><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">http://example.com</a>.
4789 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4790 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4791 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4792 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4793 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4794 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4795 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4796 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4797 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
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;nbsp;","srcContent":" "}'> </span>
4799 <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>
4800 <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>
4801 <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>
4802 <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>
4803 <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>
4804 !! end
4805
4806 !! test
4807 External links: tricky Parsoid html2html case
4808 !! options
4809 parsoid=wt2html,wt2wt,html2html
4810 !! wikitext
4811 http://example.com/url_with_entity&amp;amp;
4812 !! html/php
4813 <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>;
4814 </p>
4815 !! html/parsoid
4816 <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>
4817 !! end
4818
4819 !! test
4820 External links: Free with trailing quotes (T113666)
4821 !! wikitext
4822 '''News:''' Stuff here
4823
4824 news:'a'b''c''d e
4825 !! html/php
4826 <p><b>News:</b> Stuff here
4827 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4828 </p>
4829 !! html/parsoid
4830 <p><b>News:</b> Stuff here</p>
4831 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4832 !! end
4833
4834 !! test
4835 External links: with entity
4836 !! wikitext
4837 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4838 !! html/php
4839 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4840 </p>
4841 !! html/parsoid
4842 <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>
4843 !! end
4844
4845 !! test
4846 External links: Lone protocols are never linked (T105697)
4847 !! wikitext
4848 http://
4849 http://;
4850 (http://)
4851 bitcoin:
4852 bitcoin:;
4853 (bitcoin:)
4854 !! html
4855 <p>http://
4856 http://;
4857 (http://)
4858 bitcoin:
4859 bitcoin:;
4860 (bitcoin:)
4861 </p>
4862 !! end
4863
4864 !! test
4865 External links: No preceding word characters allowed (T67278)
4866 !! wikitext
4867 NOPEhttp://example.com
4868 N0http://example.com
4869 ok:http://example.com
4870 ok-http://example.com
4871 !! html
4872 <p>NOPEhttp://example.com
4873 N0http://example.com
4874 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4875 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4876 </p>
4877 !! end
4878
4879 !! test
4880 External links: nofollow domain exception
4881 !! wikitext
4882 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4883 !! html
4884 <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>.
4885 </p>
4886 !!end
4887
4888 !! test
4889 External image
4890 !! wikitext
4891 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4892 !! html
4893 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External image from https
4899 !! wikitext
4900 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4901 !! html
4902 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4903 </p>
4904 !! end
4905
4906 !! test
4907 External image (when not allowed)
4908 !! options
4909 wgAllowExternalImages=0
4910 !! wikitext
4911 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4912 !! html
4913 <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>
4914 </p>
4915 !! end
4916
4917 !! test
4918 Link to non-http image, no img tag
4919 !! wikitext
4920 Link to non-http image, no img tag: ftp://example.com/test.jpg
4921 !! html
4922 <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>
4923 </p>
4924 !! end
4925
4926 !! test
4927 External links: terminating separator
4928 !! wikitext
4929 Terminating separator: http://example.com/thing,
4930 !! html
4931 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4932 </p>
4933 !! end
4934
4935 !! test
4936 External links: intervening separator
4937 !! wikitext
4938 Intervening separator: http://example.com/1,2,3
4939 !! html
4940 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4941 </p>
4942 !! end
4943
4944 !! test
4945 External links: old bug with URL in query
4946 !! wikitext
4947 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4948 !! html
4949 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4950 </p>
4951 !! end
4952
4953 !! test
4954 External links: old URL-in-URL bug, mixed protocols
4955 !! wikitext
4956 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4957 !! html
4958 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4959 </p>
4960 !!end
4961
4962 # Since Parsoid is starting to emit canonical wikitext for links,
4963 # [http://example.com http://example.com] will not RT back to that
4964 # form anymore.
4965 !! test
4966 External links: URL in text
4967 !! options
4968 parsoid=wt2html
4969 !! wikitext
4970 URL in text: [http://example.com http://example.com]
4971 !! html/php
4972 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4973 </p>
4974 !! html/parsoid
4975 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4976 !! end
4977
4978 !! test
4979 External links: Clickable images
4980 !! wikitext
4981 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4982 !! html/php
4983 <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>
4984 </p>
4985 !! html/parsoid
4986 <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>
4987 !! end
4988
4989 !! test
4990 External links: raw ampersand
4991 !! wikitext
4992 Old &amp; use: http://x&y
4993 !! html
4994 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4995 </p>
4996 !! end
4997
4998 !! test
4999 External links: encoded ampersand
5000 !! wikitext
5001 Old &amp; use: http://x&amp;y
5002 !! html/php
5003 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5004 </p>
5005 !! html/parsoid
5006 <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>
5007 !! end
5008
5009 !! test
5010 External links: encoded equals (T8102)
5011 !! wikitext
5012 http://example.com/?foo&#61;bar
5013 !! html/php
5014 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5015 </p>
5016 !! html/parsoid
5017 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5018 !! end
5019
5020 ##
5021 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5022 ## does it number them. As discussed in T55505, we can identify
5023 ## autonumbered links via CSS.
5024 ##
5025
5026 !! test
5027 External links: [raw ampersand]
5028 !! wikitext
5029 Old &amp; use: [http://x&y]
5030 !! html/php
5031 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5032 </p>
5033 !! html/parsoid
5034 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5035 !! end
5036
5037 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5038 # mode will return the [raw ampersand] wikitext
5039 !! test
5040 External links: [encoded ampersand]
5041 !! options
5042 parsoid=wt2html,wt2wt,html2html
5043 !! wikitext
5044 Old &amp; use: [http://x&amp;y]
5045 !! html/php
5046 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5047 </p>
5048 !! html/parsoid
5049 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5050 !! end
5051
5052 !! test
5053 External links: [raw equals]
5054 !! wikitext
5055 [http://example.com/?foo=bar]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5061 !! end
5062
5063 # note that parsoid html is identical to [raw equals] case; so html2wt
5064 # mode will return the [raw equals] wikitext
5065 !! test
5066 External links: [encoded equals] (T8102)
5067 !! options
5068 parsoid=wt2html,wt2wt,html2html
5069 !! wikitext
5070 [http://example.com/?foo&#61;bar]
5071 !! html/php
5072 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5073 </p>
5074 !! html/parsoid
5075 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5076 !! end
5077
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: [IDN ignored character reference in hostname; strip it right off]
5082 !! options
5083 parsoid=wt2html,wt2wt,html2html
5084 !! wikitext
5085 [http://e&zwnj;xample.com/]
5086 !! html/php
5087 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5091 !! end
5092
5093 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5094 # Where an external link could easily circumvent the sanitization of the text of
5095 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5096 # test demands a higher standard. That's a bit strange.
5097 #
5098 # Example:
5099 #
5100 # http://e‌xample.com -> [http://example.com|http://example.com]
5101 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5102 #
5103 # The first example is sanitized, but the second is not. Any security benefits
5104 # from this production are trivial to circumvent. Either remove this test and
5105 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5106 # the test accordingly.
5107 #
5108 # All our love,
5109 # The Parsoid team.
5110 # xxx parsoid strips the IDN character, so the round-trip tests will
5111 # obviously fail and are disabled. --cscott
5112 !! test
5113 External links: IDN ignored character reference in hostname; strip it right off
5114 !! options
5115 parsoid=wt2html,html2html
5116 !! wikitext
5117 http://e&zwnj;xample.com/
5118 !! html/php
5119 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5120 </p>
5121 !! html/parsoid
5122 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5123 !! end
5124
5125 !! test
5126 External links: www.jpeg.org (T2554)
5127 !! wikitext
5128 http://www.jpeg.org
5129 !! html
5130 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5131 </p>
5132 !! end
5133
5134 # parsoid doesn't explicitly mark autonumbered links, see T55505
5135 !! test
5136 External links: URL within URL (T2002)
5137 !! wikitext
5138 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5139 !! html/php
5140 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5141 </p>
5142 !! html/parsoid
5143 <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>
5144 !! end
5145
5146 !! test
5147 T2361: URL inside bracketed URL
5148 !! wikitext
5149 [http://www.example.com/foo http://www.example.com/bar]
5150 !! html
5151 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5152 </p>
5153 !! end
5154
5155 !! test
5156 T2361: URL within URL, not bracketed
5157 !! wikitext
5158 http://www.example.com/foo?=http://www.example.com/bar
5159 !! html
5160 <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>
5161 </p>
5162 !! end
5163
5164 !! test
5165 T2289: ">"-token in URL-tail
5166 !! wikitext
5167 http://www.example.com/<hello>
5168 !! html
5169 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5170 </p>
5171 !!end
5172
5173 !! test
5174 T2289: literal ">"-token in URL-tail
5175 !! wikitext
5176 http://www.example.com/<b>html</b>
5177 !! html/php
5178 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5179 </p>
5180 !! html/parsoid
5181 <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>
5182 !! end
5183
5184 !! test
5185 T2289: ">"-token in bracketed URL
5186 !! wikitext
5187 [http://www.example.com/<hello> stuff]
5188 !! html
5189 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5190 </p>
5191 !!end
5192
5193 !! test
5194 T2289: literal ">"-token in bracketed URL
5195 !! wikitext
5196 [http://www.example.com/<b>html</b> stuff]
5197 !! html
5198 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5199 </p>
5200 !!end
5201
5202 !! test
5203 T2289: literal double quote at end of URL
5204 !! wikitext
5205 http://www.example.com/"hello"
5206 !! html
5207 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5208 </p>
5209 !!end
5210
5211 !! test
5212 T2289: literal double quote in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/"hello" stuff]
5215 !! html
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5217 </p>
5218 !!end
5219
5220 !! test
5221 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5222 !! wikitext
5223 [http://www.example.com test]
5224 !! html
5225 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5226 </p>
5227 !! end
5228
5229 !! test
5230 External links: link text with spaces
5231 !! wikitext
5232 [http://www.example.com a b c]
5233 [http://www.example.com ''a'' ''b'']
5234 !! html
5235 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5236 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5237 </p>
5238 !! end
5239
5240 # Note edge case difference between PHP and Parsoid here.
5241 !! test
5242 External links: wiki links within external link (T5695)
5243 !! options
5244 parsoid=wt2html,html2html
5245 !! wikitext
5246 [http://example.com [[wikilink]] embedded in ext link]
5247
5248 [http://example.com test [[wikilink]] embedded in ext link]
5249 !! html/php
5250 <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>
5251 </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>
5252 </p>
5253 !! html/parsoid
5254 <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>
5255 <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>
5256 !! end
5257
5258 !! test
5259 T2787: Links with one slash after the url protocol are invalid
5260 !! wikitext
5261 http:/example.com
5262
5263 [http:/example.com title]
5264 !! html
5265 <p>http:/example.com
5266 </p><p>[http:/example.com title]
5267 </p>
5268 !! end
5269
5270 !! test
5271 Bracketed external links with template-generated invalid target
5272 !! wikitext
5273 [{{echo|http:/example.com}} title]
5274 !! html
5275 <p>[http:/example.com title]
5276 </p>
5277 !! end
5278
5279 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5280 !! test
5281 Broken wikilinks (but not external links) prevent templates from closing
5282 !! options
5283 parsoid=wt2html
5284 !! wikitext
5285 [http://example.com x
5286
5287 {{echo|[http://example.com x}}
5288
5289 [[Foo
5290
5291 {{echo|[[Foo}}
5292 !! html/php
5293 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5294 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5295 </p><p>[[Foo
5296 </p><p>{{echo|[[Foo}}
5297 </p>
5298 !! html/parsoid
5299 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5300 <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>
5301 <p>[[Foo</p>
5302 <p>{{echo|[[Foo}}</p>
5303 !! end
5304
5305 !! test
5306 Wikilinks with embedded newlines are not broken
5307 !! wikitext
5308 {{echo|[[ Foo
5309 B
5310 C]]}}
5311 !! html/php
5312 <p>[[ Foo
5313 B
5314 C]]
5315 </p>
5316 !! html/parsoid
5317 <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>
5318 !! end
5319
5320 !! test
5321 Broken templates
5322 !! options
5323 parsoid=wt2html
5324 !! wikitext
5325 {{echo|[[Foo|}}]]
5326
5327 [[Foo|{{echo|]]}}
5328 !! html/php
5329 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5330 </p><p>[[Foo|]]
5331 </p>
5332 !! html/parsoid
5333 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5334 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5335 !! end
5336
5337 !! test
5338 T4702: Mismatched <i>, <b> and <a> tags are invalid
5339 !! wikitext
5340 ''[http://example.com text'']
5341 [http://example.com '''text]'''
5342 ''Something [http://example.com in italic'']
5343 ''Something [http://example.com mixed''''', even bold]'''
5344 '''''Now [http://example.com both''''']
5345 !! html
5346 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5347 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5348 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5349 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5350 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5351 </p>
5352 !! end
5353
5354
5355 !! test
5356 T6781: %26 in URL
5357 !! wikitext
5358 http://www.example.com/?title=AT%26T
5359 !! html/php
5360 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5361 </p>
5362 !! html/parsoid
5363 <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>
5364 !! end
5365
5366 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5367 # % is actually legal in HTML5. Any change in output would need testing though.
5368 !! test
5369 T6781, T7267: %25 in URL
5370 !! wikitext
5371 http://www.example.com/?title=100%25_Bran
5372 !! html/php
5373 <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>
5374 </p>
5375 !! html/parsoid
5376 <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>
5377 !! end
5378
5379 !! test
5380 T6781, T7267: %28, %29 in URL
5381 !! wikitext
5382 http://www.example.com/?title=Ben-Hur_%281959_film%29
5383 !! html/php
5384 <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>
5385 </p>
5386 !! html/parsoid
5387 <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>
5388 !! end
5389
5390
5391 !! test
5392 T6781: %26 in autonumber URL
5393 !! wikitext
5394 [http://www.example.com/?title=AT%26T]
5395 !! html/php
5396 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5397 </p>
5398 !! html/parsoid
5399 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5400 !! end
5401
5402 !! test
5403 T6781, T7267: %26 in autonumber URL
5404 !! wikitext
5405 [http://www.example.com/?title=100%25_Bran]
5406 !! html/php
5407 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5408 </p>
5409 !! html/parsoid
5410 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5411 !! end
5412
5413 !! test
5414 T6781, T7267: %28, %29 in autonumber URL
5415 !! wikitext
5416 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5417 !! html/php
5418 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5422 !! end
5423
5424
5425 !! test
5426 T6781: %26 in bracketed URL
5427 !! wikitext
5428 [http://www.example.com/?title=AT%26T link]
5429 !! html/php
5430 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5431 </p>
5432 !! html/parsoid
5433 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5434 !! end
5435
5436 !! test
5437 T6781, T7267: %25 in bracketed URL
5438 !! wikitext
5439 [http://www.example.com/?title=100%25_Bran link]
5440 !! html
5441 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5442 </p>
5443 !! end
5444
5445 !! test
5446 T6781, T7267: %28, %29 in bracketed URL
5447 !! wikitext
5448 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5449 !! html/php
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5451 </p>
5452 !! html/parsoid
5453 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5454 !! end
5455
5456 !! test
5457 External link containing a period in the anchor. (T65947)
5458 !! wikitext
5459 [//foo.org/bar#baz. bang]
5460
5461 [//foo.org/bar. bang]
5462 !! html/php
5463 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5464 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5465 </p>
5466 !! html/parsoid
5467 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5468 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5469 !! end
5470
5471 !! test
5472 External link containing a single quote. (T65947)
5473 !! wikitext
5474 [//foo.org/bar'baz]
5475
5476 [//foo.org/bar'baz bang]
5477 !! html/php
5478 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5479 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5483 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5484 !! end
5485
5486 !! test
5487 External link containing double-single-quotes in text '' (T6598 sanity check)
5488 !! wikitext
5489 Some [http://example.com/ pretty ''italics'' and stuff]!
5490 !! html
5491 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5492 </p>
5493 !! end
5494
5495 !! test
5496 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5497 !! wikitext
5498 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5499 !! html
5500 <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>
5501 </p>
5502 !! end
5503
5504 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5505 !! test
5506 External link containing double-single-quotes with no space separating the url from text in italics
5507 !! wikitext
5508 [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]].]
5509 !! html/php+tidy
5510 <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>.
5511 </p>
5512 !! html/parsoid
5513 <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>
5514 !! end
5515
5516 !! test
5517 External link with comments in link text
5518 !! wikitext
5519 [http://www.google.com Google <!-- comment -->]
5520 !! html/php
5521 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5522 </p>
5523 !! html/parsoid
5524 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5525 !! end
5526
5527 !! test
5528 External link to bare IPv4 address
5529 !! wikitext
5530 [http://192.168.0.1 Link]
5531 !! html/php
5532 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5536 !! end
5537
5538 !! test
5539 URL-encoding in URL functions (single parameter)
5540 !! wikitext
5541 {{localurl:Some page|amp=&}}
5542 !! html
5543 <p>/index.php?title=Some_page&amp;amp=&amp;
5544 </p>
5545 !! end
5546
5547 !! test
5548 URL-encoding in URL functions (multiple parameters)
5549 !! wikitext
5550 {{localurl:Some page|q=?&amp=&}}
5551 !! html
5552 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5553 </p>
5554 !! end
5555
5556 !! test
5557 Brackets in urls
5558 !! wikitext
5559 http://example.com/index.php?foozoid%5B%5D=bar
5560
5561 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5562 !! html/php
5563 <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>
5564 </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>
5565 </p>
5566 !! html/parsoid
5567 <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>
5568
5569 <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>
5570 !! end
5571
5572 !! test
5573 IPv6 urls, autolink format (T23261)
5574 !! wikitext
5575 http://[2404:130:0:1000::187:2]/index.php
5576
5577 Examples from RFC 2373, section 2.2:
5578
5579 *http://[1080::8:800:200C:417A]/unicast
5580 *http://[FF01::101]/multicast
5581 *http://[::1]/loopback
5582 *http://[::]/unspecified
5583 *http://[::13.1.68.3]/ipv4compat
5584 *http://[::FFFF:129.144.52.38]/ipv4compat
5585
5586 Examples from RFC 2732, section 2:
5587
5588 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5589 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5590 *http://[3ffe:2a00:100:7031::1]
5591 *http://[1080::8:800:200C:417A]/foo
5592 *http://[::192.9.5.5]/ipng
5593 *http://[::FFFF:129.144.52.38]:80/index.html
5594 *http://[2010:836B:4179::836B:4179]
5595 !! html/php
5596 <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>
5597 </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:
5598 </p>
5599 <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>
5600 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5601 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5602 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5603 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5604 <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>
5605 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5606 </p>
5607 <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>
5608 <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>
5609 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5610 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5611 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5612 <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>
5613 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5614
5615 !! html/parsoid
5616 <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>
5617
5618 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5619 <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>
5620 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5621 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5622 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5623 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5624 <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>
5625
5626 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5627 <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>
5628 <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>
5629 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5630 <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>
5631 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5632 <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>
5633 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5634 !! end
5635
5636 !! test
5637 IPv6 urls, bracketed format (T23261)
5638 !! wikitext
5639 [http://[2404:130:0:1000::187:2]/index.php test]
5640
5641 Examples from RFC 2373, section 2.2:
5642
5643 *[http://[1080::8:800:200C:417A] unicast]
5644 *[http://[FF01::101] multicast]
5645 *[http://[::1]/ loopback]
5646 *[http://[::] unspecified]
5647 *[http://[::13.1.68.3] ipv4compat]
5648 *[http://[::FFFF:129.144.52.38] ipv4compat]
5649
5650 Examples from RFC 2732, section 2:
5651
5652 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5653 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5654 *[http://[3ffe:2a00:100:7031::1] 3]
5655 *[http://[1080::8:800:200C:417A]/foo 4]
5656 *[http://[::192.9.5.5]/ipng 5]
5657 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5658 *[http://[2010:836B:4179::836B:4179] 7]
5659 !! html/php
5660 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5661 </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:
5662 </p>
5663 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5664 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5665 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5666 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5667 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5668 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5669 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5670 </p>
5671 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5672 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5673 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5674 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5675 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5676 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5677 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5678
5679 !! html/parsoid
5680 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5681
5682 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5683 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5684 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5685 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5686 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5687 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5688 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5689
5690 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5691 <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>
5692 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5693 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5694 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5695 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5696 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5697 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5698 !! end
5699
5700 !! test
5701 Non-extlinks in brackets
5702 !! wikitext
5703 [foo]
5704 [foo bar]
5705 [foo ''bar'']
5706 [fool's] errand
5707 [fool's errand]
5708 [{{echo|foo}}]
5709 [{{echo|foo}} bar]
5710 [{{echo|foo}} ''bar'']
5711 [{{echo|foo}}l's] errand
5712 [{{echo|foo}}l's errand]
5713 [url={{echo|foo}}]
5714 [url=http://example.com]
5715 [http:// bare protocols don't count]
5716 !! html/php
5717 <p>[foo]
5718 [foo bar]
5719 [foo <i>bar</i>]
5720 [fool's] errand
5721 [fool's errand]
5722 [foo]
5723 [foo bar]
5724 [foo <i>bar</i>]
5725 [fool's] errand
5726 [fool's errand]
5727 [url=foo]
5728 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5729 [http:// bare protocols don't count]
5730 </p>
5731 !! html/parsoid
5732 <p>[foo]
5733 [foo bar]
5734 [foo <i>bar</i>]
5735 [fool's] errand
5736 [fool's errand]
5737 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5738 [<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]
5739 [<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>]
5740 [<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
5741 [<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]
5742 [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>]
5743 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5744 [http:// bare protocols don't count]</p>
5745 !! end
5746
5747 !! test
5748 Percent encoding in external links
5749 !! wikitext
5750 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5751 !! html/php
5752 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5753 </p>
5754 !! html/parsoid
5755 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5756 !! end
5757
5758 !! test
5759 Use url link syntax for links where the content is equal the link target
5760 !! wikitext
5761 http://example.com
5762 !! html/php
5763 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5764 </p>
5765 !! html/parsoid
5766 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5767 !! end
5768
5769 !! test
5770 Parenthesis in external links, especially URL links
5771 !! wikitext
5772 http://example.com)
5773
5774 http://example.com/test)
5775
5776 http://example.com/(test)
5777
5778 http://example.com/((test)
5779
5780 (http://example.com/(test))
5781
5782 (http://example.com/(test)))))
5783
5784 http://example.com/a)b
5785
5786 [http://example.com) foo]
5787 !! html/php
5788 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5789 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5790 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5791 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5792 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5793 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5794 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5795 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5796 </p>
5797 !! html/parsoid
5798 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5799 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5800 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5801 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5802 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5803 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5804 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5805 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5806 !! end
5807
5808 !! test
5809 Parenthesis in external links, w/ transclusion or comment
5810 !! wikitext
5811 (http://example.com/{{echo|hi}})
5812
5813 (http://example.com<!-- hi -->)
5814 !! html/php
5815 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5816 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5817 </p>
5818 !! html/parsoid
5819 <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>
5820
5821 <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>
5822 !! end
5823
5824 !! test
5825 Serialize <a> tags with invalid link targets as plain text
5826 !! options
5827 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5828 !! html/parsoid
5829 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5830 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5831 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5832 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5833 !! wikitext
5834 text
5835 <nowiki>*</nowiki>text
5836 <nowiki>[[foo]]</nowiki>
5837 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5838 !! end
5839
5840 !! test
5841 mw:ExtLink -vs- mw:WikiLink (T94723)
5842 !! options
5843 parsoid=html2wt
5844 !! html/parsoid
5845 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5846 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5847 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5848 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5849 <p>
5850 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5851 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5852 </p>
5853 !! wikitext
5854 [[Foo|Bar]]
5855 [[Foo|Bar]]
5856 [[:en:Foo|Bar]]
5857 [[:en:Foo|Bar]]
5858
5859 [[:en:European_Robin|European Robin]]
5860 [[:en:European_Robin|European Robin]]
5861 !! end
5862
5863 !! test
5864 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5865 !! options
5866 parsoid=wt2wt
5867 !! wikitext
5868 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5869 !! html/parsoid
5870 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5871 !! end
5872
5873
5874 ###
5875 ### Quotes
5876 ###
5877
5878 !! test
5879 Quotes
5880 !! wikitext
5881 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5882
5883 Normal text. '''''Bold italic text.''''' Normal text.
5884 !! html
5885 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5886 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5887 </p>
5888 !! end
5889
5890
5891 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5892 # parser strips. The wikitext contains just the first half of the bold
5893 # quote pair.
5894 !! test
5895 Unclosed and unmatched quotes
5896 !! wikitext
5897 '''''Bold italic text '''with bold deactivated''' in between.'''''
5898
5899 '''''Bold italic text ''with italic deactivated'' in between.'''''
5900
5901 '''Bold text..
5902
5903 ..spanning two paragraphs (should not work).'''
5904
5905 '''Bold tag left open
5906
5907 ''Italic tag left open
5908
5909 Normal text.
5910
5911 <!-- Unmatching number of opening, closing tags: -->
5912 '''This year''''s election ''should'' beat '''last year''''s.
5913
5914 ''Tom'''s car is bigger than ''Susan'''s.
5915
5916 Plain ''italic'''s plain
5917 !! html/php
5918 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5919 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5920 </p><p><b>Bold text..</b>
5921 </p><p>..spanning two paragraphs (should not work).
5922 </p><p><b>Bold tag left open</b>
5923 </p><p><i>Italic tag left open</i>
5924 </p><p>Normal text.
5925 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5926 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5927 </p><p>Plain <i>italic'</i>s plain
5928 </p>
5929 !! html/parsoid
5930 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5931 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5932 </p><p><b>Bold text..</b>
5933 </p><p>..spanning two paragraphs (should not work).<b></b>
5934 </p><p><b>Bold tag left open</b>
5935 </p><p><i>Italic tag left open</i>
5936 </p><p>Normal text.
5937 </p>
5938 <!-- Unmatching number of opening, closing tags: -->
5939 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5940 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5941 </p><p>Plain <i>italic'</i>s plain
5942 </p>
5943 !! end
5944
5945 ###
5946 ### Tables
5947 ###
5948 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5949 ###
5950
5951 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5952 # is the bare minimum required by the spec, see:
5953 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5954 # Parsoid team replies: empty table tags are legal in HTML5
5955 !! test
5956 A table with no data.
5957 !! options
5958 parsoid=wt2html
5959 !! wikitext
5960 {||}
5961 !! html/php
5962
5963 !! html/parsoid
5964 <table></table>
5965
5966 !! end
5967
5968 !! test
5969 A table with stray table end tags on start tag line (wt2html)
5970 !! options
5971 parsoid=wt2html
5972 !! wikitext
5973 {|style="color: red;"|}
5974
5975 {|style="color: red;" |}
5976 |foo
5977 |}
5978
5979 {|style="color: red;"|} id="foo"
5980 |foo
5981 |}
5982
5983 {|style="color: red;" |} id="foo"
5984 |foo
5985 |}
5986 !! html
5987 <table style="color: red;"></table>
5988
5989 <table style="color: red;">
5990 <tbody><tr>
5991 <td>foo</td>
5992 </tr></tbody>
5993 </table>
5994
5995 <table style="color: red;" id="foo">
5996 <tbody><tr>
5997 <td>foo</td>
5998 </tr></tbody>
5999 </table>
6000
6001 <table style="color: red;" id="foo">
6002 <tbody><tr>
6003 <td>foo</td>
6004 </tr></tbody>
6005 </table>
6006
6007 !! end
6008
6009 !! test
6010 A table with no data (take 2)
6011 !! wikitext
6012 {|
6013 |}
6014 !! html/parsoid
6015 <table></table>
6016 !! end
6017
6018 # A table with nothing but a caption is invalid XHTML, we might want to render
6019 # this as <p>caption</p>
6020 # Parsoid team replies: table with only a caption is legal in HTML5
6021 !! test
6022 A table with nothing but a caption
6023 !! wikitext
6024 {|
6025 |+caption
6026 |}
6027 !! html/php
6028 <table>
6029 <caption>caption
6030 </caption><tr><td></td></tr></table>
6031
6032 !! html/parsoid
6033 <table><caption>caption</caption></table>
6034 !! end
6035
6036 !! test
6037 A table with caption with default-spaced attributes and a table row
6038 !! wikitext
6039 {|
6040 |+ style="color: red;" | caption1
6041 |-
6042 |foo
6043 |}
6044 !! html
6045 <table>
6046 <caption style="color: red;">caption1
6047 </caption>
6048 <tr>
6049 <td>foo
6050 </td></tr></table>
6051
6052 !! end
6053
6054 !! test
6055 A table with captions with non-default spaced attributes and a table row
6056 !! wikitext
6057 {|
6058 |+style="color: red;"|caption2
6059 |+ style="color: red;"|caption3
6060 |-
6061 |foo
6062 |}
6063 !! html
6064 <table>
6065 <caption style="color: red;">caption2
6066 </caption>
6067 <caption style="color: red;">caption3
6068 </caption>
6069 <tr>
6070 <td>foo
6071 </td></tr></table>
6072
6073 !! end
6074
6075 !! test
6076 Table td-cell syntax variations
6077 !! wikitext
6078 {|
6079 |foo bar foo|baz
6080 |foo bar foo||baz
6081 |style='color:red;'|baz
6082 |style='color:red;'||baz
6083 |}
6084 !! html
6085 <table>
6086 <tr>
6087 <td>baz
6088 </td>
6089 <td>foo bar foo</td>
6090 <td>baz
6091 </td>
6092 <td style="color:red;">baz
6093 </td>
6094 <td>style='color:red;'</td>
6095 <td>baz
6096 </td></tr></table>
6097
6098 !! end
6099
6100 !! test
6101 Simple table
6102 !! wikitext
6103 {|
6104 |1||2
6105 |-
6106 |3||4
6107 |}
6108 !! html
6109 <table>
6110 <tr>
6111 <td>1</td>
6112 <td>2
6113 </td></tr>
6114 <tr>
6115 <td>3</td>
6116 <td>4
6117 </td></tr></table>
6118
6119 !! end
6120
6121 !! test
6122 Simple table but with multiple dashes for row wikitext
6123 !! wikitext
6124 {|
6125 |foo
6126 |-----
6127 |bar
6128 |}
6129 !! html
6130 <table>
6131 <tr>
6132 <td>foo
6133 </td></tr>
6134 <tr>
6135 <td>bar
6136 </td></tr></table>
6137
6138 !! end
6139
6140 !! test
6141 Multiplication table
6142 !! wikitext
6143 {| border="1" cellpadding="2"
6144 |+Multiplication table
6145 |-
6146 !&times;!!1!!2!!3
6147 |-
6148 !1
6149 |1||2||3
6150 |-
6151 !2
6152 |2||4||6
6153 |-
6154 !3
6155 |3||6||9
6156 |-
6157 !4
6158 |4||8||12
6159 |-
6160 !5
6161 |5||10||15
6162 |}
6163 !! html
6164 <table border="1" cellpadding="2">
6165 <caption>Multiplication table
6166 </caption>
6167 <tr>
6168 <th>&#215;</th>
6169 <th>1</th>
6170 <th>2</th>
6171 <th>3
6172 </th></tr>
6173 <tr>
6174 <th>1
6175 </th>
6176 <td>1</td>
6177 <td>2</td>
6178 <td>3
6179 </td></tr>
6180 <tr>
6181 <th>2
6182 </th>
6183 <td>2</td>
6184 <td>4</td>
6185 <td>6
6186 </td></tr>
6187 <tr>
6188 <th>3
6189 </th>
6190 <td>3</td>
6191 <td>6</td>
6192 <td>9
6193 </td></tr>
6194 <tr>
6195 <th>4
6196 </th>
6197 <td>4</td>
6198 <td>8</td>
6199 <td>12
6200 </td></tr>
6201 <tr>
6202 <th>5
6203 </th>
6204 <td>5</td>
6205 <td>10</td>
6206 <td>15
6207 </td></tr></table>
6208
6209 !! end
6210
6211 !! test
6212 Accept "||" in table headings
6213 !! wikitext
6214 {|
6215 !h1||h2
6216 |}
6217 !! html
6218 <table>
6219 <tr>
6220 <th>h1</th>
6221 <th>h2
6222 </th></tr></table>
6223
6224 !! end
6225
6226 !! test
6227 Accept "!!" in table data
6228 !! wikitext
6229 {|
6230 |Foo!!||
6231 |}
6232 !! html
6233 <table>
6234 <tr>
6235 <td>Foo!!</td>
6236 <td>
6237 </td></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6242 </tbody></table>
6243 !! end
6244
6245 !! test
6246 Accept "||" in indented table headings
6247 !! wikitext
6248 :{|
6249 !h1||h2
6250 |}
6251 !! html
6252 <dl><dd><table>
6253 <tr>
6254 <th>h1</th>
6255 <th>h2
6256 </th></tr></table></dd></dl>
6257
6258 !! end
6259
6260 !! test
6261 Accept "!!" in templates
6262 !! wikitext
6263 {|
6264 !a {{echo|b!!c}}
6265 |}
6266 !! html/php
6267 <table>
6268 <tr>
6269 <th>a b</th>
6270 <th>c
6271 </th></tr></table>
6272
6273 !! html/parsoid
6274 <table>
6275 <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>
6276 !! end
6277
6278 !! test
6279 Accept "!!" in table headings after newline
6280 !! wikitext
6281 {|
6282 !a
6283 b!!c
6284 |}
6285 !! html/php
6286 <table>
6287 <tr>
6288 <th>a
6289 <p>b!!c
6290 </p>
6291 </th></tr></table>
6292
6293 !! html/parsoid
6294 <table>
6295 <tbody><tr><th>a
6296 <p>b!!c</p></th></tr>
6297 </tbody></table>
6298 !! end
6299
6300 !! test
6301 Accept "!!" in table data of mixed wikitext / html syntax
6302 !! wikitext
6303 {|
6304 !a
6305 <tr><td>b!!c</td></tr>
6306 |}
6307 !! html/php+tidy
6308 <table>
6309 <tbody><tr>
6310 <th>a
6311 </th></tr><tr><td>b!!c</td></tr>
6312 </tbody></table>
6313 !! html/parsoid
6314 <table>
6315 <tbody><tr><th>a</th></tr>
6316 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6317 </tbody></table>
6318 !! end
6319
6320 !! test
6321 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6322 !! wikitext
6323 {|
6324 !| h1
6325 || a
6326 |}
6327 !! html
6328 <table>
6329 <tr>
6330 <th>h1
6331 </th>
6332 <td>a
6333 </td></tr></table>
6334
6335 !! end
6336
6337 !!test
6338 Accept "| !" at start of line in tables (ignore !-attribute)
6339 !! wikitext
6340 {|
6341 |-
6342 |!style="color:red"|bar
6343 |}
6344 !! html
6345 <table>
6346
6347 <tr>
6348 <td>bar
6349 </td></tr></table>
6350
6351 !!end
6352
6353 !!test
6354 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 +/-
6355 !! wikitext
6356 {|
6357 |-
6358 |style='color:red;'|+1
6359 |style='color:blue;'|-1
6360 |-
6361 |1||2||3
6362 |1||+2||-3
6363 |-
6364 | +1
6365 | -1
6366 |}
6367 !! html
6368 <table>
6369
6370 <tr>
6371 <td style="color:red;">+1
6372 </td>
6373 <td style="color:blue;">-1
6374 </td></tr>
6375 <tr>
6376 <td>1</td>
6377 <td>2</td>
6378 <td>3
6379 </td>
6380 <td>1</td>
6381 <td>+2</td>
6382 <td>-3
6383 </td></tr>
6384 <tr>
6385 <td>+1
6386 </td>
6387 <td>-1
6388 </td></tr></table>
6389
6390 !!end
6391
6392 !! test
6393 Table rowspan
6394 !! wikitext
6395 {| border=1
6396 |Cell 1, row 1
6397 |rowspan=2|Cell 2, row 1 (and 2)
6398 |Cell 3, row 1
6399 |-
6400 |Cell 1, row 2
6401 |Cell 3, row 2
6402 |}
6403 !! html
6404 <table border="1">
6405 <tr>
6406 <td>Cell 1, row 1
6407 </td>
6408 <td rowspan="2">Cell 2, row 1 (and 2)
6409 </td>
6410 <td>Cell 3, row 1
6411 </td></tr>
6412 <tr>
6413 <td>Cell 1, row 2
6414 </td>
6415 <td>Cell 3, row 2
6416 </td></tr></table>
6417
6418 !! end
6419
6420 !! test
6421 Nested table
6422 !! wikitext
6423 {| border=1
6424 | &alpha;
6425 |
6426 {| bgcolor=#ABCDEF border=2
6427 |nested
6428 |-
6429 |table
6430 |}
6431 |the original table again
6432 |}
6433 !! html
6434 <table border="1">
6435 <tr>
6436 <td>&#945;
6437 </td>
6438 <td>
6439 <table bgcolor="#ABCDEF" border="2">
6440 <tr>
6441 <td>nested
6442 </td></tr>
6443 <tr>
6444 <td>table
6445 </td></tr></table>
6446 </td>
6447 <td>the original table again
6448 </td></tr></table>
6449
6450 !! end
6451
6452 !! test
6453 Invalid attributes in table cell (T3830)
6454 !! wikitext
6455 {|
6456 |Cell:|broken
6457 |}
6458 !! html
6459 <table>
6460 <tr>
6461 <td>broken
6462 </td></tr></table>
6463
6464 !! end
6465
6466 !! test
6467 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6468 !! wikitext
6469 {|
6470 | title="foo" |bar
6471 | title="foo<nowiki>|</nowiki>" |bar
6472 | title="foo<nowiki>|</nowiki>" bar
6473 |}
6474 !! html/php
6475 <table>
6476 <tr>
6477 <td title="foo">bar
6478 </td>
6479 <td title="foo&#124;">bar
6480 </td>
6481 <td>title="foo|" bar
6482 </td></tr></table>
6483
6484 !! html/parsoid
6485 <table>
6486 <tbody><tr><td title="foo">bar</td>
6487 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6488 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6489 </tbody></table>
6490 !! end
6491
6492 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6493 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6494 # *2wt modes will fail.
6495 !! test
6496 Table security: embedded pipes
6497 !! options
6498 parsoid=wt2html,html2html
6499 !! wikitext
6500 {|
6501 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6502 !! html/php
6503 <table>
6504 <tr>
6505 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6506 <td>]" onmouseover="alert(document.cookie)"&gt;test
6507 </td>
6508 </tr>
6509 </table>
6510
6511 !! html/parsoid
6512 <table><tbody>
6513 <tr>
6514 <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>
6515 !! end
6516
6517 !! test
6518 Element attributes with double ! should not be broken up by <th>
6519 !! wikitext
6520 {|
6521 !hi <div class="!!">ha</div> ho
6522 |}
6523 !! html/php
6524 <table>
6525 <tr>
6526 <th>hi <div class="!!">ha</div> ho
6527 </th></tr></table>
6528
6529 !! html/parsoid
6530 <table>
6531 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6532 </tbody></table>
6533 !! end
6534
6535 !! test
6536 ! and || in element attributes should not be parsed as <th>/<td>
6537 !! wikitext
6538 {|
6539 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6540 |}
6541 !! html/php
6542 <table>
6543 <tr>
6544 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6545 </td></tr></table>
6546
6547 !! html/parsoid
6548 <table>
6549 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6550 </tbody></table>
6551 !! end
6552
6553 # FIXME: The output seems broken. Filed as T110268.
6554 !! test
6555 ! and || in td attributes should not be parsed as <th>/<td>
6556 !! options
6557 parsoid=wt2html
6558 !! wikitext
6559 {|
6560 |style="color: red !important;" data-contrived="put this here ||"|foo
6561 |}
6562 !! html/php
6563 <table>
6564 <tr>
6565 <td>style="color: red !important;" data-contrived="put this here</td>
6566 <td>foo
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table>
6571 <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>
6572 </tbody></table>
6573 !! end
6574
6575 !! test
6576 Break on | in element attribute in template
6577 !! options
6578 parsoid=wt2html,html2html
6579 !! wikitext
6580 {{echo|1=<div class="hi|ho">ha</div>}}
6581 !! html/php
6582 <p>ho"&gt;ha&lt;/div&gt;
6583 </p>
6584 !! html/parsoid
6585 <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>
6586 !! end
6587
6588 !! test
6589 Break on | in element attribute name in template
6590 !! wikitext
6591 {{echo|<div cla|ss="hiho">ha</div>}}
6592 !! html/parsoid
6593 <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>
6594 !! end
6595
6596 !! test
6597 Don't break on | in extension attribute in template
6598 !! wikitext
6599 {{echo|<ref name="hi|ho">ha</ref>}}
6600
6601 <references />
6602 !! html/parsoid
6603 <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>
6604
6605 <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>
6606 !! end
6607
6608 ## We don't support roundtripping of these attributes in Parsoid.
6609 ## Selective serialization takes care of preventing dirty diffs.
6610 ## But, on edits, we dirty-diff the invalid attribute text.
6611 !! test
6612 Invalid text in table attributes should be discarded
6613 !! options
6614 parsoid=wt2html
6615 !! wikitext
6616 {| <span>boo</span> style='border:1px solid black'
6617 | <span>boo</span> style='color:blue' |1
6618 |<span>boo</span> style='color:blue'|2
6619 |}
6620 !! html/php
6621 <table style="border:1px solid black">
6622 <tr>
6623 <td style="color:blue">1
6624 </td>
6625 <td style="color:blue">2
6626 </td></tr></table>
6627
6628 !! html/parsoid
6629 <table style="border:1px solid black">
6630 <tr>
6631 <td style="color:blue">1</td>
6632 <td style="color:blue">2</td>
6633 </tr>
6634 </table>
6635 !! end
6636
6637 !! test
6638 Invalid text in table attributes should be preserved by selective serializer
6639 !! options
6640 parsoid={
6641 "modes": ["selser"],
6642 "changes": [
6643 ["td:first-child", "text", "abc"],
6644 ["td + td", "text", "xyz"]
6645 ]
6646 }
6647 !! wikitext
6648 {| <span>boo</span> style='border:1px solid black'
6649 | <span>boo</span> style='color:blue' | 1
6650 |<span>boo</span> style='color:blue'| 2
6651 |}
6652 !! wikitext/edited
6653 {| <span>boo</span> style='border:1px solid black'
6654 | <span>boo</span> style='color:blue' |abc
6655 |<span>boo</span> style='color:blue'|xyz
6656 |}
6657 !! end
6658
6659 !! test
6660 1. Template-generated table cell attributes and cell content
6661 !! wikitext
6662 {|
6663 |{{table_attribs}}
6664 | {{table_attribs}}
6665 || {{table_attribs_5}}
6666 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6667 |align=center {{table_attribs}}
6668 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6669 |}
6670 !! html
6671 <table>
6672 <tr>
6673 <td style="color:red;">Foo
6674 </td>
6675 <td style="color:red;">Foo
6676 </td>
6677 <td>style="color:red;"</td>
6678 <td>Bar
6679 </td>
6680 <td style="color:red;">Foo
6681 </td>
6682 <td align="center" style="color:red;">Foo
6683 </td>
6684 <td align="center" style="color:red;">Foo
6685 </td></tr></table>
6686
6687 !! end
6688
6689 !! test
6690 2. Template-generated table cell attributes and cell content
6691 !! wikitext
6692 {|
6693 |{{table_attribs_2}}
6694 |}
6695 !! html/php
6696 <table>
6697 <tr>
6698 <td style="color:red;">Foo
6699 </td>
6700 <td>Bar</td>
6701 <td>Baz
6702 </td></tr></table>
6703
6704 !! html/parsoid
6705 <table>
6706 <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>
6707 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6708 </tbody></table>
6709 !! end
6710
6711 !! test
6712 3. Template-generated table cell attributes and cell content
6713 !! wikitext
6714 {|
6715 !align=center {{table_header_cells}}
6716 |-
6717 |align=center {{table_cells}}
6718 |}
6719 !! html/php
6720 <table>
6721 <tr>
6722 <th align="center" style="color:red;">Foo</th>
6723 <th style="color:red;"><i>Bar</i></th>
6724 <th style="color:brown;"><i>Foo</i> and Baz
6725 </th></tr>
6726 <tr>
6727 <td align="center" style="color:red;">Foo</td>
6728 <td style="color:red;"><i>Bar</i></td>
6729 <td style="color:brown;"><i>Foo</i> and Baz
6730 </td></tr></table>
6731
6732 !! html/parsoid
6733 <table>
6734 <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>
6735 <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>
6736 </tbody></table>
6737 !! end
6738
6739 !! test
6740 4. Template-generated table cell attributes and cell content inside a templated table
6741 !! wikitext
6742 {{tbl-start}}
6743 !align=center {{table_header_cells}}
6744 |-
6745 |align=center {{table_cells}}
6746 {{tbl-end}}
6747 !! html/php
6748 <table>
6749 <tr>
6750 <th align="center" style="color:red;">Foo</th>
6751 <th style="color:red;"><i>Bar</i></th>
6752 <th style="color:brown;"><i>Foo</i> and Baz
6753 </th></tr>
6754 <tr>
6755 <td align="center" style="color:red;">Foo</td>
6756 <td style="color:red;"><i>Bar</i></td>
6757 <td style="color:brown;"><i>Foo</i> and Baz
6758 </td></tr></table>
6759
6760 !! html/parsoid
6761 <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}}]}'>
6762 <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>
6763 <tr>
6764 <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>
6765 </tbody></table>
6766 !! end
6767
6768 ## Edge case fix to prevent future regressions
6769 !! test
6770 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6771 !! wikitext
6772 {|
6773 |{{table_attribs_7}}
6774 |}
6775 <references />
6776 !! html/parsoid
6777 <table>
6778 <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>
6779 </tbody></table>
6780 <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>
6781 !! end
6782
6783 !! test
6784 Table with row followed by newlines and table heading
6785 !! options
6786 parsoid=wt2html,html2html
6787 !! wikitext
6788 {|
6789 |-
6790
6791 !foo
6792 |}
6793 !! html/*
6794 <table>
6795
6796
6797 <tr>
6798 <th>foo
6799 </th></tr></table>
6800
6801 !! end
6802
6803 !! test
6804 Table with empty line following the start tag
6805 !! options
6806 parsoid=wt2html,html2html
6807 !! wikitext
6808 {|
6809
6810 |-
6811 |foo
6812 |}
6813 !! html/*
6814 <table>
6815
6816
6817 <tr>
6818 <td>foo
6819 </td></tr></table>
6820
6821 !! end
6822
6823 !! test
6824 Table attributes with empty value
6825 !! options
6826 parsoid=wt2html,html2html
6827 !! wikitext
6828 {|
6829 | style=|hello
6830 |}
6831 !! html/php
6832 <table>
6833 <tr>
6834 <td style="">hello
6835 </td></tr></table>
6836
6837 !! html/parsoid
6838 <table>
6839 <tbody><tr><td style="">hello</td></tr>
6840 </tbody></table>
6841 !! end
6842
6843 !! test
6844 Wikitext table with a lot of comments
6845 !! wikitext
6846 {|
6847 <!-- c0 -->
6848 |foo
6849 <!-- c1 -->
6850 |-<!-- c2 -->
6851 <!-- c3 -->
6852 |<!-- c4 -->
6853 <!-- c5 -->
6854 |}
6855 !! html
6856 <table>
6857 <tr>
6858 <td>foo
6859 </td></tr>
6860 <tr>
6861 <td>
6862 </td></tr></table>
6863
6864 !! end
6865
6866 !! test
6867 Wikitext table comments represented in parsoid dom
6868 !! wikitext
6869 {|<!--c1--><!--c2-->
6870 |-<!--c3-->
6871 |x
6872 |}
6873 !! html/php+tidy
6874 <table>
6875
6876 <tbody><tr>
6877 <td>x
6878 </td></tr></tbody></table>
6879 !! html/parsoid
6880 <table><!--c1--><!--c2-->
6881 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6882 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
6883 </tbody></table>
6884 !! end
6885
6886 !! test
6887 Wikitext table with double-line table cell
6888 !! wikitext
6889 {|
6890 |a
6891 b
6892 |}
6893 !! html
6894 <table>
6895 <tr>
6896 <td>a
6897 <p>b
6898 </p>
6899 </td></tr></table>
6900
6901 !! end
6902
6903 !! test
6904 Table cell with a single comment
6905 !! wikitext
6906 {|
6907 | <!-- c1 -->
6908 |a
6909 |}
6910 !! html
6911 <table>
6912 <tr>
6913 <td>
6914 </td>
6915 <td>a
6916 </td></tr></table>
6917
6918 !! end
6919
6920 !! test
6921 Table-cell after a comment-only-empty-line
6922 !! wikitext
6923 {|
6924 |a
6925 <!--c1-->
6926 <!--c2-->|b
6927 |}
6928 !! html
6929 <table>
6930 <tr>
6931 <td>a
6932 </td>
6933 <td>b
6934 </td></tr></table>
6935
6936 !! html/parsoid
6937 <table>
6938 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6939 <!--c1-->
6940 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
6941 </tbody></table>
6942
6943 !! end
6944
6945 !! test
6946 Build table with {{!}}
6947 !! wikitext
6948 {{{!}} class="wikitable"
6949 !header
6950 !second header
6951 {{!}}- style="color:red;"
6952 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
6953 {{!}}}
6954 !! html
6955 <table class="wikitable">
6956 <tr>
6957 <th>header
6958 </th>
6959 <th>second header
6960 </th></tr>
6961 <tr style="color:red;">
6962 <td>data</td>
6963 <td style="color:red;">second data
6964 </td></tr></table>
6965
6966 !! end
6967
6968 !! test
6969 Build table with pipe as data
6970 !! wikitext
6971 {| class="wikitable"
6972 !header
6973 !second header
6974 |- style="color:red;"
6975 |data|| style="color:red;" |second data
6976 |-
6977 | style="color:red;" |data with | || style="color:red;" | second data with |
6978 |-
6979 ||data with | |||second data with |
6980 |}
6981 !! html
6982 <table class="wikitable">
6983 <tr>
6984 <th>header
6985 </th>
6986 <th>second header
6987 </th></tr>
6988 <tr style="color:red;">
6989 <td>data</td>
6990 <td style="color:red;">second data
6991 </td></tr>
6992 <tr>
6993 <td style="color:red;">data with |</td>
6994 <td style="color:red;">second data with |
6995 </td></tr>
6996 <tr>
6997 <td>data with |</td>
6998 <td>second data with |
6999 </td></tr></table>
7000
7001 !! end
7002
7003 !! test
7004 Build table with wikilink
7005 !! wikitext
7006 {| class="wikitable"
7007 !header||second header
7008 |- style="color:red;"
7009 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7010 |-
7011 |data||second data [[Main Page|link|text with pipe]]
7012 |}
7013 !! html
7014 <table class="wikitable">
7015 <tr>
7016 <th>header</th>
7017 <th>second header
7018 </th></tr>
7019 <tr style="color:red;">
7020 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7021 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7022 </td></tr>
7023 <tr>
7024 <td>data</td>
7025 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7026 </td></tr></table>
7027
7028 !! end
7029
7030 # The expected HTML structure in this test is debatable. The PHP parser does
7031 # not parse this kind of table at all. The main focus for Parsoid is on
7032 # round-tripping, so this output is ok for now. TODO: revisit!
7033 !! test
7034 Wikitext table with html-syntax row
7035 !! wikitext
7036 {|
7037 |-
7038 <td>foo</td>
7039 |}
7040 !! html/parsoid
7041 <table>
7042 <tbody>
7043 <tr>
7044 <td>foo</td></tr></tbody></table>
7045 !! end
7046
7047 !! test
7048 Fostered content in tables: Plain text
7049 !! options
7050 parsoid=wt2html,html2html
7051 !! wikitext
7052 {|
7053 |-
7054 a
7055 |}
7056 !! html/php
7057 <table>
7058
7059 a
7060 </table>
7061
7062 !! html/php+tidy
7063
7064
7065 a
7066 <table></table>
7067 !! html/parsoid
7068 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7069 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7070
7071 </tr></tbody></table>
7072 !! end
7073
7074 !! test
7075 Fostered content in tables: Lists
7076 !! options
7077 parsoid=wt2html,html2html
7078 !! wikitext
7079 {|
7080 |-
7081 *a
7082 |}
7083 !! html/php
7084 <table>
7085
7086 <ul><li>a</li></ul>
7087 </table>
7088
7089 !! html/php+tidy
7090 <ul><li>a</li></ul><table>
7091
7092
7093 </table>
7094 !! html/parsoid
7095 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7096 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7097
7098 </tr></tbody></table>
7099 !! end
7100
7101 !! test
7102 Template generated table cell with attributes
7103 !! wikitext
7104 {|
7105 |-
7106 {{table_attribs_4}} ||a||b
7107 |}
7108 !! html/php+tidy
7109 <table>
7110
7111 <tbody><tr>
7112 <td style="background-color:#DC241f;" width="10px"></td>
7113 <td>a</td>
7114 <td>b
7115 </td></tr></tbody></table>
7116 !! html/parsoid
7117 <table>
7118 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7119 <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>
7120 !! end
7121
7122 !! test
7123 Parsoid: Round-trip tables directly followed by content (T53219)
7124 !! options
7125 parsoid=wt2html,wt2wt
7126 !! wikitext
7127 {|
7128 |foo
7129 |} bar
7130
7131 {|
7132 |baz
7133 |}<b>quux</b>
7134 !! html+tidy
7135 <table>
7136 <tbody><tr>
7137 <td>foo
7138 </td></tr></tbody></table><p> bar
7139 </p><table>
7140 <tbody><tr>
7141 <td>baz
7142 </td></tr></tbody></table><p><b>quux</b>
7143 </p>
7144 !! end
7145
7146 !! test
7147 Parsoid: Default to a newline after tables in new content (T53219)
7148 !! options
7149 parsoid=html2wt
7150 !! html/parsoid
7151 <table><tbody>
7152 <tr><td>foo</td></tr></tbody></table> bar
7153 <table><tbody>
7154 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7155 !! wikitext
7156 {|
7157 |foo
7158 |}
7159 <nowiki> </nowiki>bar
7160 {|
7161 |baz
7162 |}
7163 '''quux'''
7164 !! end
7165
7166 !! test
7167 Parsoid: newline inducing block nodes don't suppress <nowiki>
7168 !! options
7169 parsoid=html2wt
7170 !! html/parsoid
7171 a<h1>foo</h1>
7172 !! wikitext
7173 <nowiki> </nowiki>a
7174
7175 = foo =
7176 !! end
7177
7178 !! test
7179 Parsoid: Row-syntax table headings followed by comment & table cells
7180 !! options
7181 parsoid=wt2html,wt2wt
7182 !! wikitext
7183 {|
7184 !foo||bar
7185 <!-- foo --> ||baz||quux
7186 |}
7187 !! html/php
7188 <table>
7189 <tr>
7190 <th>foo</th>
7191 <th>bar
7192 </th>
7193 <td>baz</td>
7194 <td>quux
7195 </td></tr></table>
7196
7197 !! html/parsoid
7198 <table>
7199 <tbody><tr><th> foo </th><th> bar
7200 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7201 </tbody></table>
7202 !! end
7203
7204 !!test
7205 Parsoid: Recover better from broken table attributes
7206 !!options
7207 parsoid=wt2html
7208 !!wikitext
7209 {| class="foo
7210 | class="bar" |
7211 foo
7212 |}
7213 !!html/php+tidy
7214 <table class="foo">
7215 <tbody><tr>
7216 <td class="bar">
7217 <p>foo
7218 </p>
7219 </td></tr></tbody></table>
7220 !!html/parsoid
7221 <table class="foo">
7222 <tr>
7223 <td class="bar">
7224 <p>foo</p></td></tr>
7225 </tbody></table>
7226 !!end
7227
7228 !! test
7229 Tables: Digest broken attributes on table and tr tag
7230 !! options
7231 parsoid=wt2html
7232 !! wikitext
7233 {| || |} ++
7234 |- || || ++ --
7235 |- > [
7236 |}
7237 !! html
7238 <table>
7239 <tbody>
7240 <tr class='mw-empty-elt'></tr>
7241 <tr class='mw-empty-elt'></tr>
7242 </tbody></table>
7243 !! end
7244
7245 # T137406: Whitespace in the HTML
7246 !! test
7247 1. Generate correct wikitext for tables with thead/tbody/tfoot
7248 !! options
7249 parsoid=html2wt
7250 !! html/parsoid
7251 <table>
7252 <caption>Test</caption>
7253 <thead>
7254 <tr>
7255 <th>Month</th>
7256 <th>Savings</th>
7257 </tr>
7258 </thead>
7259 <tbody>
7260 <tr>
7261 <td>January</td>
7262 <td>$100</td>
7263 </tr>
7264 <tr>
7265 <td>February</td>
7266 <td>$80</td>
7267 </tr>
7268 </tbody>
7269 <tfoot>
7270 <tr>
7271 <td>Sum</td>
7272 <td>$180</td>
7273 </tr>
7274 </tfoot>
7275 </table>
7276 !! wikitext
7277 {|
7278 |+Test
7279 !Month
7280 !Savings
7281 |-
7282 |January
7283 |$100
7284 |-
7285 |February
7286 |$80
7287 |-
7288 |Sum
7289 |$180
7290 |}
7291 !! html/php+tidy
7292 <table>
7293 <caption>Test
7294 </caption>
7295 <tbody><tr>
7296 <th>Month
7297 </th>
7298 <th>Savings
7299 </th></tr>
7300 <tr>
7301 <td>January
7302 </td>
7303 <td>$100
7304 </td></tr>
7305 <tr>
7306 <td>February
7307 </td>
7308 <td>$80
7309 </td></tr>
7310 <tr>
7311 <td>Sum
7312 </td>
7313 <td>$180
7314 </td></tr></tbody></table>
7315 !! end
7316
7317 # T137406: No whitespace in the HTML
7318 !! test
7319 2. Generate correct wikitext for tables with thead/tbody/tfoot
7320 !! options
7321 parsoid=html2wt
7322 !! html/parsoid
7323 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7324 !! wikitext
7325 {|
7326 !heading
7327 |-
7328 |foo
7329 |}
7330 !! end
7331
7332 !! test
7333 Testing serialization after deletion in references
7334 !! options
7335 parsoid={
7336 "modes": ["wt2wt"],
7337 "changes": [
7338 ["#x", "remove"]
7339 ]
7340 }
7341 !! wikitext
7342 hi <ref><div id="x">ho</div></ref>
7343
7344 <references />
7345 !! wikitext/edited
7346 hi <ref></ref>
7347
7348 <references />
7349 !! end
7350
7351 !!test
7352 Testing serialization after deletion of table cells
7353 !!options
7354 parsoid={
7355 "modes": ["wt2wt", "selser"],
7356 "changes": [
7357 ["#x", "remove"]
7358 ]
7359 }
7360 !!wikitext
7361 {|
7362 !h1 !!h2 !!h3
7363 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7364 |}
7365 !! wikitext/edited
7366 {|
7367 !h1 !!h2 !!h3
7368 |c2 |||c3
7369 |}
7370 !!end
7371
7372 !! test
7373 Testing selser after addition of new row before first row (T125419)
7374 !! options
7375 parsoid={
7376 "modes": ["wt2wt", "selser"],
7377 "changes": [
7378 [ "tr", "before", "<tr><td>X</td></tr>" ]
7379 ]
7380 }
7381 !! wikitext
7382 {|
7383 |a
7384 |}
7385 !! wikitext/edited
7386 {|
7387 |X
7388 |-
7389 |a
7390 |}
7391 !! end
7392
7393 !! test
7394 Serialize new table rows in a HTML table using HTML tags
7395 !! options
7396 parsoid={
7397 "modes": ["wt2wt", "selser"],
7398 "changes": [
7399 [ "tr", "before", "<tr><td>X</td></tr>" ]
7400 ]
7401 }
7402 !! wikitext
7403 <table><tr><td>a</td></tr></table>
7404 !! wikitext/edited
7405 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7406 !! end
7407
7408 !! test
7409 Serialize new table cells in a HTML row using HTML tags
7410 !! options
7411 parsoid={
7412 "modes": ["wt2wt", "selser"],
7413 "changes": [
7414 [ "td", "before", "<td>X</td>" ]
7415 ]
7416 }
7417 !! wikitext
7418 <table><tr><td>a</td></tr></table>
7419 !! wikitext/edited
7420 <table><tr><td>X</td><td>a</td></tr></table>
7421 !! end
7422
7423 !! test
7424 Wikitext tables can be nested inside HTML tables
7425 !! options
7426 parsoid=html2wt
7427 !! html
7428 <table data-parsoid='{"stx":"html"}'>
7429 <tr><td>
7430 <table>
7431 <tr><td>foo</td></tr>
7432 </table>
7433 </td></tr>
7434 </table>
7435 !! wikitext
7436 <table>
7437 <tr><td>
7438 {|
7439 |foo
7440 |}
7441 </td></tr>
7442 </table>
7443 !! end
7444
7445 !! test
7446 Serialize wikitext list items as HTML list items when embedded in a HTML list
7447 !! options
7448 parsoid=html2wt
7449 !! html
7450 <ul data-parsoid='{"stx": "html"}'>
7451 <li data-parsoid='{}'>a</li>
7452 <li>b</li>
7453 </ul>
7454 !! wikitext
7455 <ul>
7456 <li>a</li>
7457 <li>b</li>
7458 </ul>
7459 !! end
7460
7461 # SSS FIXME: Is this actually a good thing given the
7462 # odd nested list output that is generated by MW?
7463 # <ul><li>foo<ul>..</ul></li></ul> instead of
7464 # <ul><li>foo</li><ul>..</ul></ul>
7465 !! test
7466 Wikitext lists can be nested inside HTML lists
7467 !! options
7468 parsoid=html2wt
7469 !! html
7470 <ul data-parsoid='{"stx": "html"}'>
7471 <li data-parsoid='{"stx": "html"}'>a
7472 <ul><li>b</li></ul>
7473 </li>
7474 </ul>
7475
7476 <ul data-parsoid='{"stx": "html"}'>
7477 <li>x
7478 <ul><li>y</li></ul>
7479 </li>
7480 </ul>
7481 !! wikitext
7482 <ul>
7483 <li>a
7484 * b
7485 </li>
7486 </ul>
7487
7488 <ul>
7489 <li>x
7490 * y
7491 </li>
7492 </ul>
7493 !! end
7494
7495 ###
7496 ### Internal links
7497 ###
7498 !! test
7499 Plain link, capitalized
7500 !! wikitext
7501 [[Main Page]]
7502 !! html
7503 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7504 </p>
7505 !! end
7506
7507 !! test
7508 Plain link, uncapitalized
7509 !! wikitext
7510 [[main Page]]
7511 !! html
7512 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7513 </p>
7514 !! end
7515
7516 !! test
7517 Piped link
7518 !! wikitext
7519 [[Main Page|The Main Page]]
7520 !! html
7521 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7522 </p>
7523 !! end
7524
7525 !! test
7526 Piped link with comment in link text
7527 !! wikitext
7528 [[Main Page|The Main<!--front--> Page]]
7529 !! html
7530 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7531 </p>
7532 !! end
7533
7534 !! test
7535 Piped link with multiple pipe characters in link text
7536 !! wikitext
7537 [[Main Page||The|Main|Page|]]
7538 !! html/php
7539 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7540 </p>
7541 !! html/parsoid
7542 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7543 !! end
7544
7545 !! test
7546 Piped link with no link text
7547 !! wikitext
7548 [[Thomas Bek (bishop of St David's)|]]
7549 !! html/php
7550 <p>[[Thomas Bek (bishop of St David's)|]]
7551 </p>
7552 !! html/parsoid
7553 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7554 !! end
7555
7556 !! test
7557 Piped link with empty link text
7558 !! wikitext
7559 [[Main Page|<nowiki/>]] - empty nowiki
7560 [[Main Page| ]] - empty space
7561 [[Main Page|&nbsp;]] - empty non breaking space
7562 !! html/php
7563 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7564 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7565 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7566 </p>
7567 !! html/parsoid
7568 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7569 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7570 <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>
7571 !! end
7572
7573 !! test
7574 Broken link
7575 !! wikitext
7576 [[Zigzagzogzagzig]]
7577 !! html
7578 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7579 </p>
7580 !! end
7581
7582 !! test
7583 Broken link with fragment
7584 !! wikitext
7585 [[Zigzagzogzagzig#zug]]
7586 !! html
7587 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7588 </p>
7589 !! end
7590
7591 !! test
7592 Special page link with fragment
7593 !! wikitext
7594 [[Special:Version#anchor]]
7595 !! html
7596 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7597 </p>
7598 !! end
7599
7600 !! test
7601 Nonexistent special page link with fragment
7602 !! wikitext
7603 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7604 !! html
7605 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7606 </p>
7607 !! end
7608
7609 !! test
7610 Link with prefix
7611 !! wikitext
7612 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7613 !! html
7614 <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>
7615 </p>
7616 !! end
7617
7618 !! test
7619 Link with suffix
7620 !! wikitext
7621 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7622 !! html
7623 <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>!!!
7624 </p>
7625 !! end
7626
7627 !! article
7628 prefixed article
7629 !! text
7630 Some text
7631 !! endarticle
7632
7633 !! test
7634 T45661: Piped links with identical prefixes
7635 !! wikitext
7636 [[prefixed article|prefixed articles with spaces]]
7637
7638 [[prefixed article|prefixed articlesaoeu]]
7639
7640 [[Main Page|Main Page test]]
7641 !! html
7642 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7643 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7644 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7645 </p>
7646 !! end
7647
7648
7649 !! test
7650 Link with HTML entity in suffix / tail
7651 !! wikitext
7652 [[Main Page]]&quot;, [[Main Page]]&#97;
7653 !! html/php
7654 <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;
7655 </p>
7656 !! html/parsoid
7657 <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>
7658 !! end
7659
7660 !! test
7661 Link with 3 brackets
7662 !! wikitext
7663 [[[Main Page]]]
7664 Foo [[[Main Page]]]
7665 !! html
7666 <p>[[[Main Page]]]
7667 Foo [[[Main Page]]]
7668 </p>
7669 !! end
7670
7671 !! test
7672 Link with 4 brackets
7673 !! wikitext
7674 [[[[Main Page]]]]
7675 !! html
7676 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7677 </p>
7678 !! end
7679
7680 !! test
7681 Piped link with 3 brackets
7682 !! wikitext
7683 [[[main page|the main page]]]
7684 !! html
7685 <p>[[[main page|the main page]]]
7686 </p>
7687 !! end
7688
7689 !! test
7690 Piped link with extlink-like text
7691 !! wikitext
7692 [[Main Page|[bar]]]
7693 [[Main Page|This is a [bar]]]
7694 [[Main Page|[bar]]
7695 !! html/php
7696 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7697 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7698 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7699 </p>
7700 !! html/parsoid
7701 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7702 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7703 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7704 !! end
7705
7706 !! test
7707 Link with multiple pipes
7708 !! wikitext
7709 [[Main Page|The|Main|Page]]
7710 !! html
7711 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7712 </p>
7713 !! end
7714
7715 !! test
7716 Anchor containing a #. (T65430)
7717 !! config
7718 wgFragmentMode=[ 'html5', 'legacy' ]
7719 !! wikitext
7720 [[Main Page#And#Link]]
7721 !! html/php
7722 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7723 </p>
7724 !! html/parsoid
7725 <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>
7726 !! end
7727
7728 !! test
7729 Link to namespaces
7730 !! wikitext
7731 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7732 !! html
7733 <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>
7734 </p>
7735 !! end
7736
7737 !! test
7738 Link with space in namespace
7739 !! wikitext
7740 [[User talk:Foo bar]]
7741 !! html
7742 <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>
7743 </p>
7744 !! end
7745
7746 !! article
7747 MemoryAlpha:AlphaTest
7748 !! text
7749 This is an article in the MemoryAlpha namespace
7750 (which shadows the memoryalpha interwiki link).
7751 !! endarticle
7752
7753 !! test
7754 Namespace takes precedence over interwiki link (T53680)
7755 !! wikitext
7756 [[MemoryAlpha:AlphaTest]]
7757 !! html
7758 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7759 </p>
7760 !! end
7761
7762 # The previous test doesn't work correctly in html2*, due to not recognizing the
7763 # link as an internal one. This one checks for the correct behavior.
7764 !! test
7765 Link to namespace preferred over interwiki with correct rel attribute
7766 !! options
7767 parsoid=html2wt,html2html
7768 !! html/parsoid
7769 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7770 !! wikitext
7771 [[MemoryAlpha:AlphaTest]]
7772 !! end
7773
7774 !! test
7775 Piped link to namespace
7776 !! wikitext
7777 [[Meta:Disclaimers|The disclaimers]]
7778 !! html
7779 <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>
7780 </p>
7781 !! end
7782
7783 !! test
7784 Link containing }
7785 !! wikitext
7786 [[Usually caused by a typo (oops}]]
7787 !! html
7788 <p>[[Usually caused by a typo (oops}]]
7789 </p>
7790 !! end
7791
7792 !! article
7793 7% Solution
7794 !! text
7795 Just a test of an article title containing a percent.
7796 !! endarticle
7797
7798 !! test
7799 Link containing % (not as a hex sequence)
7800 !! wikitext
7801 [[7% Solution]]
7802 [[7% Solution|7%25 Solution]]
7803 !! html/php
7804 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7805 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7806 </p>
7807 !! html/parsoid
7808 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7809 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7810 !! end
7811
7812 # note that the parsoid HTML is identical to the previous test output,
7813 # so the previous test ensures that the html2wt mode will generate the
7814 # "not as a hex sequence" wikitext.
7815 !! test
7816 Link containing % as a single hex sequence interpreted to char
7817 !! options
7818 parsoid=wt2wt,wt2html,html2html
7819 !! wikitext
7820 [[7%25 Solution]]
7821 [[7%25 Solution|7%25 Solution]]
7822 !! html/php
7823 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7824 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7825 </p>
7826 !! html/parsoid
7827 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7828 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7829 !!end
7830
7831 !! test
7832 Link containing % as a double hex sequence interpreted to hex sequence
7833 !! wikitext
7834 [[7%2525 Solution]]
7835 !! html
7836 <p>[[7%2525 Solution]]
7837 </p>
7838 !!end
7839
7840 ## Example for such a section: == < ==
7841 !! test
7842 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7843 !! config
7844 wgFragmentMode=[ 'html5', 'legacy' ]
7845 !! wikitext
7846 [[%23%3c]][[%23%3e]]
7847 !! html/php
7848 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7849 </p>
7850 !! html/parsoid
7851 <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>
7852 !! end
7853
7854 ## Example for such a section: == < ==
7855 !! test
7856 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7857 !! config
7858 wgFragmentMode=[ 'legacy' ]
7859 !! wikitext
7860 [[%23%3c]][[%23%3e]]
7861 !! html/php
7862 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7863 </p>
7864 !! end
7865
7866 !! test
7867 Link containing "<#" and ">#" as a hex sequences
7868 !! wikitext
7869 [[%3c%23]][[%3e%23]]
7870 !! html
7871 <p>[[%3c%23]][[%3e%23]]
7872 </p>
7873 !! end
7874
7875 !! test
7876 Link containing an equals sign
7877 !! wikitext
7878 [[Special:BookSources/isbn=4-00-026157-6]]
7879 !! html/php
7880 <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>
7881 </p>
7882 !! html/parsoid
7883 <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>
7884 !! end
7885
7886 !! article
7887 Foo~bar
7888 !! text
7889 Just a test of an article title containing a tilde.
7890 !! endarticle
7891
7892 # note that links containing signatures, like [[Foo~~~~]], are
7893 # massaged by the pre-save transform (PST) and so the tildes are never
7894 # seen by the parser.
7895 !! test
7896 Link containing a tilde
7897 !! wikitext
7898 [[Foo~bar]]
7899 !! html/php
7900 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7901 </p>
7902 !! html/parsoid
7903 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7904 !! end
7905
7906 !! test
7907 Link containing double-single-quotes '' (T6598)
7908 !! wikitext
7909 [[Lista d''e paise d''o munno]]
7910 !! html/php
7911 <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>
7912 </p>
7913 !! html/parsoid
7914 <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>
7915 !! end
7916
7917 !! test
7918 Link containing double quotes and spaces
7919 !! wikitext
7920 [[Cool "Gator"]]
7921 !! html/php
7922 <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>
7923 </p>
7924 !! html/parsoid
7925 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7926 !! end
7927
7928 !! test
7929 File containing double quotes and spaces
7930 !! wikitext
7931 [[File:Cool "Gator".png]]
7932 !! html/parsoid
7933 <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>
7934 !! end
7935
7936 !! test
7937 Redirect containing double quotes and spaces
7938 !! wikitext
7939 #REDIRECT [[Cool "Gator"]]
7940 !! html/parsoid
7941 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7942 !! end
7943
7944 !! test
7945 Link containing double-single-quotes '' in text (T6598 sanity check)
7946 !! wikitext
7947 Some [[Link|pretty ''italics'' and stuff]]!
7948 !! html/php
7949 <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>!
7950 </p>
7951 !! html/parsoid
7952 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7953 !! end
7954
7955 !! test
7956 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7957 !! wikitext
7958 ''Some [[Link|pretty ''italics'' and stuff]]!''
7959 !! html
7960 <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>
7961 </p>
7962 !! end
7963
7964 !! test
7965 Link with double quotes in title part (literal) and alternate part (interpreted)
7966 !! wikitext
7967 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7968
7969 [[''Pentecoste'']]
7970
7971 [[''Pentecoste''|Pentecoste]]
7972
7973 [[''Pentecoste''|''Pentecoste'']]
7974 !! html/php
7975 <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>
7976 </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>
7977 </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>
7978 </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>
7979 </p>
7980 !! html/parsoid
7981 <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>
7982 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7983 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7984 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7985 !! end
7986
7987 !! test
7988 Broken image links with HTML captions (T41700)
7989 !! wikitext
7990 [[File:Nonexistent|<script></script>]]
7991 [[File:Nonexistent|100x100px|<script></script>]]
7992 [[File:Nonexistent|&lt;]]
7993 [[File:Nonexistent|a<i>b</i>c]]
7994 !! html/php
7995 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7996 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7997 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7998 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7999 </p>
8000 !! html/parsoid
8001 <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>
8002 <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>
8003 <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>
8004 <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>
8005 !! end
8006
8007 !! test
8008 Plain link to URL
8009 !! wikitext
8010 [[http://www.example.com]]
8011 !! html/php
8012 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8013 </p>
8014 !! html/parsoid
8015 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8016 !! end
8017
8018 !! test
8019 Plain link to URL with link text
8020 !! wikitext
8021 [[http://www.example.com Link text]]
8022 !! html
8023 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8024 </p>
8025 !! end
8026
8027 !! test
8028 Plain link to protocol-relative URL
8029 !! wikitext
8030 [[//www.example.com]]
8031 !! html/php
8032 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8033 </p>
8034 !! html/parsoid
8035 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8036 !! end
8037
8038 !! test
8039 Plain link to protocol-relative URL with link text
8040 !! wikitext
8041 [[//www.example.com Link text]]
8042 !! html
8043 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8044 </p>
8045 !! end
8046
8047 !! test
8048 Plain link to page with question mark in title
8049 !! wikitext
8050 [[A?b]]
8051
8052 [[A?b|Baz]]
8053 !! html
8054 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8055 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8056 </p>
8057 !! end
8058
8059 # I'm fairly sure the expected result here is wrong.
8060 # We want these to be URL links, not pseudo-pages with URLs for titles....
8061 # However the current output is also pretty screwy.
8062 #
8063 # ----
8064 # I'm changing it to match the current output--it arguably makes more
8065 # sense in the light of the test above. Old expected result was:
8066 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8067 #</p>
8068 # But I think this test is bordering on "garbage in, garbage out" anyway.
8069 # -- wtm
8070 !! test
8071 Piped link to URL
8072 !! wikitext
8073 Piped link to URL: [[http://www.example.com|an example URL]]
8074 !! html/php
8075 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8076 </p>
8077 !! html/parsoid
8078 <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>
8079 !! end
8080
8081 !! test
8082 Plain link in template argument
8083 !! options
8084 parsoid=wt2html
8085 !! wikitext
8086 {{echo|[http://www.example.com |123]}}
8087
8088 {{echo|[[http://www.example.com |123]]}}
8089
8090 {{echo|[[http://www.example.com |123]}}
8091
8092 {{echo|[http://www.example.com |123]]}}
8093 !! html/php
8094 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8095 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8096 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8097 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8098 </p>
8099 !! html/parsoid
8100 <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>
8101
8102 <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>
8103
8104 <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>
8105
8106 <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>
8107 !! end
8108
8109 !! test
8110 T2002: [[page|http://url/]] should link to page, not http://url/
8111 !! wikitext
8112 [[Main Page|http://url/]]
8113 !! html/php
8114 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8115 </p>
8116 !! html/parsoid
8117 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8118 !! end
8119
8120 # Parsoid does not mark self-links, by design.
8121 !! test
8122 T2337: Escaped self-links should be bold
8123 !! options
8124 title=[[Bug462]]
8125 !! wikitext
8126 [[Bu&#103;462]] [[Bug462]]
8127 !! html/php+tidy
8128 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8129 </p>
8130 !! html/parsoid
8131 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8132 !! end
8133
8134 !! test
8135 Self-link to section should not be bold
8136 !! options
8137 title=[[Main Page]]
8138 !! wikitext
8139 [[Main Page#section]]
8140 !! html
8141 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8142 </p>
8143 !! end
8144
8145 !! article
8146 00
8147 !! text
8148 This is 00.
8149 !! endarticle
8150
8151 !!test
8152 Self-link to numeric title
8153 !!options
8154 title=[[0]]
8155 !! wikitext
8156 [[0]]
8157 !! html
8158 <p><a class="mw-selflink selflink">0</a>
8159 </p>
8160 !!end
8161
8162 !!test
8163 Link to numeric-equivalent title
8164 !!options
8165 title=[[0]]
8166 !! wikitext
8167 [[00]]
8168 !! html
8169 <p><a href="/wiki/00" title="00">00</a>
8170 </p>
8171 !!end
8172
8173 !! test
8174 <nowiki> inside a link
8175 !! wikitext
8176 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8177 !! html
8178 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8179 </p>
8180 !! end
8181
8182 !! test
8183 Non-breaking spaces in title
8184 !! wikitext
8185 [[&nbsp; Main &nbsp; Page &nbsp;]]
8186 !! html
8187 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8188 </p>
8189 !!end
8190
8191 # Add new article for the test below so that it doesn't red-link
8192 !! article
8193 Foo bar baz
8194 !! text
8195 boo
8196 !! endarticle
8197
8198 !! test
8199 Multiple spaces in titles should normalize to a single underscore
8200 !! options
8201 parsoid=wt2html,wt2wt
8202 !! wikitext
8203 [[Foo bar baz|x]]
8204 [[Foo bar baz|x]]
8205 [[Foo bar baz|x]]
8206 !! html/php
8207 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8208 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8209 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8210 </p>
8211 !! html/parsoid
8212 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8213 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8214 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8215 </p>
8216 !! end
8217
8218 !! test
8219 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8220 !! options
8221 language=ca
8222 !! wikitext
8223 '''[[Main Page]]'''
8224 !! html
8225 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8226 </p>
8227 !! end
8228
8229 !! test
8230 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8231 !! options
8232 language=ca
8233 !! wikitext
8234 ''[[Main Page]]''
8235 !! html
8236 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8237 </p>
8238 !! end
8239
8240 !! test
8241 Internal link with en linktrail: no apostrophes (T29473)
8242 !! options
8243 language=en
8244 !! wikitext
8245 [[Something]]'nice
8246 !! html
8247 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8248 </p>
8249 !! end
8250
8251 !! test
8252 Internal link with ca linktrail with apostrophes (T29473)
8253 !! options
8254 language=ca
8255 !! wikitext
8256 [[Something]]'nice
8257 !! html
8258 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8259 </p>
8260 !! end
8261
8262 !! test
8263 Internal link with kaa linktrail with apostrophes (T29473)
8264 !! options
8265 language=kaa
8266 !! wikitext
8267 [[Something]]'nice
8268 !! html
8269 <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>
8270 </p>
8271 !! end
8272
8273 !! test
8274 Link with multiple ":" in a subpage-supporting namespace (T65636)
8275 !! wikitext
8276 [[User:Foo/Test/63636:Bar|Test]]
8277 !! html/php
8278 <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>
8279 </p>
8280 !! html/parsoid
8281 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8282 !! end
8283
8284 ## Mainly a sanity check for Parsoid
8285 !! test
8286 Handle title parsing for subpages
8287 !! options
8288 title=[[/123123]]
8289 subpage
8290 !! wikitext
8291 123
8292 !! html/php
8293 <p>123
8294 </p>
8295 !! html/parsoid
8296 <p>123</p>
8297 !! end
8298
8299 !! article
8300 User:Test/123
8301 !! text
8302 test 123
8303 !! endarticle
8304
8305 !! test
8306 Link to a subpage from a namespace other than main
8307 !! options
8308 title=[[User:Test]]
8309 subpage
8310 !! wikitext
8311 [[/123]]
8312 !! html/php
8313 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8314 </p>
8315 !! html/parsoid
8316 <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>
8317 !! end
8318
8319 !! test
8320 Ensure that transclusion titles are not url-decoded
8321 !! options
8322 subpage title=[[Test]]
8323 parsoid=wt2html
8324 !! wikitext
8325 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8326 !! html/php
8327 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8328 </p>
8329 !! html/parsoid
8330 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8331 !! end
8332
8333 !! test
8334 Purely hash wikilink
8335 !! options
8336 title=[[User:Test/123]]
8337 subpage
8338 !! wikitext
8339 [[#a|b]]
8340 !! html/php
8341 <p><a href="#a">b</a>
8342 </p>
8343 !! html/parsoid
8344 <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>
8345 !! end
8346
8347 !! test
8348 Serialization of purely hash wikilink
8349 !! options
8350 title=[[User:Test/123]]
8351 subpage
8352 parsoid=html2wt
8353 !! html/parsoid
8354 <p><a href="#a">[[</a></p>
8355 !! wikitext
8356 [[#a|<nowiki>[[</nowiki>]]
8357 !! html/php
8358 <p><a href="#a">[[</a>
8359 </p>
8360 !! end
8361
8362 !! test
8363 1. Interaction of linktrail and template encapsulation
8364 !! wikitext
8365 {{echo|[[Foo]]}}l
8366 !! html/parsoid
8367 <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>
8368 !! end
8369
8370 !! test
8371 2. Interaction of linktrail and template encapsulation
8372 !! options
8373 parsoid
8374 !! wikitext
8375 {{echo|Some [[Fool]]}}s
8376 !! html
8377 <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>
8378 !! end
8379
8380 !! test
8381 3. Interaction of linktrail and template encapsulation
8382 !! options
8383 parsoid
8384 !! wikitext
8385 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8386 !! html
8387 <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>
8388 !! end
8389
8390 !! article
8391 Söfnuður
8392 !! text
8393 Test.
8394 !! endarticle
8395
8396 !! test
8397 Internal link with is link prefix
8398 !! options
8399 language=is
8400 !! wikitext
8401 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8402 !! html
8403 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8404 </p>
8405 !! end
8406
8407 !! article
8408 Mótmælendatrú
8409 !! text
8410 Test.
8411 !! endarticle
8412
8413 !! test
8414 Internal link with is link trail and link prefix
8415 !! options
8416 language=is
8417 !! wikitext
8418 [[mótmælendatrú|xxx]]ar
8419 [[mótmælendatrú]]ar
8420 mótmælenda[[söfnuður]]
8421 mótmælenda[[söfnuður|söfnuðir]]
8422 mótmælenda[[söfnuður|söfnuðir]]xxx
8423 !! html
8424 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8425 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8426 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8427 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8428 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8429 </p>
8430 !! end
8431
8432 !! test
8433 Parsoid link trail escaping
8434 !! options
8435 parsoid=html2wt,html2html
8436 !! html/parsoid
8437 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8438 !! wikitext
8439 [[apple]]<nowiki/>s
8440 !! end
8441
8442 !! test
8443 Parsoid link prefix escaping
8444 !! options
8445 language=is
8446 parsoid=html2wt,html2html
8447 !! html/parsoid
8448 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8449 !! wikitext
8450 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8451 !! end
8452
8453 !! test
8454 Parsoid link bracket escaping
8455 !! options
8456 parsoid=html2wt,html2html
8457 !! html/parsoid
8458 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8459 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8460 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8461 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8462 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8463 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8464 !! wikitext
8465 [[Test]]
8466
8467 [<nowiki/>[[Test]]]
8468
8469 [[[[Test]]]]
8470
8471 [[[<nowiki/>[[Test]]]]]
8472
8473 [[[[[[Test]]]]]]
8474
8475 [[[[[<nowiki/>[[Test]]]]]]]
8476 !! end
8477
8478 !! test
8479 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8480 !! wikitext
8481 [[Foo| bar]]
8482
8483 [[Foo| ''bar'']]
8484
8485 [http://wp.org foo]
8486
8487 [http://wp.org ''foo'']
8488 !! html
8489 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8490 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8491 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8492 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8493 </p>
8494 !! end
8495
8496 !! test
8497 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8498 !! wikitext
8499 [[Foo|{{echo|a}} b {{echo|c}}]]
8500 !! html/parsoid
8501 <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>
8502 !! end
8503
8504 !! test
8505 Link with angle bracket after anchor
8506 !! config
8507 wgFragmentMode=[ 'html5', 'legacy' ]
8508 !! wikitext
8509 [[Foo#<bar>]]
8510 !! html/php
8511 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8512 </p>
8513 !! html/parsoid
8514 <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>
8515 !! end
8516
8517 !! test
8518 Link with angle bracket after anchor (legacy)
8519 !! config
8520 wgFragmentMode=[ 'legacy' ]
8521 !! wikitext
8522 [[Foo#<bar>]]
8523 !! html/php
8524 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8525 </p>
8526 !! end
8527
8528 ###
8529 ### Interwiki links (see maintenance/interwiki.sql)
8530 ###
8531
8532 !! test
8533 Inline interwiki link
8534 !! options
8535 parsoid=wt2html,wt2wt,html2html
8536 !! wikitext
8537 [[MeatBall:SoftSecurity]]
8538 !! html/php
8539 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8540 </p>
8541 !! html/parsoid
8542 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8543 !! end
8544
8545 !! test
8546 Inline interwiki link with empty title (T4372)
8547 !! options
8548 parsoid=wt2html,wt2wt,html2html
8549 !! wikitext
8550 [[MeatBall:]]
8551 !! html/php
8552 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8553 </p>
8554 !! html/parsoid
8555 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8556 !! end
8557
8558 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8559 !! test
8560 Interwiki link encoding conversion (T3636)
8561 !! options
8562 parsoid=wt2html,wt2wt
8563 !! wikitext
8564 *[[Wikipedia:ro:Olteni&#0355;a]]
8565 *[[Wikipedia:ro:Olteni&#355;a]]
8566 !! html
8567 <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>
8568 <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>
8569
8570 !! html/php+tidy
8571 <ul>
8572 <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>
8573 <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>
8574 </ul>
8575 !! html/parsoid
8576 <ul>
8577 <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>
8578 <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>
8579 </ul>
8580 !! end
8581
8582 !! test
8583 Interwiki link with fragment (T4130)
8584 !! wikitext
8585 [[MeatBall:SoftSecurity#foo]]
8586 !! html
8587 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8588 </p>
8589 !! end
8590
8591 !! test
8592 Link scenarios with escaped fragments
8593 !! config
8594 wgFragmentMode=[ 'html5', 'legacy' ]
8595 !! wikitext
8596 [[#Is this great?]]
8597 [[Foo#Is this great?]]
8598 [[meatball:Foo#Is this great?]]
8599 !! html/php
8600 <p><a href="#Is_this_great?">#Is this great?</a>
8601 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8602 <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>
8603 </p>
8604 !! html/parsoid
8605 <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>
8606 <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>
8607 <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>
8608 !! end
8609
8610 !! test
8611 Link scenarios with escaped fragments (legacy)
8612 !! config
8613 wgFragmentMode=[ 'legacy' ]
8614 !! wikitext
8615 [[#Is this great?]]
8616 [[Foo#Is this great?]]
8617 [[meatball:Foo#Is this great?]]
8618 !! html/php
8619 <p><a href="#Is_this_great.3F">#Is this great?</a>
8620 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8621 <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>
8622 </p>
8623 !! end
8624
8625 # Ideally the wikipedia: prefix here should be proto-relative too
8626 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8627 # define the 'en' prefix, and originally the test used 'wikipedia',
8628 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8629 # article.
8630 !! test
8631 Different interwiki prefixes mapping to the same URL
8632 !! wikitext
8633 [[:en:Foo]]
8634
8635 [[:en:Foo|Foo]]
8636
8637 [[wikipedia:Foo]]
8638
8639 [[:wikipedia:Foo|Foo]]
8640
8641 [[wikipedia:en:Foo]]
8642
8643 [[:wikipedia:en:Foo]]
8644
8645 [[ wikiPEdia :Foo]]
8646 !! html/parsoid
8647 <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>
8648
8649 <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>
8650
8651 <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>
8652
8653 <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>
8654
8655 <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>
8656
8657 <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>
8658
8659 <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>
8660 !! end
8661
8662 !! test
8663 Interwiki links that cannot be represented in wiki syntax
8664 !! wikitext
8665 [[meatball:ok]]
8666 [[meatball:ok#foo|ok with fragment]]
8667 [[meatball:ok_as_well?|ok ending with ? mark]]
8668 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8669 [http://de.wikipedia.org/wiki/#foo is just fragment]
8670
8671 !! html/php
8672 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8673 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8674 <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>
8675 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8676 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8677 </p>
8678 !! html/parsoid
8679 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8680 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8681 <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>
8682 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8683 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8684 !! end
8685
8686 !! test
8687 Interwiki links: trail
8688 !! wikitext
8689 [[wikipedia:Foo|Ba]]r
8690 !! html/php
8691 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8692 </p>
8693 !! html/parsoid
8694 <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>
8695 !! end
8696
8697 !! test
8698 Local interwiki link
8699 !! options
8700 parsoid=wt2html,wt2wt,html2html
8701 !! wikitext
8702 [[local:Template:Foo]]
8703 !! html/php
8704 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8705 </p>
8706 !! html/parsoid
8707 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8708 !! end
8709
8710 # Parsoid does not mark self-links, by design.
8711 !! test
8712 Local interwiki link: self-link to current page
8713 !! options
8714 title=[[Main Page]]
8715 parsoid=wt2html,wt2wt,html2html
8716 !! wikitext
8717 [[local:Main Page]]
8718 !! html/php
8719 <p><a class="mw-selflink selflink">local:Main Page</a>
8720 </p>
8721 !! html/parsoid
8722 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8723 !! end
8724
8725 !! test
8726 Local interwiki link: prefix only (T66167)
8727 !! options
8728 parsoid=wt2html,wt2wt,html2html
8729 !! wikitext
8730 [[local:]]
8731 !! html/php
8732 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8733 </p>
8734 !! html/parsoid
8735 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8736 !! end
8737
8738 !! test
8739 Local interwiki link: with additional interwiki prefix (T63357)
8740 !! options
8741 parsoid=wt2html,wt2wt,html2html
8742 !! wikitext
8743 [[local:meatball:Hello]]
8744 !! html/php
8745 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8746 </p>
8747 !! html/parsoid
8748 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8749 !! end
8750
8751 !! test
8752 Multiple local interwiki link prefixes
8753 !! wikitext
8754 [[local:local:local:local:mi:local:Foo]]
8755 !! options
8756 parsoid=wt2html,wt2wt,html2html
8757 !! html/php
8758 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8759 </p>
8760 !! html/parsoid
8761 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8762 !! end
8763
8764 ###
8765 ### Interlanguage links
8766 ### Language links (so that searching for '### language' matches..)
8767 ###
8768
8769 !! test
8770 Interlanguage link
8771 !! wikitext
8772 Blah blah blah
8773 [[zh:Chinese]]
8774 !! html/php
8775 <p>Blah blah blah
8776 </p>
8777 !! html/parsoid
8778 <p>Blah blah blah</p>
8779 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8780 !! end
8781
8782 ## parsoid html2wt will lose the space variations
8783 !! test
8784 Interlanguage link with spacing
8785 !! options
8786 parsoid=wt2html,wt2wt,html2html
8787 !! wikitext
8788 Blah blah blah
8789 [[ zh : Chinese ]]
8790 !! html/php
8791 <p>Blah blah blah
8792 </p>
8793 !! html/parsoid
8794 <p>Blah blah blah</p>
8795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8796 !! end
8797
8798 !! test
8799 Double interlanguage link
8800 !! wikitext
8801 Blah blah blah
8802 [[es:Spanish]]
8803 [[zh:Chinese]]
8804 !! html/php
8805 <p>Blah blah blah
8806 </p>
8807 !! html/parsoid
8808 <p>Blah blah blah</p>
8809 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8810 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8811 !! end
8812
8813 ## parsoid html2wt will lose the space variations
8814 !! test
8815 Interlanguage link variations
8816 !! options
8817 parsoid=wt2html,wt2wt,html2html
8818 !! wikitext
8819 Blah blah blah
8820 [[ es :Spanish]]
8821 [[ ZH :Chinese]]
8822 [[es:Foo_bar]]
8823 !! html/php
8824 <p>Blah blah blah
8825 </p>
8826 !! html/parsoid
8827 <p>Blah blah blah</p>
8828 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8829 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8830 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8831 !! end
8832
8833 !! test
8834 Escaping of interlanguage links (T129218, T156308)
8835 !! wikitext
8836 Blah blah blah
8837 [[:es:Spanish]]
8838 [[ : zh : Chinese ]]
8839 !! html/php
8840 <p>Blah blah blah
8841 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8842 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8843 </p>
8844 !! html/parsoid
8845 <p>Blah blah blah
8846 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8847 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8848 !! end
8849
8850 !! test
8851 Multiple colons escaping interlanguage links
8852 !! options
8853 parsoid=wt2html
8854 !! wikitext
8855 [[:es:Spanish]]
8856 [[::es:Spanish]]
8857 [[:::es:Spanish]]
8858 !! html/php
8859 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8860 [[::es:Spanish]]
8861 [[:::es:Spanish]]
8862 </p>
8863 !! html/parsoid
8864 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8865 [[::es:Spanish]]
8866 [[:::es:Spanish]]</p>
8867 !! end
8868
8869 ## parsoid html2wt will normalize the space to _
8870 !! test
8871 Space and question mark encoding in interlanguage links (T95473)
8872 !! options
8873 parsoid=wt2html,wt2wt,html2html
8874 !! wikitext
8875 Blah blah blah
8876 [[es:Foo bar?]]
8877 !! html/php
8878 <p>Blah blah blah
8879 </p>
8880 !! html/parsoid
8881 <p>Blah blah blah</p>
8882 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8883 !! end
8884
8885 !! test
8886 Interlanguage link, with prefix links
8887 !! options
8888 language=ln
8889 !! wikitext
8890 Blah blah blah
8891 [[zh:Chinese]]
8892 !! html/php
8893 <p>Blah blah blah
8894 </p>
8895 !! html/parsoid
8896 <p>Blah blah blah</p>
8897 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8898 !! end
8899
8900 !! test
8901 Double interlanguage link, with prefix links (T10897)
8902 !! options
8903 language=ln
8904 !! wikitext
8905 Blah blah blah
8906 [[es:Spanish]]
8907 [[zh:Chinese]]
8908 !! html/php
8909 <p>Blah blah blah
8910 </p>
8911 !! html/parsoid
8912 <p>Blah blah blah</p>
8913 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8914 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8915 !! end
8916
8917 !! test
8918 "Extra" interlanguage links (T34189 / gerrit 111390)
8919 !! wikitext
8920 Blah blah blah
8921 [[mul:Article]]
8922 !! html/php
8923 <p>Blah blah blah
8924 </p>
8925 !! html/parsoid
8926 <p>Blah blah blah</p>
8927 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8928 !! end
8929
8930 ## PHP parser tests script needs an update
8931 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8932 !! test
8933 Language links render as inline links if $wgInterwikiMagic=false
8934 !! options
8935 wgInterwikiMagic=false
8936 parsoid=wt2html,wt2wt,html2html
8937 !! wikitext
8938 Blah blah blah
8939 [[zh:Chinese]]
8940 !! html/parsoid
8941 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8942 !! end
8943
8944 ## PHP parser tests script needs an update
8945 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8946 !! test
8947 Language links render as inline links in the Talk namespace
8948 !! options
8949 title=Talk:Foo
8950 parsoid=wt2html,wt2wt,html2html
8951 !! wikitext
8952 Blah blah blah
8953 [[zh:Chinese]]
8954 !! html/parsoid
8955 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8956 !! end
8957
8958 !! test
8959 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8960 !! options
8961 language=ln
8962 !! wikitext
8963 [[WW&nbsp;II]]
8964 !! html
8965 <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>
8966 </p>
8967 !! end
8968
8969 !! test
8970 Parsoid T55221: Wikilinks should be properly entity-escaped
8971 !! options
8972 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8973 !! html/parsoid
8974 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8975 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8976 !! wikitext
8977 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8978
8979 He&amp;nbsp;llo He&amp;nbsp;llo
8980 !! html/php
8981 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8982 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8983 </p>
8984 !! end
8985
8986 # html2wt will fail because of title normalization without data-parsoid
8987 !! test
8988 Parsoid: handle constructor well
8989 !! options
8990 parsoid=wt2html,wt2wt
8991 !! wikitext
8992 [[constructor]]
8993
8994 [[constructor:foo]]
8995 !! html/php
8996 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8997 </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>
8998 </p>
8999 !! html/parsoid
9000 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9001
9002 <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>
9003 !! end
9004
9005 !! article
9006 ko:
9007 !! text
9008 Test.
9009 !! endarticle
9010
9011 # Note that `ko` isn't a known interlanguage prefix
9012 !! test
9013 Parsoid: recognize interlanguage links without a target page
9014 !! options
9015 ill
9016 !! wikitext
9017 [[es:]]
9018
9019 [[ko:]]
9020 !! html/php
9021 es:
9022 !! html/parsoid
9023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9024
9025 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9026 !! end
9027
9028 # Note that `ko` isn't a known interwiki prefix
9029 !! test
9030 Parsoid: recognize interwiki links without a target page
9031 !! options
9032 parsoid=wt2html,wt2wt,html2html
9033 !! wikitext
9034 [[:es:]]
9035
9036 [[:ko:]]
9037 !! html/php
9038 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9039 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9040 </p>
9041 !! html/parsoid
9042 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9043 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9044 !! end
9045
9046 !! test
9047 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9048 !! wikitext
9049 [[mi:Foo]]
9050 !! html/php
9051 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9052 </p>
9053 !! html/parsoid
9054 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9055 !! end
9056
9057 !! test
9058 Interlanguage link with preceding local interwiki link (T70085)
9059 !! options
9060 parsoid=wt2html,wt2wt,html2html
9061 !! wikitext
9062 Blah blah blah
9063 [[local:es:Spanish]]
9064 !! html/php
9065 <p>Blah blah blah
9066 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9067 </p>
9068 !! html/parsoid
9069 <p>Blah blah blah
9070 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9071 !! end
9072
9073 !! test
9074 Looks like an interlanguage link, but is actually a local interwiki
9075 !! options
9076 parsoid=wt2html,wt2wt,html2html
9077 !! wikitext
9078 Blah blah blah
9079 [[mi:Template:Foo]]
9080 !! html/php
9081 <p>Blah blah blah
9082 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9083 </p>
9084 !! html/parsoid
9085 <p>Blah blah blah
9086 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9087 !! end
9088
9089 ###
9090 ### Redirects, Parsoid-only
9091 ###
9092
9093 !! test
9094 1. Simple redirect to page
9095 !! wikitext
9096 #REDIRECT [[Main Page]]
9097 !! html/parsoid
9098 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9099 !! end
9100
9101 !! test
9102 2. Other redirect variants
9103 !! wikitext
9104 #REDIRECT [[Main_Page]]
9105 !! html/parsoid
9106 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9107 !! end
9108
9109 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9110 # This tests the Parsoid bail-out code.
9111 !! test
9112 3. Other redirect variants
9113 !! options
9114 parsoid=wt2html
9115 !! wikitext
9116 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9117 !! html/parsoid
9118 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9119 !! end
9120
9121 !! test
9122 4. Redirect to a templated destination
9123 !! wikitext
9124 #REDIRECT [[{{echo|Foo}}bar]]
9125 !! html/parsoid
9126 <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"}]]}'/>
9127 !! end
9128
9129 !! test
9130 Empty redirect
9131 !! options
9132 parsoid=wt2html,wt2wt
9133 !! wikitext
9134 #REDIRECT [[]]
9135 !! html/parsoid
9136 <ol>
9137 <li>REDIRECT [[]]</li></ol>
9138 !! end
9139
9140 !! test
9141 Optional colon in #REDIRECT
9142 !! options
9143 # the colon is archaic syntax. we support it for wt2html, but we
9144 # don't care that it roundtrips back to the modern syntax.
9145 parsoid=wt2html,html2html
9146 !! wikitext
9147 #REDIRECT:[[Main Page]]
9148 !! html/parsoid
9149 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9150 !! end
9151
9152 !! test
9153 Whitespace in #REDIRECT with optional colon
9154 !! options
9155 # the colon and gratuitous whitespace is archaic syntax. we support
9156 # it for wt2html, but we don't care that it roundtrips back to the
9157 # modern syntax (without extra whitespace)
9158 parsoid=wt2html,html2html
9159 !! wikitext
9160
9161 #REDIRECT
9162 :
9163 [[Main Page]]
9164 !! html/parsoid
9165 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9166 !! end
9167
9168 !! test
9169 Piped link in #REDIRECT
9170 !! options
9171 # content after piped link is ignored. we support this syntax,
9172 # but don't care that the piped link is lost when we roundtrip this.
9173 parsoid=wt2html
9174 !! wikitext
9175 #REDIRECT [[Main Page|bar]]
9176 !! html/parsoid
9177 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9178 !! end
9179
9180 !! test
9181 Redirect to category (T104502)
9182 !! options
9183 parsoid=wt2html,wt2wt
9184 !! wikitext
9185 #REDIRECT [[Category:Foo]]
9186 !! html/parsoid
9187 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9188 !! end
9189
9190 !! test
9191 Redirect to category with URL encoding (T104502)
9192 !! options
9193 parsoid=wt2html
9194 !! wikitext
9195 #REDIRECT [[Category%3AFoo]]
9196 !! html/parsoid
9197 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9198 !! end
9199
9200 !! test
9201 Redirect to category page
9202 !! wikitext
9203 #REDIRECT [[:Category:Foo]]
9204 !! html/parsoid
9205 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9206 !! end
9207
9208 !! test
9209 Redirect to image page (1)
9210 !! wikitext
9211 #REDIRECT [[File:Wiki.png]]
9212 !! html/parsoid
9213 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9214 !! end
9215
9216 !! test
9217 Redirect to image page (2)
9218 !! wikitext
9219 #REDIRECT [[Image:Wiki.png]]
9220 !! html/parsoid
9221 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9222 !! end
9223
9224 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9225 # Next test confirms this.
9226 !! test
9227 Redirect to language (1) (T104918)
9228 !! options
9229 parsoid=wt2html,wt2wt,html2html
9230 !! wikitext
9231 #REDIRECT [[en:File:Wiki.png]]
9232 !! html/parsoid
9233 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9234 !! end
9235
9236 !! test
9237 Redirect to language (2) (T104918)
9238 !! wikitext
9239 #REDIRECT [[:en:File:Wiki.png]]
9240 !! html/parsoid
9241 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9242 !! end
9243
9244 !! test
9245 Redirect to interwiki (T104918)
9246 !! wikitext
9247 #REDIRECT [[meatball:File:Wiki.png]]
9248 !! html/parsoid
9249 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9250 !! end
9251
9252 !! test
9253 Non-English #REDIRECT
9254 !! options
9255 language=is
9256 !! wikitext
9257 #TILVÍSUN [[Main Page]]
9258 !! html/parsoid
9259 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9260 !! end
9261
9262 !! test
9263 Redirect syntax under text isn't considered a redirect
9264 !! wikitext
9265 some text
9266
9267 #redirect [[Main Page]]
9268 !! html/parsoid
9269 <p>some text</p>
9270 <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>
9271 !! end
9272
9273 !! test
9274 New redirect
9275 !! options
9276 parsoid=html2wt
9277 !! html/parsoid
9278 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9279 !! wikitext
9280 #REDIRECT [[Foo]]
9281 Foo
9282 !! end
9283
9284 !! test
9285 Redirect followed by block on the same line
9286 !! options
9287 parsoid=wt2html
9288 !! wikitext
9289 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9290 !! html/parsoid
9291 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9292 !! end
9293
9294 !! test
9295 Redirect followed by a newline
9296 !! wikitext
9297 #REDIRECT [[Main Page]]
9298 A newline
9299 !! html/parsoid
9300 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9301 <p>A newline</p>
9302 !! end
9303
9304 !! test
9305 Redirect followed by multiple newlines
9306 !! wikitext
9307 #REDIRECT [[Main Page]]
9308
9309
9310 A newline
9311 !! html/parsoid
9312 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9313
9314 <p><br/>
9315 A newline</p>
9316 !! end
9317
9318 !! test
9319 Drop duplicate redirects
9320 !! options
9321 parsoid=html2wt
9322 !! html/parsoid
9323 <link rel="mw:PageProp/redirect" href="./Foo"/>
9324 <link rel="mw:PageProp/redirect" href="./Bar"/>
9325 <link rel="mw:PageProp/redirect" href="./Baz"/>
9326 !! wikitext
9327 #REDIRECT [[Foo]]
9328 !! end
9329
9330 ##
9331 ## XHTML tidiness
9332 ###
9333
9334 !! test
9335 <br> to <br />
9336 !! wikitext
9337 1<br>2<br />3
9338 !! html
9339 <p>1<br />2<br />3
9340 </p>
9341 !! end
9342
9343 !! test
9344 Broken br tag sanitization
9345 !! wikitext
9346 </br>
9347 !! html/php
9348 <p>&lt;/br&gt;
9349 </p>
9350 !! end
9351
9352 # TODO: Fix html2html mode (T53055)!
9353 !! test
9354 Parsoid: Broken br tag recognition
9355 !! options
9356 parsoid=wt2html
9357 !! wikitext
9358 </br>
9359
9360 <br/ >
9361 !! html+tidy
9362 <p><br />
9363 </p><p><br />
9364 </p>
9365 !! end
9366
9367 !! test
9368 Incorrecly removing closing slashes from correctly formed XHTML
9369 !! wikitext
9370 <br style="clear:both;" />
9371 !! html
9372 <p><br style="clear:both;" />
9373 </p>
9374 !! end
9375
9376 !! test
9377 Failing to transform badly formed HTML into correct XHTML
9378 !! wikitext
9379 <br style="clear: left;">
9380 <br style="clear: right;">
9381 <br style="clear: both;">
9382 !! html
9383 <p><br style="clear: left;" />
9384 <br style="clear: right;" />
9385 <br style="clear: both;" />
9386 </p>
9387 !!end
9388
9389 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9390 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9391 !! test
9392 Handling html with a div self-closing tag
9393 !! wikitext
9394 <div title />
9395 <div title/>
9396 <div title/ >
9397 <div title=bar />
9398 <div title=bar/>
9399 <div title=bar/ >
9400 !! html/php
9401 <p>&lt;div title /&gt;
9402 &lt;div title/&gt;
9403 </p>
9404 <div>
9405 <p>&lt;div title=bar /&gt;
9406 &lt;div title=bar/&gt;
9407 </p>
9408 <div title="bar/"></div>
9409 </div>
9410
9411 !! html/parsoid
9412 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9413 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9414 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9415 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9416 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9417 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9418 !! end
9419
9420 !! test
9421 Handling html with a br self-closing tag
9422 !! wikitext
9423 <br title />
9424 <br title/>
9425 <br title/ >
9426 <br title=bar />
9427 <br title=bar/>
9428 <br title=bar/ >
9429 !! html/php
9430 <p><br title="" />
9431 <br title="" />
9432 <br />
9433 <br title="bar" />
9434 <br title="bar" />
9435 <br title="bar/" />
9436 </p>
9437 !! html/parsoid
9438 <p><br title="" />
9439 <br title="" />
9440 <br title="" />
9441 <br title="bar" />
9442 <br title="bar" />
9443 <br title="bar/" />
9444 </p>
9445 !! end
9446
9447 !! test
9448 Horizontal ruler (should it add that extra space?)
9449 !! wikitext
9450 <hr>
9451 <hr >
9452 foo <hr
9453 > bar
9454 !! html+tidy
9455 <hr />
9456 <hr /><p>
9457 foo </p><hr /><p> bar
9458 </p>
9459 !! end
9460
9461 !! test
9462 Horizontal ruler -- 4+ dashes render hr
9463 !! wikitext
9464 ----
9465 !! html
9466 <hr />
9467
9468 !! end
9469
9470 !! test
9471 Horizontal ruler -- eats additional dashes on the same line
9472 !! wikitext
9473 ---------
9474 !! html
9475 <hr />
9476
9477 !! end
9478
9479 !! test
9480 Horizontal ruler -- does not collapse dashes on consecutive lines
9481 !! wikitext
9482 ----
9483 ----
9484 !! html
9485 <hr />
9486 <hr />
9487
9488 !! end
9489
9490 !! test
9491 Horizontal ruler -- <4 dashes render as plain text
9492 !! wikitext
9493 ---
9494 !! html
9495 <p>---
9496 </p>
9497 !! end
9498
9499 !! test
9500 Horizontal ruler -- Supports content following dashes on same line
9501 !! wikitext
9502 ---- Foo
9503 !! html
9504 <hr /> Foo
9505
9506 !! html+tidy
9507 <hr /><p> Foo
9508 </p>
9509 !! end
9510
9511 ###
9512 ### Block-level elements
9513 ###
9514 !! test
9515 Common list
9516 !! wikitext
9517 *Common list
9518 *item 2
9519 *item 3
9520 !! html
9521 <ul><li>Common list</li>
9522 <li>item 2</li>
9523 <li>item 3</li></ul>
9524
9525 !! end
9526
9527 !! test
9528 Numbered list
9529 !! wikitext
9530 #Numbered list
9531 #item 2
9532 #item 3
9533 !! html
9534 <ol><li>Numbered list</li>
9535 <li>item 2</li>
9536 <li>item 3</li></ol>
9537
9538 !! end
9539
9540 # the switch from level 3 to ordered should not introduce a newline between
9541 !! test
9542 Mixed list
9543 !! wikitext
9544 *Mixed list
9545 *#with numbers
9546 **and bullets
9547 *#and numbers
9548 *bullets again
9549 **bullet level 2
9550 ***bullet level 3
9551 ***#Number on level 4
9552 **bullet level 2
9553 **#Number on level 3
9554 **#Number on level 3
9555 *#number level 2
9556 *Level 1
9557 ***Level 3
9558 #**Level 3, but ordered
9559 !! html
9560 <ul><li>Mixed list
9561 <ol><li>with numbers</li></ol>
9562 <ul><li>and bullets</li></ul>
9563 <ol><li>and numbers</li></ol></li>
9564 <li>bullets again
9565 <ul><li>bullet level 2
9566 <ul><li>bullet level 3
9567 <ol><li>Number on level 4</li></ol></li></ul></li>
9568 <li>bullet level 2
9569 <ol><li>Number on level 3</li>
9570 <li>Number on level 3</li></ol></li></ul>
9571 <ol><li>number level 2</li></ol></li>
9572 <li>Level 1
9573 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9574 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9575
9576 !! end
9577
9578 !! test
9579 1. Nested mixed wikitext and html list
9580 !! wikitext
9581 *hi
9582 *<ul><li>ho</li></ul>
9583 *hi
9584 **ho
9585 !! html/php
9586 <ul><li>hi</li>
9587 <li><ul><li>ho</li></ul></li>
9588 <li>hi
9589 <ul><li>ho</li></ul></li></ul>
9590
9591 !! html/parsoid
9592 <ul><li>hi</li>
9593 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9594 <li>hi
9595 <ul><li>ho</li></ul></li></ul>
9596 !! end
9597
9598 !! test
9599 2. Nested mixed wikitext and html list (incompatible)
9600 !! wikitext
9601 ;hi
9602 :{{echo|<li>ho</li>}}
9603 !! html/php
9604 <dl><dt>hi</dt>
9605 <dd><li>ho</li></dd></dl>
9606
9607 !! html/parsoid
9608 <dl><dt>hi</dt>
9609 <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>
9610 !! end
9611
9612 !! test
9613 Nested lists 1
9614 !! wikitext
9615 *foo
9616 **bar
9617 !! html
9618 <ul><li>foo
9619 <ul><li>bar</li></ul></li></ul>
9620
9621 !! end
9622
9623 !! test
9624 Nested lists 2
9625 !! wikitext
9626 **foo
9627 *bar
9628 !! html
9629 <ul><li><ul><li>foo</li></ul></li>
9630 <li>bar</li></ul>
9631
9632 !! end
9633
9634 !! test
9635 Nested lists 3 (first element empty)
9636 !! wikitext
9637 *
9638 **bar
9639 !! html
9640 <ul><li>
9641 <ul><li>bar</li></ul></li></ul>
9642
9643 !! end
9644
9645 !! test
9646 Nested lists 4 (first element empty)
9647 !! wikitext
9648 **
9649 *bar
9650 !! html
9651 <ul><li><ul><li></li></ul></li>
9652 <li>bar</li></ul>
9653
9654 !! end
9655
9656 !! test
9657 Nested lists 5 (both elements empty)
9658 !! wikitext
9659 **
9660 *
9661 !! html
9662 <ul><li><ul><li></li></ul></li>
9663 <li></li></ul>
9664
9665 !! end
9666
9667 !! test
9668 Nested lists 6 (both elements empty)
9669 !! wikitext
9670 *
9671 **
9672 !! html
9673 <ul><li>
9674 <ul><li></li></ul></li></ul>
9675
9676 !! end
9677
9678 !! test
9679 Nested lists 7 (skip initial nesting levels)
9680 !! wikitext
9681 ***foo
9682 !! html
9683 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9684
9685 !! end
9686
9687 !! test
9688 Nested lists 8 (multiple nesting transitions)
9689 !! wikitext
9690 *foo
9691 ***bar
9692 **baz
9693 *boo
9694 !! html
9695 <ul><li>foo
9696 <ul><li><ul><li>bar</li></ul></li>
9697 <li>baz</li></ul></li>
9698 <li>boo</li></ul>
9699
9700 !! end
9701
9702 !! test
9703 Nested lists 9 (extension interaction)
9704 !! options
9705 parsoid
9706 !! wikitext
9707 *<references />
9708 !! html/parsoid
9709 <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>
9710 !! end
9711
9712 !! test
9713 1. Lists with start-of-line-transparent tokens before bullets: Comments
9714 !! wikitext
9715 *foo
9716 *<!--cmt-->bar
9717 <!--cmt-->*baz
9718 !! html
9719 <ul><li>foo</li>
9720 <li>bar</li>
9721 <li>baz</li></ul>
9722
9723 !! end
9724
9725 !! test
9726 2. Lists with start-of-line-transparent tokens before bullets: Template close
9727 !! wikitext
9728 *foo {{echo|bar
9729 }}*baz
9730 !! html
9731 <ul><li>foo bar</li>
9732 <li>baz</li></ul>
9733
9734 !! end
9735
9736 !! test
9737 List items are not parsed correctly following a <pre> block (T2785)
9738 !! wikitext
9739 *<pre>foo</pre>
9740 *<pre>bar</pre>
9741 *zar
9742 !! html/php
9743 <ul><li><pre>foo</pre></li>
9744 <li><pre>bar</pre></li>
9745 <li>zar</li></ul>
9746
9747 !! html/parsoid
9748 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9749 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9750 <li>zar</li></ul>
9751 !! end
9752
9753 # FIXME: Might benefit from a html/parsoid since this has a template
9754 !! test
9755 List items from template
9756 !! wikitext
9757
9758 {{inner list}}
9759 *item 2
9760
9761 *item 0
9762 {{inner list}}
9763 *item 2
9764
9765 *item 0
9766 *notSOL{{inner list}}
9767 *item 2
9768 !! html
9769 <ul><li>item 1</li>
9770 <li>item 2</li></ul>
9771 <ul><li>item 0</li>
9772 <li>item 1</li>
9773 <li>item 2</li></ul>
9774 <ul><li>item 0</li>
9775 <li>notSOL</li>
9776 <li>item 1</li>
9777 <li>item 2</li></ul>
9778
9779 !! end
9780
9781 !! test
9782 List interrupted by empty line or heading
9783 !! wikitext
9784 *foo
9785
9786 **bar
9787 ==A heading==
9788 *Another list item
9789 !! html
9790 <ul><li>foo</li></ul>
9791 <ul><li><ul><li>bar</li></ul></li></ul>
9792 <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>
9793 <ul><li>Another list item</li></ul>
9794
9795 !!end
9796
9797 !!test
9798 Multiple list tags generated by templates
9799 !! wikitext
9800 {{echo|<li>}}a
9801 {{echo|<li>}}b
9802 {{echo|<li>}}c
9803 !! html
9804 <li>a
9805 <li>b
9806 <li>c</li>
9807 </li>
9808 </li>
9809
9810 !! html+tidy
9811 <li>a
9812 </li><li>b
9813 </li><li>c
9814 </li>
9815 !! html/parsoid
9816 <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
9817 </li><li about="#mwt1">b
9818 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9819 !!end
9820
9821 !!test
9822 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9823 !! wikitext
9824 *a
9825 <!--This line will NOT split the list-->
9826 *b
9827 <!--This line will NOT split the list either-->
9828 *c
9829 <!--foo--> <!----> <!--This line NOT split the list either-->
9830 *d
9831 !! html
9832 <ul><li>a</li>
9833 <li>b</li>
9834 <li>c</li>
9835 <li>d</li></ul>
9836
9837 !!end
9838
9839 !!test
9840 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9841 !! wikitext
9842 *a
9843 <!--This line will NOT split the list-->
9844 *b
9845 <!--This line will NOT split the list either-->
9846 *c
9847 <!--foo--> <!----> <!--This line NOT split the list
9848 either-->
9849 *d
9850 !! html
9851 <ul><li>a</li>
9852 <li>b</li>
9853 <li>c</li>
9854 <li>d</li></ul>
9855
9856 !!end
9857
9858 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9859 # That pass could possibly be removed.
9860 !!test
9861 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9862 !!options
9863 parsoid=wt2html,wt2wt
9864 !! wikitext
9865 *foo
9866 *<li>li-hack
9867 *{{echo|<li>templated li-hack}}
9868 *<!--foo--><li> unsupported li-hack with preceding comments
9869
9870 <ul>
9871 <li><li>not a li-hack
9872 </li>
9873 </ul>
9874 !! html+tidy
9875 <ul><li>foo</li>
9876 <li class="mw-empty-elt"></li><li>li-hack</li>
9877 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9878 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9879 <ul>
9880 <li class="mw-empty-elt"></li><li>not a li-hack
9881 </li>
9882 </ul>
9883 !! html/parsoid
9884 <ul><li> foo</li>
9885 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9886 <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>
9887 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9888
9889 <ul data-parsoid='{"stx":"html"}'>
9890 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9891 </li>
9892 </ul>
9893
9894 !!end
9895
9896 !! test
9897 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9898 !! options
9899 parsoid
9900 !! wikitext
9901 #foo
9902 ##bar
9903
9904 *foo
9905 **bar
9906
9907 :foo
9908 ::bar
9909 !! html
9910 <ol>
9911 <li>foo<ol>
9912 <li>bar</li>
9913 </ol></li>
9914 </ol><ul>
9915 <li>foo<ul>
9916 <li>bar</li>
9917 </ul></li>
9918 </ul><dl>
9919 <dd>foo<dl>
9920 <dd>bar</dd>
9921 </dl></dd>
9922 </dl>
9923 !! end
9924
9925 !! test
9926 Parsoid: Test of whitespace serialization with Templated bullets
9927 !! options
9928 parsoid
9929 !! wikitext
9930 * {{bullet}}
9931 !! html/parsoid
9932 <ul>
9933 <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>
9934 </ul>
9935 !! end
9936
9937 # ------------------------------------------------------------------------
9938 # The next set of tests are about Parsoid's ability to handle badly nested
9939 # tags (parse, minimize scope of fixup, and roundtrip back)
9940 # ------------------------------------------------------------------------
9941
9942 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9943 # Parsoid's list handling is more aware of block structure.
9944 !! test
9945 Unbalanced closing block tags break a list
9946 !! wikitext
9947 <div>
9948 *a</div><div>
9949 *b</div>
9950 !! html+tidy
9951 <div>
9952 <ul><li>a</li></ul></div><div>
9953 <li>b</li></div>
9954 !! html/parsoid
9955 <div><ul>
9956 <li>a</li>
9957 </ul></div>
9958 <div><ul>
9959 <li>b</li>
9960 </ul></div>
9961 !! end
9962
9963 !! test
9964 Unbalanced closing non-block tags don't break a list
9965 !! wikitext
9966 <span>
9967 *a</span><span>
9968 *b</span>
9969 !! html/php+tidy
9970 <p><span>
9971 </span></p>
9972 <ul><li>a<span></span></li>
9973 <li>b</li></ul>
9974 !! html/parsoid
9975 <span>
9976 <ul>
9977 <li>a<span></span></li>
9978 <li>b</li>
9979 </ul>
9980 </span>
9981 !! end
9982
9983 # Parsoid does some post-dom-building cleanup
9984 # which is why its output differs from Remex.
9985 !! test
9986 Unclosed formatting tags that straddle lists are closed and reopened
9987 !! options
9988 parsoid=wt2html,wt2wt,html2html
9989 !! wikitext
9990 #<s> a
9991 #b </s>
9992 !! html/php+tidy
9993 <ol><li><s> a</s></li><s>
9994 </s><li><s>b </s></li></ol>
9995 !! html/parsoid
9996 <ol><li><s> a</s></li>
9997 <li><s>b </s></li></ol>
9998 !! end
9999
10000 # Output is ugly because of all the misnested tag fixups.
10001 # Remex is wrapping p-tags around empty elements.
10002 # Parsoid has special-case handling of this pattern of
10003 # wrapping lists in formatting tags.
10004 # FIXME: Should we remove this code from Parsoid? Or add
10005 # special support in Remex? If the latter, maybe just wait
10006 # for Parsoid to become the default parser.
10007 # See T70395.
10008 !!test
10009 1. List embedded in a formatting tag
10010 !! wikitext
10011 <small>
10012 *foo
10013 </small>
10014 !! html/php+tidy
10015 <p><small>
10016 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10017 </p>
10018 !! html/parsoid
10019 <small>
10020 <ul>
10021 <li>foo</li>
10022 </ul>
10023 </small>
10024 !!end
10025
10026 # Output is ugly because of all the misnested tag fixups
10027 # Remex is wrapping p-tags around empty elements.
10028 # Parsoid has code that strips useless p-tags.
10029 !!test
10030 2. List embedded in a formatting tag in a misnested way
10031 !! wikitext
10032 <small>
10033 *a
10034 *b</small>
10035 !! html/php+tidy
10036 <p><small>
10037 </small></p><small></small><ul><small><li>a</li>
10038 </small><li><small>b</small></li></ul>
10039 !! html/parsoid
10040 <small></small>
10041 <ul><small>
10042 <li>a</li>
10043 </small>
10044 <li><small>b</small></li>
10045 </ul>
10046 !!end
10047
10048 !! test
10049 Table with missing opening <tr> tag
10050 !! options
10051 parsoid=wt2html,wt2wt
10052 !! wikitext
10053 <table>
10054 <td>foo</td>
10055 </tr>
10056 </table>
10057 !! html+tidy
10058 <table>
10059 <tbody><tr><td>foo</td>
10060 </tr>
10061 </tbody></table>
10062 !! end
10063
10064 ###
10065 ### Magic Words
10066 ###
10067
10068 # Note that the current date is hard-coded as
10069 # 1970-01-01T00:02:03Z (a Thursday)
10070 # when running parser tests. The timezone is also fixed to GMT, so
10071 # local date will be identical to current date.
10072
10073 !! test
10074 Magic Word: {{CURRENTDAY}}
10075 !! wikitext
10076 {{CURRENTDAY}}
10077 !! html
10078 <p>1
10079 </p>
10080 !! end
10081
10082 !! test
10083 Magic Word: {{CURRENTDAY2}}
10084 !! wikitext
10085 {{CURRENTDAY2}}
10086 !! html
10087 <p>01
10088 </p>
10089 !! end
10090
10091 !! test
10092 Magic Word: {{CURRENTDAYNAME}}
10093 !! wikitext
10094 {{CURRENTDAYNAME}}
10095 !! html
10096 <p>Thursday
10097 </p>
10098 !! end
10099
10100 !! test
10101 Magic Word: {{CURRENTDOW}}
10102 !! wikitext
10103 {{CURRENTDOW}}
10104 !! html
10105 <p>4
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{CURRENTMONTH}}
10111 !! wikitext
10112 {{CURRENTMONTH}}
10113 !! html
10114 <p>01
10115 </p>
10116 !! end
10117
10118 !! test
10119 Magic Word: {{CURRENTMONTH1}}
10120 !! wikitext
10121 {{CURRENTMONTH1}}
10122 !! html
10123 <p>1
10124 </p>
10125 !! end
10126
10127 !! test
10128 Magic Word: {{CURRENTMONTHABBREV}}
10129 !! wikitext
10130 {{CURRENTMONTHABBREV}}
10131 !! html
10132 <p>Jan
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{CURRENTMONTHNAME}}
10138 !! wikitext
10139 {{CURRENTMONTHNAME}}
10140 !! html
10141 <p>January
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{CURRENTMONTHNAMEGEN}}
10147 !! wikitext
10148 {{CURRENTMONTHNAMEGEN}}
10149 !! html
10150 <p>January
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{CURRENTTIME}}
10156 !! wikitext
10157 {{CURRENTTIME}}
10158 !! html
10159 <p>00:02
10160 </p>
10161 !! end
10162
10163 !! test
10164 Magic Word: {{CURRENTHOUR}}
10165 !! wikitext
10166 {{CURRENTHOUR}}
10167 !! html
10168 <p>00
10169 </p>
10170 !! end
10171
10172 !! test
10173 Magic Word: {{CURRENTWEEK}} (T6594)
10174 !! wikitext
10175 {{CURRENTWEEK}}
10176 !! html
10177 <p>1
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{CURRENTYEAR}}
10183 !! wikitext
10184 {{CURRENTYEAR}}
10185 !! html
10186 <p>1970
10187 </p>
10188 !! end
10189
10190 !! test
10191 Magic Word: {{CURRENTTIMESTAMP}}
10192 !! wikitext
10193 {{CURRENTTIMESTAMP}}
10194 !! html
10195 <p>19700101000203
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Words LOCAL (UTC)
10201 !! wikitext
10202 *{{LOCALMONTH}}
10203 *{{LOCALMONTH1}}
10204 *{{LOCALMONTHNAME}}
10205 *{{LOCALMONTHNAMEGEN}}
10206 *{{LOCALMONTHABBREV}}
10207 *{{LOCALDAY}}
10208 *{{LOCALDAY2}}
10209 *{{LOCALDAYNAME}}
10210 *{{LOCALYEAR}}
10211 *{{LOCALTIME}}
10212 *{{LOCALHOUR}}
10213 *{{LOCALWEEK}}
10214 *{{LOCALDOW}}
10215 *{{LOCALTIMESTAMP}}
10216 !! html
10217 <ul><li>01</li>
10218 <li>1</li>
10219 <li>January</li>
10220 <li>January</li>
10221 <li>Jan</li>
10222 <li>1</li>
10223 <li>01</li>
10224 <li>Thursday</li>
10225 <li>1970</li>
10226 <li>00:02</li>
10227 <li>00</li>
10228 <li>1</li>
10229 <li>4</li>
10230 <li>19700101000203</li></ul>
10231
10232 !! end
10233
10234 !! test
10235 Magic Word: {{FULLPAGENAME}}
10236 !! options
10237 title=[[User:Ævar Arnfjörð Bjarmason]]
10238 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10239 !! wikitext
10240 {{FULLPAGENAME}}
10241 !! html/*
10242 <p>User:Ævar Arnfjörð Bjarmason
10243 </p>
10244 !! end
10245
10246 !! test
10247 Magic Word: {{FULLPAGENAMEE}}
10248 !! options
10249 title=[[User:Ævar Arnfjörð Bjarmason]]
10250 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10251 !! wikitext
10252 {{FULLPAGENAMEE}}
10253 !! html/*
10254 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10255 </p>
10256 !! end
10257
10258 !! test
10259 Magic Word: {{TALKSPACE}}
10260 !! options
10261 title=[[User:Ævar Arnfjörð Bjarmason]]
10262 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10263 !! wikitext
10264 {{TALKSPACE}}
10265 !! html/*
10266 <p>User talk
10267 </p>
10268 !! end
10269
10270 !! test
10271 Magic Word: {{TALKSPACE}}, same namespace
10272 !! options
10273 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10274 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10275 !! wikitext
10276 {{TALKSPACE}}
10277 !! html/*
10278 <p>User talk
10279 </p>
10280 !! end
10281
10282 !! test
10283 Magic Word: {{TALKSPACE}}, main namespace
10284 !! options
10285 title=[[Parser Test]]
10286 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10287 !! wikitext
10288 {{TALKSPACE}}
10289 !! html/*
10290 <p>Talk
10291 </p>
10292 !! end
10293
10294 !! test
10295 Magic Word: {{TALKSPACEE}}
10296 !! options
10297 title=[[User:Ævar Arnfjörð Bjarmason]]
10298 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10299 !! wikitext
10300 {{TALKSPACEE}}
10301 !! html/*
10302 <p>User_talk
10303 </p>
10304 !! end
10305
10306 !! test
10307 Magic Word: {{SUBJECTSPACE}}
10308 !! options
10309 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10310 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10311 !! wikitext
10312 {{SUBJECTSPACE}}
10313 !! html/*
10314 <p>User
10315 </p>
10316 !! end
10317
10318 !! test
10319 Magic Word: {{SUBJECTSPACE}}, same namespace
10320 !! options
10321 title=[[User:Ævar Arnfjörð Bjarmason]]
10322 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10323 !! wikitext
10324 {{SUBJECTSPACE}}
10325 !! html/*
10326 <p>User
10327 </p>
10328 !! end
10329
10330 !! test
10331 Magic Word: {{SUBJECTSPACE}}, main namespace
10332 !! options
10333 title=[[Parser Test]]
10334 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10335 !! wikitext
10336 {{SUBJECTSPACE}}
10337 !! html/*
10338
10339 !! end
10340
10341 !! test
10342 Magic Word: {{SUBJECTSPACEE}}
10343 !! options
10344 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10345 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10346 !! wikitext
10347 {{SUBJECTSPACEE}}
10348 !! html/*
10349 <p>User
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: {{NAMESPACE}}
10355 !! options
10356 title=[[User:Ævar Arnfjörð Bjarmason]]
10357 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10358 !! wikitext
10359 {{NAMESPACE}}
10360 !! html/*
10361 <p>User
10362 </p>
10363 !! end
10364
10365 !! test
10366 Magic Word: {{NAMESPACEE}}
10367 !! options
10368 title=[[User:Ævar Arnfjörð Bjarmason]]
10369 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10370 !! wikitext
10371 {{NAMESPACEE}}
10372 !! html/*
10373 <p>User
10374 </p>
10375 !! end
10376
10377 !! test
10378 Magic Word: {{NAMESPACENUMBER}}
10379 !! options
10380 title=[[User:Ævar Arnfjörð Bjarmason]]
10381 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10382 !! wikitext
10383 {{NAMESPACENUMBER}}
10384 !! html/*
10385 <p>2
10386 </p>
10387 !! end
10388
10389 !! test
10390 Magic Word: {{SUBPAGENAME}}
10391 !! options
10392 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10393 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10394 !! wikitext
10395 {{SUBPAGENAME}}
10396 !! html/*
10397 <p>sub ö
10398 </p>
10399 !! end
10400
10401 !! test
10402 Magic Word: {{SUBPAGENAMEE}}
10403 !! options
10404 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10405 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10406 !! wikitext
10407 {{SUBPAGENAMEE}}
10408 !! html/*
10409 <p>sub_%C3%B6
10410 </p>
10411 !! end
10412
10413 !! test
10414 Magic Word: {{ROOTPAGENAME}}
10415 !! options
10416 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10417 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10418 !! wikitext
10419 {{ROOTPAGENAME}}
10420 !! html/*
10421 <p>Ævar Arnfjörð Bjarmason
10422 </p>
10423 !! end
10424
10425 !! test
10426 Magic Word: {{ROOTPAGENAMEE}}
10427 !! options
10428 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10429 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10430 !! wikitext
10431 {{ROOTPAGENAMEE}}
10432 !! html/*
10433 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10434 </p>
10435 !! end
10436
10437 !! test
10438 Magic Word: {{BASEPAGENAME}}
10439 !! options
10440 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10441 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10442 !! wikitext
10443 {{BASEPAGENAME}}
10444 !! html/*
10445 <p>Ævar Arnfjörð Bjarmason
10446 </p>
10447 !! end
10448
10449 !! test
10450 Magic Word: {{BASEPAGENAMEE}}
10451 !! options
10452 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10453 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10454 !! wikitext
10455 {{BASEPAGENAMEE}}
10456 !! html/*
10457 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10458 </p>
10459 !! end
10460
10461 !! test
10462 Magic Word: {{TALKPAGENAME}}
10463 !! options
10464 title=[[User:Ævar Arnfjörð Bjarmason]]
10465 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10466 !! wikitext
10467 {{TALKPAGENAME}}
10468 !! html/*
10469 <p>User talk:Ævar Arnfjörð Bjarmason
10470 </p>
10471 !! end
10472
10473 !! test
10474 Magic Word: {{TALKPAGENAMEE}}
10475 !! options
10476 title=[[User:Ævar Arnfjörð Bjarmason]]
10477 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10478 !! wikitext
10479 {{TALKPAGENAMEE}}
10480 !! html/*
10481 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10482 </p>
10483 !! end
10484
10485 !! test
10486 Magic Word: {{SUBJECTPAGENAME}}
10487 !! options
10488 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10489 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10490 !! wikitext
10491 {{SUBJECTPAGENAME}}
10492 !! html/*
10493 <p>User:Ævar Arnfjörð Bjarmason
10494 </p>
10495 !! end
10496
10497 !! test
10498 Magic Word: {{SUBJECTPAGENAMEE}}
10499 !! options
10500 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10501 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10502 !! wikitext
10503 {{SUBJECTPAGENAMEE}}
10504 !! html/*
10505 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10506 </p>
10507 !! end
10508
10509 !! test
10510 Magic Word: {{NUMBEROFFILES}}
10511 !! options
10512 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10513 !! wikitext
10514 {{NUMBEROFFILES}}
10515 !! html/*
10516 <p>7
10517 </p>
10518 !! end
10519
10520 !! test
10521 Magic Word: {{PAGENAME}}
10522 !! options
10523 title=[[User:Ævar Arnfjörð Bjarmason]]
10524 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10525 !! wikitext
10526 {{PAGENAME}}
10527 !! html/*
10528 <p>Ævar Arnfjörð Bjarmason
10529 </p>
10530 !! end
10531
10532 !! test
10533 Magic Word: {{PAGENAME}} with metacharacters
10534 !! options
10535 title=[['foo & bar = baz']]
10536 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10537 !! wikitext
10538 ''{{PAGENAME}}''
10539 !! html+tidy
10540 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10541 </p>
10542 !! end
10543
10544 !! test
10545 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10546 !! options
10547 title=[[*RFC 1234 http://example.com/]]
10548 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10549 !! wikitext
10550 {{PAGENAME}}
10551 !! html+tidy
10552 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10553 </p>
10554 !! end
10555
10556 !! test
10557 Magic Word: {{PAGENAMEE}}
10558 !! options
10559 title=[[User:Ævar Arnfjörð Bjarmason]]
10560 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10561 !! wikitext
10562 {{PAGENAMEE}}
10563 !! html/*
10564 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10565 </p>
10566 !! end
10567
10568 !! test
10569 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10570 !! options
10571 title=[[*RFC 1234 http://example.com/]]
10572 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10573 !! wikitext
10574 {{PAGENAMEE}}
10575 !! html+tidy
10576 <p>&#42;RFC_1234_http&#58;//example.com/
10577 </p>
10578 !! end
10579
10580 !! test
10581 Magic Word: {{REVISIONID}}
10582 !! options
10583 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10584 showflags
10585 !! wikitext
10586 {{REVISIONID}}
10587 !! html/*
10588 <p>1337
10589 </p>
10590 flags=vary-revision-id
10591 !! end
10592
10593 !! test
10594 Magic Word: {{SCRIPTPATH}}
10595 !! options
10596 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10597 !! wikitext
10598 {{SCRIPTPATH}}
10599 !! html/*
10600
10601 !! end
10602
10603 !! test
10604 Magic Word: {{STYLEPATH}}
10605 !! options
10606 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10607 !! wikitext
10608 {{STYLEPATH}}
10609 !! html/*
10610 <p>/skins
10611 </p>
10612 !! end
10613
10614 !! test
10615 Magic Word: {{SERVER}}
10616 !! options
10617 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10618 !! wikitext
10619 {{SERVER}}
10620 !! html/*
10621 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10622 </p>
10623 !! end
10624
10625 !! test
10626 Magic Word: {{SERVERNAME}}
10627 !! options
10628 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10629 !! wikitext
10630 {{SERVERNAME}}
10631 !! html/*
10632 <p>example.org
10633 </p>
10634 !! end
10635
10636 !! test
10637 Magic Word: {{SITENAME}}
10638 !! options
10639 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10640 !! wikitext
10641 {{SITENAME}}
10642 !! html/*
10643 <p>MediaWiki
10644 </p>
10645 !! end
10646
10647 !! test
10648 Magic Word: {{PAGELANGUAGE}}
10649 !! options
10650 language=fr
10651 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10652 !! wikitext
10653 {{PAGELANGUAGE}}
10654 !! html/*
10655 <p>fr
10656 </p>
10657 !! end
10658
10659 !! test
10660 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10661 !! options
10662 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10663 !! wikitext
10664 {{PAGELANGUAGE}}
10665 !! html/*
10666 <p>en
10667 </p>
10668 !! end
10669
10670 !! test
10671 Case-sensitive magic words, when cased differently, should just be template transclusions
10672 !! wikitext
10673 {{CurrentMonth}}
10674 {{currentday}}
10675 {{cURreNTweEK}}
10676 {{currentHour}}
10677 !! html
10678 <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>
10679 <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>
10680 <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>
10681 <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>
10682 </p>
10683 !! end
10684
10685 !! test
10686 Case-insensitive magic words should still work with weird casing.
10687 !! wikitext
10688 {{sErVeRNaMe}}
10689 {{LCFirst:AOEU}}
10690 {{ucFIRST:aoeu}}
10691 {{SERver}}
10692 !! html
10693 <p>example.org
10694 aOEU
10695 Aoeu
10696 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10697 </p>
10698 !! end
10699
10700 # From plwiki:PLOS_ONE
10701 !! test
10702 Parsoid: Page property magic word with magic word contents
10703 !! wikitext
10704 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10705 !! html/parsoid
10706 <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>"}]]}'/>
10707 !! end
10708
10709 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10710 # But, this is a limitation of our representation and is documented in
10711 # TemplateHandler.js in processSpecialMagicWord
10712 !! test
10713 Parsoid: Template-generated DISPLAYTITLE
10714 !! wikitext
10715 {{{{echo|DISPLAYTITLE}}:Foo}}
10716 !! options
10717 showtitle
10718 !! config
10719 wgAllowDisplayTitle=true
10720 wgRestrictDisplayTitle=false
10721 !! html/php
10722 Foo
10723
10724 !! html/parsoid
10725 <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"}]]}'/>
10726 !! end
10727
10728 !! test
10729 Namespace 1 {{ns:1}}
10730 !! wikitext
10731 {{ns:1}}
10732 !! html
10733 <p>Talk
10734 </p>
10735 !! end
10736
10737 !! test
10738 Namespace 1 {{ns:01}}
10739 !! wikitext
10740 {{ns:01}}
10741 !! html
10742 <p>Talk
10743 </p>
10744 !! end
10745
10746 !! test
10747 Namespace 0 {{ns:0}} (T6783)
10748 !! wikitext
10749 {{ns:0}}
10750 !! html
10751
10752 !! end
10753
10754 !! test
10755 Namespace 0 {{ns:00}} (T6783)
10756 !! wikitext
10757 {{ns:00}}
10758 !! html
10759
10760 !! end
10761
10762 !! test
10763 Namespace -1 {{ns:-1}}
10764 !! wikitext
10765 {{ns:-1}}
10766 !! html
10767 <p>Special
10768 </p>
10769 !! end
10770
10771 !! test
10772 Namespace User {{ns:User}}
10773 !! wikitext
10774 {{ns:User}}
10775 !! html
10776 <p>User
10777 </p>
10778 !! end
10779
10780 !! test
10781 Namespace User talk {{ns:User_talk}}
10782 !! wikitext
10783 {{ns:User_talk}}
10784 !! html
10785 <p>User talk
10786 </p>
10787 !! end
10788
10789 !! test
10790 Namespace User talk {{ns:uSeR tAlK}}
10791 !! wikitext
10792 {{ns:uSeR tAlK}}
10793 !! html
10794 <p>User talk
10795 </p>
10796 !! end
10797
10798 !! test
10799 Namespace File {{ns:File}}
10800 !! wikitext
10801 {{ns:File}}
10802 !! html
10803 <p>File
10804 </p>
10805 !! end
10806
10807 !! test
10808 Namespace File {{ns:Image}}
10809 !! wikitext
10810 {{ns:Image}}
10811 !! html
10812 <p>File
10813 </p>
10814 !! end
10815
10816 !! test
10817 Namespace (lang=de) Benutzer {{ns:User}}
10818 !! options
10819 language=de
10820 !! wikitext
10821 {{ns:User}}
10822 !! html
10823 <p>Benutzer
10824 </p>
10825 !! end
10826
10827 !! test
10828 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10829 !! options
10830 language=de
10831 !! wikitext
10832 {{ns:3}}
10833 !! html
10834 <p>Benutzer Diskussion
10835 </p>
10836 !! end
10837
10838 !! test
10839 Urlencode
10840 !! wikitext
10841 {{urlencode:hi world?!}}
10842 {{urlencode:hi world?!|WIKI}}
10843 {{urlencode:hi world?!|PATH}}
10844 {{urlencode:hi world?!|QUERY}}
10845 !! html/php
10846 <p>hi+world%3F%21
10847 hi_world%3F!
10848 hi%20world%3F%21
10849 hi+world%3F%21
10850 </p>
10851 !! end
10852
10853 !! test
10854 Magic Word: prioritize type info over data-parsoid
10855 !! options
10856 parsoid=html2wt
10857 !! html/parsoid
10858 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10859 !! wikitext
10860 __FORCETOC__
10861 !! end
10862
10863 !! test
10864 Magic Word: serialize on separate line (parsoid)
10865 !! options
10866 parsoid=wt2wt,html2wt
10867 !! wikitext
10868 foo
10869 __NOTOC__
10870 bar
10871 !! html/parsoid
10872 foo<meta property="mw:PageProp/notoc"/>bar
10873 !! end
10874
10875 !! test
10876 Magic Word: rt non-english wikis
10877 !! options
10878 parsoid=wt2wt
10879 language=de
10880 !! wikitext
10881 __NOEDITSECTION__
10882 !! html/parsoid
10883 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10884 !! end
10885
10886 !!test
10887 __proto__ is treated as normal wikitext (T105997)
10888 !!wikitext
10889 __proto__
10890 !!html
10891 <p>__proto__
10892 </p>
10893 !!end
10894
10895 ###
10896 ### Magic links
10897 ###
10898 !! test
10899 Magic links: internal link to RFC (T2479)
10900 !! wikitext
10901 [[RFC 123]]
10902 !! html/php
10903 <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>
10904 </p>
10905 !! html/parsoid
10906 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10907 !! end
10908
10909 !! test
10910 Magic links: RFC (T2479)
10911 !! wikitext
10912 RFC 822
10913 !! html/php
10914 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10915 </p>
10916 !! html/parsoid
10917 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10918 !! end
10919
10920 !! test
10921 Magic links: RFC (T67278)
10922 !! wikitext
10923 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10924 !! html/php
10925 <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.
10926 </p>
10927 !! html/parsoid
10928 <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>
10929 !! end
10930
10931 !! test
10932 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10933 !! wikitext
10934 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10935 RFC
10936 822
10937 !! html/php
10938 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10939 RFC
10940 822
10941 </p>
10942 !! html/parsoid
10943 <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>
10944 RFC
10945 822</p>
10946 !! end
10947
10948 !! test
10949 Magic links: ISBN (T3937)
10950 !! wikitext
10951 ISBN 0-306-40615-2
10952 !! html/php
10953 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10954 </p>
10955 !! html/parsoid
10956 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10957 !! end
10958
10959 !! test
10960 Magic links: ISBN (T67278)
10961 !! wikitext
10962 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10963 !! html/php
10964 <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.
10965 </p>
10966 !! html/parsoid
10967 <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>
10968 !! end
10969
10970 !! test
10971 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10972 !! wikitext
10973 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10974 ISBN
10975 9780316098113
10976 ISBN 978
10977 0316098113
10978 !! html/php
10979 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10980 ISBN
10981 9780316098113
10982 ISBN 978
10983 0316098113
10984 </p>
10985 !! html/parsoid
10986 <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>
10987 ISBN
10988 9780316098113
10989 ISBN 978
10990 0316098113</p>
10991 !! end
10992
10993 !! test
10994 Magic links: PMID incorrectly converts space to underscore
10995 !! wikitext
10996 PMID 1234
10997 !! html/php
10998 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10999 </p>
11000 !! html/parsoid
11001 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
11002 !! end
11003
11004 !! test
11005 Magic links: PMID (T67278)
11006 !! wikitext
11007 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11008 !! html/php
11009 <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.
11010 </p>
11011 !! html/parsoid
11012 <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>
11013 !! end
11014
11015 !! test
11016 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11017 !! wikitext
11018 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11019 PMID
11020 1234
11021 !! html/php
11022 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11023 PMID
11024 1234
11025 </p>
11026 !! html/parsoid
11027 <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>
11028 PMID
11029 1234</p>
11030 !! end
11031
11032 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11033 # since these are ExtLinkText, not MagicLinkText
11034 !! test
11035 Magic links: use appropriate serialization for "almost" magic links.
11036 !! wikitext
11037 X[[Special:BookSources/0978739256|foo]]
11038
11039 X[https://tools.ietf.org/html/rfc1234 foo]
11040 !! html/php
11041 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11042 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11043 </p>
11044 !! html/parsoid
11045 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11046 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11047 !! end
11048
11049 !! test
11050 Magic links: All disabled (T47942)
11051 !! options
11052 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11053 !! wikitext
11054 ISBN 0-306-40615-2
11055 PMID 1234
11056 RFC 4321
11057 !! html/php
11058 <p>ISBN 0-306-40615-2
11059 PMID 1234
11060 RFC 4321
11061 </p>
11062 !! end
11063
11064 ###
11065 ### Templates
11066 ####
11067
11068 !! test
11069 Nonexistent template
11070 !! wikitext
11071 {{thistemplatedoesnotexist}}
11072 !! html
11073 <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>
11074 </p>
11075 !! end
11076
11077 !! test
11078 Template with invalid target containing tags
11079 !! wikitext
11080 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11081 !! html
11082 <p>{{a<b>b</b>|foo|a=b|a = b}}
11083 </p>
11084 !! end
11085
11086 !! test
11087 Template with invalid target containing unclosed tag
11088 !! wikitext
11089 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11090 !! html
11091 <p>{{a<b>|foo|a=b|a = b}}</b>
11092 </p>
11093 !! end
11094
11095 !! test
11096 Template with invalid target containing wikilink
11097 !! wikitext
11098 {{[[Main Page]]}}
11099 !! html/php
11100 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11101 </p>
11102 !! html/parsoid
11103 <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>
11104 !! end
11105
11106 !! test
11107 Template with just whitespace in it, T70421
11108 !! wikitext
11109 {{echo|{{ }}}}
11110 !! html/parsoid
11111 <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>
11112 !! end
11113
11114 !! article
11115 Template:test
11116 !! text
11117 This is a test template
11118 !! endarticle
11119
11120 !! test
11121 Simple template
11122 !! wikitext
11123 {{test}}
11124 !! html
11125 <p>This is a test template
11126 </p>
11127 !! end
11128
11129 !! test
11130 Template with explicit namespace
11131 !! wikitext
11132 {{Template:test}}
11133 !! html
11134 <p>This is a test template
11135 </p>
11136 !! end
11137
11138
11139 !! article
11140 Template:paramtest
11141 !! text
11142 This is a test template with parameter {{{param}}}
11143 !! endarticle
11144
11145 !! test
11146 Template parameter
11147 !! wikitext
11148 {{paramtest|param=foo}}
11149 !! html
11150 <p>This is a test template with parameter foo
11151 </p>
11152 !! end
11153
11154 !! article
11155 Template:paramtestnum
11156 !! text
11157 [[{{{1}}}|{{{2}}}]]
11158 !! endarticle
11159
11160 !! test
11161 Template unnamed parameter
11162 !! wikitext
11163 {{paramtestnum|Main Page|the main page}}
11164 !! html
11165 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11166 </p>
11167 !! end
11168
11169 !! article
11170 Template:templatesimple
11171 !! text
11172 (test)
11173 !! endarticle
11174
11175 !! article
11176 Template:templateredirect
11177 !! text
11178 #redirect [[Template:templatesimple]]
11179 !! endarticle
11180
11181 !! article
11182 Template:templateasargtestnum
11183 !! text
11184 {{{{{1}}}}}
11185 !! endarticle
11186
11187 !! article
11188 Template:templateasargtest
11189 !! text
11190 {{template{{{templ}}}}}
11191 !! endarticle
11192
11193 !! article
11194 Template:templateasargtest2
11195 !! text
11196 {{{{{templ}}}}}
11197 !! endarticle
11198
11199 !! test
11200 Template with template name as unnamed argument
11201 !! wikitext
11202 {{templateasargtestnum|templatesimple}}
11203 !! html
11204 <p>(test)
11205 </p>
11206 !! end
11207
11208 !! test
11209 Template with template name as argument
11210 !! wikitext
11211 {{templateasargtest|templ=simple}}
11212 !! html
11213 <p>(test)
11214 </p>
11215 !! end
11216
11217 !! test
11218 Template with template name as argument (2)
11219 !! wikitext
11220 {{templateasargtest2|templ=templatesimple}}
11221 !! html
11222 <p>(test)
11223 </p>
11224 !! end
11225
11226 !! article
11227 Template:templateasargtestdefault
11228 !! text
11229 {{{{{templ|templatesimple}}}}}
11230 !! endarticle
11231
11232 !! article
11233 Template:templa
11234 !! text
11235 '''templ'''
11236 !! endarticle
11237
11238 !! test
11239 Template with default value
11240 !! wikitext
11241 {{templateasargtestdefault}}
11242 !! html
11243 <p>(test)
11244 </p>
11245 !! end
11246
11247 !! test
11248 Template with default value (value set)
11249 !! wikitext
11250 {{templateasargtestdefault|templ=templa}}
11251 !! html
11252 <p><b>templ</b>
11253 </p>
11254 !! end
11255
11256 !! test
11257 Template redirect
11258 !! wikitext
11259 {{templateredirect}}
11260 !! html/php
11261 <p>(test)
11262 </p>
11263 !! html/parsoid
11264 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11265 !! end
11266
11267 !! test
11268 Template with argument in separate line
11269 !! wikitext
11270 {{ templateasargtest |
11271 templ = simple }}
11272 !! html
11273 <p>(test)
11274 </p>
11275 !! end
11276
11277 !! test
11278 Template with complex template as argument
11279 !! wikitext
11280 {{paramtest|
11281 param ={{ templateasargtest |
11282 templ = simple }}}}
11283 !! html
11284 <p>This is a test template with parameter (test)
11285 </p>
11286 !! end
11287
11288 !! test
11289 Templates with templated name
11290 !! wikitext
11291 {{{{echo|echo}}|foo}}
11292 {{{{echo|inner list}} }}
11293 !! html
11294 <p>foo
11295 </p>
11296 <ul><li>item 1</li></ul>
11297
11298 !! html/parsoid
11299 <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>
11300 <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>
11301 !! end
11302
11303 ## Regression test; the output here isn't really that interesting.
11304 !! test
11305 Templates with templated name and top level template args
11306 !! wikitext
11307 {{1{{2{{{3}}}|4=5}}}}
11308 !! html/parsoid
11309 <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>
11310 !! end
11311
11312 # Parsoid markup is deliberate "broken". This is an edge case.
11313 # See long comment in TemplateHandler.js:convertAttribsToString.
11314 !! test
11315 Templates with invalid templated targets
11316 !! wikitext
11317 {{echo
11318 {{echo|foo}}
11319 }}
11320 !! html/php
11321 <p>{{echo
11322 foo
11323 }}
11324 </p>
11325 !! html/parsoid
11326 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11327 foo }}</p>
11328 !! end
11329
11330 !! test
11331 Template with thumb image (with link in description)
11332 !! wikitext
11333 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11334 !! html/php
11335 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>
11336
11337 !! html+tidy
11338 <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>
11339 !! html/parsoid
11340 <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>
11341 !! end
11342
11343 !! article
11344 Template:complextemplate
11345 !! text
11346 {{{1}}} {{paramtest|
11347 param ={{{param}}}}}
11348 !! endarticle
11349
11350 !! test
11351 Template with complex arguments
11352 !! wikitext
11353 {{complextemplate|
11354 param ={{ templateasargtest |
11355 templ = simple }}|[[Template:complextemplate|link]]}}
11356 !! html
11357 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11358 </p>
11359 !! end
11360
11361 !! test
11362 T2553: link with two variables in a piped link
11363 !! wikitext
11364 {|
11365 |[[{{{1}}}|{{{2}}}]]
11366 |}
11367 !! html/php
11368 <table>
11369 <tr>
11370 <td>[[{{{1}}}|{{{2}}}]]
11371 </td></tr></table>
11372
11373 !! html/parsoid
11374 <table>
11375 <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>
11376 </tbody></table>
11377 !! end
11378
11379 # See: T2553
11380 !! test
11381 Abort table cell attribute parsing on wikilink
11382 !! wikitext
11383 {|
11384 |testing [[one|two]] |three||four
11385 |testing one two |three||four
11386 |testing="[[one|two]]" |three||four
11387 |}
11388 !! html/php
11389 <table>
11390 <tr>
11391 <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>
11392 <td>four
11393 </td>
11394 <td>three</td>
11395 <td>four
11396 </td>
11397 <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>
11398 <td>four
11399 </td></tr></table>
11400
11401 !! html/parsoid
11402 <table>
11403 <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>
11404 <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>
11405 <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>
11406 </tbody></table>
11407 !! end
11408
11409 !! test
11410 Don't abort table cell attribute parsing if wikilink is found in template arg
11411 !! wikitext
11412 {|
11413 |Test {{#tag:ref|One two "[[three]]" four}}
11414 |}
11415 !! html/parsoid
11416 <table>
11417 <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>
11418 </tbody></table>
11419 !! end
11420
11421 !! test
11422 Magic variable as template parameter
11423 !! wikitext
11424 {{paramtest|param={{SITENAME}}}}
11425 !! html
11426 <p>This is a test template with parameter MediaWiki
11427 </p>
11428 !! end
11429
11430 !! article
11431 Template:linktest
11432 !! text
11433 [[{{{param}}}|link]]
11434 !! endarticle
11435
11436 !! test
11437 Template parameter as link source
11438 !! wikitext
11439 {{linktest|param=Main Page}}
11440 !! html
11441 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11442 </p>
11443 !! end
11444
11445 !!article
11446 Template:paramtest2
11447 !! text
11448 including another template, {{paramtest|param={{{arg}}}}}
11449 !! endarticle
11450
11451 !! test
11452 Template passing argument to another template
11453 !! wikitext
11454 {{paramtest2|arg='hmm'}}
11455 !! html
11456 <p>including another template, This is a test template with parameter 'hmm'
11457 </p>
11458 !! end
11459
11460 !! article
11461 Template:Linktest2
11462 !! text
11463 Main Page
11464 !! endarticle
11465
11466 !! test
11467 Template as link source
11468 !! wikitext
11469 [[{{linktest2}}]]
11470
11471 [[{{linktest2}}|Main Page]]
11472
11473 [[{{linktest2}}]]Page
11474 !! html
11475 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11476 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11477 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11478 </p>
11479 !! end
11480
11481
11482 !! article
11483 Template:loop1
11484 !! text
11485 {{loop2}}
11486 !! endarticle
11487
11488 !! article
11489 Template:loop2
11490 !! text
11491 {{loop1}}
11492 !! endarticle
11493
11494 !! test
11495 Template infinite loop
11496 !! wikitext
11497 {{loop1}}
11498 !! html
11499 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11500 </p>
11501 !! end
11502
11503 !! test
11504 Template from main namespace
11505 !! wikitext
11506 {{:Main Page}}
11507 !! html
11508 <p>blah blah
11509 </p>
11510 !! end
11511
11512 !! article
11513 Template:table
11514 !! text
11515 {|
11516 | 1 || 2
11517 |-
11518 | 3 || 4
11519 |}
11520 !! endarticle
11521
11522 !! test
11523 T2529: Template with table, not included at beginning of line
11524 !! wikitext
11525 foo {{table}}
11526 !! html
11527 <p>foo
11528 </p>
11529 <table>
11530 <tr>
11531 <td>1</td>
11532 <td>2
11533 </td></tr>
11534 <tr>
11535 <td>3</td>
11536 <td>4
11537 </td></tr></table>
11538
11539 !! end
11540
11541 !! test
11542 T2523: Template shouldn't eat newline (or add an extra one before table)
11543 !! wikitext
11544 foo
11545 {{table}}
11546 !! html
11547 <p>foo
11548 </p>
11549 <table>
11550 <tr>
11551 <td>1</td>
11552 <td>2
11553 </td></tr>
11554 <tr>
11555 <td>3</td>
11556 <td>4
11557 </td></tr></table>
11558
11559 !! end
11560
11561 !! test
11562 T2041: Template parameters shown as broken links
11563 !! wikitext
11564 {{{parameter}}}
11565 !! html
11566 <p>{{{parameter}}}
11567 </p>
11568 !! end
11569
11570 !! test
11571 Template with targets containing wikilinks
11572 !! options
11573 parsoid=wt2html
11574 !! wikitext
11575 {{[[foo]]}}
11576
11577 {{[[{{echo|foo}}]]}}
11578
11579 {{{{echo|[[foo}}]]}}
11580 !! html/php
11581 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11582 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11583 </p><p>{{[[foo}}]]
11584 </p>
11585 !! html/parsoid
11586 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11587 <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>
11588 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11589 !! end
11590
11591 !! article
11592 Template:''
11593 !! text
11594 bar
11595 !! endarticle
11596
11597 !! test
11598 Templates: Double quotes as template target
11599 !! wikitext
11600 foo {{''}} baz
11601 !! html/php
11602 <p>foo bar baz
11603 </p>
11604 !! html/parsoid
11605 <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
11606 </p>
11607 !! end
11608
11609 ## This test is about making sure Parsoid's data-mw is well formed in the
11610 ## face of multiple templates with intersecting and overlapping ranges. The
11611 ## wikitext itself is wretched.
11612 !! test
11613 Templates with intersecting and overlapping ranges
11614 !! wikitext
11615 {|{{echo|
11616 <p>ha</p>}}
11617 {|{{echo|
11618 <p>ho</p>}}
11619 {{echo|{{!}}hi}}
11620 |}
11621 !! html/php+tidy
11622 <p>ha</p><table>
11623
11624 </table><p>ho</p><table>
11625
11626 <tbody><tr>
11627 <td>hi
11628 </td></tr></tbody></table>
11629 !! html/parsoid
11630 <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":""}]]}'>
11631
11632 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11633
11634 <tbody><tr><td>hi</td></tr>
11635 </tbody></table>
11636 !! end
11637
11638 !! article
11639 Template:MSGNW test
11640 !! text
11641 ''None'' of '''this''' should be
11642 * interpreted
11643 but rather passed unmodified
11644 {{test}}
11645 <gallery>
11646 File:Foobar.jpg
11647 </gallery>
11648 <!-- comment -->
11649 !! endarticle
11650
11651 # hmm, fix this or just deprecate msgnw and document its behavior?
11652 !! test
11653 msgnw keyword
11654 !! wikitext
11655 {{msgnw:MSGNW test}}
11656 !! html/php
11657 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11658 &#42; interpreted
11659 &#32;but rather passed unmodified
11660 &#123;&#123;test&#125;&#125;
11661 &#60;gallery&#62;
11662 File:Foobar.jpg
11663 &#60;/gallery&#62;
11664 &#60;!-- comment --&#62;
11665 </p>
11666 !! end
11667
11668 !! test
11669 int keyword
11670 !! wikitext
11671 {{int:youhavenewmessages|lots of money|not!}}
11672 !! html
11673 <p>You have lots of money (not!).
11674 </p>
11675 !! end
11676
11677 !! test
11678 int keyword - non-existing message
11679 !! wikitext
11680 {{int:var}}
11681 !! html
11682 <p>⧼var⧽
11683 </p>
11684 !! end
11685
11686 !! article
11687 Template:Includes
11688 !! text
11689 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11690 !! endarticle
11691
11692 !! test
11693 <includeonly> and <noinclude> being included
11694 !! wikitext
11695 {{Includes}}
11696 !! html
11697 <p>Foobar
11698 </p>
11699 !! end
11700
11701 !! article
11702 Template:Includes2
11703 !! text
11704 <onlyinclude>Foo</onlyinclude>bar
11705 !! endarticle
11706
11707 !! test
11708 <onlyinclude> being included
11709 !! wikitext
11710 {{Includes2}}
11711 !! html
11712 <p>Foo
11713 </p>
11714 !! end
11715
11716
11717 !! article
11718 Template:Includes3
11719 !! text
11720 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11721 !! endarticle
11722
11723 !! test
11724 <onlyinclude> and <includeonly> being included
11725 !! wikitext
11726 {{Includes3}}
11727 !! html
11728 <p>Foo
11729 </p>
11730 !! end
11731
11732 !! test
11733 <includeonly> and <noinclude> on a page
11734 !! wikitext
11735 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11736 !! html
11737 <p>Foozar
11738 </p>
11739 !! end
11740
11741 !! test
11742 Un-closed <noinclude>
11743 !! wikitext
11744 <noinclude>
11745 !! html
11746 !! end
11747
11748 !! test
11749 <onlyinclude> on a page
11750 !! wikitext
11751 <onlyinclude>Foo</onlyinclude>bar
11752 !! html
11753 <p>Foobar
11754 </p>
11755 !! end
11756
11757 !! test
11758 Un-closed <onlyinclude>
11759 !! wikitext
11760 <onlyinclude>
11761 !! html
11762 !! end
11763
11764 !!test
11765 Self-closed noinclude, includeonly, onlyinclude tags
11766 !! wikitext
11767 <noinclude />
11768 <includeonly />
11769 <onlyinclude />
11770 !! html
11771 <p><br />
11772 </p>
11773 !!end
11774
11775 !!test
11776 Unbalanced includeonly and noinclude tags
11777 !! wikitext
11778 {|
11779 |a</noinclude>
11780 |b</noinclude></noinclude>
11781 |c</noinclude></includeonly>
11782 |d</includeonly></includeonly>
11783 |}
11784 !! html
11785 <table>
11786 <tr>
11787 <td>a
11788 </td>
11789 <td>b
11790 </td>
11791 <td>c&lt;/includeonly&gt;
11792 </td>
11793 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11794 </td></tr></table>
11795
11796 !!end
11797
11798 !! article
11799 Template:Includeonly section
11800 !! text
11801 <includeonly>
11802 ==Includeonly section==
11803 </includeonly>
11804 ==Section T-1==
11805 !!endarticle
11806
11807 !! test
11808 T8563: Edit link generation for section shown by <includeonly>
11809 !! wikitext
11810 {{includeonly section}}
11811 !! html
11812 <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>
11813 <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>
11814
11815 !! end
11816
11817 # Uses same input as the contents of [[Template:Includeonly section]]
11818 !! test
11819 T8563: Section extraction for section shown by <includeonly>
11820 !! options
11821 section=T-2
11822 !! wikitext
11823 <includeonly>
11824 ==Includeonly section==
11825 </includeonly>
11826 ==Section T-2==
11827 !! html
11828 ==Section T-2==
11829 !! end
11830
11831 !! test
11832 T8563: Edit link generation for section suppressed by <includeonly>
11833 !! wikitext
11834 <includeonly>
11835 ==Includeonly section==
11836 </includeonly>
11837 ==Section 1==
11838 !! html
11839 <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>
11840
11841 !! end
11842
11843 !! test
11844 T8563: Section extraction for section suppressed by <includeonly>
11845 !! options
11846 section=1
11847 !! wikitext
11848 <includeonly>
11849 ==Includeonly section==
11850 </includeonly>
11851 ==Section 1==
11852 !! html
11853 ==Section 1==
11854 !! end
11855
11856 !! test
11857 Un-closed <includeonly>
11858 !! wikitext
11859 <includeonly>
11860 !! html/php
11861 !! html/parsoid
11862 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11863 !! end
11864
11865 ## We used to, but no longer wt2wt this test since the default serializer
11866 ## will normalize the include directives to serialize on their own line.
11867 ## Selser will take care of preserving formatting in scenarios where they
11868 ## intermingled with other wikitext.
11869 !! test
11870 Includes and comments at SOL
11871 !! options
11872 parsoid=wt2html,html2html
11873 !! wikitext
11874 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11875
11876 <noinclude>
11877 some
11878 </noinclude>*stuff
11879 *here
11880
11881 <includeonly>can have stuff</includeonly>===here===
11882
11883 !! html/php
11884 <h2><span class="mw-headline" id="hu">hu</span></h2>
11885 <p>some
11886 </p>
11887 <ul><li>stuff</li>
11888 <li>here</li></ul>
11889 <h3><span class="mw-headline" id="here">here</span></h3>
11890
11891 !! html/parsoid
11892 <!-- 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>
11893
11894 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11895 <p>some</p>
11896 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11897 <li>here</li></ul>
11898
11899 <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>
11900
11901 !! end
11902
11903 # TODO: test with DOM fragment reuse!
11904 !! test
11905 Parsoid: DOM fragment reuse
11906 !! options
11907 parsoid=wt2wt,wt2html
11908 !! wikitext
11909 a{{echo|b<table></table>c}}d
11910
11911 a{{echo|b
11912 <table></table>
11913 c}}d
11914
11915 {{echo|a
11916
11917 <table></table>
11918
11919 b}}
11920 !! html
11921 <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>
11922
11923 <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">
11924 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11925 </span><p about="#mwt2">cd</p>
11926
11927 <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">
11928
11929 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11930
11931 </span><p about="#mwt3">b</p>
11932 !! end
11933
11934 !! test
11935 Parsoid: Merge double tds (T52603)
11936 !! options
11937 parsoid
11938 !! wikitext
11939 {|
11940 |{{echo|{{!}} foo}}
11941 |}
11942 !! html
11943 <table><tbody>
11944 <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>
11945 </tbody></table>
11946 !! end
11947
11948 !! test
11949 Parsoid: Merge double tds in nested transclusion content (T52603)
11950 !! options
11951 parsoid
11952 !! wikitext
11953 {{echo|<div>}}
11954 {|
11955 |{{echo|{{!}} foo}}
11956 |}
11957 {{echo|</div>}}
11958 !! html
11959 <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}}]}'>
11960 <table><tbody>
11961 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11962 </tbody></table>
11963 </div>
11964 !! end
11965
11966 ###
11967 ### <includeonly> and <noinclude> in attributes
11968 ###
11969 !!test
11970 0. includeonly around the entire attribute
11971 !! wikitext
11972 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11973 !! html
11974 <p><span id="v2">bar</span>
11975 </p>
11976 !!end
11977
11978 !!test
11979 1. includeonly in html attr key
11980 !! wikitext
11981 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11982 !! html
11983 <p><span id="foo">bar</span>
11984 </p>
11985 !!end
11986
11987 !!test
11988 2. includeonly in html attr value
11989 !! wikitext
11990 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11991 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11992 !! html
11993 <p><span id="v1">bar</span>
11994 <span id="v1">bar</span>
11995 </p>
11996 !!end
11997
11998 !!test
11999 3. includeonly in part of an attr value
12000 !! wikitext
12001 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12002 !! html
12003 <p><span style="color:red;">bar</span>
12004 </p>
12005 !!end
12006
12007 !!test
12008 4. includeonly in table attributes
12009 !! wikitext
12010 {|
12011 |- <noinclude>
12012 |-
12013 |a
12014 </noinclude>
12015 |- <includeonly>
12016 |-
12017 |b
12018 </includeonly>
12019 |}
12020 !! html
12021 <table>
12022
12023
12024 <tr>
12025 <td>a
12026 </td></tr>
12027 </table>
12028
12029 !!end
12030
12031 ###
12032 ### Preprocessor precedence tests
12033 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12034 ###
12035 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12036 !! test
12037 Preprocessor precedence 1: link is rightmost opening
12038 !! options
12039 parsoid=wt2html
12040 !! wikitext
12041 {{[[Foo|bar}}]]
12042
12043 But close-brace is not a valid character in a link title:
12044 {{[[Foo}}|bar]]
12045
12046 However, we can still tell this was handled as a link in the preprocessor:
12047 {{echo|[[Foo}}|bar]]|bat}}
12048 !! html/php
12049 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12050 </p><p>But close-brace is not a valid character in a link title:
12051 {{[[Foo}}|bar]]
12052 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12053 [[Foo}}|bar]]
12054 </p>
12055 !! html/parsoid
12056 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12057 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12058 <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>
12059 !! end
12060
12061 !! test
12062 Preprocessor precedence 2: template is rightmost opening
12063 !! options
12064 language=zh
12065 !! wikitext
12066 -{{echo|foo}-}}-
12067 !! html/php
12068 <p>-foo}--
12069 </p>
12070 !! html/parsoid
12071 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12072 !! end
12073
12074 !! test
12075 Preprocessor precedence 3: language converter is rightmost opening
12076 !! options
12077 language=zh
12078 parsoid=wt2html
12079 !! wikitext
12080 {{echo|hi}}
12081
12082 {{-{R|echo|hi}}}-
12083
12084 [[-{R|raw]]}-
12085 !! html/php
12086 <p>hi
12087 </p><p>{{echo|hi}}
12088 </p><p>[[raw]]
12089 </p>
12090 !! html/parsoid
12091 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12092 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12093 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12094 !! end
12095
12096 !! test
12097 Preprocessor precedence 4: left-most angle bracket
12098 !! options
12099 language=zh
12100 !! wikitext
12101 <!--{raw}-->
12102 !! html/php
12103 !! html/parsoid
12104 <!--{raw}-->
12105 !! end
12106
12107 !! article
12108 Template:Precedence5
12109 !! text
12110 {{{{{1}}}}}
12111 !! endarticle
12112
12113 !! test
12114 Preprocessor precedence 5: tplarg takes precedence over template
12115 !! wikitext
12116 {{Precedence5|Bullet}}
12117 !! html/php
12118 <ul><li>Bar</li></ul>
12119
12120 !! html/parsoid
12121 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12122 !! end
12123
12124 !! test
12125 Preprocessor precedence 6: broken link is rightmost opening
12126 !! options
12127 parsoid=wt2html
12128 !! wikitext
12129 {{echo|[[Foo}}
12130
12131 {{echo|[[Foo|bar|bat=baz}}
12132 !! html/php
12133 <p>{{echo|[[Foo}}
12134 </p><p>{{echo|[[Foo|bar|bat=baz}}
12135 </p>
12136 !! html/parsoid
12137 <p>{{echo|[[Foo}}</p>
12138 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12139 !! end
12140
12141 # This next test exposes a difference between PHP and Parsoid:
12142 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12143 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12144 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12145 # outer `[[Foo` extends until the `y]]`
12146 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12147 # intermediate result (after template expansion), and link processing
12148 # happens on this intermediate result, which moves the wikilink
12149 # boundary leftward to `[[Foo|Bar]]`
12150 # 2b) Parsoid works in a single step, so it's going to keep the
12151 # wikilink as extending to the `y]]`
12152 # 3a) Then PHP does linktrail processing which slurps up the trailing
12153 # `xy` inside the link.
12154 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12155 # `z` inside the link.
12156 # This is "correct" behavior. Parsoid's basic worldview is that the
12157 # `]]` inside the template shouldn't be allowed to leak out to affect
12158 # the surrounding wikilink. PHP may match Parsoid (in the future)
12159 # if you use {{#balance}} (T114445).
12160
12161 !! test
12162 Preprocessor precedence 7: broken template is rightmost opening
12163 !! options
12164 parsoid=wt2html
12165 !! wikitext
12166 [[Foo|{{echo|Bar]]
12167
12168 [[Foo|{{echo|Bar]]-x}}-y]]-z
12169
12170 Careful: linktrails can move the end of the wikilink:
12171 [[Foo|{{echo|y']]a}}l]]l
12172 !! html/php
12173 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12174 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12175 </p><p>Careful: linktrails can move the end of the wikilink:
12176 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12177 </p>
12178 !! html/parsoid
12179 <p>[[Foo|{{echo|Bar]]</p>
12180 <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>
12181 <p>Careful: linktrails can move the end of the wikilink:
12182 <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>
12183 !! end
12184
12185 !! test
12186 Preprocessor precedence 8: broken language converter is rightmost opening
12187 !! options
12188 language=zh
12189 !! wikitext
12190 [[Foo-{R|raw]]
12191 !! html
12192 <p>[[Foo-{R|raw]]
12193 </p>
12194 !! end
12195
12196 !! article
12197 Template:Preprocessor_precedence_9
12198 !! text
12199 ;4: {{{{1}}}}
12200 ;5: {{{{{2}}}}}
12201 ;6: {{{{{{3}}}}}}
12202 ;7: {{{{{{{4}}}}}}}
12203 !! endarticle
12204
12205 !! test
12206 Preprocessor precedence 9: groups of braces
12207 !! wikitext
12208 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12209 !! html/php
12210 <dl><dt>4</dt>
12211 <dd>{Four}</dd>
12212 <dt>5</dt>
12213 <dd></dd></dl>
12214 <ul><li>Bar</li></ul>
12215 <dl><dt>6</dt>
12216 <dd>Four</dd>
12217 <dt>7</dt>
12218 <dd>{Bullet}</dd></dl>
12219
12220 !! html/parsoid
12221 <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}}]}'>
12222 <dt>4</dt>
12223 <dd>{Four}</dd>
12224 <dt>5</dt>
12225 <dd></dd>
12226 </dl><ul about="#mwt1">
12227 <li>Bar</li>
12228 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12229 <dt>6</dt>
12230 <dd>Four</dd>
12231 <dt>7</dt>
12232 <dd>{Bullet}</dd>
12233 </dl>
12234 !! end
12235
12236 !! article
12237 Template:Preprocessor_precedence_10
12238 !! text
12239 ;1: -{R|raw}-
12240 ;2: -{{Bullet}}-
12241 ;3: -{{{1}}}-
12242 ;4: -{{{{2}}}}-
12243 ;5: -{{{{{3}}}}}-
12244 ;6: -{{{{{{4}}}}}}-
12245 ;7: -{{{{{{{5}}}}}}}-
12246 !! endarticle
12247
12248 !! test
12249 Preprocessor precedence 10: groups of braces with leading dash
12250 !! options
12251 language=zh
12252 !! wikitext
12253 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12254 !! html/php
12255 <dl><dt>1</dt>
12256 <dd>raw</dd>
12257 <dt>2</dt>
12258 <dd>-</dd></dl>
12259 <ul><li>Bar-</li></ul>
12260 <dl><dt>3</dt>
12261 <dd>-Three-</dd>
12262 <dt>4</dt>
12263 <dd>raw2</dd>
12264 <dt>5</dt>
12265 <dd>-</dd></dl>
12266 <ul><li>Bar-</li></ul>
12267 <dl><dt>6</dt>
12268 <dd>-Three-</dd>
12269 <dt>7</dt>
12270 <dd>raw2</dd></dl>
12271
12272 !! html/parsoid
12273 <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}}]}'>
12274 <dt>1</dt>
12275 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12276 <dt>2</dt>
12277 <dd>-</dd>
12278 </dl><ul about="#mwt1">
12279 <li>Bar-</li>
12280 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12281 <dt>3</dt>
12282 <dd>-Three-</dd>
12283 <dt>4</dt>
12284 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12285 <dt>5</dt>
12286 <dd>-</dd>
12287 </dl><ul about="#mwt1">
12288 <li>Bar-</li>
12289 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12290 <dt>6</dt>
12291 <dd>-Three-</dd>
12292 <dt>7</dt>
12293 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12294 </dl>
12295 !! end
12296
12297 !! test
12298 Preprocessor precedence 11: found during visual diff testing
12299 !! wikitext
12300 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12301
12302 {{echo|-{{echo|-{{echo|x}}}}}}
12303
12304 {{echo|-{{echo|x}}}}
12305 !! html/php
12306 <p><span>-<span>-x</span></span>
12307 </p><p>--x
12308 </p><p>-x
12309 </p>
12310 !! html/parsoid
12311 <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>
12312
12313 <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>
12314
12315 <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>
12316 !! end
12317
12318 !! test
12319 Preprocessor precedence 12: broken language converter closed by brace.
12320 !! options
12321 parsoid=wt2html
12322 !! wikitext
12323 This form breaks the template, which is unfortunate:
12324 *{{echo|foo-{bar}bat}}
12325
12326 But if the broken language converter markup is inside an extension
12327 tag, nothing bad happens:
12328 *<nowiki>foo-{bar}bat</nowiki>
12329 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12330 *<pre>foo-{bar}bat</pre>
12331 *{{echo|<pre>foo-{bar}bat</pre>}}
12332
12333 <tag>foo-{bar}bat</tag>
12334 {{echo|<tag>foo-{bar}bat</tag>}}
12335
12336 !! html/php+tidy
12337 <p>This form breaks the template, which is unfortunate:
12338 </p>
12339 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12340 <p>But if the broken language converter markup is inside an extension
12341 tag, nothing bad happens:
12342 </p>
12343 <ul><li>foo-&#123;bar}bat</li>
12344 <li>foo-&#123;bar}bat</li>
12345 <li><pre>foo-{bar}bat</pre></li>
12346 <li><pre>foo-{bar}bat</pre></li></ul>
12347 <pre>'foo-{bar}bat'
12348 array (
12349 )
12350 </pre>
12351 <pre>'foo-{bar}bat'
12352 array (
12353 )
12354 </pre>
12355 !! html/parsoid
12356 <p>This form breaks the template, which is unfortunate:</p>
12357 <ul>
12358 <li>{{echo|foo-{bar}bat}}</li>
12359 </ul>
12360 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12361 <ul>
12362 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12363 <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>
12364 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12365 <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>
12366 </ul>
12367 <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>
12368 !! end
12369
12370 !! test
12371 Preprocessor precedence 13: broken language converter in external link
12372 !! options
12373 parsoid=wt2html
12374 !! wikitext
12375 *[http://example.com/-{foo Example in URL]
12376 *[http://example.com Example in -{link} description]
12377 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12378 !! html/php+tidy
12379 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12380 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12381 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12382 !! html/parsoid
12383 <ul>
12384 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12385 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12386 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12387 </ul>
12388 !! end
12389
12390 !! test
12391 Preprocessor precedence 14: broken language converter in comment
12392 !! wikitext
12393 *<!--{{foo}}-->...should be ok
12394 *<!---{{foo}}-->...extra dashes
12395 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12396 !! html/php+tidy
12397 <ul><li>...should be ok</li>
12398 <li>...extra dashes</li>
12399 <li>foobat...should be ok</li></ul>
12400 !! html/parsoid
12401 <ul>
12402 <li><!--{{foo}}-->...should be ok</li>
12403 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12404 <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>
12405 </ul>
12406 !! end
12407
12408 !! test
12409 Preprocessor precedence 15: broken brace markup in headings
12410 !! config
12411 wgFragmentMode=[ 'html5', 'legacy' ]
12412 !! options
12413 parsoid=wt2html
12414 !! wikitext
12415 __NOTOC__ __NOEDITSECTION__
12416 ===1 foo[bar 1===
12417 1
12418 ===2 foo[[bar 2===
12419 2
12420 ===3 foo{bar 3===
12421 3
12422 ===4 foo{{bar 4===
12423 4
12424 ===5 foo{{{bar 5===
12425 5
12426 ===6 foo-{bar 6===
12427 6
12428 !! html/php+tidy
12429 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12430 <p>1
12431 </p>
12432 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12433 <p>2
12434 </p>
12435 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12436 <p>3
12437 </p>
12438 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12439 <p>4
12440 </p>
12441 <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>
12442 <p>5
12443 </p>
12444 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12445 <p>6
12446 </p>
12447 !! html/parsoid
12448 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12449 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12450 <p>1</p>
12451 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12452 <p>2</p>
12453 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12454 <p>3</p>
12455 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12456 <p>4</p>
12457 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12458 <p>5</p>
12459 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12460 <p>6</p>
12461 !! end
12462
12463 !! test
12464 Preprocessor precedence 16: matching closing braces to opening braces
12465 !! options
12466 language=zh
12467 parsoid=wt2html
12468 !! wikitext
12469 -{{{echo|foo}}bar}-
12470 !! html/php
12471 <p>foobar
12472 </p>
12473 !! html/parsoid
12474 <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>
12475 !! end
12476
12477 !! test
12478 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12479 !! options
12480 parsoid=wt2html
12481 !! wikitext
12482 {{echo|hi {{}}}}
12483 !! html/php
12484 <p>hi {{}}
12485 </p>
12486 !! html/parsoid
12487 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12488 !! end
12489
12490 !! test
12491 Preprocessor precedence 18: another rightmost wins scenario
12492 !! options
12493 parsoid=wt2html
12494 !! wikitext
12495 {{ -{{{{1|tplarg}}} }} }-
12496 !! html/php
12497 <p>{{ -{tplarg }} }-
12498 </p>
12499 !! html/parsoid
12500 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12501 !! end
12502
12503 !! test
12504 Preprocessor precedence 19: break syntax
12505 !! options
12506 parsoid=wt2html
12507 !! wikitext
12508 -{{
12509 !! html/php
12510 <p>-{{
12511 </p>
12512 !! html/parsoid
12513 <p>-{{</p>
12514 !! end
12515
12516 ###
12517 ### Token Stream Patcher tests
12518 ###
12519 ### These tests won't always pass wt2wt and other modes because
12520 ### on serialization, the table will be output on a new line.
12521 ### For now, we are blacklisting them, and using this to test selser.
12522 ###
12523
12524 !!test
12525 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12526 !!options
12527 parsoid=wt2html,wt2wt
12528 !!wikitext
12529 {{echo|}}{| width = '100%'
12530 |foo
12531 |}
12532 !!html/parsoid
12533 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12534 <tbody><tr><td>foo</td></tr>
12535 </tbody></table>
12536 !!end
12537
12538 ## We used to, but no longer wt2wt this test since the default serializer
12539 ## will normalize the include directives to serialize on their own line.
12540 ## Selser will take care of preserving formatting in scenarios where they
12541 ## intermingled with other wikitext.
12542 !!test
12543 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12544 !!options
12545 parsoid=wt2html
12546 !!wikitext
12547 <includeonly>a</includeonly>{| {{{b}}}
12548 |c
12549 |}
12550 !!html/parsoid
12551 <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":""}]]}'>
12552 <tbody><tr><td>c</td></tr>
12553 </tbody></table>
12554 !!end
12555
12556 !! test
12557 Table wikitext syntax outside wiki-tables
12558 !! wikitext
12559 a
12560 |+ not a caption
12561 ! not a table heading
12562 |- not a table row
12563 | not a table cell
12564 | class="foo bar" | baz
12565 b
12566 |}
12567 |-
12568 c
12569 !! html
12570 <p>a
12571 |+ not a caption
12572 ! not a table heading
12573 |- not a table row
12574 | not a table cell
12575 | class="foo bar" | baz
12576 b
12577 |}
12578 |-
12579 c
12580 </p>
12581 !! end
12582
12583 ###
12584 ### Testing parsing of templates where a template arg
12585 ### has the same name as the template itself.
12586 ###
12587
12588 !! article
12589 Template:quote
12590 !! text
12591 {{{quote|{{{1}}}}}}
12592 !! endarticle
12593
12594 !!test
12595 Templates: Template Name/Arg clash: 1. Use of positional param
12596 !! wikitext
12597 {{quote|foo}}
12598 !! html
12599 <p>foo
12600 </p>
12601 !!end
12602
12603 !!test
12604 Templates: Template Name/Arg clash: 2. Use of named param
12605 !! wikitext
12606 {{quote|quote=foo}}
12607 !! html
12608 <p>foo
12609 </p>
12610 !!end
12611
12612 !!test
12613 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12614 !! wikitext
12615 {{quote|quote}}
12616 !! html
12617 <p>quote
12618 </p>
12619 !!end
12620
12621 ###
12622 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12623 ###
12624
12625 !!test
12626 Templates: 1. Simple use
12627 !! wikitext
12628 {{echo|Foo}}
12629 !! html
12630 <p>Foo
12631 </p>
12632 !!end
12633
12634 !!test
12635 Templates: 2. Inside a block tag
12636 !! wikitext
12637 <div>{{echo|Foo}}</div>
12638 <blockquote>{{echo|Foo}}</blockquote>
12639 !! html
12640 <div>Foo</div>
12641 <blockquote>Foo</blockquote>
12642
12643 !! html+tidy
12644 <div>Foo</div>
12645 <blockquote><p>Foo</p></blockquote>
12646 !!end
12647
12648 !!test
12649 Templates: P-wrapping: 1a. Templates on consecutive lines
12650 !! wikitext
12651 {{echo|Foo}}
12652 {{echo|bar}}
12653 !! html
12654 <p>Foo
12655 bar
12656 </p>
12657 !!end
12658
12659 !!test
12660 Templates: P-wrapping: 1b. Templates on consecutive lines
12661 !! wikitext
12662 Foo
12663
12664 {{echo|bar}}
12665 {{echo|baz}}
12666 !! html
12667 <p>Foo
12668 </p><p>bar
12669 baz
12670 </p>
12671 !!end
12672
12673 !!test
12674 Templates: P-wrapping: 1c. Templates on consecutive lines
12675 !! wikitext
12676 {{echo|Foo}}
12677 {{echo|bar}} <div>baz</div>
12678 !! html
12679 <p>Foo
12680 </p>
12681 bar <div>baz</div>
12682
12683 !! html+tidy
12684 <p>Foo
12685 </p><p>
12686 bar </p><div>baz</div>
12687 !! end
12688
12689 !!test
12690 Templates: P-wrapping: 1d. Template preceded by comment-only line
12691 !!options
12692 parsoid
12693 !! wikitext
12694 <!-- foo -->
12695 {{echo|Bar}}
12696 !! html
12697 <!-- foo -->
12698
12699 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12700 !!end
12701
12702 !!test
12703 Templates: Inline Text: 1. Multiple template uses
12704 !! wikitext
12705 {{echo|Foo}}bar{{echo|baz}}
12706 !! html
12707 <p>Foobarbaz
12708 </p>
12709 !!end
12710
12711 !!test
12712 Templates: Inline Text: 2. Back-to-back template uses
12713 !! wikitext
12714 {{echo|Foo}}{{echo|bar}}
12715 !! html
12716 <p>Foobar
12717 </p>
12718 !!end
12719
12720 !!test
12721 Templates: Block Tags: 1. Multiple template uses
12722 !! wikitext
12723 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12724 !! html
12725 <div>Foo</div><div>bar</div><div>baz</div>
12726
12727 !!end
12728
12729 !!test
12730 Templates: Block Tags: 2. Back-to-back template uses
12731 !! wikitext
12732 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12733 !! html
12734 <div>Foo</div><div>bar</div>
12735
12736 !!end
12737
12738 # This is an edge case relating to paragraph wrapping.
12739 !!test
12740 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12741 !! wikitext
12742 {{echo|a
12743 b</p>}}
12744 !! html/parsoid
12745 <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
12746 b</p>
12747 !!end
12748
12749 !!test
12750 Templates: Links: 1. Simple example
12751 !! wikitext
12752 {{echo|[[Foo|bar]]}}
12753 !! html
12754 <p><a href="/wiki/Foo" title="Foo">bar</a>
12755 </p>
12756 !!end
12757
12758 !!test
12759 Templates: Links: 2. Generation of link href
12760 !! wikitext
12761 [[{{echo|Foo}}|bar]]
12762 !! html
12763 <p><a href="/wiki/Foo" title="Foo">bar</a>
12764 </p>
12765 !!end
12766
12767 !!test
12768 Templates: Links: 3. Generation of part of a link href
12769 !! wikitext
12770 [[Fo{{echo|o}}|bar]]
12771
12772 [[Foo{{echo|bar}}]]
12773
12774 [[Foo{{echo|bar}}baz]]
12775
12776 [[Foo{{echo|bar}}|bar]]
12777
12778 [[:Foo{{echo|bar}}]]
12779
12780 [[:Foo{{echo|bar}}|bar]]
12781 !! html
12782 <p><a href="/wiki/Foo" title="Foo">bar</a>
12783 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12784 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12785 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12786 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12787 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12788 </p>
12789 !!end
12790
12791 !!test
12792 Templates: Links: 4. Multiple templates generating link href
12793 !! wikitext
12794 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12795 !! html
12796 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12797 </p>
12798 !!end
12799
12800 !!test
12801 Templates: Links: 5. Generation of link text
12802 !! wikitext
12803 [[Foo|{{echo|bar}}]]
12804 !! html
12805 <p><a href="/wiki/Foo" title="Foo">bar</a>
12806 </p>
12807 !!end
12808
12809 !!test
12810 Templates: Links: 5. Nested templates (only outermost template should be marked)
12811 !! wikitext
12812 {{echo|[[{{echo|Foo}}|bar]]}}
12813 !! html
12814 <p><a href="/wiki/Foo" title="Foo">bar</a>
12815 </p>
12816 !!end
12817
12818 !!test
12819 Templates: HTML Tag: 1. Generation of HTML attr. key
12820 !! wikitext
12821 <div {{echo|style}}="color:red;">foo</div>
12822 !! html
12823 <div style="color:red;">foo</div>
12824
12825 !!end
12826
12827 !!test
12828 Templates: HTML Tag: 2. Generation of HTML attr. value
12829 !! wikitext
12830 <div style={{echo|'color:red;'}}>foo</div>
12831 !! html
12832 <div style="color:red;">foo</div>
12833
12834 !!end
12835
12836 !!test
12837 Templates: HTML Tag: 3. Generation of HTML attr key and value
12838 !! wikitext
12839 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12840 !! html
12841 <div style="color:red;">foo</div>
12842
12843 !!end
12844
12845 !!test
12846 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12847 !! wikitext
12848 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12849 !! html
12850 <div title="This is a long title with just one piece templated">foo</div>
12851
12852 !!end
12853
12854 !!test
12855 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12856 !! wikitext
12857 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12858 !! html
12859 <div title="This is a long title with just one piece templated">foo</div>
12860
12861 !!end
12862
12863 !!test
12864 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12865 !! wikitext
12866 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12867 !! html
12868 <div title="This is a long title with just one piece templated">foo</div>
12869
12870 !!end
12871
12872 # SSS FIXME: While it is great we added support for all this,
12873 # do we want to make this part of the spec? Maybe we want to
12874 # deprecate this kind of usage in the future?
12875 !!test
12876 Templates: HTML Tag: 7. Generation of partial attribute key string
12877 !! wikitext
12878 <div st{{echo|yle}}="color:red;">foo</div>
12879 !! html
12880 <div style="color:red;">foo</div>
12881
12882 !!end
12883
12884 !! test
12885 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12886 !! wikitext
12887 <div {{echo|1=id="v1"}}>bar</div>
12888 !! html
12889 <div id="v1">bar</div>
12890
12891 !!end
12892
12893 !! test
12894 Templates: HTML Tag: 9. Multiple template-generated attributes
12895 !! wikitext
12896 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12897 !! html
12898 <div id="v1" title="foo">bar</div>
12899
12900 !!end
12901
12902 !! test
12903 Templates: Support for templates generating attributes and content
12904 !! wikitext
12905 {| {{mixed_attr_content_template}}
12906 |-
12907 |bar
12908 |}
12909 !! html/php
12910 <table style="color:red;" title="T48811">
12911
12912 <tr>
12913 <td>foo
12914 </td></tr>
12915 <tr>
12916 <td>bar
12917 </td></tr></table>
12918
12919 !! html/parsoid
12920 <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|}"]}'>
12921 <tbody><tr>
12922 <td>foo</td></tr>
12923 <tr>
12924 <td>bar</td></tr>
12925 </tbody></table>
12926 !!end
12927
12928 !! test
12929 1. Entities and nowikis inside templated attributes should be handled correctly
12930 !! wikitext
12931 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12932 !! html/php
12933 <div style="background:#f9f9f9;">foo</div>
12934
12935 !! html/parsoid
12936 <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>
12937 !! end
12938
12939 !! test
12940 2. Entities and nowikis inside templated attributes should be handled correctly
12941 !! wikitext
12942 {|
12943 |{{table_attribs_3}}
12944 |}
12945 !! html/php
12946 <table>
12947 <tr>
12948 <td style="background:#f9f9f9;">Foo
12949 </td></tr></table>
12950
12951 !! html/parsoid
12952 <table>
12953 <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>
12954 </tbody></table>
12955 !! end
12956
12957 !! test
12958 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12959 !! wikitext
12960 {{tbl-start}}
12961 |{{table_attribs_3}}
12962 {{tbl-end}}
12963 !! html/php
12964 <table>
12965 <tr>
12966 <td style="background:#f9f9f9;">Foo
12967 </td></tr></table>
12968
12969 !! html/parsoid
12970 <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}}]}'>
12971 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12972 </tbody></table>
12973 !! end
12974
12975 # T107622
12976 !! test
12977 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12978 !! wikitext
12979 {|
12980 |{{table_attribs_6}} hi
12981 |}
12982 !! html/php
12983 <table>
12984 <tr>
12985 <td style="background: red;">hi
12986 </td></tr></table>
12987
12988 !! html/parsoid
12989 <table>
12990 <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>
12991 </tbody></table>
12992 !! end
12993
12994 !!test
12995 Templates: HTML Tables: 1. Generating start of a HTML table
12996 !! wikitext
12997 {{echo|<table><tr><td>foo</td>}}</tr></table>
12998 !! html
12999 <table><tr><td>foo</td></tr></table>
13000
13001 !!end
13002
13003 !!test
13004 Templates: HTML Tables: 2a. Generating middle of a HTML table
13005 !! wikitext
13006 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13007 !! html
13008 <table><tr><td>foo</td></tr></table>
13009
13010 !!end
13011
13012 !!test
13013 Templates: HTML Tables: 2b. Generating middle of a HTML table
13014 !! wikitext
13015 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13016 !! html
13017 <table><tr><td>foo</td></tr></table>
13018
13019 !!end
13020
13021 !!test
13022 Templates: HTML Tables: 3. Generating end of a HTML table
13023 !! wikitext
13024 <table><tr>{{echo|<td>foo</td></tr></table>}}
13025 !! html
13026 <table><tr><td>foo</td></tr></table>
13027
13028 !!end
13029
13030 !!test
13031 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13032 !! wikitext
13033 {{echo|<table>}}<tr><td>foo</td></tr></table>
13034 !! html
13035 <table><tr><td>foo</td></tr></table>
13036
13037 !!end
13038
13039 !!test
13040 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13041 !! wikitext
13042 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13043 !! html
13044 <table><tr><td>foo</td></tr></table>
13045
13046 !!end
13047
13048 !!test
13049 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13050 !! wikitext
13051 <table><tr>{{echo|<td>}}foo</td></tr></table>
13052 !! html
13053 <table><tr><td>foo</td></tr></table>
13054
13055 !!end
13056
13057 !!test
13058 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13059 !! wikitext
13060 <table><tr><td>foo{{echo|</td>}}</tr></table>
13061 !! html
13062 <table><tr><td>foo</td></tr></table>
13063
13064 !!end
13065
13066 !!test
13067 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13068 !! wikitext
13069 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13070 !! html
13071 <table><tr><td>foo</td></tr></table>
13072
13073 !!end
13074
13075 !!test
13076 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13077 !! wikitext
13078 <table><tr><td>foo</td></tr>{{echo|</table>}}
13079 !! html
13080 <table><tr><td>foo</td></tr></table>
13081
13082 !!end
13083
13084 !!test
13085 Templates: HTML Tables: 5. Proper fostering of categories from inside
13086 !!options
13087 parsoid=wt2html,wt2wt
13088 !! wikitext
13089 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13090 <!--Two categories (T52330)-->
13091 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13092 !! html
13093 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13094 <!--Two categories (T52330)-->
13095 <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>
13096 !!end
13097
13098 !!test
13099 Templates: Wiki Tables: 1a. Fostering of entire template content
13100 !! wikitext
13101 {|
13102 {{echo|a}}
13103 |}
13104 !! html
13105 <table>
13106 a
13107 <tr><td></td></tr></table>
13108
13109 !! html/php+tidy
13110
13111 a
13112 <table><tbody><tr><td></td></tr></tbody></table>
13113 !! html/parsoid
13114 <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">
13115
13116 </table>
13117 !! end
13118
13119 !!test
13120 Templates: Wiki Tables: 1b. Fostering of entire template content
13121 !! wikitext
13122 {|
13123 {{echo|<div>}}
13124 foo
13125 {{echo|</div>}}
13126 |}
13127 !! html
13128 <table>
13129 <div>
13130 <p>foo
13131 </p>
13132 </div>
13133 <tr><td></td></tr></table>
13134
13135 !! html/php+tidy
13136 <div>
13137 <p>foo
13138 </p>
13139 </div><table>
13140
13141 <tbody><tr><td></td></tr></tbody></table>
13142 !! html/parsoid
13143 <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|}"]}'>
13144 <p>foo</p>
13145 </div><table about="#mwt3">
13146
13147 </table>
13148 !! end
13149
13150 !!test
13151 Templates: Wiki Tables: 2. Fostering of partial template content
13152 !! wikitext
13153 {|
13154 {{echo|a
13155 <div>b</div>}}
13156 |}
13157 !! html
13158 <table>
13159 a
13160 <div>b</div>
13161 <tr><td></td></tr></table>
13162
13163 !! html/php+tidy
13164
13165 a
13166 <div>b</div><table>
13167 <tbody><tr><td></td></tr></tbody></table>
13168 !! html/parsoid
13169 <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">
13170
13171
13172 </table>
13173 !! end
13174
13175 !!test
13176 Templates: Wiki Tables: 3. td-content via multiple templates
13177 !! wikitext
13178 {|
13179 {{echo|{{pipe}}a}}{{echo|b}}
13180 |}
13181 !! html
13182 <table>
13183 <tr>
13184 <td>ab
13185 </td></tr></table>
13186
13187 !!end
13188
13189 !!test
13190 Templates: Wiki Tables: 4. Templated tags, no content
13191 !! wikitext
13192 {{tbl-start}}
13193 {{tbl-end}}
13194 !! html
13195 <table>
13196 <tr><td></td></tr></table>
13197
13198 !!end
13199
13200 !!test
13201 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13202 !! wikitext
13203 {{tbl-start}}
13204 |foo
13205 {{tbl-end}}
13206 !! html
13207 <table>
13208 <tr>
13209 <td>foo
13210 </td></tr></table>
13211
13212 !!end
13213
13214 !!test
13215 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13216 !! wikitext
13217 {{tbl-start}}
13218 {{!}}foo
13219 {{tbl-end}}
13220 !! html
13221 <table>
13222 <tr>
13223 <td>foo
13224 </td></tr></table>
13225
13226 !!end
13227
13228 ## This test case is very specific to Parsoid's internals
13229 ## and is hence only tested for Parsoid's code. Parsoid uses
13230 ## a <meta> marker tag for <ref> tags and they are expanded
13231 ## much later. We are verifying that this <meta> tag usage
13232 ## doesn't prevent foster parenting.
13233 !!test
13234 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13235 !!wikitext
13236 {{PartialTable}}<ref>foo</ref>
13237 |}
13238
13239 <references />
13240 !!html/parsoid
13241 <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">
13242 <tbody>
13243 </tbody></table>
13244
13245 <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>
13246 !!end
13247
13248 !! test
13249 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13250 !! wikitext
13251 {{echo|
13252 {{{!}}
13253 {{!}}-}}
13254 <onlyinclude>
13255 |foo
13256 </onlyinclude>
13257 {{!}}}
13258 !! html/parsoid
13259 <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{{!}}}"]}'>
13260 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13261 <tbody><tr>
13262
13263 <td>foo
13264 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13265 </tbody></table>
13266 !! end
13267
13268 !!test
13269 Templates: Lists: Multi-line list-items via templates
13270 !! wikitext
13271 *{{echo|a {{nonexistent|
13272 unused}}}}
13273 *{{echo|b {{nonexistent|
13274 unused}}}}
13275 !! html
13276 <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>
13277 <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>
13278
13279 !!end
13280
13281 !!test
13282 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13283 !! wikitext
13284 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13285 !! html
13286 <p><i>ab</i>c<i>d</i>e
13287 </p>
13288 !!end
13289
13290 !!test
13291 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13292 (PHP parser generates misnested html)
13293 !! wikitext
13294 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13295 !! html/parsoid
13296 <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>
13297 !!end
13298
13299 !!test
13300 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13301 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13302 !! options
13303 parsoid=wt2html,wt2wt
13304 !! wikitext
13305 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13306 !! html
13307 <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>
13308 <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>
13309 <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>
13310 !!end
13311
13312 !!test
13313 Templates: Ugly nesting: 4. Divs opened/closed across templates
13314 !! wikitext
13315 a<div>b{{echo|c</div>d}}e
13316 !! html
13317 a<div>bc</div>de
13318
13319 !! html+tidy
13320 <p>a</p><div>bc</div><p>de
13321 </p>
13322 !! end
13323
13324 !! test
13325 Templates: Ugly templates: 3. newline-only template parameter
13326 !! wikitext
13327 foo {{echo|
13328 }}
13329 !! html
13330 <p>foo
13331 </p>
13332 !! end
13333
13334 # This looks like a bug: a single newline triggers p/br for some reason.
13335 !! test
13336 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13337 !! wikitext
13338 {{echo|
13339 }}
13340 !! html
13341 <p><br />
13342 </p>
13343 !! end
13344
13345 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13346 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13347 !! test
13348 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13349 !! wikitext
13350 {{echo|<table>}}
13351 {{echo|<div>foo}}
13352 {{echo|</table>}}
13353 !! html/parsoid
13354 <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
13355 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13356 </table>
13357 !! end
13358
13359 # T66017 -- ugly wikitext with fostered content generates two template ranges
13360 # that are "identical" and generate nesting cycles in the algorithm
13361 !! test
13362 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13363 !! wikitext
13364 {{echo|<table><tr><td><table>}}
13365 {{echo|<div>}}
13366 {{echo|</div>}}
13367 !! html/parsoid
13368 <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"}'>
13369 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13370 </table></td></tr></tbody></table>
13371 !! end
13372
13373 !! test
13374 Templates: Parameters substituted at the top-level
13375 !! wikitext
13376 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13377
13378 {{{foo|bar|baz}}}
13379 !! html/php
13380 <p><i>who</i> me? <b>never!</b>
13381 </p><p>bar
13382 </p>
13383 !! html/parsoid
13384 <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>
13385
13386 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13387 !! end
13388
13389 !! test
13390 Templates: Param with empty arg in the final position
13391 !! wikitext
13392 {{{hi|}}}
13393 !! html/parsoid
13394 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13395 !! end
13396
13397 !!test
13398 Parser Functions: 1. Simple example
13399 !! wikitext
13400 {{uc:foo}}
13401 !! html
13402 <p>FOO
13403 </p>
13404 !!end
13405
13406 !!test
13407 Parser Functions: 2. Nested use (only outermost should be marked up)
13408 !! wikitext
13409 {{uc:{{lc:FOO}}}}
13410 !! html
13411 <p>FOO
13412 </p>
13413 !!end
13414
13415 ###
13416 ### Pre-save transform tests
13417 ###
13418 !! test
13419 pre-save transform: subst:
13420 !! options
13421 pst
13422 !! wikitext
13423 {{subst:test}}
13424 !! html/php
13425 This is a test template
13426 !! end
13427
13428 !! test
13429 pre-save transform: normal template
13430 !! options
13431 pst
13432 !! wikitext
13433 {{test}}
13434 !! html/php
13435 {{test}}
13436 !! end
13437
13438 !! test
13439 pre-save transform: nonexistent template
13440 !! options
13441 pst
13442 !! wikitext
13443 {{thistemplatedoesnotexist}}
13444 !! html/php
13445 {{thistemplatedoesnotexist}}
13446 !! end
13447
13448 !! test
13449 pre-save transform: subst magic variables
13450 !! options
13451 pst
13452 !! wikitext
13453 {{subst:SITENAME}}
13454 !! html/php
13455 MediaWiki
13456 !! end
13457
13458 # This is T2089, which I fixed. -- wtm
13459 !! test
13460 pre-save transform: subst: templates with parameters
13461 !! options
13462 pst
13463 !! wikitext
13464 {{subst:paramtest|param="something else"}}
13465 !! html/php
13466 This is a test template with parameter "something else"
13467 !! end
13468
13469 !! article
13470 Template:nowikitest
13471 !! text
13472 <nowiki>'''not wiki'''</nowiki>
13473 !! endarticle
13474
13475 !! test
13476 pre-save transform: nowiki in subst (T3188)
13477 !! options
13478 pst
13479 !! wikitext
13480 {{subst:nowikitest}}
13481 !! html/php
13482 <nowiki>'''not wiki'''</nowiki>
13483 !! end
13484
13485 !! article
13486 Template:commenttest
13487 !! text
13488 This template has <!-- a comment --> in it.
13489 !! endarticle
13490
13491 !! test
13492 pre-save transform: comment in subst (T3936)
13493 !! options
13494 pst
13495 !! wikitext
13496 {{subst:commenttest}}
13497 !! html/php
13498 This template has <!-- a comment --> in it.
13499 !! end
13500
13501 !! test
13502 pre-save transform: unclosed tag
13503 !! options
13504 pst
13505 !! wikitext
13506 <nowiki>'''not wiki'''
13507 !! html/php
13508 <nowiki>'''not wiki'''
13509 !! end
13510
13511 !! test
13512 pre-save transform: mixed tag case
13513 !! options
13514 pst
13515 !! wikitext
13516 <NOwiki>'''not wiki'''</noWIKI>
13517 !! html/php
13518 <NOwiki>'''not wiki'''</noWIKI>
13519 !! end
13520
13521 !! test
13522 pre-save transform: unclosed comment in <nowiki>
13523 !! options
13524 pst
13525 !! wikitext
13526 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13527 !! html/php
13528 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13529 !!end
13530
13531 # Leading @ in this template definition works around a limitation
13532 # in parsoid's parserTests which otherwise strips the <span> from the
13533 # result (confusing it for a template wrapper)
13534 !! article
13535 Template:dangerous
13536 !!text
13537 @<span onmouseover="alert('crap')">Oh no</span>
13538 !!endarticle
13539
13540 !!test
13541 (confirming safety of fix for subst T3936)
13542 !! wikitext
13543 {{Template:dangerous}}
13544 !! html
13545 <p>@<span>Oh no</span>
13546 </p>
13547 !! end
13548
13549 !! test
13550 pre-save transform: comment containing gallery (T7024)
13551 !! options
13552 pst
13553 !! wikitext
13554 <!-- <gallery>data</gallery> -->
13555 !! html/php
13556 <!-- <gallery>data</gallery> -->
13557 !!end
13558
13559 !! test
13560 pre-save transform: comment containing extension
13561 !! options
13562 pst
13563 !! wikitext
13564 <!-- <tag>data</tag> -->
13565 !! html/php
13566 <!-- <tag>data</tag> -->
13567 !!end
13568
13569 !! test
13570 pre-save transform: comment containing nowiki
13571 !! options
13572 pst
13573 !! wikitext
13574 <!-- <nowiki>data</nowiki> -->
13575 !! html/php
13576 <!-- <nowiki>data</nowiki> -->
13577 !!end
13578
13579 !! test
13580 pre-save transform: <noinclude> in subst (T5298)
13581 !! options
13582 pst
13583 !! wikitext
13584 {{subst:Includes}}
13585 !! html/php
13586 Foobar
13587 !! end
13588
13589 !! test
13590 pre-save transform: <onlyinclude> in subst (T5298)
13591 !! options
13592 pst
13593 !! wikitext
13594 {{subst:Includes2}}
13595 !! html/php
13596 Foo
13597 !! end
13598
13599 !! article
13600 Template:SubstTest
13601 !!text
13602 {{<includeonly>subst:</includeonly>Includes}}
13603 !! endarticle
13604
13605 !! article
13606 Template:SafeSubstTest
13607 !! text
13608 {{<includeonly>safesubst:</includeonly>Includes}}
13609 !! endarticle
13610
13611 !! test
13612 T24297: safesubst: works during PST
13613 !! options
13614 pst
13615 !! wikitext
13616 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13617 !! html/php
13618 FoobarFoobar
13619 !! end
13620
13621 !! test
13622 T24297: safesubst: works during normal parse
13623 !! wikitext
13624 {{SafeSubstTest}}
13625 !! html
13626 <p>Foobar
13627 </p>
13628 !! end
13629
13630 !! test
13631 subst: does not work during normal parse
13632 !! wikitext
13633 {{SubstTest}}
13634 !! html
13635 <p>{{subst:Includes}}
13636 </p>
13637 !! end
13638
13639 !! test
13640 pre-save transform: context links ("pipe trick")
13641 !! options
13642 pst
13643 !! wikitext
13644 [[Article (context)|]]
13645 [[Bar:Article|]]
13646 [[:Bar:Article|]]
13647 [[Bar:Article (context)|]]
13648 [[:Bar:Article (context)|]]
13649 [[|Article]]
13650 [[|Article (context)]]
13651 [[Bar:X (Y) Z|]]
13652 [[:Bar:X (Y) Z|]]
13653 !! html/php
13654 [[Article (context)|Article]]
13655 [[Bar:Article|Article]]
13656 [[:Bar:Article|Article]]
13657 [[Bar:Article (context)|Article]]
13658 [[:Bar:Article (context)|Article]]
13659 [[Article]]
13660 [[Article (context)]]
13661 [[Bar:X (Y) Z|X (Y) Z]]
13662 [[:Bar:X (Y) Z|X (Y) Z]]
13663 !! end
13664
13665 !! test
13666 pre-save transform: context links ("pipe trick") with interwiki prefix
13667 !! options
13668 pst
13669 !! wikitext
13670 [[interwiki:Article|]]
13671 [[:interwiki:Article|]]
13672 [[interwiki:Bar:Article|]]
13673 [[:interwiki:Bar:Article|]]
13674 !! html/php
13675 [[interwiki:Article|Article]]
13676 [[:interwiki:Article|Article]]
13677 [[interwiki:Bar:Article|Bar:Article]]
13678 [[:interwiki:Bar:Article|Bar:Article]]
13679 !! end
13680
13681 !! test
13682 pre-save transform: context links ("pipe trick") with parens in title
13683 !! options
13684 pst title=[[Somearticle (context)]]
13685 !! wikitext
13686 [[|Article]]
13687 !! html/php
13688 [[Article (context)|Article]]
13689 !! end
13690
13691 !! test
13692 pre-save transform: context links ("pipe trick") with comma in title
13693 !! options
13694 pst title=[[Someplace, Somewhere]]
13695 !! wikitext
13696 [[|Otherplace]]
13697 [[Otherplace, Elsewhere|]]
13698 [[Otherplace, Elsewhere, Anywhere|]]
13699 !! html/php
13700 [[Otherplace, Somewhere|Otherplace]]
13701 [[Otherplace, Elsewhere|Otherplace]]
13702 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13703 !! end
13704
13705 !! test
13706 pre-save transform: context links ("pipe trick") with parens and comma
13707 !! options
13708 pst title=[[Someplace (IGNORED), Somewhere]]
13709 !! wikitext
13710 [[|Otherplace]]
13711 [[Otherplace (place), Elsewhere|]]
13712 !! html/php
13713 [[Otherplace, Somewhere|Otherplace]]
13714 [[Otherplace (place), Elsewhere|Otherplace]]
13715 !! end
13716
13717 !! test
13718 pre-save transform: context links ("pipe trick") with comma and parens
13719 !! options
13720 pst title=[[Who, me? (context)]]
13721 !! wikitext
13722 [[|Yes, you.]]
13723 [[Me, Myself, and I (1937 song)|]]
13724 !! html/php
13725 [[Yes, you. (context)|Yes, you.]]
13726 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13727 !! end
13728
13729 !! test
13730 pre-save transform: context links ("pipe trick") with namespace
13731 !! options
13732 pst title=[[Ns:Somearticle]]
13733 !! wikitext
13734 [[|Article]]
13735 !! html/php
13736 [[Ns:Article|Article]]
13737 !! end
13738
13739 !! test
13740 pre-save transform: context links ("pipe trick") with namespace and parens
13741 !! options
13742 pst title=[[Ns:Somearticle (context)]]
13743 !! wikitext
13744 [[|Article]]
13745 !! html/php
13746 [[Ns:Article (context)|Article]]
13747 !! end
13748
13749 !! test
13750 pre-save transform: context links ("pipe trick") with namespace and comma
13751 !! options
13752 pst title=[[Ns:Somearticle, Context, Whatever]]
13753 !! wikitext
13754 [[|Article]]
13755 !! html/php
13756 [[Ns:Article, Context, Whatever|Article]]
13757 !! end
13758
13759 !! test
13760 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13761 !! options
13762 pst title=[[Ns:Somearticle, Context (context)]]
13763 !! wikitext
13764 [[|Article]]
13765 !! html/php
13766 [[Ns:Article (context)|Article]]
13767 !! end
13768
13769 !! test
13770 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13771 !! options
13772 pst title=[[Ns:Somearticle (IGNORED), Context]]
13773 !! wikitext
13774 [[|Article]]
13775 !! html/php
13776 [[Ns:Article, Context|Article]]
13777 !! end
13778
13779 !! test
13780 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13781 !! options
13782 pst
13783 !! wikitext
13784 [[Article(context)|]]
13785 [[Bar:Article(context)|]]
13786 [[:Bar:Article(context)|]]
13787 [[|Article(context)]]
13788 [[Bar:X(Y)Z|]]
13789 [[:Bar:X(Y)Z|]]
13790 !! html/php
13791 [[Article(context)|Article]]
13792 [[Bar:Article(context)|Article]]
13793 [[:Bar:Article(context)|Article]]
13794 [[Article(context)]]
13795 [[Bar:X(Y)Z|X(Y)Z]]
13796 [[:Bar:X(Y)Z|X(Y)Z]]
13797 !! end
13798
13799 !! test
13800 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13801 !! options
13802 pst
13803 !! wikitext
13804 [[Article (context)|]]
13805 [[Bar:Article (context)|]]
13806 [[:Bar:Article (context)|]]
13807 [[|Article (context)]]
13808 [[Bar:X (Y) Z|]]
13809 [[:Bar:X (Y) Z|]]
13810 !! html/php
13811 [[Article (context)|Article]]
13812 [[Bar:Article (context)|Article]]
13813 [[:Bar:Article (context)|Article]]
13814 [[Article (context)]]
13815 [[Bar:X (Y) Z|X (Y) Z]]
13816 [[:Bar:X (Y) Z|X (Y) Z]]
13817 !! end
13818
13819 !! test
13820 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13821 !! options
13822 pst
13823 !! wikitext
13824 [[Article(context)|]]
13825 [[Bar:Article(context)|]]
13826 [[:Bar:Article(context)|]]
13827 [[|Article(context)]]
13828 [[Bar:X(Y)Z|]]
13829 [[:Bar:X(Y)Z|]]
13830 !! html/php
13831 [[Article(context)|Article]]
13832 [[Bar:Article(context)|Article]]
13833 [[:Bar:Article(context)|Article]]
13834 [[Article(context)]]
13835 [[Bar:X(Y)Z|X(Y)Z]]
13836 [[:Bar:X(Y)Z|X(Y)Z]]
13837 !! end
13838
13839 !! test
13840 pre-save transform: context links ("pipe trick") with commas (T23660)
13841 !! options
13842 pst
13843 !! wikitext
13844 [[Article (context), context|]]
13845 [[Article (context),context|]]
13846 [[Bar:Article (context), context|]]
13847 [[Bar:Article (context),context|]]
13848 [[:Bar:Article (context), context|]]
13849 [[:Bar:Article (context),context|]]
13850 !! html/php
13851 [[Article (context), context|Article]]
13852 [[Article (context),context|Article]]
13853 [[Bar:Article (context), context|Article]]
13854 [[Bar:Article (context),context|Article]]
13855 [[:Bar:Article (context), context|Article]]
13856 [[:Bar:Article (context),context|Article]]
13857 !! end
13858
13859 !! test
13860 Parsoid: backwards pipe trick
13861 !! wikitext
13862 [[|'''bar''']]
13863 !! html/php
13864 <p>[[|<b>bar</b>]]
13865 </p>
13866 !! html/parsoid
13867 <p>[[|<b>bar</b>]]</p>
13868 !! end
13869
13870 !! test
13871 pre-save transform: trim trailing empty lines
13872 !! options
13873 pst
13874 !! wikitext
13875 Empty lines are trimmed
13876
13877
13878
13879
13880 !! html/php
13881 Empty lines are trimmed
13882 !! end
13883
13884 !! test
13885 pre-save transform: Signature expansion
13886 !! options
13887 pst
13888 !! wikitext
13889 * ~~~
13890 * ~~~~
13891 * ~~~~~
13892 * <noinclude>~~~</noinclude>
13893 * <includeonly>~~~</includeonly>
13894 * <onlyinclude>~~~</onlyinclude>
13895 !! html/php
13896 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13897 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13898 * 00:02, 1 January 1970 (UTC)
13899 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13900 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13901 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13902 !! end
13903
13904
13905 !! test
13906 ParserOutput flags from signature expansion (T84843)
13907 !! options
13908 pst
13909 showflags
13910 !! wikitext
13911 ~~~~
13912 !! html/php
13913 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13914 flags=user-signature
13915 !! end
13916
13917
13918 !! test
13919 pre-save transform: Signature expansion in nowiki tags (T2093)
13920 !! options
13921 pst disabled
13922 !! wikitext
13923 Shall not expand:
13924
13925 <nowiki>~~~~</nowiki>
13926
13927 <includeonly><nowiki>~~~~</nowiki></includeonly>
13928
13929 <noinclude><nowiki>~~~~</nowiki></noinclude>
13930
13931 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13932
13933 {{subst:Foo}} shall be converted to FOO
13934
13935 As well as inside noinclude/onlyinclude
13936 <noinclude>{{subst:Foo}}</noinclude>
13937 <onlyinclude>{{subst:Foo}}</onlyinclude>
13938
13939 But not inside includeonly
13940 <includeonly>{{subst:Foo}}</includeonly>
13941 !! html/php
13942 Shall not expand:
13943
13944 <nowiki>~~~~</nowiki>
13945
13946 <includeonly><nowiki>~~~~</nowiki></includeonly>
13947
13948 <noinclude><nowiki>~~~~</nowiki></noinclude>
13949
13950 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13951
13952 FOO shall be converted to FOO
13953
13954 As well as inside noinclude/onlyinclude
13955 <noinclude>FOO</noinclude>
13956 <onlyinclude>FOO</onlyinclude>
13957
13958 But not inside includeonly
13959 <includeonly>{{subst:Foo}}</includeonly>
13960 !! end
13961
13962 !! test
13963 Parsoid: Recognize nowiki with trailing space in tags
13964 !! options
13965 parsoid=wt2html
13966 !! wikitext
13967 <nowiki ><div>[[foo]]</nowiki >
13968
13969 a<nowiki / >b
13970
13971 c<nowiki />d
13972
13973 e<nowiki/ >f
13974 !! html
13975 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13976 <p>ab</p>
13977 <p>cd</p>
13978 <p>ef</p>
13979 !! end
13980
13981 !! test
13982 Parsoid: Recognize nowiki with odd capitalization
13983 !! options
13984 parsoid=wt2html
13985 !! wikitext
13986 <noWikI ><div>[[foo]]</Nowiki >
13987 !! html
13988 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13989 !! end
13990
13991
13992 !! test
13993 Parsoid: Escape nowiki with trailing space in tags
13994 !! options
13995 parsoid=html2wt
13996 !! html/parsoid
13997 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13998 <p>a&lt;nowiki /&gt;b</p>
13999 <p>c&lt;nowiki/ &gt;d</p>
14000 !! wikitext
14001 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14002
14003 a&lt;nowiki /&gt;b
14004
14005 c&lt;nowiki/ &gt;d
14006 !! end
14007
14008 !! test
14009 Parsoid: Escape weird noWikI capitalizations
14010 !! options
14011 parsoid=html2wt
14012 !! html/parsoid
14013 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14014 !! wikitext
14015 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14016 !! end
14017
14018 ###
14019 ### Message transform tests
14020 ###
14021 !! test
14022 message transform: magic variables
14023 !! options
14024 msg
14025 !! wikitext
14026 {{SITENAME}}
14027 !! html
14028 MediaWiki
14029 !! end
14030
14031 !! test
14032 message transform: should not transform wiki markup
14033 !! options
14034 msg
14035 !! wikitext
14036 ''test''
14037 !! html
14038 ''test''
14039 !! end
14040
14041 !! test
14042 message transform: <noinclude> in transcluded template (T6926)
14043 !! options
14044 msg
14045 !! wikitext
14046 {{Includes}}
14047 !! html
14048 Foobar
14049 !! end
14050
14051 !! test
14052 message transform: <onlyinclude> in transcluded template (T6926)
14053 !! options
14054 msg
14055 !! wikitext
14056 {{Includes2}}
14057 !! html
14058 Foo
14059 !! end
14060
14061 !! test
14062 {{#special:}} page name, known
14063 !! options
14064 msg
14065 !! wikitext
14066 {{#special:Recentchanges}}
14067 !! html
14068 Special:RecentChanges
14069 !! end
14070
14071 !! test
14072 {{#special:}} page name with subpage, known
14073 !! options
14074 msg
14075 !! wikitext
14076 {{#special:Recentchanges/param}}
14077 !! html
14078 Special:RecentChanges/param
14079 !! end
14080
14081 !! test
14082 {{#special:}} page name, unknown
14083 !! options
14084 msg
14085 !! wikitext
14086 {{#special:foobar nonexistent}}
14087 !! html
14088 Special:Foobar nonexistent
14089 !! end
14090
14091 !! test
14092 {{#speciale:}} page name, known
14093 !! options
14094 msg
14095 !! wikitext
14096 {{#speciale:Recentchanges}}
14097 !! html
14098 Special:RecentChanges
14099 !! end
14100
14101 !! test
14102 {{#speciale:}} page name with subpage, known
14103 !! options
14104 msg
14105 !! wikitext
14106 {{#speciale:Recentchanges/param}}
14107 !! html
14108 Special:RecentChanges/param
14109 !! end
14110
14111 !! test
14112 {{#speciale:}} page name, unknown
14113 !! options
14114 msg
14115 !! wikitext
14116 {{#speciale:foobar nonexistent}}
14117 !! html
14118 Special:Foobar_nonexistent
14119 !! end
14120
14121 ###
14122 ### Images
14123 ###
14124 ### For Parsoid-specific tests, see
14125 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14126
14127 !! test
14128 Simple image
14129 !! options
14130 parsoid=wt2html,wt2wt,html2html
14131 !! wikitext
14132 [[Image:foobar.jpg]]
14133 !! html/php
14134 <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>
14135 </p>
14136 !! html/parsoid
14137 <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>
14138 !! end
14139
14140 !! test
14141 Serialize simple image with span wrapper
14142 !! options
14143 parsoid=html2wt
14144 !! html/parsoid
14145 <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>
14146 !! wikitext
14147 [[File:Foobar.jpg]]
14148 !! end
14149
14150 !! test
14151 Simple image (using File: namespace, now canonical)
14152 !! wikitext
14153 [[File:Foobar.jpg]]
14154 !! html/php
14155 <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>
14156 </p>
14157 !! html/parsoid
14158 <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>
14159 !! end
14160
14161 !! test
14162 Right-aligned image
14163 !! wikitext
14164 [[File:Foobar.jpg|right]]
14165 !! html/php
14166 <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>
14167
14168 !! html/parsoid
14169 <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>
14170 !! end
14171
14172 !! test
14173 Image with caption
14174 !! wikitext
14175 [[File:Foobar.jpg|right|Caption text]]
14176 !! html/php
14177 <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>
14178
14179 !! html/parsoid
14180 <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>
14181 !! end
14182
14183 !! test
14184 Image with caption, T55312 #1
14185 !! wikitext
14186 [[File:Foobar.jpg|right|Caption page stuff]]
14187 !! html/php
14188 <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>
14189
14190 !! html/parsoid
14191 <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>
14192 !! end
14193
14194 !! test
14195 Image with caption, T55312 #2
14196 !! wikitext
14197 [[File:Foobar.jpg|right|Caption page=]]
14198 !! html/php
14199 <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>
14200
14201 !! html/parsoid
14202 <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>
14203 !! end
14204
14205 !! test
14206 Image with caption, T55312 #3
14207 !! wikitext
14208 [[File:Foobar.jpg|right|Caption page=stuff]]
14209 !! html/php
14210 <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>
14211
14212 !! html/parsoid
14213 <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>
14214 !! end
14215
14216 !! test
14217 Image caption with pipe entity
14218 !! wikitext
14219 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14220 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14221 !! html/php
14222 <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>
14223 <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>
14224
14225 !! html/parsoid
14226 <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>
14227 <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>
14228 !! end
14229
14230 !! test
14231 Allow empty links in image captions (T62753)
14232 !! options
14233 thumbsize=220
14234 !! wikitext
14235 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14236 [[]]
14237 [[Link2]]
14238 ]]
14239 !! html/php
14240 <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>
14241
14242 !! html/parsoid
14243 <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>
14244 [[]]
14245 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14246 </figcaption></figure>
14247 !! end
14248
14249 !! test
14250 Titles in unlinked images (T23454)
14251 !! wikitext
14252 [[File:Foobar.jpg|link=|stuff]]
14253 !! html/php
14254 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14255 </p>
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 Link with empty target
14262 !! wikitext
14263 [[]]
14264 !! html
14265 <p>[[]]
14266 </p>
14267 !! end
14268
14269 !! test
14270 Image with link trail
14271 !! wikitext
14272 Linktrails should not work for images: [[File:Foobar.jpg]]s
14273 !! html/php
14274 <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
14275 </p>
14276 !! html/parsoid
14277 <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>
14278 !! end
14279
14280 !! test
14281 Image with empty attribute
14282 !! options
14283 parsoid=wt2html,wt2wt,html2html
14284 !! wikitext
14285 [[File:Foobar.jpg|right||Caption text]]
14286 !! html/php
14287 <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>
14288
14289 !! html/parsoid
14290 <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>
14291 !! end
14292
14293 !! test
14294 1. Block image with individual attributes from templates
14295 !! wikitext
14296 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14297 !! html/php
14298 <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>
14299
14300 !! html/parsoid
14301 <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>
14302 !! end
14303
14304 !! test
14305 2. Block Image with individual attributes from templates
14306 !! wikitext
14307 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14308 !! html/php
14309 <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>
14310
14311 !! html/parsoid
14312 <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>
14313 !! end
14314
14315 !! test
14316 3. Inline image with individual attributes from templates
14317 !! wikitext
14318 [[File:Foobar.jpg|{{echo|50px}}]]
14319 !! html/php
14320 <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>
14321 </p>
14322 !! html/parsoid
14323 <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>
14324 !! end
14325
14326 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14327 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14328 !! test
14329 Image with multiple attributes from the same template
14330 !! wikitext
14331 [[File:Foobar.jpg|{{image_attribs}}]]
14332 !! html/php
14333 <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>
14334
14335 !! html/parsoid
14336 <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>
14337 !! end
14338
14339 !! test
14340 Image with link tails
14341 !! options
14342 thumbsize=220
14343 !! wikitext
14344 123[[File:Foobar.jpg]]456
14345 123[[File:Foobar.jpg|right]]456
14346 123[[File:Foobar.jpg|thumb]]456
14347 !! html/php
14348 <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
14349 </p>
14350 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
14351 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
14352
14353 !! html/php+tidy
14354 <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
14355 </p><p>
14356 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
14357 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
14358 </p>
14359 !! html/parsoid
14360 <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>
14361 <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>
14362 <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>
14363 !! end
14364
14365 !! test
14366 Image with multiple captions -- only last one is accepted
14367 !! wikitext
14368 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14369 !! html/php
14370 <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>
14371
14372 !! html/parsoid
14373 <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>
14374 !! end
14375
14376 !! test
14377 Image with multiple widths -- use last
14378 !! wikitext
14379 [[File:Foobar.jpg|200px|300px|caption]]
14380 !! html/php
14381 <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>
14382 </p>
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 !! test
14388 Image with multiple alignments -- use first (T50664)
14389 !! options
14390 thumbsize=220
14391 !! wikitext
14392 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14393
14394 [[File:Foobar.jpg|middle|text-top|caption]]
14395 !! html/php
14396 <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>
14397 <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>
14398 </p>
14399 !! html/parsoid
14400 <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>
14401 <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>
14402 !! end
14403
14404 !! test
14405 Image with width attribute at different positions
14406 !! wikitext
14407 [[File:Foobar.jpg|200px|right|Caption]]
14408 [[File:Foobar.jpg|right|200px|Caption]]
14409 [[File:Foobar.jpg|right|Caption|200px]]
14410 !! html/php
14411 <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>
14412 <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>
14413 <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>
14414
14415 !! html/parsoid
14416 <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>
14417 <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>
14418 <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>
14419 !! end
14420
14421 # a sad bit of backward-compatibility
14422 !! test
14423 Image with size specified with pxpx (T15500, T53628)
14424 !! options
14425 parsoid=wt2html,wt2wt,html2html
14426 !! wikitext
14427 [[File:Foobar.jpg|20pxpx]]
14428 [[File:Foobar.jpg|200x20pxpx]]
14429 !! html/php
14430 <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>
14431 <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>
14432 </p>
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Image with link parameter, wiki target
14439 !! wikitext
14440 [[File:Foobar.jpg|link=Main Page]]
14441 !! html/php
14442 <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>
14443 </p>
14444 !! html/parsoid
14445 <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>
14446 !! end
14447
14448 # parsoid T51293 (part 1)
14449 !! test
14450 Image with link parameter, URL target
14451 !! wikitext
14452 [[File:Foobar.jpg|link=http://example.com/]]
14453 !! html/php
14454 <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>
14455 </p>
14456 !! html/parsoid
14457 <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>
14458 !! end
14459
14460 # parsoid T51293 (part 2)
14461 !! test
14462 Image with link parameter, protocol-less URL target
14463 !! wikitext
14464 [[File:Foobar.jpg|link=//example.com/]]
14465 !! html/php
14466 <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>
14467 </p>
14468 !! html/parsoid
14469 <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>
14470 !! end
14471
14472 !! test
14473 Escaping non-block captions (T107435)
14474 !! options
14475 parsoid={
14476 "modes": ["wt2wt"],
14477 "changes": [
14478 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14479 ]
14480 }
14481 !! wikitext
14482 [[Image:Foobar.jpg|caption]]
14483 !! wikitext/edited
14484 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14485 !! end
14486
14487 # wgExternalLinkTarget not supported by Parsoid
14488 !! test
14489 Image with link parameter, wgExternalLinkTarget
14490 !! wikitext
14491 [[Image:foobar.jpg|link=http://example.com/]]
14492 !! config
14493 wgExternalLinkTarget='foobar'
14494 !! html/php
14495 <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>
14496 </p>
14497 !! end
14498
14499 !! test
14500 Image with link parameter, wgNoFollowLinks set to false
14501 !! wikitext
14502 [[Image:foobar.jpg|link=http://example.com/]]
14503 !! config
14504 wgNoFollowLinks=false
14505 !! html/php
14506 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14507 </p>
14508 !! end
14509
14510 !! test
14511 Image with link parameter, wgNoFollowDomainExceptions
14512 !! wikitext
14513 [[Image:foobar.jpg|link=http://example.com/]]
14514 !! config
14515 wgNoFollowDomainExceptions='example.com'
14516 !! html/php
14517 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14518 </p>
14519 !! end
14520
14521 # wgExternalLinkTarget not supported by Parsoid
14522 !! test
14523 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14524 !! wikitext
14525 [[Image:foobar.jpg|link=http://example.com/|Title]]
14526 !! config
14527 wgExternalLinkTarget='foobar'
14528 !! html/php
14529 <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>
14530 </p>
14531 !! end
14532
14533 !! test
14534 Image with empty link parameter
14535 !! wikitext
14536 [[File:Foobar.jpg|link=]]
14537 !! html/php
14538 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14539 </p>
14540 !! html/parsoid
14541 <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>
14542 !! end
14543
14544 !! test
14545 Image with link parameter (wiki target) and unnamed parameter
14546 !! wikitext
14547 [[File:Foobar.jpg|link=Main_Page|Title]]
14548 !! html/php
14549 <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>
14550 </p>
14551 !! html/parsoid
14552 <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>
14553 !! end
14554
14555 !! test
14556 Image with link parameter (URL target) and unnamed parameter
14557 !! wikitext
14558 [[File:Foobar.jpg|link=http://example.com/|Title]]
14559 !! html/php
14560 <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>
14561 </p>
14562 !! html/parsoid
14563 <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>
14564 !! end
14565
14566 !! test
14567 Thumbnail image with link parameter
14568 !! options
14569 thumbsize=220
14570 parsoid=wt2html,wt2wt,html2html
14571 !! wikitext
14572 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14573 !! html/php
14574 <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>
14575
14576 !! html/parsoid
14577 <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>
14578 !! end
14579
14580 !! test
14581 Manually-specified thumbnail image
14582 !! options
14583 thumbsize=220
14584 !! wikitext
14585 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14586 !! html/php
14587 <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>
14588
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Manually-specified thumbnail image with explicit link to wiki page
14595 !! options
14596 thumbsize=220
14597 parsoid=wt2html,wt2wt,html2html
14598 !! wikitext
14599 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14600 !! html/php
14601 <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>
14602
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Manually-specified thumbnail image with explicit link to url
14609 !! options
14610 thumbsize=220
14611 parsoid=wt2html,wt2wt,html2html
14612 !! wikitext
14613 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14614 !! html/php
14615 <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>
14616
14617 !! html/parsoid
14618 <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>
14619 !! end
14620
14621 !! test
14622 Manually-specified thumbnail image with explicit no link
14623 !! options
14624 thumbsize=220
14625 parsoid=wt2html,wt2wt,html2html
14626 !! wikitext
14627 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14628 !! html/php
14629 <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>
14630
14631 !! html/parsoid
14632 <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>
14633 !! end
14634
14635 !! test
14636 Manually-specified thumbnail image with explicit link and alt text
14637 !! options
14638 thumbsize=220
14639 parsoid=wt2html,wt2wt,html2html
14640 !! wikitext
14641 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14642 !! html/php
14643 <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>
14644
14645 !! html/parsoid
14646 <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>
14647 !! end
14648
14649 !! test
14650 Image with frame and link
14651 !! options
14652 parsoid=wt2html,wt2wt,html2html
14653 !! wikitext
14654 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14655 !! html/php
14656 <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>
14657
14658 !! html/parsoid
14659 <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>
14660 !! end
14661
14662 !! test
14663 Image with frame and link and explicit alt
14664 !! options
14665 parsoid=wt2html,wt2wt,html2html
14666 !! wikitext
14667 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14668 !! html/php
14669 <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>
14670
14671 !! html/parsoid
14672 <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>
14673 !! end
14674
14675 !! test
14676 Image with wiki markup in implicit alt
14677 !! wikitext
14678 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14679
14680 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14681 !! html/php
14682 <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>
14683 </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>
14684 </p>
14685 !! html/parsoid
14686 <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>
14687
14688 <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>
14689 !! end
14690
14691 !! test
14692 Alt image option should handle most kinds of wikitext without barfing
14693 !! wikitext
14694 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14695 !! html/php
14696 <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>
14697
14698 !! html/parsoid
14699 <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>
14700 !! end
14701
14702 !! test
14703 Image with table with attributes in caption
14704 !! options
14705 parsoid=wt2html,html2html
14706 !! wikitext
14707 [[File:Foobar.jpg|thumb|
14708 {| class="123" |
14709 |- class="456" |
14710 | ha
14711 |}
14712 ]]
14713 !! html/parsoid
14714 <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>
14715 <table class="123">
14716 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14717 <td> ha</td></tr>
14718 </tbody></table>
14719 </figcaption></figure>
14720 !! end
14721
14722 !! test
14723 Image with table with rows from templates in caption
14724 !! wikitext
14725 [[File:Foobar.jpg|thumb|
14726 {|
14727 {{echo|{{!}} hi}}
14728 |}
14729 ]]
14730 !! html/parsoid
14731 <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>
14732 <table>
14733 <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>
14734 </tbody></table>
14735 </figcaption></figure>
14736 !! end
14737
14738 !! test
14739 Image with nested tables in caption
14740 !! wikitext
14741 [[File:Foobar.jpg|thumb|Foo<br />
14742 {|
14743 |
14744 {|
14745 |z
14746 |}
14747 |}
14748 ]]
14749 !! html/parsoid
14750 <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}'/>
14751 <table>
14752 <tbody><tr><td>
14753 <table>
14754 <tbody><tr><td>z</td></tr>
14755 </tbody></table></td></tr>
14756 </tbody></table>
14757 </figcaption></figure>
14758 !! end
14759
14760 ###################
14761 # Conflicting image format options.
14762 # First option specified should 'win'.
14763 # All three cases in each test should be identical.
14764
14765 !! test
14766 Image with 'frameless' first.
14767 !! options
14768 parsoid=wt2html,wt2wt,html2html
14769 !! wikitext
14770 [[File:Foobar.jpg|frameless|caption]]
14771
14772 [[File:Foobar.jpg|frameless|frame|caption]]
14773
14774 [[File:Foobar.jpg|frameless|thumb|caption]]
14775 !! html/php
14776 <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>
14777 </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>
14778 </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>
14779 </p>
14780 !! html/parsoid
14781 <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>
14782 <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>
14783 <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>
14784 !! end
14785
14786 !! test
14787 Image with 'frame' first.
14788 !! options
14789 parsoid=wt2html,wt2wt,html2html
14790 !! wikitext
14791 [[File:Foobar.jpg|frame|caption]]
14792 [[File:Foobar.jpg|frame|frameless|caption]]
14793 [[File:Foobar.jpg|frame|thumb|caption]]
14794 !! html/php
14795 <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>
14796 <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>
14797 <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>
14798
14799 !! html/parsoid
14800 <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>
14801 <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>
14802 <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>
14803 !! end
14804
14805 !! test
14806 Image with 'thumb' first.
14807 !! options
14808 parsoid=wt2html,wt2wt,html2html
14809 !! wikitext
14810 [[File:Foobar.jpg|thumb|caption]]
14811 [[File:Foobar.jpg|thumb|frameless|caption]]
14812 [[File:Foobar.jpg|thumb|frame|caption]]
14813 !! html/php
14814 <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>
14815 <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>
14816 <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>
14817
14818 !! html/parsoid
14819 <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>
14820 <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>
14821 <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>
14822 !! end
14823
14824 ###################
14825 # Image sizing.
14826 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14827 # and https://phabricator.wikimedia.org/T64258
14828 # Foobar has actual size of 1941x220
14829 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14830 # a scalable format.
14831 # 2. Framed images always ignore size options; always render at default size.
14832 # 3. "Unspecified format" and border are the only types which can be
14833 # enlarged.
14834
14835 !! test
14836 Image: unspecified format and border enlarge
14837 !! options
14838 parsoid=wt2html,wt2wt,html2html
14839 !! wikitext
14840 [[File:Foobar.jpg|2000px]]
14841
14842 [[File:Foobar.jpg|border|2000px]]
14843 !! html/php
14844 <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>
14845 </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>
14846 </p>
14847 !! html/parsoid
14848 <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>
14849 <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>
14850 !! end
14851
14852 !! test
14853 Image: "unspecified format" and border reduce
14854 !! options
14855 parsoid=wt2html,wt2wt,html2html
14856 !! wikitext
14857 [[File:Foobar.jpg|1000px]]
14858
14859 [[File:Foobar.jpg|border|1000px]]
14860 !! html/php
14861 <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>
14862 </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>
14863 </p>
14864 !! html/parsoid
14865 <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>
14866 <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>
14867 !! end
14868
14869 !! test
14870 Image: thumbs reduce
14871 !! options
14872 parsoid=wt2html,wt2wt,html2html
14873 !! wikitext
14874 [[File:Foobar.jpg|thumb|50px]]
14875 !! html/php
14876 <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>
14877
14878 !! html/parsoid
14879 <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>
14880 !! end
14881
14882 !! test
14883 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14884 !! options
14885 parsoid=wt2html,wt2wt,html2html
14886 !! wikitext
14887 [[File:Foobar.jpg|thumb|2000px]]
14888
14889 [[File:Foobar.svg|thumb|2000px]]
14890 !! html/php
14891 <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>
14892 <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>
14893
14894 !! html/parsoid
14895 <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>
14896 <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>
14897 !! end
14898
14899 !! test
14900 Image: frameless can reduce in size
14901 !! options
14902 parsoid=wt2html,wt2wt,html2html
14903 !! wikitext
14904 [[File:Foobar.jpg|frameless|50px]]
14905 !! html/php
14906 <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>
14907 </p>
14908 !! html/parsoid
14909 <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>
14910 !! end
14911
14912 !! test
14913 Image: bitmap frameless can't be enlarged past original size, but vector can
14914 !! options
14915 parsoid=wt2html,wt2wt,html2html
14916 !! wikitext
14917 [[File:Foobar.jpg|frameless|2000px]]
14918
14919 [[File:Foobar.svg|frameless|2000px]]
14920 !! html/php
14921 <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>
14922 </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>
14923 </p>
14924 !! html/parsoid
14925 <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>
14926 <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>
14927 !! end
14928
14929 !! test
14930 Image: framed images are always unscaled.
14931 !! options
14932 parsoid=wt2html,wt2wt,html2html
14933 !! wikitext
14934 [[File:Foobar.jpg|frame]]
14935
14936 [[File:Foobar.jpg|frame|50px]]
14937
14938 [[File:Foobar.jpg|frame|50x50px]]
14939
14940 [[File:Foobar.jpg|frame|2000px]]
14941 !! html/php
14942 <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>
14943 <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>
14944 <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>
14945 <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>
14946
14947 !! html/parsoid
14948 <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>
14949 <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>
14950 <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>
14951 <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>
14952 !! end
14953
14954 ###################
14955
14956 !! test
14957 Link to image page- image page normally doesn't exists, hence edit link
14958 Add test with existing image page
14959 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14960 !! wikitext
14961 [[:Image:test]]
14962 !! html
14963 <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>
14964 </p>
14965 !! end
14966
14967 !! test
14968 T20784 Link to non-existent image page with caption should use caption as link text
14969 !! wikitext
14970 [[:Image:test|caption]]
14971 !! html
14972 <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>
14973 </p>
14974 !! end
14975
14976 !! test
14977 Frameless image caption with a free URL
14978 !! wikitext
14979 [[File:Foobar.jpg|http://example.com]]
14980 !! html/php
14981 <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>
14982 </p>
14983 !! html/parsoid
14984 <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>
14985 !! end
14986
14987 !! test
14988 Thumbnail image caption with a free URL
14989 !! options
14990 thumbsize=220
14991 !! wikitext
14992 [[File:Foobar.jpg|thumb|http://example.com]]
14993 !! html/php
14994 <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>
14995
14996 !! html/parsoid
14997 <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>
14998 !! end
14999
15000 !! test
15001 Thumbnail image caption with a free URL and explicit alt
15002 !! options
15003 thumbsize=220
15004 parsoid=wt2html,wt2wt,html2html
15005 !! wikitext
15006 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15007 !! html/php
15008 <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>
15009
15010 !! html/parsoid
15011 <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>
15012 !! end
15013
15014 !! test
15015 SVG thumbnails with no language set
15016 !! options
15017 !! wikitext
15018 [[File:Foobar.svg|thumb|caption]]
15019 !! html/php
15020 <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>
15021
15022 !! html/parsoid
15023 <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>
15024 !! end
15025
15026 !! test
15027 SVG thumbnails with language de
15028 !! options
15029 parsoid=wt2html,wt2wt,html2html
15030 !! wikitext
15031 [[File:Foobar.svg|thumb|caption|lang=de]]
15032 !! html/php
15033 <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>
15034
15035 !! html/parsoid
15036 <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>
15037 !! end
15038
15039 !! test
15040 SVG thumbnails with invalid language code
15041 !! options
15042 parsoid=wt2html,wt2wt,html2html
15043 !! wikitext
15044 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15045 !! html/php
15046 <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>
15047
15048 !! html/parsoid
15049 <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>
15050 !! end
15051
15052 !! test
15053 T3887: A ISBN with a thumbnail
15054 !! wikitext
15055 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15056 !! html/php
15057 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
15058
15059 !! html/parsoid
15060 <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>
15061 !! end
15062
15063 !! test
15064 T3887: A RFC with a thumbnail
15065 !! wikitext
15066 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15067 !! html/php
15068 <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>
15069
15070 !! html/parsoid
15071 <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>
15072 !! end
15073
15074 !! test
15075 T3887: A mailto link with a thumbnail
15076 !! wikitext
15077 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15078 !! html/php
15079 <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>
15080
15081 !! html/parsoid
15082 <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>
15083 !! end
15084
15085 # Pending resolution to T2368
15086 !! test
15087 T2648: Frameless image caption with a link
15088 !! wikitext
15089 [[File:Foobar.jpg|text with a [[link]] in it]]
15090 !! html/php
15091 <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>
15092 </p>
15093 !! html/parsoid
15094 <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>
15095 !! end
15096
15097 !! test
15098 T2648: Frameless image caption with a link (suffix)
15099 !! wikitext
15100 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15101 !! html/php
15102 <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>
15103 </p>
15104 !! html/parsoid
15105 <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>
15106 !! end
15107
15108 !! test
15109 T2648: Frameless image caption with an interwiki link
15110 !! wikitext
15111 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15112 !! html/php
15113 <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>
15114 </p>
15115 !! html/parsoid
15116 <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>
15117 !! end
15118
15119 !! test
15120 T2648: Frameless image caption with a piped interwiki link
15121 !! wikitext
15122 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15123 !! html/php
15124 <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>
15125 </p>
15126 !! html/parsoid
15127 <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>
15128 !! end
15129
15130 !! test
15131 T107474: Frameless image caption with <nowiki>
15132 !! wikitext
15133 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15134 !! html/parsoid
15135 <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>
15136 !! end
15137
15138 !! test
15139 Escape HTML special chars in image alt text
15140 !! wikitext
15141 [[File:Foobar.jpg|& < > "]]
15142 !! html/php
15143 <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>
15144 </p>
15145 !! html/parsoid
15146 <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>
15147 !! end
15148
15149 !! test
15150 Escape HTML special chars in image alt text with LanguageConverter
15151 !! options
15152 language=zh
15153 !! wikitext
15154 [[File:Foobar.jpg|& < > "]]
15155 !! html/php
15156 <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>
15157 </p>
15158 !! html/parsoid
15159 <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>
15160 !! end
15161
15162 !! test
15163 Entities in file name and attributes
15164 !! wikitext
15165 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15166 !! html/php
15167 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15168 </p>
15169 !! html/parsoid
15170 <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>
15171 !! end
15172
15173 !! test
15174 T2499: Alt text should have &#1234;, not &amp;1234;
15175 !! wikitext
15176 [[File:Foobar.jpg|&#9792;]]
15177 !! html/php
15178 <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>
15179 </p>
15180 !! html/parsoid
15181 <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>
15182 !! end
15183
15184 !! test
15185 Broken image caption with link
15186 !! options
15187 parsoid=wt2html,wt2wt,html2html
15188 !! wikitext
15189 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15190 !! html/php
15191 <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.
15192 </p>
15193 !! html/parsoid
15194 <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>
15195 !! end
15196
15197 !! test
15198 Image caption containing another image
15199 !! wikitext
15200 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15201 !! html/php
15202 <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>
15203
15204 !! html/parsoid
15205 <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>
15206 !! end
15207
15208 !! test
15209 Image: caption containing a newline
15210 !! wikitext
15211 [[File:Foobar.jpg|This
15212 *is some text]]
15213 !! html/php
15214 <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>
15215 </p>
15216 !! html/parsoid
15217 <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>
15218 !!end
15219
15220 !!test
15221 Image: caption containing leading space
15222 (The leading space should not trigger nowiki escaping in wt2wt mode)
15223 !! wikitext
15224 [[File:Foobar.jpg|thumb| bar]]
15225 !! html/php
15226 <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>
15227
15228 !! html/parsoid
15229 <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>
15230 !!end
15231
15232 # html/php output not have newlines after table, td, th, etc. because
15233 # Linker::makeThumbLink2() replaces the newlines with spaces since
15234 # the table is inside a caption.
15235 # FIXME: Verify if that circa 2004 fix is still required.
15236 !! test
15237 Image: caption containing a table
15238 !! options
15239 parsoid=wt2html,wt2wt,html2html
15240 !! wikitext
15241 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15242 {|
15243 !Foo!!Bar
15244 |-
15245 |Foo1||Bar1
15246 |}
15247 and some more text.]]
15248 !! html/php
15249 <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>
15250
15251 !! html/parsoid
15252 <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
15253 <table>
15254 <tbody>
15255 <tr><th>Foo</th><th>Bar</th></tr>
15256 <tr>
15257 <td>Foo1</td>
15258 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15259 !! end
15260
15261 !! test
15262 T5090: External links other than http: in image captions
15263 !! wikitext
15264 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15265 !! html/php
15266 <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>
15267
15268 !! html/parsoid
15269 <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>
15270 !! end
15271
15272 !! test
15273 Custom class
15274 !! options
15275 parsoid=wt2html,wt2wt,html2html
15276 !! wikitext
15277 [[Image:foobar.jpg|a|class=b]]
15278 !! html/php
15279 <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>
15280 </p>
15281 !! html/parsoid
15282 <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>
15283 !! end
15284
15285 !! test
15286 Localized image handling (1).
15287 !! options
15288 parsoid=wt2html,wt2wt,html2html
15289 language=es
15290 !! wikitext
15291 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15292 !! html/php
15293 <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>
15294
15295 !! html/parsoid
15296 <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>
15297 !! end
15298
15299 !! test
15300 Localized image handling (2).
15301 !! options
15302 thumbsize=220
15303 parsoid=wt2html,wt2wt,html2html
15304 language=es
15305 !! wikitext
15306 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15307 !! html/php
15308 <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>
15309
15310 !! html/parsoid
15311 <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>
15312 !! end
15313
15314 !! test
15315 Localized image handling (3).
15316 !! options
15317 language=fa
15318 parsoid=html2wt
15319 !! html/parsoid
15320 <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>
15321 !! wikitext
15322 [[File:Foobar.jpg|بندانگشتی]]
15323 !! end
15324
15325 !! test
15326 "border", "frameless" and "class" attributes on an image.
15327 !! options
15328 thumbsize=220
15329 parsoid=wt2html,wt2wt,html2html
15330 !! wikitext
15331 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15332 !! html/php
15333 <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>
15334 </p>
15335 !! html/parsoid
15336 <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>
15337 !! end
15338
15339 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15340 !! test
15341 Invalid image attributes (T64500)
15342 !! options
15343 thumbsize=220
15344 parsoid=wt2html,wt2wt,html2html
15345 !! wikitext
15346 [[File:Foobar.jpg|thumb|float|left|caption]]
15347
15348 [[File:Foobar.jpg|thumb|righ|caption]]
15349
15350 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15351 !! html/php
15352 <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>
15353 <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>
15354 <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>
15355
15356 !! html/parsoid
15357 <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>
15358 <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>
15359 <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>
15360 !! end
15361
15362 !! article
15363 File:Barfoo.jpg
15364 !! text
15365 #REDIRECT [[File:Barfoo.jpg]]
15366 !! endarticle
15367
15368 # FIXME: Parsoid should run this test -- but we'd need to teach the
15369 # mockAPI about the redirected Barfoo.jpg image.
15370 !! test
15371 Redirected image
15372 !! wikitext
15373 [[Image:Barfoo.jpg]]
15374 !! html/php
15375 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15376 </p>
15377 !! end
15378
15379 !! test
15380 Missing image with uploads disabled
15381 !! options
15382 wgEnableUploads=0
15383 !! wikitext
15384 [[File:Foobaz.jpg]]
15385 !! html/php
15386 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15387 </p>
15388 !! html/parsoid
15389 <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>
15390 !! end
15391
15392 # Parsoid-specific testing for images
15393 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15394 # Currently imperfect due to a flaw in the Parsoid testrunner
15395 # Work in progress
15396 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15397 # image tests.
15398
15399 !! test
15400 Parsoid-specific image handling - simple image with size and middle alignment
15401 !! wikitext
15402 [[File:Foobar.jpg|middle|50px]]
15403 !! html/parsoid
15404 <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>
15405 !! end
15406
15407 !! test
15408 Parsoid-specific image handling - simple image with size, middle alignment,
15409 non-standard namespace alias
15410 !! options
15411 parsoid=wt2wt,wt2html,html2html
15412 !! wikitext
15413 [[Image:Foobar.jpg|middle|50px]]
15414 !! html/parsoid
15415 <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>
15416 !! end
15417
15418 !! test
15419 Parsoid-specific image handling - simple image with size and middle alignment
15420 (existing content)
15421 !! wikitext
15422 [[File:Foobar.jpg|50px|middle]]
15423 !! html/parsoid
15424 <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>
15425 !! end
15426
15427 !! test
15428 Parsoid-specific image handling - simple image with size and middle alignment
15429 and non-standard namespace name
15430 !! options
15431 parsoid=wt2html,wt2wt,html2html
15432 !! wikitext
15433 [[Image:Foobar.jpg|50px|middle]]
15434 !! html/parsoid
15435 <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>
15436 !! end
15437
15438 !! test
15439 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15440 !! wikitext
15441 [[File:Foobar.jpg|500x10px|baseline|caption]]
15442 !! html/parsoid
15443 <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>
15444 !! end
15445
15446 !! test
15447 Parsoid-specific image handling - simple image with border and size spec
15448 !! wikitext
15449 [[File:Foobar.jpg|50px|border|caption]]
15450 !! html/parsoid
15451 <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>
15452 !! end
15453
15454 !! test
15455 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15456 !! wikitext
15457 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15458 !! html/parsoid
15459 <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>
15460 !! end
15461
15462 !! test
15463 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15464 (existing content)
15465 !! wikitext
15466 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15467 !! html/parsoid
15468 <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>
15469 !! end
15470
15471 !! test
15472 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15473 !! wikitext
15474 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15475 !! html/parsoid
15476 <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>
15477 !! end
15478
15479 !! test
15480 Parsoid-specific image handling - thumbnail with specific size, halign,
15481 valign, and caption (existing content)
15482 !! wikitext
15483 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15484 !! html/parsoid
15485 <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>
15486 !! end
15487
15488 !! test
15489 Parsoid-specific image handling - framed image with specific size and caption
15490 (size is ignored)
15491 !! options
15492 parsoid=wt2html,wt2wt,html2html
15493 !! wikitext
15494 [[File:Foobar.jpg|frame|500x50px|caption]]
15495 !! html/parsoid
15496 <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>
15497 !! end
15498
15499 !! test
15500 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15501 (size is ignored)
15502 !! options
15503 parsoid=wt2html,wt2wt,html2html
15504 !! wikitext
15505 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15506 !! html/parsoid
15507 <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>
15508 !! end
15509
15510 !! test
15511 Parsoid-specific image handling - frameless image with specific size, border, and caption
15512 !! wikitext
15513 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15514 !! html/parsoid
15515 <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>
15516 !! end
15517
15518 !! test
15519 Parsoid-specific image handling - simple image with a formatted caption
15520 !! wikitext
15521 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15522 !! html/parsoid
15523 <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>
15524 !! end
15525
15526 !! test
15527 Parsoid-specific image handling - caption with a template in it
15528 !! wikitext
15529 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15530 !! html/parsoid
15531 <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>
15532 !! end
15533
15534 !! test
15535 Parsoid-specific image handling - caption with unbalanced tags in it
15536 !! options
15537 parsoid=wt2html,wt2wt,html2html
15538 !! wikitext
15539 foo
15540 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15541 bar
15542 !! html/parsoid
15543 <p>foo</p>
15544 <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>
15545 <p>bar</p>
15546 !! end
15547
15548 !! test
15549 Parsoid-specific image handling - empty caption (1)
15550 !! options
15551 parsoid=wt2html,wt2wt
15552 !! wikitext
15553 [[File:Foobar.jpg|thumb|]]
15554 !! html/parsoid
15555 <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>
15556 !! end
15557
15558 # empty captions don't get serialized unless we're in the "round trip" case
15559 !! test
15560 Parsoid-specific image handling - empty caption (2)
15561 !! options
15562 parsoid=html2wt
15563 !! html/parsoid
15564 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15565 <a href="./File:Foobar.jpg">
15566 <img resource="./File:Foobar.jpg"
15567 src="//example.com/images/3/3a/Foobar.jpg"
15568 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15569 height="25" width="220"/>
15570 </a>
15571 <figcaption></figcaption>
15572 </figure>
15573 !! wikitext
15574 [[File:Foobar.jpg|thumb]]
15575 !! end
15576
15577 !! test
15578 Parsoid-specific image handling - whitespace caption
15579 !! wikitext
15580 [[File:Foobar.jpg|thumb| ]]
15581 !! html/parsoid
15582 <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>
15583 !! end
15584
15585 !! test
15586 Parsoid-specific image handling - lang option
15587 !! wikitext
15588 foo
15589 [[File:Foobar.svg|lang=de|caption]]
15590 bar
15591 !! html/parsoid
15592 <p>foo
15593 <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>
15594 bar</p>
15595 !! end
15596
15597 ## Edge case bugs in Parsoid from T93580
15598 !! test
15599 T93580: 1. Templated <ref> inside block images
15600 !! wikitext
15601 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15602
15603 <references />
15604 !! html/parsoid
15605 <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>
15606
15607 <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>
15608 !! end
15609
15610 !! test
15611 T93580: 2. <ref> inside inline images
15612 !! wikitext
15613 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15614
15615 <references />
15616 !! html/parsoid
15617 <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>
15618
15619 <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>
15620 !! end
15621
15622 !! test
15623 T93580: 3. Templated <ref> inside inline images
15624 !! wikitext
15625 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15626
15627 <references />
15628 !! html/parsoid
15629 <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>
15630
15631 <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>
15632 !! end
15633
15634 ###
15635 ### Subpages
15636 ###
15637 !! article
15638 Subpage test/subpage
15639 !! text
15640 foo
15641 !! endarticle
15642
15643 !! test
15644 Subpage link
15645 !! options
15646 subpage title=[[Subpage test]]
15647 !! wikitext
15648 [[/subpage]]
15649 !! html
15650 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15651 </p>
15652 !! end
15653
15654 !! test
15655 Subpage noslash link
15656 !! options
15657 subpage title=[[Subpage test]]
15658 !! wikitext
15659 [[/subpage/]]
15660 !! html
15661 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15662 </p>
15663 !! end
15664
15665 !! article
15666 Subpage test/1/2/subpage
15667 !! text
15668 blah
15669 !! endarticle
15670
15671 !! test
15672 Relative subpage noslash link
15673 !! options
15674 parsoid=wt2wt,wt2html,html2html
15675 subpage title=[[Subpage test/1/2/3/4]]
15676 !! wikitext
15677 [[../../subpage/]]
15678
15679 [[../../subpage]]
15680 !! html/php
15681 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15682 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15683 </p>
15684 !! html/parsoid
15685 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15686 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15687 !! end
15688
15689 !! test
15690 Parsoid: dot-slash prefixed wikilinks
15691 !! wikitext
15692 [[./foo]]
15693
15694 [[././bar]]
15695
15696 [[././baz/]]
15697 !! html/php
15698 <p>[[./foo]]
15699 </p><p>[[././bar]]
15700 </p><p>[[././baz/]]
15701 </p>
15702 !! html/parsoid
15703 <p>[[./foo]]
15704 </p><p>[[././bar]]
15705 </p><p>[[././baz/]]
15706 </p>
15707 !! end
15708
15709 !! test
15710 Render invalid page names as plain text (T53090)
15711 !! wikitext
15712 [[./../foo|bar]]
15713 [[foo�|bar]]
15714 [[foo/.|bar]]
15715 [[foo/..|bar]]
15716 [[foo~~~bar]]
15717 [[foo>bar]]
15718 [[foo[bar]]
15719 [[.]]
15720 [[..]]
15721 [[foo././bar]]
15722 [[foo[http://example.com]xyz]]
15723
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 [[{{echo|foo{bar}}]]
15731 [[{{echo|foo}bar}}]]
15732 [[{{echo|foo[bar}}]]
15733 [[{{echo|foo]bar}}]]
15734 [[{{echo|foo<bar}}]]
15735 !!html/php
15736 <p>[[./../foo|bar]]
15737 [[foo�|bar]]
15738 [[foo/.|bar]]
15739 [[foo/..|bar]]
15740 [[foo~~~bar]]
15741 [[foo&gt;bar]]
15742 [[foo[bar]]
15743 [[.]]
15744 [[..]]
15745 [[foo././bar]]
15746 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15747 </p><p>[[./../foo|bar]]
15748 [[foo/.|bar]]
15749 [[foo/..|bar]]
15750 [[foo~~~~bar]]
15751 [[foo&gt;bar]]
15752 [[foo././bar]]
15753 [[foo{bar]]
15754 [[foo}bar]]
15755 [[foo[bar]]
15756 [[foo]bar]]
15757 [[foo&lt;bar]]
15758 </p>
15759 !!html/parsoid
15760 <p>[[./../foo|bar]]
15761 [[foo�|bar]]
15762 [[foo/.|bar]]
15763 [[foo/..|bar]]
15764 [[foo~~~bar]]
15765 [[foo>bar]]
15766 [[foo[bar]]
15767 [[.]]
15768 [[..]]
15769 [[foo././bar]]
15770 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15771
15772 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15773 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15774 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
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././bar"}},"i":0}}]}'>foo././bar</span>]]
15778 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15779 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15780 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15781 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15782 [[<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>
15783 !!end
15784
15785 !! test
15786 Disabled subpages
15787 !! wikitext
15788 [[/subpage]]
15789 !! html
15790 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15791 </p>
15792 !! end
15793
15794 !! test
15795 T2561: {{/Subpage}}
15796 !! options
15797 subpage title=[[Page]]
15798 !! wikitext
15799 {{/Subpage}}
15800 !! html
15801 <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>
15802 </p>
15803 !! end
15804
15805 ###
15806 ### Categories
15807 ###
15808 !! article
15809 Category:MediaWiki User's Guide
15810 !! text
15811 blah
15812 !! endarticle
15813
15814 !! test
15815 Link to category
15816 !! wikitext
15817 [[:Category:MediaWiki User's Guide]]
15818 !! html
15819 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15820 </p>
15821 !! end
15822
15823 !! test
15824 Simple category
15825 !! options
15826 cat
15827 !! wikitext
15828 [[Category:MediaWiki User's Guide]]
15829 !! html/php
15830 cat=MediaWiki_User's_Guide sort=
15831 !! html/parsoid
15832 <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"}}'/>
15833 !! end
15834
15835 !! test
15836 PAGESINCATEGORY invalid title fatal (r33546 fix)
15837 !! wikitext
15838 {{PAGESINCATEGORY:<bogus>}}
15839 !! html
15840 <p>0
15841 </p>
15842 !! end
15843
15844 !! test
15845 Category with different sort key
15846 !! options
15847 cat
15848 !! wikitext
15849 [[Category:MediaWiki User's Guide|Foo]]
15850 !! html/php
15851 cat=MediaWiki_User's_Guide sort=Foo
15852 !! html/parsoid
15853 <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"}}'/>
15854 !! end
15855
15856 !! test
15857 Category with identical sort key
15858 !! options
15859 cat
15860 !! wikitext
15861 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15862 !! html/php
15863 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15864 !! html/parsoid
15865 <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"}}'/>
15866 !! end
15867
15868 !! test
15869 Category with empty sort key
15870 !! options
15871 cat
15872 pst
15873 !! wikitext
15874 [[Category:MediaWiki User's Guide|]]
15875 !! html/php
15876 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15877 !! end
15878
15879 !! test
15880 Category with empty sort key and parentheses
15881 !! options
15882 cat
15883 pst
15884 !! wikitext
15885 [[Category:Foo (bar)|]]
15886 !! html/php
15887 [[Category:Foo (bar)|Foo]]
15888 !! end
15889
15890 !! test
15891 Category with link tail
15892 !! options
15893 cat
15894 pst
15895 !! wikitext
15896 123[[Category:Foo]]456
15897 !! html/php
15898 123[[Category:Foo]]456
15899 !! end
15900
15901 !! test
15902 Category with template
15903 !! options
15904 cat
15905 pst
15906 !! wikitext
15907 [[Category:{{echo|Foo}}]]
15908 !! html/php
15909 [[Category:{{echo|Foo}}]]
15910 !! end
15911
15912 !! test
15913 Category with template in sort key
15914 !! options
15915 cat
15916 pst
15917 !! wikitext
15918 [[Category:Foo|{{echo|Bar}}]]
15919 !! html/php
15920 [[Category:Foo|{{echo|Bar}}]]
15921 !! end
15922
15923 !! test
15924 Category with template in sort key and title
15925 !! options
15926 cat
15927 pst
15928 !! wikitext
15929 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15930 !! html/php
15931 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15932 !! end
15933
15934 ## We used to, but no longer wt2wt this test since the default serializer
15935 ## will normalize all categories to serialize on their own line.
15936 ## This wikitext usage is going to be fairly uncommon in production and
15937 ## selser will take care of preserving formatting in those scenarios.
15938 !! test
15939 Category / paragraph interactions
15940 !! options
15941 parsoid=wt2html
15942 !! wikitext
15943 Foo [[Category:Baz]] Bar
15944
15945 Foo [[Category:Baz]]
15946 Bar
15947
15948 Foo
15949 [[Category:Baz]]
15950 Bar
15951
15952 Foo
15953 [[Category:Baz]] Bar
15954
15955 Foo
15956 [[Category:Baz]]
15957 [[Category:Baz]]
15958 [[Category:Baz]]
15959 Bar
15960
15961 [[Category:Baz]]
15962 [[Category:Baz]]
15963 [[Category:Baz]]
15964
15965 [[Category:Baz]]
15966 {{echo|[[Category:Baz]]}}
15967 [[Category:Baz]]
15968 !! html/php
15969 <p>Foo Bar
15970 </p><p>Foo
15971 Bar
15972 </p><p>Foo
15973 Bar
15974 </p><p>Foo Bar
15975 </p><p>Foo
15976 Bar
15977 </p>
15978 !! html/parsoid
15979 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15980 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15981 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15982 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15983 <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>
15984 <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}}]}'/>
15985 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15986 !! end
15987
15988 ## We used to, but no longer wt2wt this test since the default serializer
15989 ## will normalize all categories to serialize on their own line.
15990 ## This wikitext usage is going to be fairly uncommon in production and
15991 ## selser will take care of preserving formatting in those scenarios.
15992 ##
15993 ## The whitespace on the empty line is part of the test. Please do not delete
15994 !! test
15995 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15996 !! options
15997 parsoid=wt2html
15998 !! wikitext
15999 This
16000
16001 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16002
16003 {{echo|[[Category:Foo]] and so should this!}}
16004 !! html/php
16005 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16006 </p>
16007 !! html/parsoid
16008 <p>This
16009
16010 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16011
16012 <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>
16013 !! end
16014
16015 ## Parsoid will not try to wt2wt this while preserving newlines because
16016 ## it suppresses excess newlines within list items -- and we don't want to
16017 ## introduce a special case just for categories, which is, in reality somewhat
16018 ## odd behavior -- categories are unlikely to be used in list items like this
16019 ## in top-level pages and are only likely to show up in template-generated
16020 ## list items where this RT-ing is a non-issue.
16021 ##
16022 ## The whitespace on the empty line is part of the test. Please do not delete
16023 !! test
16024 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16025 !! options
16026 parsoid=wt2html
16027 !! wikitext
16028 * This
16029
16030 [[Category:Foo]] and this should be part of the same list item
16031 * So should this
16032
16033 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16034 !! html
16035 <ul><li>This and this should be part of the same list item</li>
16036 <li>So should this and this should be part of the same list item</li></ul>
16037 !! html/parsoid
16038 <ul>
16039 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16040 <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>
16041 </ul>
16042 !! end
16043
16044 ## Newlines and categories that follow the last item of a list
16045 ## are treated differently because this (list followed by categories)
16046 ## is an extremely common pattern on wikis.
16047 !! test
16048 3. Categories and newlines: newline suppression for last list item should RT properly
16049 !! wikitext
16050 * a
16051 * b
16052
16053 [[Category:Foo]]
16054
16055 [[Category:Bar]]
16056 [[Category:Baz]]
16057 !! html/parsoid
16058 <ul><li> a</li>
16059 <li> b</li></ul>
16060
16061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16062
16063 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16064 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16065 !! end
16066
16067 !! test
16068 4. Categories and newlines: newline suppression for last list item should RT properly
16069 !! wikitext
16070 * a
16071 **** b
16072
16073 [[Category:Foo]]
16074 !! html/parsoid
16075 <ul><li> a
16076 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16077
16078 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16079 !! end
16080
16081 ## only wt2html for this to make sure the algo only applies to the rightmost path
16082 !! test
16083 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16084 !! options
16085 parsoid=wt2html
16086 !! wikitext
16087 * a
16088 ** b
16089 [[Category:Foo]]
16090 * c
16091 ** d
16092 [[Category:Foo]]
16093 !! html/parsoid
16094 <ul><li> a
16095 <ul><li> b
16096 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16097 <li> c
16098 <ul><li> d</li></ul></li></ul>
16099 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16100 !! end
16101
16102 ## We used to, but no longer wt2wt this test since the default serializer
16103 ## will normalize all categories to serialize on their own line.
16104 ## This wikitext usage is going to be fairly uncommon in production and
16105 ## selser will take care of preserving formatting in those scenarios.
16106 !! test
16107 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16108 !! options
16109 parsoid=wt2html
16110 !! wikitext
16111 * a [[Category:Foo]]
16112 !! html/parsoid
16113 <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>
16114 !! end
16115
16116 # This test also demonstrates because of newline+category tunneling
16117 # through the list hander, template wrapping doesn't expand to the
16118 # containing list when the list item swallows the category.
16119 !! test
16120 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16121 !! wikitext
16122 * {{echo|a
16123 [[Category:Foo]]}}
16124 !! html/parsoid
16125 <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
16126 </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>
16127 !! end
16128
16129 !! test
16130 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16131 !! wikitext
16132 * a
16133
16134 {{echo|[[Category:Foo]]
16135 [[Category:Bar]]}}
16136 [[Category:Baz]]
16137 !! html/parsoid
16138 <ul><li> a</li></ul>
16139
16140 <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">
16141 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16142 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16143 !! end
16144
16145 !! test
16146 9. Categories and newlines: should behave properly with linkprefix (T87753)
16147 !! options
16148 language=ar
16149 !! wikitext
16150 foo bar
16151 foo bar
16152 [[تصنيف:Foo]]
16153 [[تصنيف:Bar]]
16154 !! html/php
16155 <p>foo bar
16156 foo bar
16157 </p>
16158 !! html/parsoid
16159 <p>foo bar
16160 foo bar</p>
16161 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16162 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16163 !! end
16164
16165 !! test
16166 10. No regressions on internal links following category (T174639)
16167 !! options
16168 parsoid=wt2html,html2html
16169 !! wikitext
16170 [[Category:Foo]]<div>a
16171
16172 [[Foo]]</div>
16173 !! html/php
16174 <div>a
16175 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16176
16177 !! html/parsoid
16178 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16179
16180 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16181 !! end
16182
16183 # Note that Parsoid differs slightly from PHP due to T175421
16184 !! test
16185 11. Special case where only newlines separate links (T175416)
16186 !! options
16187 parsoid=wt2html,html2html
16188 !! wikitext
16189 [[Category:Foo]]
16190
16191 [[Foo]][[es:Alimento]]
16192
16193 [[Foo]]
16194 !! html/php
16195 <p><br />
16196 <a href="/wiki/Foo" title="Foo">Foo</a>
16197 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16198 </p>
16199 !! html/parsoid
16200 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16201
16202 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16203
16204 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16205 !! end
16206
16207 !! test
16208 Category links with multiple namespaces
16209 !! wikitext
16210 [[Category:Project:Foo]]
16211 !! html/parsoid
16212 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16213 !! end
16214
16215 !! test
16216 Parsoid: Serialize link to category page with colon escape
16217 !! options
16218 parsoid
16219 !! wikitext
16220
16221 [[:Category:Foo]]
16222 [[:Category:Foo|Bar]]
16223 !! html
16224 <p>
16225 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16226 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16227 </p>
16228 !! end
16229
16230 # We used to, but no longer wt2wt this test since the default serializer
16231 # will normalize all categories to serialize on their own line.
16232 # This wikitext usage is going to be fairly uncommon in production and
16233 # selser will take care of preventing whitespace insertion if this
16234 # occurs in an article.
16235 #
16236 # html2html disabled for the same reason (whitespace insertion between
16237 # x and y).
16238 #
16239 # html2wt disabled because it localizes the "Category" namespace.
16240 !! test
16241 Link prefix/suffixes aren't applied to category links
16242 !! options
16243 parsoid=wt2html
16244 language=is
16245 !! wikitext
16246 x[[Category:Foo]]y
16247 !! html/php
16248 <p>xy
16249 </p>
16250 !! html/parsoid
16251 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16252 !! end
16253
16254 !! test
16255 Link prefix/suffixes aren't applied to language links
16256 !! options
16257 parsoid=wt2html
16258 language=is
16259 !! wikitext
16260 x[[es:Foo]]y
16261 !! html/php
16262 <p>xy
16263 </p>
16264 !! html/parsoid
16265 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16266 !! end
16267
16268 !! test
16269 Parsoid: Serialize link to file page with colon escape
16270 !! options
16271 parsoid
16272 !! wikitext
16273
16274 [[:File:Foo.png]]
16275 [[:File:Foo.png|Bar]]
16276 !! html
16277 <p>
16278 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16279 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16280 </p>
16281 !! end
16282
16283 !! test
16284 Parsoid: Serialize a genuine category link without colon escape
16285 !! options
16286 parsoid
16287 !! wikitext
16288 [[Category:Foo]]
16289 [[Category:Foo|Bar]]
16290 !! html
16291 <link rel="mw:PageProp/Category" href="./Category:Foo">
16292 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16293 !! end
16294
16295 !! test
16296 Normalize hrefs properly before testing for invalid link targets (T72894)
16297 !! options
16298 parsoid=html2wt
16299 !! html/parsoid
16300 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16301 !! wikitext
16302 [[Category:Toxine bactérienne]]
16303 !! end
16304
16305 !! test
16306 Parsoid: Defaultsort
16307 !! wikitext
16308 {{DEFAULTSORT:Foo}}
16309 !! html/parsoid
16310 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16311 !! end
16312
16313 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16314 # But, this is a limitation of our representation and is documented in
16315 # TemplateHandler.js in processSpecialMagicWord
16316 !! test
16317 Parsoid: Defaultsort (template-generated)
16318 !! wikitext
16319 {{{{echo|DEFAULTSORT}}:Foo}}
16320 !! html/parsoid
16321 <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"}]]}'/>
16322 !! end
16323
16324 ###
16325 ### Inter-language links
16326 ###
16327 !! test
16328 Interlanguage links
16329 !! options
16330 ill
16331 !! wikitext
16332 [[es:Alimento]]
16333 [[fr:Nourriture]]
16334 [[zh:食品]]
16335 !! html/php
16336 es:Alimento fr:Nourriture zh:食品
16337 !! html/parsoid
16338 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16339 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16340 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16341 !! end
16342
16343 !! test
16344 Duplicate interlanguage links (T26502)
16345 !! options
16346 ill
16347 !! wikitext
16348 [[es:1]]
16349 [[es:2]]
16350 [[fr:1]]
16351 [[fr:2]]
16352 !! html/php
16353 es:1 fr:1
16354 !! html/parsoid
16355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16357 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16358 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16359 !! end
16360
16361 ###
16362 ### Sections
16363 ###
16364 !! test
16365 Basic section headings
16366 !! wikitext
16367 ==Headline 1==
16368 Some text
16369
16370 ==Headline 2==
16371 More
16372 ===Smaller headline===
16373 Blah blah
16374 !! html
16375 <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>
16376 <p>Some text
16377 </p>
16378 <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>
16379 <p>More
16380 </p>
16381 <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>
16382 <p>Blah blah
16383 </p>
16384 !! end
16385
16386 !! test
16387 Section headings with TOC
16388 !! wikitext
16389 ==Headline 1==
16390 ===Subheadline 1===
16391 =====Skipping a level=====
16392 ======Skipping a level======
16393
16394 ==Headline 2==
16395 Some text
16396 ===Another headline===
16397 !! html
16398 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16399 <ul>
16400 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16401 <ul>
16402 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16403 <ul>
16404 <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>
16405 <ul>
16406 <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>
16407 </ul>
16408 </li>
16409 </ul>
16410 </li>
16411 </ul>
16412 </li>
16413 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16414 <ul>
16415 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16416 </ul>
16417 </li>
16418 </ul>
16419 </div>
16420
16421 <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>
16422 <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>
16423 <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>
16424 <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>
16425 <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>
16426 <p>Some text
16427 </p>
16428 <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>
16429
16430 !! end
16431
16432 !! test
16433 TOC anchors don't collide
16434 !! wikitext
16435 __FORCETOC__
16436 ==Headline 2==
16437 ==Headline==
16438 ==Headline 2==
16439 ==Headline==
16440 !! html/php
16441 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16442 <ul>
16443 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16444 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16445 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16446 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16447 </ul>
16448 </div>
16449
16450 <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>
16451 <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>
16452 <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>
16453 <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>
16454
16455 !! end
16456
16457 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16458 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16459 !! test
16460 Handling of sections up to level 6 and beyond
16461 !! options
16462 parsoid=wt2html
16463 !! wikitext
16464 =Level 1 Heading=
16465 ==Level 2 Heading==
16466 ===Level 3 Heading===
16467 ====Level 4 Heading====
16468 =====Level 5 Heading=====
16469 ======Level 6 Heading======
16470 =======Level 7 Heading=======
16471 ========Level 8 Heading========
16472 =========Level 9 Heading=========
16473 ==========Level 10 Heading==========
16474 !! html/php
16475 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16476 <ul>
16477 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16478 <ul>
16479 <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>
16480 <ul>
16481 <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>
16482 <ul>
16483 <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>
16484 <ul>
16485 <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>
16486 <ul>
16487 <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>
16488 <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>
16489 <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>
16490 <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>
16491 <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>
16492 </ul>
16493 </li>
16494 </ul>
16495 </li>
16496 </ul>
16497 </li>
16498 </ul>
16499 </li>
16500 </ul>
16501 </li>
16502 </ul>
16503 </div>
16504
16505 <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>
16506 <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>
16507 <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>
16508 <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>
16509 <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>
16510 <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>
16511 <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>
16512 <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>
16513 <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>
16514 <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>
16515
16516 !! html/parsoid
16517 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16518 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16519 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16520 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16521 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16522 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16523 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16524 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16525 <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>
16526 <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>
16527 !! end
16528
16529 !! test
16530 TOC regression (T11764)
16531 !! wikitext
16532 ==title 1==
16533 ===title 1.1===
16534 ====title 1.1.1====
16535 ===title 1.2===
16536 ==title 2==
16537 ===title 2.1===
16538 !! html
16539 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16540 <ul>
16541 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16542 <ul>
16543 <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>
16544 <ul>
16545 <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>
16546 </ul>
16547 </li>
16548 <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>
16549 </ul>
16550 </li>
16551 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16552 <ul>
16553 <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>
16554 </ul>
16555 </li>
16556 </ul>
16557 </div>
16558
16559 <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>
16560 <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>
16561 <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>
16562 <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>
16563 <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>
16564 <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>
16565
16566 !! end
16567
16568 !! test
16569 TOC for heading containing <span id="..."></span> (T96153)
16570 !! wikitext
16571 __FORCETOC__
16572 ==<span id="old-anchor"></span>New title==
16573 !! html/php
16574 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16575 <ul>
16576 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16577 </ul>
16578 </div>
16579
16580 <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>
16581
16582 !! end
16583
16584 !! test
16585 TOC with wgMaxTocLevel=3 (T8204)
16586 !! options
16587 wgMaxTocLevel=3
16588 !! wikitext
16589 ==title 1==
16590 ===title 1.1===
16591 ====title 1.1.1====
16592 ===title 1.2===
16593 ==title 2==
16594 ===title 2.1===
16595 !! html
16596 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16597 <ul>
16598 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16599 <ul>
16600 <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>
16601 <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>
16602 </ul>
16603 </li>
16604 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16605 <ul>
16606 <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>
16607 </ul>
16608 </li>
16609 </ul>
16610 </div>
16611
16612 <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>
16613 <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>
16614 <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>
16615 <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>
16616 <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>
16617 <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>
16618
16619 !! end
16620
16621 !! test
16622 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16623 !! options
16624 wgMaxTocLevel=3
16625 !! wikitext
16626 ==Section 1==
16627 ===Section 1.1===
16628 ====Section 1.1.1====
16629 ====Section 1.1.1.1====
16630 ==Section 2==
16631 !! html
16632 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16633 <ul>
16634 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16635 <ul>
16636 <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>
16637 </ul>
16638 </li>
16639 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16640 </ul>
16641 </div>
16642
16643 <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>
16644 <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>
16645 <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>
16646 <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>
16647 <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>
16648
16649 !! end
16650
16651
16652 !! test
16653 Resolving duplicate section names
16654 !! wikitext
16655 ==Foo bar==
16656 ==Foo bar==
16657 !! html
16658 <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>
16659 <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>
16660
16661 !! end
16662
16663 !! test
16664 Resolving duplicate section names with differing case (T12721)
16665 !! wikitext
16666 ==Foo bar==
16667 ==Foo Bar==
16668 !! html
16669 <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>
16670 <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>
16671
16672 !! end
16673
16674 !! article
16675 Template:sections
16676 !! text
16677 ===Section 1===
16678 ==Section 2==
16679 !! endarticle
16680
16681 !! test
16682 Template with sections, __NOTOC__
16683 !! wikitext
16684 __NOTOC__
16685 ==Section 0==
16686 {{sections}}
16687 ==Section 4==
16688 !! html
16689 <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>
16690 <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>
16691 <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>
16692 <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>
16693
16694 !! end
16695
16696 !! test
16697 __NOEDITSECTION__ keyword
16698 !! wikitext
16699 __NOEDITSECTION__
16700 ==Section 1==
16701 ==Section 2==
16702 !! html
16703 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16704 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16705
16706 !! end
16707
16708 !! test
16709 Link inside a section heading
16710 !! wikitext
16711 ==Section with a [[Main Page|link]] in it==
16712 !! html
16713 <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>
16714
16715 !! end
16716
16717 !! test
16718 TOC regression (T14077)
16719 !! wikitext
16720 __TOC__
16721 ==title 1==
16722 ===title 1.1===
16723 ==title 2==
16724 !! html
16725 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16726 <ul>
16727 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16728 <ul>
16729 <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>
16730 </ul>
16731 </li>
16732 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16733 </ul>
16734 </div>
16735
16736 <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>
16737 <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>
16738 <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>
16739
16740 !! end
16741
16742 !! test
16743 T3219 URL next to image (good)
16744 !! wikitext
16745 http://example.com [[File:Foobar.jpg]]
16746 !! html/php
16747 <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>
16748 </p>
16749 !! html/parsoid
16750 <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>
16751 !!end
16752
16753 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16754 !! test
16755 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16756 !! options
16757 parsoid=wt2html,html2html
16758 !! wikitext
16759 ===
16760 The line above must have a trailing space!
16761 === <!--
16762 --> <!-- -->
16763 But just in case it doesn't...
16764 !! html/php
16765 <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>
16766 <p>The line above must have a trailing space!
16767 </p>
16768 <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>
16769 <p>But just in case it doesn't...
16770 </p>
16771 !! html/parsoid
16772 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16773 <p>The line above must have a trailing space!</p>
16774 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16775 --> <!-- -->
16776 <p>But just in case it doesn't...</p>
16777 !! end
16778
16779 !! test
16780 Header with special characters (T27462)
16781 !! wikitext
16782 The tooltips shall not show entities to the user (ie. be double escaped)
16783
16784 ==text > text==
16785 section 1
16786
16787 ==text < text==
16788 section 2
16789
16790 ==text & text==
16791 section 3
16792
16793 ==text ' text==
16794 section 4
16795
16796 ==text " text==
16797 section 5
16798 !! html/php
16799 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16800 </p>
16801 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16802 <ul>
16803 <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>
16804 <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>
16805 <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>
16806 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16807 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16808 </ul>
16809 </div>
16810
16811 <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>
16812 <p>section 1
16813 </p>
16814 <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>
16815 <p>section 2
16816 </p>
16817 <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>
16818 <p>section 3
16819 </p>
16820 <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>
16821 <p>section 4
16822 </p>
16823 <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>
16824 <p>section 5
16825 </p>
16826 !! html/parsoid
16827 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16828
16829 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16830 <p>section 1</p>
16831
16832 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16833 <p>section 2</p>
16834
16835 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16836 <p>section 3</p>
16837
16838 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16839 <p>section 4</p>
16840
16841 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16842 <p>section 5</p>
16843 !! end
16844
16845 !! test
16846 Header with space, plus and underscore as entity
16847 !! wikitext
16848 Id should not contain + for spaces
16849
16850 ==Space between Text==
16851 section 1
16852
16853 ==Space-Entity&#32;between&#32;Text==
16854 section 2
16855
16856 ==Plus+between+Text==
16857 section 3
16858
16859 ==Plus-Entity&#43;between&#43;Text==
16860 section 4
16861
16862 ==Underscore_between_Text==
16863 section 5
16864
16865 ==Underscore-Entity&#95;between&#95;Text==
16866 section 6
16867
16868 [[#Space between Text]]
16869 [[#Space-Entity&#32;between&#32;Text]]
16870 [[#Plus+between+Text]]
16871 [[#Plus-Entity&#43;between&#43;Text]]
16872 [[#Underscore_between_Text]]
16873 [[#Underscore-Entity&#95;between&#95;Text]]
16874 !! html/php
16875 <p>Id should not contain + for spaces
16876 </p>
16877 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16878 <ul>
16879 <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>
16880 <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>
16881 <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>
16882 <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>
16883 <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>
16884 <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>
16885 </ul>
16886 </div>
16887
16888 <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>
16889 <p>section 1
16890 </p>
16891 <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>
16892 <p>section 2
16893 </p>
16894 <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>
16895 <p>section 3
16896 </p>
16897 <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>
16898 <p>section 4
16899 </p>
16900 <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>
16901 <p>section 5
16902 </p>
16903 <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>
16904 <p>section 6
16905 </p><p><a href="#Space_between_Text">#Space between Text</a>
16906 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16907 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16908 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16909 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16910 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16911 </p>
16912 !! html/parsoid
16913 <p>Id should not contain + for spaces</p>
16914
16915 <h2 id="Space_between_Text">Space between Text</h2>
16916 <p>section 1</p>
16917
16918 <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>
16919 <p>section 2</p>
16920
16921 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16922 <p>section 3</p>
16923
16924 <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>
16925 <p>section 4</p>
16926
16927 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16928 <p>section 5</p>
16929
16930 <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>
16931 <p>section 6</p>
16932
16933 <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>
16934 <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>
16935 <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>
16936 <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>
16937 <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>
16938 <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>
16939 !! end
16940
16941 # Parsoid html2wt disabled because it adds padding spaces around =
16942 !! test
16943 Headers with excess '=' characters
16944 (Are similar tests necessary beyond the 1st level?)
16945 !! options
16946 parsoid=wt2html,wt2wt,html2html
16947 !! wikitext
16948 =foo==
16949 ==foo=
16950 =''italic'' heading==
16951 ==''italic'' heading=
16952 !! html/php
16953 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16954 <ul>
16955 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16956 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16957 <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>
16958 <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>
16959 </ul>
16960 </div>
16961
16962 <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>
16963 <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>
16964 <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>
16965 <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>
16966
16967 !! html/parsoid
16968 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16969 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16970 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16971 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16972 !! end
16973
16974 !! test
16975 HTML headers vs TOC (T25393)
16976 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16977 !! wikitext
16978 <h1>Header 1</h1>
16979 ==Header 1.1==
16980 ==Header 1.2==
16981
16982 <h1>Header 2
16983 </h1>
16984 ==Header 2.1==
16985 ==Header 2.2==
16986 __NOEDITSECTION__
16987 !! html/php
16988 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16989 <ul>
16990 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16991 <ul>
16992 <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>
16993 <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>
16994 </ul>
16995 </li>
16996 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16997 <ul>
16998 <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>
16999 <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>
17000 </ul>
17001 </li>
17002 </ul>
17003 </div>
17004
17005 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17006 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17007 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17008 <h1><span class="mw-headline" id="Header_2">Header 2
17009 </span></h1>
17010 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17011 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17012
17013 !! html/parsoid
17014 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17015 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17016 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17017
17018 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17019 </h1>
17020 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17021 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17022 <meta property="mw:PageProp/noeditsection"/>
17023 !! end
17024
17025 !! test
17026 Single-line or multiline-comments can follow headings
17027 !! options
17028 parsoid=wt2html,wt2wt
17029 !! wikitext
17030 ==foo==<!---->
17031 ==bar==<!--c1-->
17032 ==baz==<!--
17033 c2
17034 c3-->
17035 !! html/php
17036 <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>
17037 <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>
17038 <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>
17039
17040 !! html/parsoid
17041 <h2 id="foo">foo</h2><!---->
17042 <h2 id="bar">bar</h2><!--c1-->
17043 <h2 id="baz">baz</h2><!--
17044 c2
17045 c3-->
17046 !! end
17047
17048 !! test
17049 T3219 URL next to image (broken)
17050 !! wikitext
17051 http://example.com[[File:Foobar.jpg]]
17052 !! html/php
17053 <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>
17054 </p>
17055 !! html/parsoid
17056 <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>
17057 !!end
17058
17059 !! test
17060 T3186 news: in the middle of text
17061 !! wikitext
17062 http://en.wikinews.org/wiki/Wikinews:Workplace
17063 !! html
17064 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17065 </p>
17066 !!end
17067
17068
17069 !! test
17070 Namespaced link must have a title
17071 !! wikitext
17072 [[Project:]]
17073 !! html
17074 <p>[[Project:]]
17075 </p>
17076 !!end
17077
17078 !! test
17079 Namespaced link must have a title (bad fragment version)
17080 !! wikitext
17081 [[Project:#fragment]]
17082 !! html
17083 <p>[[Project:#fragment]]
17084 </p>
17085 !!end
17086
17087
17088 ###
17089 ### HTML tags and HTML attributes
17090 ###
17091
17092 !! test
17093 div with no attributes
17094 !! wikitext
17095 <div>HTML rocks</div>
17096 !! html
17097 <div>HTML rocks</div>
17098
17099 !! end
17100
17101 !! test
17102 div with double-quoted attribute
17103 !! wikitext
17104 <div id="rock">HTML rocks</div>
17105 !! html
17106 <div id="rock">HTML rocks</div>
17107
17108 !! end
17109
17110 !! test
17111 div with single-quoted attribute
17112 !! wikitext
17113 <div id='rock'>HTML rocks</div>
17114 !! html
17115 <div id="rock">HTML rocks</div>
17116
17117 !! end
17118
17119 !! test
17120 div with unquoted attribute
17121 !! wikitext
17122 <div id=rock>HTML rocks</div>
17123 !! html
17124 <div id="rock">HTML rocks</div>
17125
17126 !! end
17127
17128 !! test
17129 div with illegal double attributes
17130 !! wikitext
17131 <div id="a" id="b">HTML rocks</div>
17132 !! html
17133 <div id="b">HTML rocks</div>
17134
17135 !!end
17136
17137 !! test
17138 div with empty attribute value, space before equals
17139 !! options
17140 parsoid=wt2html,html2html
17141 !! wikitext
17142 <div class =>HTML rocks</div>
17143 !! html/php
17144 <div class="">HTML rocks</div>
17145
17146 !! html/parsoid
17147 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17148 !! end
17149
17150 !! test
17151 div with multiple empty attribute values
17152 !! config
17153 wgFragmentMode=[ 'html5', 'legacy' ]
17154 !! options
17155 parsoid=wt2html,html2html
17156 !! wikitext
17157 <div id= title=>HTML rocks</div>
17158 !! html/php
17159 <div id="title=">HTML rocks</div>
17160
17161 !! html/parsoid
17162 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17163 !! end
17164
17165 # FIXME Parsoid doesn't actually match PHP here.
17166 # Probably we should use the synthetic <foo /> or <indicator>
17167 # extensions for this test, which are enabled when running parser tests.
17168 !! test
17169 Extension tag in attribute value
17170 !! wikitext
17171 <span title="<translate>123</translate>">ok</span>
17172 !! html/php+disabled
17173 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17174 </p>
17175 !! html/parsoid
17176 <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>
17177 !! end
17178
17179 !! test
17180 table with multiple empty attribute values
17181 !! options
17182 parsoid=wt2html,html2html
17183 !! wikitext
17184 {| title= id=
17185 |hi
17186 |}
17187 !! html/php
17188 <table title="id=">
17189 <tr>
17190 <td>hi
17191 </td></tr></table>
17192
17193 !! html/parsoid
17194 <table title="id=">
17195 <tbody><tr><td>hi</td></tr>
17196 </tbody></table>
17197 !! end
17198
17199 !! test
17200 div with braces in attribute value
17201 !! wikitext
17202 <div title="{}">Foo</div>
17203 !! html/php
17204 <div title="&#123;&#125;">Foo</div>
17205
17206 !! html/parsoid
17207 <div title="{}">Foo</div>
17208 !! end
17209
17210 !! test
17211 div with empty attribute value, no space before equals
17212 !! options
17213 parsoid=wt2html,html2html
17214 !! wikitext
17215 <div class=>HTML rocks</div>
17216 !! html/php
17217 <div class="">HTML rocks</div>
17218
17219 !! html/parsoid
17220 <div class="">HTML rocks</div>
17221 !! end
17222
17223 !! test
17224 HTML multiple attributes correction
17225 !! wikitext
17226 <p class="error" class="awesome">Awesome!</p>
17227 !! html
17228 <p class="awesome">Awesome!</p>
17229
17230 !!end
17231
17232 !! test
17233 Table multiple attributes correction
17234 !! wikitext
17235 {|
17236 !+ class="error" class="awesome"|status
17237 |}
17238 !! html
17239 <table>
17240 <tr>
17241 <th class="awesome">status
17242 </th></tr></table>
17243
17244 !!end
17245
17246 !! test
17247 DIV IN UPPERCASE
17248 !! wikitext
17249 <DIV ID="x">HTML ROCKS</DIV>
17250 !! html
17251 <div id="x">HTML ROCKS</div>
17252
17253 !!end
17254
17255 !! test
17256 Non-ASCII pseudo-tags are rendered as text
17257 !! wikitext
17258 <khyô>
17259 !! html
17260 <p>&lt;khyô&gt;
17261 </p>
17262 !! end
17263
17264 !! test
17265 Pseudo-tag with URL 'name' renders as url link
17266 !! wikitext
17267 <http://example.com/>
17268 !! html
17269 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17270 </p>
17271 !! end
17272
17273 !! test
17274 text with amp in the middle of nowhere
17275 !! wikitext
17276 Remember AT&T?
17277 !! html
17278 <p>Remember AT&amp;T?
17279 </p>
17280 !! end
17281
17282 !! test
17283 text with character entity: eacute
17284 !! wikitext
17285 I always thought &eacute; was a cute letter.
17286 !! html+tidy
17287 <p>I always thought &#233; was a cute letter.
17288 </p>
17289 !! end
17290
17291 !! test
17292 text with entity-escaped character entity-like string: eacute
17293 !! wikitext
17294 I always thought &amp;eacute; was a cute letter.
17295 !! html
17296 <p>I always thought &amp;eacute; was a cute letter.
17297 </p>
17298 !! end
17299
17300 !! test
17301 text with undefined character entity: xacute
17302 !! wikitext
17303 I always thought &xacute; was a cute letter.
17304 !! html
17305 <p>I always thought &amp;xacute; was a cute letter.
17306 </p>
17307 !! end
17308
17309 !! test
17310 HTML5 tags
17311 !! wikitext
17312 <data value="5">five</data>
17313 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17314 <mark>This highlighted text</mark>
17315 !! html
17316 <p><data value="5">five</data>
17317 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17318 <mark>This highlighted text</mark>
17319 </p>
17320 !! end
17321
17322 !! test
17323 HTML tag with leading space is parsed as text
17324 !! wikitext
17325 < div>foo< /div>
17326 !! html
17327 <p>&lt; div&gt;foo&lt; /div&gt;
17328 </p>
17329 !! end
17330
17331 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17332 ## the HTML5 parsing spec.
17333 !! test
17334 Element with broken attribute syntax
17335 !! options
17336 parsoid=wt2html
17337 !! wikitext
17338 <div style=" style="123">hi</div>
17339 <div =>ho</div>
17340 !! html/php
17341 <div style="123">hi</div>
17342 <div>ho</div>
17343
17344 !! html/parsoid
17345 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17346 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17347 !! end
17348
17349 ###
17350 ### Nesting tests (see T43545, T52604, T53081)
17351 ###
17352
17353 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17354 # Note that html2wt is considerably more difficult if we use <b> in
17355 # the test case, instead of <small>
17356 !! test
17357 Ensure that HTML adoption agency algorithm is properly implemented.
17358 !! wikitext
17359 <small>X<small>Y</small>Z</small>
17360 !! html
17361 <p><small>X<small>Y</small>Z</small>
17362 </p>
17363 !! end
17364
17365 # This was T43545 in the PHP parser.
17366 !! test
17367 Nesting of <kbd>
17368 !! wikitext
17369 <kbd>X<kbd>Y</kbd>Z</kbd>
17370 !! html+tidy
17371 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17372 </p>
17373 !! end
17374
17375 # The following cases were T53081 in the PHP parser.
17376 # Note that there are some other nestable tags (b, i, etc) which are
17377 # not covered; see T53081 for discussion.
17378
17379 !! test
17380 Nesting of <em>
17381 !! wikitext
17382 <em>X<em>Y</em>Z</em>
17383 !! html+tidy
17384 <p><em>X<em>Y</em>Z</em>
17385 </p>
17386 !! end
17387
17388 !! test
17389 Nesting of <strong>
17390 !! wikitext
17391 <strong>X<strong>Y</strong>Z</strong>
17392 !! html+tidy
17393 <p><strong>X<strong>Y</strong>Z</strong>
17394 </p>
17395 !! end
17396
17397 !! test
17398 Nesting of <q>
17399 !! wikitext
17400 <q>X<q>Y</q>Z</q>
17401 !! html+tidy
17402 <p><q>X<q>Y</q>Z</q>
17403 </p>
17404 !! end
17405
17406 !! test
17407 Nesting of <ruby>
17408 !! wikitext
17409 <ruby>X<ruby>Y</ruby>Z</ruby>
17410 !! html
17411 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17412 </p>
17413 !! end
17414
17415 !! test
17416 Nesting of <bdo>
17417 !! wikitext
17418 <bdo>X<bdo>Y</bdo>Z</bdo>
17419 !! html
17420 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17421 </p>
17422 !! end
17423
17424
17425 ###
17426 ### Media links
17427 ###
17428
17429 !! test
17430 Media link
17431 !! wikitext
17432 [[Media:Foobar.jpg]]
17433 [[Media:Video.ogv]]
17434 [[:Media:Video.ogv]]
17435 !! html/php
17436 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17437 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17438 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17439 </p>
17440 !! html/parsoid
17441 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17442 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17443 <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>
17444 !! end
17445
17446 !! test
17447 Media link with text
17448 !! wikitext
17449 [[Media:Foobar.jpg|A neat file to look at]]
17450 !! html/php
17451 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17452 </p>
17453 !! html/parsoid
17454 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17455 !! end
17456
17457 # FIXME: this is still bad HTML tag nesting
17458 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17459 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17460 !! test
17461 Media link with nasty text
17462 !! wikitext
17463 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17464 !! html/php
17465 <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>
17466
17467 !! html/php+tidy
17468 <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>
17469 !! html/parsoid
17470 <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>
17471
17472 !! end
17473
17474 !! test
17475 Media link to nonexistent file (T3702)
17476 !! wikitext
17477 [[Media:No such.jpg]]
17478 [[Media:No_such file.jpg]]
17479 !! html/php
17480 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17481 <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>
17482 </p>
17483 !! html/parsoid
17484 <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>
17485 <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>
17486 !! end
17487
17488 !! test
17489 Image link to nonexistent file (T3850 - good)
17490 !! wikitext
17491 [[File:No_such.jpg]]
17492 !! html/php
17493 <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>
17494 </p>
17495 !! html/parsoid
17496 <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>
17497 !! end
17498
17499 !! test
17500 :Image link to nonexistent file (T3850 - bad)
17501 !! wikitext
17502 [[:Image:No such.jpg]]
17503 !! html/php
17504 <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>
17505 </p>
17506 !! html/parsoid
17507 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17508 !! end
17509
17510 !! test
17511 Character reference normalization in link text (T3938)
17512 !! wikitext
17513 [[Main Page|this&that]]
17514 !! html
17515 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17516 </p>
17517 !!end
17518
17519 !! article
17520 אַ
17521 !! text
17522 Test for unicode normalization
17523
17524 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17525 !! endarticle
17526
17527 !! test
17528 (T21451) Links should refer to the normalized form.
17529 !! wikitext
17530 [[&#xFB2E;]]
17531 [[&#x5d0;&#x5b7;]]
17532 [[&#x5d0;ַ]]
17533 [[א&#x5b7;]]
17534 [[אַ]]
17535 !! html
17536 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17537 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17538 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17539 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17540 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17541 </p>
17542 !! end
17543
17544 !! test
17545 Empty attribute crash test (T4067)
17546 !! wikitext
17547 <font color="">foo</font>
17548 !! html
17549 <p><font color="">foo</font>
17550 </p>
17551 !! end
17552
17553 !! test
17554 Empty attribute crash test single-quotes (T4067)
17555 !! wikitext
17556 <font color=''>foo</font>
17557 !! html
17558 <p><font color="">foo</font>
17559 </p>
17560 !! end
17561
17562 !! test
17563 Attribute test: equals, then nothing
17564 !! options
17565 parsoid=wt2html,html2html
17566 !! wikitext
17567 <font color=>foo</font>
17568 !! html/php
17569 <p><font color="">foo</font>
17570 </p>
17571 !! html/parsoid
17572 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17573 !! end
17574
17575 !! test
17576 Attribute test: unquoted value
17577 !! options
17578 parsoid=wt2html,html2html
17579 !! wikitext
17580 <font color=x>foo</font>
17581 !! html/php
17582 <p><font color="x">foo</font>
17583 </p>
17584 !! html/parsoid
17585 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17586 !! end
17587
17588 !! test
17589 Attribute test: unquoted but illegal value (hash)
17590 !! wikitext
17591 <font color=#x>foo</font>
17592 !! html
17593 <p><font color="#x">foo</font>
17594 </p>
17595 !! end
17596
17597 # Parsoid does not serialize to empty attribute syntax,
17598 # so wt2wt and html2wt cases are skipped
17599 !! test
17600 Attribute test: no value (T54330)
17601 !! options
17602 parsoid=wt2html,html2html
17603 !! wikitext
17604 <font color>foo</font>
17605 !! html/php
17606 <p><font color="">foo</font>
17607 </p>
17608 !! html/parsoid
17609 <p><font color="">foo</font></p>
17610 !! end
17611
17612 !! test
17613 T4095: link with three closing brackets
17614 !! wikitext
17615 [[Main Page]]]
17616 !! html/php
17617 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17618 </p>
17619 !! html/parsoid
17620 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17621 !! end
17622
17623 !! test
17624 T4095: link with pipe and three closing brackets
17625 !! wikitext
17626 [[Main Page|link]]]
17627 !! html/php
17628 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17629 </p>
17630 !! html/parsoid
17631 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17632 !! end
17633
17634 !! test
17635 T4095: link with pipe and three closing brackets, version 2
17636 !! wikitext
17637 [[Main Page|[http://example.com/]]]
17638 !! html/php
17639 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17640 </p>
17641 !! html/parsoid
17642 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17643 !! end
17644
17645
17646 ###
17647 ### Safety
17648 ###
17649
17650 !! article
17651 Template:Dangerous attribute
17652 !! text
17653 " onmouseover="alert(document.cookie)
17654 !! endarticle
17655
17656 !! article
17657 Template:Dangerous style attribute
17658 !! text
17659 border-size: expression(alert(document.cookie))
17660 !! endarticle
17661
17662 !! article
17663 Template:Div style
17664 !! text
17665 <div style="float: right; {{{1}}}">Magic div</div>
17666 !! endarticle
17667
17668 !! test
17669 T4304: HTML attribute safety (safe template; regression T4309)
17670 !! wikitext
17671 <div title="{{test}}"></div>
17672 !! html/php
17673 <div title="This is a test template"></div>
17674
17675 !! html/parsoid
17676 <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>
17677 !! end
17678
17679 # Parsoid has enough context to handle this case
17680 !! test
17681 T4304: HTML attribute safety (dangerous template; 2309)
17682 !! wikitext
17683 <div title="{{dangerous attribute}}"></div>
17684 !! html/php
17685 <div title=""></div>
17686
17687 !! html/parsoid
17688 <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>
17689 !! end
17690
17691 !! test
17692 T4304: HTML attribute safety (dangerous style template; 2309)
17693 !! wikitext
17694 <div style="{{dangerous style attribute}}"></div>
17695 !! html/php
17696 <div style="/* insecure input */"></div>
17697
17698 !! html/parsoid
17699 <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>
17700 !! end
17701
17702 !! test
17703 T4304: HTML attribute safety (safe parameter; 2309)
17704 !! wikitext
17705 {{div style|width: 200px}}
17706 !! html/php
17707 <div style="float: right; width: 200px">Magic div</div>
17708
17709 !! html/parsoid
17710 <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>
17711 !! end
17712
17713 !! test
17714 T4304: HTML attribute safety (unsafe parameter; 2309)
17715 !! wikitext
17716 {{div style|width: expression(alert(document.cookie))}}
17717 !! html/php
17718 <div style="/* insecure input */">Magic div</div>
17719
17720 !! html/parsoid
17721 <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>
17722 !! end
17723
17724 ## Parsoid output here differs; needs investigation.
17725 !! test
17726 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17727 !! wikitext
17728 {{div style|"><script>alert(document.cookie)</script>}}
17729 !! html
17730 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17731
17732 !! end
17733
17734 ## Parsoid output here differs; needs investigation.
17735 !! test
17736 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17737 !! wikitext
17738 {{div style|" ><script>alert(document.cookie)</script>}}
17739 !! html
17740 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17741
17742 !! end
17743
17744 !! test
17745 T4304: HTML attribute safety (link)
17746 !! wikitext
17747 <div title="[[Main Page]]"></div>
17748 !! html/php
17749 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17750
17751 !! html/parsoid
17752 <div title="[[Main Page]]"></div>
17753 !! end
17754
17755 !! test
17756 T4304: HTML attribute safety (italics)
17757 !! wikitext
17758 <div title="''foobar''"></div>
17759 !! html
17760 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17761
17762 !! end
17763
17764 !! test
17765 T4304: HTML attribute safety (bold)
17766 !! wikitext
17767 <div title="'''foobar'''"></div>
17768 !! html
17769 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17770
17771 !! end
17772
17773 !! test
17774 T4304: HTML attribute safety (ISBN)
17775 !! wikitext
17776 <div title="ISBN 1234567890"></div>
17777 !! html
17778 <div title="&#73;SBN 1234567890"></div>
17779
17780 !! end
17781
17782 !! test
17783 T4304: HTML attribute safety (RFC)
17784 !! wikitext
17785 <div title="RFC 1234"></div>
17786 !! html
17787 <div title="&#82;FC 1234"></div>
17788
17789 !! end
17790
17791 !! test
17792 T4304: HTML attribute safety (PMID)
17793 !! wikitext
17794 <div title="PMID 1234567890"></div>
17795 !! html
17796 <div title="&#80;MID 1234567890"></div>
17797
17798 !! end
17799
17800 !! test
17801 T4304: HTML attribute safety (web link)
17802 !! wikitext
17803 <div title="http://example.com/"></div>
17804 !! html
17805 <div title="http&#58;//example.com/"></div>
17806
17807 !! end
17808
17809 !! test
17810 T4304: HTML attribute safety (named web link)
17811 !! wikitext
17812 <div title="[http://example.com/ link]"></div>
17813 !! html/php
17814 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17815
17816 !! html/parsoid
17817 <div title="[http://example.com/ link]"></div>
17818 !! end
17819
17820 !! test
17821 T5244: HTML attribute safety (extension; safe)
17822 !! wikitext
17823 <div style="<nowiki>background:blue</nowiki>"></div>
17824 !! html/php
17825 <div style="background:blue"></div>
17826
17827 !! html/parsoid
17828 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17829 !! end
17830
17831 !! test
17832 T5244: HTML attribute safety (extension; unsafe)
17833 !! wikitext
17834 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17835 !! html/php
17836 <div style="/* insecure input */"></div>
17837
17838 !! html/parsoid
17839 <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>
17840 !! end
17841
17842 # More MSIE fun discovered by Tom Gilder
17843
17844 !! test
17845 MSIE CSS safety test: spurious slash
17846 !! wikitext
17847 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17848 !! html/php
17849 <div style="/* insecure input */">evil</div>
17850
17851 !! html/parsoid
17852 <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>
17853 !! end
17854
17855 !! test
17856 MSIE CSS safety test: hex code
17857 !! wikitext
17858 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17859 !! html/php
17860 <div style="/* insecure input */">evil</div>
17861
17862 !! html/parsoid
17863 <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>
17864 !! end
17865
17866 !! test
17867 MSIE CSS safety test: comment in url
17868 !! wikitext
17869 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17870 !! html/php
17871 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17872
17873 !! html/parsoid
17874 <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>
17875 !! end
17876
17877 !! test
17878 MSIE CSS safety test: comment in expression
17879 !! wikitext
17880 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17881 !! html/php
17882 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17883
17884 !! html/parsoid
17885 <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>
17886 !! end
17887
17888 !! test
17889 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17890 !! wikitext
17891 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17892 !! html/php
17893 <p style="/* invalid control char */">A</p>
17894
17895 !! html/parsoid
17896 <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>
17897 !! end
17898
17899 !! test
17900 MSIE 6 CSS safety test: Fullwidth (T57332)
17901 !! wikitext
17902 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17903 <div style="top:EXPRESSION(alert())">B</div>
17904 !! html/php
17905 <p style="/* insecure input */">A</p>
17906 <div style="/* insecure input */">B</div>
17907
17908 !! html/parsoid
17909 <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>
17910 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17911 !! end
17912
17913 !! test
17914 MSIE 6 CSS safety test: IPA extensions (T57332)
17915 !! wikitext
17916 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17917 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17918 !! html/php
17919 <div style="/* insecure input */">A</div>
17920 <p style="/* insecure input */">B</p>
17921
17922 !! html/parsoid
17923 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17924 <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>
17925 !! end
17926
17927 !! test
17928 MSIE 6 CSS safety test: sup/sub script (T57332)
17929 !! wikitext
17930 <div style="background-image:url⁽javascript:alert())">A</div>
17931 <div style="background-image:url₍javascript:alert())">B</div>
17932 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17933 !! html/php
17934 <div style="/* insecure input */">A</div>
17935 <div style="/* insecure input */">B</div>
17936 <p style="/* insecure input */">C</p>
17937
17938 !! html/parsoid
17939 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17940 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17941 <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>
17942 !! end
17943
17944 !! test
17945 Opera -o-link CSS
17946 !! options
17947 parsoid=wt2html,html2html
17948 !! wikitext
17949 <div
17950 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;"
17951 style="-o-link:attr(title);-o-link-source:current">X</div>
17952 !! html/php
17953 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17954
17955 !! html/parsoid
17956 <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>
17957 !! end
17958
17959 !! test
17960 MSIE 6 CSS safety test: Repetition markers (T57332)
17961 !! wikitext
17962 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17963 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17964 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17965 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17966 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17967 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17968 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17969 !! html/php
17970 <p style="/* insecure input */">A</p>
17971 <p style="/* insecure input */">B</p>
17972 <p style="/* insecure input */">C</p>
17973 <p style="/* insecure input */">D</p>
17974 <p style="/* insecure input */">E</p>
17975 <p style="/* insecure input */">F</p>
17976 <p style="/* insecure input */">G</p>
17977
17978 !! html/parsoid
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;)"}}'>A</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;)"}}'>B</p>
17981 <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>
17982 <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>
17983 <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>
17984 <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>
17985 <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>
17986 !! end
17987
17988 !! test
17989 Table attribute legitimate extension
17990 !! wikitext
17991 {|
17992 !+ style="<nowiki>color:blue</nowiki>"|status
17993 |}
17994 !! html
17995 <table>
17996 <tr>
17997 <th style="color:blue">status
17998 </th></tr></table>
17999
18000 !!end
18001
18002 !! test
18003 Table attribute safety
18004 !! wikitext
18005 {|
18006 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18007 |}
18008 !! html
18009 <table>
18010 <tr>
18011 <th style="/* insecure input */">status
18012 </th></tr></table>
18013
18014 !! end
18015
18016 !! test
18017 CSS line continuation 1
18018 !! wikitext
18019 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18020 !! html
18021 <div style="/* insecure input */"></div>
18022
18023 !! end
18024
18025 !! test
18026 CSS line continuation 2
18027 !! wikitext
18028 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18029 !! html
18030 <div style="/* invalid control char */"></div>
18031
18032 !! end
18033
18034 !! article
18035 Template:Identity
18036 !! text
18037 {{{1}}}
18038 !! endarticle
18039
18040 !! test
18041 Expansion of multi-line templates in attribute values (T8255)
18042 !! wikitext
18043 <div style="background: {{identity|#00FF00}}">-</div>
18044 !! html
18045 <div style="background: #00FF00">-</div>
18046
18047 !! end
18048
18049 !! test
18050 Expansion of multi-line templates in attribute values (T8255 sanity check)
18051 !! wikitext
18052 <div style="background:
18053 #00FF00">-</div>
18054 !! html/php
18055 <div style="background: #00FF00">-</div>
18056
18057 !! html/parsoid
18058 <div style="background:
18059 #00FF00">-</div>
18060 !! end
18061
18062 !! test
18063 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18064 !! wikitext
18065 <div style="background: &#10;#00FF00">-</div>
18066 !! html
18067 <div style="background: &#10;#00FF00">-</div>
18068
18069 !! end
18070
18071 !! test
18072 Tags which are hidden from tidiers cannot pass through the Sanitizer
18073 !! wikitext
18074 <mw:toc><script>alert();</script></mw:toc>
18075 !! html+tidy
18076 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18077 </p>
18078 !! end
18079
18080 ###
18081 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18082 ###
18083
18084 !! test
18085 Parser hook: empty input
18086 !! wikitext
18087 <tag></tag>
18088 !! html/php
18089 <pre>
18090 ''
18091 array (
18092 )
18093 </pre>
18094
18095 !! html/parsoid
18096 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18097 !! end
18098
18099 ## Don't expect parsoid to rt this form.
18100 !! test
18101 Parser hook: empty input using terminated empty elements
18102 !! options
18103 parsoid=wt2html,html2html
18104 !! wikitext
18105 <tag/>
18106 !! html/php
18107 <pre>
18108 NULL
18109 array (
18110 )
18111 </pre>
18112
18113 !! html/parsoid
18114 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18115 !! end
18116
18117 !! test
18118 Parser hook: empty input using terminated empty elements (space before)
18119 !! wikitext
18120 <tag />
18121 !! html/php
18122 <pre>
18123 NULL
18124 array (
18125 )
18126 </pre>
18127
18128 !! html/parsoid
18129 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18130 !! end
18131
18132 !! test
18133 Parser hook: basic input
18134 !! wikitext
18135 <tag>input</tag>
18136 !! html/php
18137 <pre>
18138 'input'
18139 array (
18140 )
18141 </pre>
18142
18143 !! html/parsoid
18144 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18145 !! end
18146
18147 ## Don't expect parsoid to rt this form.
18148 !! test
18149 Parser hook: case insensitive
18150 !! options
18151 parsoid=wt2html,html2html
18152 !! wikitext
18153 <TAG>input</TAG>
18154 !! html/php
18155 <pre>
18156 'input'
18157 array (
18158 )
18159 </pre>
18160
18161 !! html/parsoid
18162 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18163 !! end
18164
18165 ## Don't expect parsoid to rt this form.
18166 !! test
18167 Parser hook: case insensitive, redux
18168 !! options
18169 parsoid=wt2html,html2html
18170 !! wikitext
18171 <TaG>input</TAg>
18172 !! html/php
18173 <pre>
18174 'input'
18175 array (
18176 )
18177 </pre>
18178
18179 !! html/parsoid
18180 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18181 !! end
18182
18183 !! test
18184 Parser hook: nested tags
18185 !! wikitext
18186 <tag><tag></tag></tag>
18187 !! html/php
18188 <pre>
18189 '<tag>'
18190 array (
18191 )
18192 </pre>&lt;/tag&gt;
18193
18194 !! html/parsoid
18195 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18196 !! end
18197
18198 !! test
18199 Parser hook: basic arguments
18200 !! wikitext
18201 <tag width="200" height="100" depth="50" square=""></tag>
18202 !! html/php
18203 <pre>
18204 ''
18205 array (
18206 'width' => '200',
18207 'height' => '100',
18208 'depth' => '50',
18209 'square' => '',
18210 )
18211 </pre>
18212
18213 !! html/parsoid
18214 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18215 !! end
18216
18217 ## Don't expect parsoid to rt this form.
18218 !! test
18219 Parser hook: basic arguments, variations
18220 !! options
18221 parsoid=wt2html,html2html
18222 !! wikitext
18223 <tag width=200 height = "100" depth = '50' square></tag>
18224 !! html/php
18225 <pre>
18226 ''
18227 array (
18228 'width' => '200',
18229 'height' => '100',
18230 'depth' => '50',
18231 'square' => '',
18232 )
18233 </pre>
18234
18235 !! html/parsoid
18236 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18237 !! end
18238
18239 !! test
18240 Parser hook: argument containing a forward slash (T7344)
18241 !! wikitext
18242 <tag filename="/tmp/bla"></tag>
18243 !! html/php
18244 <pre>
18245 ''
18246 array (
18247 'filename' => '/tmp/bla',
18248 )
18249 </pre>
18250
18251 !! html/parsoid
18252 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18253 !! end
18254
18255 ## Don't expect parsoid to rt this form.
18256 !! test
18257 Parser hook: empty input using terminated empty elements (T4374)
18258 !! options
18259 parsoid=wt2html,html2html
18260 !! wikitext
18261 <tag foo=bar/>text
18262 !! html/php
18263 <pre>
18264 NULL
18265 array (
18266 'foo' => 'bar',
18267 )
18268 </pre>text
18269
18270 !! html/parsoid
18271 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18272 !! end
18273
18274 ## </tag> should be output literally since there is no matching tag that begins it
18275 ## Don't expect parsoid to rt this form.
18276 !! test
18277 Parser hook: basic arguments using terminated empty elements (T4374)
18278 !! options
18279 parsoid=wt2html
18280 !! wikitext
18281 <tag width=200 height = "100" depth = '50' square/>
18282 other stuff
18283 </tag>
18284 !! html/php
18285 <pre>
18286 NULL
18287 array (
18288 'width' => '200',
18289 'height' => '100',
18290 'depth' => '50',
18291 'square' => '',
18292 )
18293 </pre>
18294 <p>other stuff
18295 &lt;/tag&gt;
18296 </p>
18297 !! html/parsoid
18298 <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
18299 &lt;/tag></p>
18300 !! end
18301
18302 ## Don't expect parsoid to rt this form.
18303 !! test
18304 Parser hook: Don't allow unclosed extension tags
18305 !! options
18306 parsoid=wt2html
18307 !! wikitext
18308 test <tag>123
18309
18310 this is a '''test'''
18311 !! html/php
18312 <p>test &lt;tag&gt;123
18313 </p><p>this is a <b>test</b>
18314 </p>
18315 !! html/parsoid
18316 <p>test &lt;tag>123</p>
18317
18318 <p>this is a <b>test</b></p>
18319 !! end
18320
18321 !! test
18322 Parser hook: horizontal rule inside extension tag that outputs <pre>
18323 !! wikitext
18324 <tag>
18325 Hello
18326 <hr/>
18327 Goodbye
18328 </tag>
18329 !! html/php
18330 <pre>
18331 '
18332 Hello
18333 <hr/>
18334 Goodbye
18335 '
18336 array (
18337 )
18338 </pre>
18339
18340 !! end
18341
18342 ###
18343 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18344 ###
18345
18346 !! test
18347 Parser hook: static parser hook not inside a comment
18348 !! wikitext
18349 <statictag>hello, world</statictag>
18350
18351 <statictag action="flush" />
18352 !! html/php
18353 <p><br />
18354 hello, world
18355 </p>
18356 !! html/parsoid
18357 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18358 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18359 !! end
18360
18361 !! test
18362 Parser hook: static parser hook inside a comment
18363 !! wikitext
18364 <!-- <statictag>hello, world</statictag> -->
18365 <statictag action="flush" />
18366 !! html/php
18367 <p><br />
18368 </p>
18369 !! html/parsoid
18370 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18371 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18372 !! end
18373
18374 # Nested template calls; this case was broken by Parser.php rev 1.506,
18375 # since reverted.
18376
18377 !! article
18378 Template:One-parameter
18379 !! text
18380 (My parameter is: {{{1}}})
18381 !! endarticle
18382
18383 !! article
18384 Template:Map-one-parameter
18385 !! text
18386 {{{{{1}}}|{{{2}}}}}
18387 !! endarticle
18388
18389 !! test
18390 Nested template calls
18391 !! wikitext
18392 {{Map-one-parameter|One-parameter|param}}
18393 !! html
18394 <p>(My parameter is: param)
18395 </p>
18396 !! end
18397
18398
18399 ###
18400 ### Sanitizer
18401 ###
18402
18403 # Remex wraps empty tag runs with p-tags.
18404 # Parsoid strips them out during p-wrapping.
18405 !! test
18406 Sanitizer: Closing of open tags
18407 !! wikitext
18408 <s></s><table></table>
18409 !! html/php+tidy
18410 <p><s></s></p><table></table>
18411 !! html/parsoid
18412 <s></s><table></table>
18413 !! end
18414
18415 !! test
18416 Sanitizer: Closing of open but not closed tags
18417 !! wikitext
18418 <s>foo
18419 !! html
18420 <p><s>foo</s>
18421 </p>
18422 !! end
18423
18424 !! test
18425 Sanitizer: Closing of closed but not open tags
18426 !! options
18427 parsoid=wt2html
18428 !! wikitext
18429 </s>
18430 !! html/php+tidy
18431 <p class="mw-empty-elt">
18432 </p>
18433 !! html/parsoid
18434 !! end
18435
18436 !! test
18437 Sanitizer: Closing of closed but not open table tags
18438 !! options
18439 parsoid=wt2html
18440 !! wikitext
18441 Table not started</td></tr></table>
18442 !! html+tidy
18443 <p>Table not started
18444 </p>
18445 !! end
18446
18447 !! test
18448 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18449 !! config
18450 wgFragmentMode=[ 'html5', 'legacy' ]
18451 !! wikitext
18452 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18453 !! html/php
18454 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18455 </p>
18456 !! html/parsoid
18457 <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>
18458 !! end
18459
18460 !! test
18461 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18462 !! config
18463 wgFragmentMode=[ 'legacy' ]
18464 !! wikitext
18465 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18466 !! html/php
18467 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18468 </p>
18469 !! end
18470
18471 # In HTML5, the restrictions are that id must contain at least one character,
18472 # and must not contain any space characters.
18473 !! test
18474 Sanitizer: Validating the contents of the id attribute (T6515)
18475 !! options
18476 disabled
18477 !! wikitext
18478 <br id="" /><br id="a space" />
18479 !! html
18480 Something ...
18481 !! end
18482
18483 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18484 !! test
18485 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18486 !! options
18487 disabled
18488 !! wikitext
18489 <br id="foo" /><br id="foo" />
18490 !! html
18491 Something need to be done. foo-2 ?
18492 !! end
18493
18494 !! test
18495 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18496 !! wikitext
18497 <div itemscope>
18498 <meta itemprop="hello" content="world">
18499 <meta http-equiv="refresh" content="5">
18500 <meta itemprop="hello" http-equiv="refresh" content="5">
18501 <link itemprop="hello" href="{{SERVER}}">
18502 <link rel="stylesheet" href="{{SERVER}}">
18503 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18504 </div>
18505 !! html
18506 <div itemscope="">
18507 <p> <meta itemprop="hello" content="world" />
18508 &lt;meta http-equiv="refresh" content="5"&gt;
18509 <meta itemprop="hello" content="5" />
18510 <link itemprop="hello" href="http&#58;//example.org" />
18511 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18512 <link itemprop="hello" href="http&#58;//example.org" />
18513 </p>
18514 </div>
18515
18516 !! end
18517
18518 !! test
18519 Sanitizer: Strip comments from CSS attributes
18520 !! options
18521 parsoid=wt2html,wt2wt
18522 !! wikitext
18523 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18524 !! html/php
18525 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18526 </p>
18527 !! html/parsoid
18528 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18529 !! end
18530
18531 !! test
18532 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18533 !! wikitext
18534 [[meatball:Soft"Security]]
18535 !! html/php
18536 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18537 </p>
18538 !! html/parsoid
18539 <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>
18540 !! end
18541
18542 !! test
18543 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18544 !! wikitext
18545 [[meatball:Foo<Bar]]
18546 [[meatball:Foo>Bar]]
18547 [[meatball:Foo&lt;bar]]
18548 [[meatball:Foo&gt;bar]]
18549 !! html/php
18550 <p>[[meatball:Foo&lt;Bar]]
18551 [[meatball:Foo&gt;Bar]]
18552 [[meatball:Foo&lt;bar]]
18553 [[meatball:Foo&gt;bar]]
18554 </p>
18555 !! html/parsoid
18556 <p>[[meatball:Foo&lt;Bar]]
18557 [[meatball:Foo>Bar]]
18558 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18559 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18560 !! end
18561
18562 !! test
18563 Language converter: output gets cut off unexpectedly (T7757)
18564 !! options
18565 language=zh
18566 !! wikitext
18567 this bit is safe: }-
18568
18569 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18570
18571 then we get cut off here: }-
18572
18573 all additional text is vanished
18574 !! html/php
18575 <p>this bit is safe: }-
18576 </p><p>but if we add a conversion instance: xxx
18577 </p><p>then we get cut off here: }-
18578 </p><p>all additional text is vanished
18579 </p>
18580 !! html/parsoid
18581 <p>this bit is safe: }-</p>
18582 <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>
18583 <p>then we get cut off here: }-</p>
18584 <p>all additional text is vanished</p>
18585 !! end
18586
18587 !! test
18588 Language converter glossary rules inside attributes (T119158)
18589 !! options
18590 language=sr variant=sr-el
18591 !! wikitext
18592 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18593
18594 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18595 !! html/php
18596 <p>
18597 </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>
18598 </p>
18599 !! html/parsoid
18600 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18601
18602 <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>
18603 !! end
18604
18605 !! test
18606 Self closed html pairs (T7487)
18607 !! wikitext
18608 <center><font id="bug" />Centered text</center>
18609 <div><font id="bug2" />In div text</div>
18610 !! html+tidy
18611 <center><font id="bug"></font>Centered text</center>
18612 <div><font id="bug2"></font>In div text</div>
18613 !! end
18614
18615 !! test
18616 Punctuation: nbsp before exclamation
18617 !! wikitext
18618 C'est grave !
18619 !! html
18620 <p>C'est grave&#160;!
18621 </p>
18622 !! end
18623
18624 !! test
18625 Punctuation: CSS !important (T13874)
18626 !! wikitext
18627 <div style="width:50% !important">important</div>
18628 !! html
18629 <div style="width:50% !important">important</div>
18630
18631 !!end
18632
18633 !! test
18634 Punctuation: CSS ! important (T13874; with space after)
18635 !! wikitext
18636 <div style="width:50% ! important">important</div>
18637 !! html
18638 <div style="width:50% ! important">important</div>
18639
18640 !!end
18641
18642 !! test
18643 HTML bullet list, closed tags (T7497)
18644 !! wikitext
18645 <ul>
18646 <li>One</li>
18647 <li>Two</li>
18648 </ul>
18649 !! html/php
18650 <ul>
18651 <li>One</li>
18652 <li>Two</li>
18653 </ul>
18654
18655 !! html/parsoid
18656 <ul data-parsoid='{"stx":"html"}'>
18657 <li data-parsoid='{"stx":"html"}'>One</li>
18658 <li data-parsoid='{"stx":"html"}'>Two</li>
18659 </ul>
18660
18661 !! end
18662
18663 !! test
18664 HTML bullet list, unclosed tags (T7497)
18665 !! wikitext
18666 <ul>
18667 <li>One
18668 <li>Two
18669 </ul>
18670 !! html/php+tidy
18671 <ul>
18672 <li>One
18673 </li><li>Two
18674 </li></ul>
18675 !! html/parsoid
18676 <ul data-parsoid='{"stx":"html"}'>
18677 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18678 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18679 </ul>
18680
18681 !! end
18682
18683 !! test
18684 HTML ordered list, closed tags (T7497)
18685 !! wikitext
18686 <ol>
18687 <li>One</li>
18688 <li>Two</li>
18689 </ol>
18690 !! html/php
18691 <ol>
18692 <li>One</li>
18693 <li>Two</li>
18694 </ol>
18695
18696 !! html/parsoid
18697 <ol data-parsoid='{"stx":"html"}'>
18698 <li data-parsoid='{"stx":"html"}'>One</li>
18699 <li data-parsoid='{"stx":"html"}'>Two</li>
18700 </ol>
18701
18702 !! end
18703
18704 !! test
18705 HTML ordered list, unclosed tags (T7497)
18706 !! options
18707 !! wikitext
18708 <ol>
18709 <li>One
18710 <li>Two
18711 </ol>
18712 !! html/php+tidy
18713 <ol>
18714 <li>One
18715 </li><li>Two
18716 </li></ol>
18717 !! html/parsoid
18718 <ol data-parsoid='{"stx":"html"}'>
18719 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18720 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18721 </ol>
18722
18723 !! end
18724
18725 !! test
18726 HTML nested bullet list, closed tags (T7497)
18727 !! wikitext
18728 <ul>
18729 <li>One</li>
18730 <li>Two:
18731 <ul>
18732 <li>Sub-one</li>
18733 <li>Sub-two</li>
18734 </ul>
18735 </li>
18736 </ul>
18737 !! html/php
18738 <ul>
18739 <li>One</li>
18740 <li>Two:
18741 <ul>
18742 <li>Sub-one</li>
18743 <li>Sub-two</li>
18744 </ul>
18745 </li>
18746 </ul>
18747
18748 !! html/parsoid
18749 <ul data-parsoid='{"stx":"html"}'>
18750 <li data-parsoid='{"stx":"html"}'>One</li>
18751 <li data-parsoid='{"stx":"html"}'>Two:
18752 <ul data-parsoid='{"stx":"html"}'>
18753 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18754 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18755 </ul>
18756 </li>
18757 </ul>
18758 !! end
18759
18760 !! test
18761 HTML nested bullet list, open tags (T7497)
18762 !! wikitext
18763 <ul>
18764 <li>One
18765 <li>Two:
18766 <ul>
18767 <li>Sub-one
18768 <li>Sub-two
18769 </ul>
18770 </ul>
18771 !! html+tidy
18772 <ul>
18773 <li>One
18774 </li><li>Two:
18775 <ul>
18776 <li>Sub-one
18777 </li><li>Sub-two
18778 </li></ul>
18779 </li></ul>
18780 !! end
18781
18782 !! test
18783 HTML nested ordered list, closed tags (T7497)
18784 !! wikitext
18785 <ol>
18786 <li>One</li>
18787 <li>Two:
18788 <ol>
18789 <li>Sub-one</li>
18790 <li>Sub-two</li>
18791 </ol>
18792 </li>
18793 </ol>
18794 !! html
18795 <ol>
18796 <li>One</li>
18797 <li>Two:
18798 <ol>
18799 <li>Sub-one</li>
18800 <li>Sub-two</li>
18801 </ol>
18802 </li>
18803 </ol>
18804
18805 !! end
18806
18807 !! test
18808 HTML nested ordered list, open tags (T7497)
18809 !! wikitext
18810 <ol>
18811 <li>One
18812 <li>Two:
18813 <ol>
18814 <li>Sub-one
18815 <li>Sub-two
18816 </ol>
18817 </ol>
18818 !! html/php
18819 <ol>
18820 <li>One
18821 <li>Two:
18822 <ol>
18823 <li>Sub-one
18824 <li>Sub-two
18825 </ol>
18826 </ol>
18827
18828 !! html/parsoid
18829 <ol>
18830 <li>One
18831 </li>
18832 <li>Two:
18833 <ol>
18834 <li>Sub-one
18835 </li>
18836 <li>Sub-two
18837 </li>
18838 </ol>
18839 </li>
18840 </ol>
18841
18842 !! end
18843
18844 !! test
18845 HTML ordered list item with parameters oddity
18846 !! wikitext
18847 <ol><li id="fragment">One</li>
18848 </ol>
18849 !! html
18850 <ol><li id="fragment">One</li>
18851 </ol>
18852
18853 !! end
18854
18855 # parsoid doesn't explicitly mark autonumbered links, see T55505
18856 !!test
18857 T7918: autonumbering
18858 !! wikitext
18859 [http://first/] [http://second] [ftp://ftp]
18860
18861 ftp://inlineftp
18862
18863 [mailto:enclosed@mail.tld With target]
18864
18865 [mailto:enclosed@mail.tld]
18866
18867 mailto:inline@mail.tld
18868 !! html/php
18869 <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>
18870 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18871 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18872 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18873 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18874 </p>
18875 !! html/parsoid
18876 <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>
18877 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18878 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18879 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18880 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18881 !! end
18882
18883
18884 #
18885 # Security and HTML correctness
18886 # From Nick Jenkins' fuzz testing
18887 #
18888
18889 !! test
18890 Fuzz testing: Parser13
18891 !! wikitext
18892 {|
18893 | http://a|
18894 !! html
18895 <table>
18896 <tr>
18897 <td>
18898 </td>
18899 </tr>
18900 </table>
18901
18902 !! end
18903
18904 # Note that Parsoid output differs from the PHP parser here: the PHP
18905 # parser breaks the URL for the magic word, while in Parsoid the URL
18906 # production takes precedence.
18907 !! test
18908 Fuzz testing: Parser14
18909 !! wikitext
18910 ==onmouseover===
18911 http://__TOC__
18912 !! html/php
18913 <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>
18914 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18915 <ul>
18916 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18917 </ul>
18918 </div>
18919
18920
18921 !! html/php+tidy
18922 <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>
18923 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18924 <ul>
18925 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18926 </ul>
18927 </div>
18928 !! html/parsoid
18929 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18930 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18931 !! end
18932
18933 !! test
18934 Fuzz testing: Parser14-table
18935 !! options
18936 parsoid=wt2html,html2html
18937 !! wikitext
18938 ==a==
18939 {| STYLE=__TOC__
18940 !! html
18941 <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>
18942 <table style="&#95;_TOC&#95;_">
18943 <tr><td></td></tr>
18944 </table>
18945
18946 !! html+tidy
18947 <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>
18948 <table style="__TOC__">
18949 <tr>
18950 <td></td>
18951 </tr>
18952 </table>
18953 !! html/parsoid
18954 <h2 id="a">a</h2>
18955 <table style="__TOC__"></table>
18956 !! end
18957
18958 # Known to produce bogus xml (extra </td>)
18959 # Don't add the html/php section since it generates broken HTML
18960 !! test
18961 Fuzz testing: Parser16
18962 !! wikitext
18963 {|
18964 !https://||||||
18965 !! html+tidy
18966 <table>
18967 <tbody><tr>
18968 <th>https://</th>
18969 <th></th>
18970 <th></th>
18971 <th>
18972
18973 </th></tr>
18974 </tbody></table>
18975 !! end
18976
18977 !! test
18978 Fuzz testing: Parser21
18979 !! wikitext
18980 {|
18981 !irc://{{ftp://a" onmouseover="alert('hello world');"
18982 |
18983 !! html
18984 <table>
18985 <tr>
18986 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18987 </th>
18988 <td>
18989 </td>
18990 </tr>
18991 </table>
18992
18993 !! end
18994
18995 !! test
18996 Fuzz testing: Parser22
18997 !! wikitext
18998 http://===r:::https://b
18999
19000 {|
19001 !! html
19002 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19003 </p>
19004 <table>
19005 <tr><td></td></tr>
19006 </table>
19007
19008 !! end
19009
19010 # Known to produce bad XML for now
19011 !! test
19012 Fuzz testing: Parser24
19013 !! options
19014 parsoid=wt2html
19015 !! wikitext
19016 {|
19017 {{{|
19018 <u CLASS=
19019 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19020 <br style="onmouseover='alert(document.cookie);' " />
19021
19022 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19023 |
19024 !! html/php
19025 <table>
19026 {{{|
19027 <u class="&#124;">}}}} &gt;
19028 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19029
19030 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19031 <tr>
19032 <td></u>
19033 </td>
19034 </tr>
19035 </table>
19036
19037 !! html/parsoid
19038 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19039 <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>"}'/>}}}} >
19040 <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}'>
19041
19042
19043
19044 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19045 !! end
19046
19047 # Note: the current result listed for this is not what the original one was,
19048 # but the original bug was JavaScript injection, which is fixed in any case.
19049 # It's not clear that the original result listed was any more correct than the
19050 # current one. Original result:
19051 # <p>{{{|
19052 # </p>
19053 # <li class="&#124;&#124;">
19054 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19055 !!test
19056 Fuzz testing: Parser25 (T8055)
19057 !! wikitext
19058 {{{
19059 |
19060 <LI CLASS=||
19061 >
19062 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19063 !! html/php
19064 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19065 </p>
19066 !! html/parsoid
19067 <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"]}'>
19068 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19069 !! end
19070
19071 !!test
19072 Fuzz testing: URL adjacent extension (with space, clean)
19073 !! wikitext
19074 http://example.com <nowiki>junk</nowiki>
19075 !! html/php
19076 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19077 </p>
19078 !! html/parsoid
19079 <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>
19080 !! end
19081
19082 !!test
19083 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19084 !! wikitext
19085 http://example.com<nowiki>junk</nowiki>
19086 !! html/php
19087 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19088 </p>
19089 !! html/parsoid
19090 <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>
19091 !! end
19092
19093 !! test
19094 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19095 !! wikitext
19096 http://example.com<pre>junk</pre>
19097 !! html/php
19098 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19099
19100 !! html/php+tidy
19101 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19102 !! html/parsoid
19103 <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>
19104 !! end
19105
19106 !! test
19107 Fuzz testing: image with bogus manual thumbnail
19108 !! wikitext
19109 [[Image:foobar.jpg|thumbnail= ]]
19110 !! html/php
19111 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19112
19113 !! html/parsoid
19114 <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>
19115 !! end
19116
19117 # Parsoid will emit the newline literally in wt2wt; see next test case.
19118 !! test
19119 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19120 !! options
19121 parsoid=wt2html
19122 !! wikitext
19123 <pre dir="&#10;"></pre>
19124 !! html/php
19125 <pre dir="&#10;"></pre>
19126
19127 !! html/parsoid
19128 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19129 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19130 !! end
19131
19132 !! test
19133 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19134 !! options
19135 parsoid=html2wt
19136 !! html/parsoid
19137 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19138 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19139 !! wikitext
19140 <pre dir="
19141 "></pre>
19142 !! html/php
19143 <pre dir=""></pre>
19144
19145 !! end
19146
19147 !! test
19148 Templates in extension attributes are not expanded
19149 !! wikitext
19150 <pre dir="{{echo|ltr}}"></pre>
19151 !! html/php
19152 <pre dir="{{echo|ltr}}"></pre>
19153
19154 !! html/parsoid
19155 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19156 !! end
19157
19158 !! test
19159 Parsing optional HTML elements (T8171)
19160 !! options
19161 !! wikitext
19162 <table>
19163 <tr>
19164 <td> Some tabular data</td>
19165 <td> More tabular data ...
19166 <td> And yet som tabular data</td>
19167 </tr>
19168 </table>
19169 !! html
19170 <table>
19171 <tr>
19172 <td> Some tabular data</td>
19173 <td> More tabular data ...
19174 </td><td> And yet som tabular data</td>
19175 </tr>
19176 </table>
19177
19178 !! end
19179
19180 !! test
19181 Correct handling of <td>, <tr> (T8171)
19182 !! options
19183 !! wikitext
19184 <table>
19185 <tr>
19186 <td> Some tabular data</td>
19187 <td> More tabular data ...</td>
19188 <td> And yet som tabular data</td>
19189 </tr>
19190 </table>
19191 !! html
19192 <table>
19193 <tr>
19194 <td> Some tabular data</td>
19195 <td> More tabular data ...</td>
19196 <td> And yet som tabular data</td>
19197 </tr>
19198 </table>
19199
19200 !! end
19201
19202
19203 !! test
19204 Parsing crashing regression (fr:JavaScript)
19205 !! wikitext
19206 </body></x>
19207 !! html
19208 <p>&lt;/body&gt;&lt;/x&gt;
19209 </p>
19210 !! end
19211
19212 !! test
19213 Inline wiki vs wiki block nesting
19214 !! wikitext
19215 '''Bold paragraph
19216
19217 New wiki paragraph
19218 !! html
19219 <p><b>Bold paragraph</b>
19220 </p><p>New wiki paragraph
19221 </p>
19222 !! end
19223
19224 # FIXME: The current php output is documented
19225 # and desired output is the parsoid target.
19226 !! test
19227 Inline HTML vs wiki block nesting
19228 !! wikitext
19229 <b>Bold paragraph
19230
19231 New wiki paragraph
19232 !! html/php
19233 <p><b>Bold paragraph
19234 </p><p>New wiki paragraph</b>
19235 </p>
19236 !! html/parsoid
19237 <p><b>Bold paragraph</b>
19238 </p><p>New wiki paragraph
19239 </p>
19240 !! end
19241
19242 # Original result was this:
19243 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19244 # </p>
19245 # While that might be marginally more intuitive, maybe, the six-apostrophe
19246 # construct is clearly pathological and the result stated here (which is what
19247 # the parser actually does) is about as reasonable as anything.
19248 !!test
19249 Mixing markup for italics and bold
19250 !! options
19251 !! wikitext
19252 '''bold''''''bold''bolditalics'''''
19253 !! html
19254 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19255 </p>
19256 !! end
19257
19258
19259 !! article
19260 Xyzzyx
19261 !! text
19262 Article for special page transclusion test
19263 !! endarticle
19264
19265 !! test
19266 Special page transclusion
19267 !! options
19268 !! wikitext
19269 {{Special:Prefixindex/Xyzzyx}}
19270 !! html
19271 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19272 </ul>
19273
19274 !! end
19275
19276 !! test
19277 Special page transclusion twice (T7021)
19278 !! options
19279 !! wikitext
19280 {{Special:Prefixindex/Xyzzyx}}
19281 {{Special:Prefixindex/Xyzzyx}}
19282 !! html
19283 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19284 </ul>
19285 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19286 </ul>
19287
19288 !! end
19289
19290 !! test
19291 Transclusion of default MediaWiki message
19292 !! wikitext
19293 {{MediaWiki:Mainpage}}
19294 !! html
19295 <p>Main Page
19296 </p>
19297 !! end
19298
19299 !! test
19300 Transclusion of nonexistent MediaWiki message
19301 !! wikitext
19302 {{MediaWiki:Mainpagexxx}}
19303 !! html
19304 <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>
19305 </p>
19306 !! end
19307
19308 !! test
19309 Transclusion of MediaWiki message with underscore
19310 !! wikitext
19311 {{MediaWiki:history_short}}
19312 !! html
19313 <p>History
19314 </p>
19315 !! end
19316
19317 !! test
19318 Transclusion of MediaWiki message with space
19319 !! wikitext
19320 {{MediaWiki:history short}}
19321 !! html
19322 <p>History
19323 </p>
19324 !! end
19325
19326 !! test
19327 Invalid header with following text
19328 !! wikitext
19329 = x = y
19330 !! html
19331 <p>= x = y
19332 </p>
19333 !! end
19334
19335
19336 !! test
19337 Section extraction test (section 0)
19338 !! options
19339 section=0
19340 !! wikitext
19341 start
19342 ==a==
19343 ===aa===
19344 ====aaa====
19345 ==b==
19346 ===ba===
19347 ===bb===
19348 ====bba====
19349 ===bc===
19350 ==c==
19351 ===ca===
19352 !! html/php
19353 start
19354 !! end
19355
19356 !! test
19357 Section extraction test (section 1)
19358 !! options
19359 section=1
19360 !! wikitext
19361 start
19362 ==a==
19363 ===aa===
19364 ====aaa====
19365 ==b==
19366 ===ba===
19367 ===bb===
19368 ====bba====
19369 ===bc===
19370 ==c==
19371 ===ca===
19372 !! html/php
19373 ==a==
19374 ===aa===
19375 ====aaa====
19376 !! end
19377
19378 !! test
19379 Section extraction test (section 2)
19380 !! options
19381 section=2
19382 !! wikitext
19383 start
19384 ==a==
19385 ===aa===
19386 ====aaa====
19387 ==b==
19388 ===ba===
19389 ===bb===
19390 ====bba====
19391 ===bc===
19392 ==c==
19393 ===ca===
19394 !! html/php
19395 ===aa===
19396 ====aaa====
19397 !! end
19398
19399 !! test
19400 Section extraction test (section 3)
19401 !! options
19402 section=3
19403 !! wikitext
19404 start
19405 ==a==
19406 ===aa===
19407 ====aaa====
19408 ==b==
19409 ===ba===
19410 ===bb===
19411 ====bba====
19412 ===bc===
19413 ==c==
19414 ===ca===
19415 !! html/php
19416 ====aaa====
19417 !! end
19418
19419 !! test
19420 Section extraction test (section 4)
19421 !! options
19422 section=4
19423 !! wikitext
19424 start
19425 ==a==
19426 ===aa===
19427 ====aaa====
19428 ==b==
19429 ===ba===
19430 ===bb===
19431 ====bba====
19432 ===bc===
19433 ==c==
19434 ===ca===
19435 !! html/php
19436 ==b==
19437 ===ba===
19438 ===bb===
19439 ====bba====
19440 ===bc===
19441 !! end
19442
19443 !! test
19444 Section extraction test (section 5)
19445 !! options
19446 section=5
19447 !! wikitext
19448 start
19449 ==a==
19450 ===aa===
19451 ====aaa====
19452 ==b==
19453 ===ba===
19454 ===bb===
19455 ====bba====
19456 ===bc===
19457 ==c==
19458 ===ca===
19459 !! html/php
19460 ===ba===
19461 !! end
19462
19463 !! test
19464 Section extraction test (section 6)
19465 !! options
19466 section=6
19467 !! wikitext
19468 start
19469 ==a==
19470 ===aa===
19471 ====aaa====
19472 ==b==
19473 ===ba===
19474 ===bb===
19475 ====bba====
19476 ===bc===
19477 ==c==
19478 ===ca===
19479 !! html/php
19480 ===bb===
19481 ====bba====
19482 !! end
19483
19484 !! test
19485 Section extraction test (section 7)
19486 !! options
19487 section=7
19488 !! wikitext
19489 start
19490 ==a==
19491 ===aa===
19492 ====aaa====
19493 ==b==
19494 ===ba===
19495 ===bb===
19496 ====bba====
19497 ===bc===
19498 ==c==
19499 ===ca===
19500 !! html/php
19501 ====bba====
19502 !! end
19503
19504 !! test
19505 Section extraction test (section 8)
19506 !! options
19507 section=8
19508 !! wikitext
19509 start
19510 ==a==
19511 ===aa===
19512 ====aaa====
19513 ==b==
19514 ===ba===
19515 ===bb===
19516 ====bba====
19517 ===bc===
19518 ==c==
19519 ===ca===
19520 !! html/php
19521 ===bc===
19522 !! end
19523
19524 !! test
19525 Section extraction test (section 9)
19526 !! options
19527 section=9
19528 !! wikitext
19529 start
19530 ==a==
19531 ===aa===
19532 ====aaa====
19533 ==b==
19534 ===ba===
19535 ===bb===
19536 ====bba====
19537 ===bc===
19538 ==c==
19539 ===ca===
19540 !! html/php
19541 ==c==
19542 ===ca===
19543 !! end
19544
19545 !! test
19546 Section extraction test (section 10)
19547 !! options
19548 section=10
19549 !! wikitext
19550 start
19551 ==a==
19552 ===aa===
19553 ====aaa====
19554 ==b==
19555 ===ba===
19556 ===bb===
19557 ====bba====
19558 ===bc===
19559 ==c==
19560 ===ca===
19561 !! html/php
19562 ===ca===
19563 !! end
19564
19565 !! test
19566 Section extraction test (nonexistent section 11)
19567 !! options
19568 section=11
19569 !! wikitext
19570 start
19571 ==a==
19572 ===aa===
19573 ====aaa====
19574 ==b==
19575 ===ba===
19576 ===bb===
19577 ====bba====
19578 ===bc===
19579 ==c==
19580 ===ca===
19581 !! html/php
19582 !! end
19583
19584 !! test
19585 Section extraction test with bogus heading (section 1)
19586 !! options
19587 section=1
19588 !! wikitext
19589 ==a==
19590 ==bogus== not a legal section
19591 ==b==
19592 !! html/php
19593 ==a==
19594 ==bogus== not a legal section
19595 !! end
19596
19597 !! test
19598 Section extraction test with bogus heading (section 2)
19599 !! options
19600 section=2
19601 !! wikitext
19602 ==a==
19603 ==bogus== not a legal section
19604 ==b==
19605 !! html/php
19606 ==b==
19607 !! end
19608
19609 !! test
19610 Section extraction test with comment after heading (section 1)
19611 !! options
19612 section=1
19613 !! wikitext
19614 ==a==
19615 ==b== <!-- -->
19616 ==c==
19617 !! html/php
19618 ==a==
19619 !! end
19620
19621 !! test
19622 Section extraction test with comment after heading (section 2)
19623 !! options
19624 section=2
19625 !! wikitext
19626 ==a==
19627 ==b== <!-- -->
19628 ==c==
19629 !! html/php
19630 ==b== <!-- -->
19631 !! end
19632
19633 !! test
19634 Section extraction test with bogus <nowiki> heading (section 1)
19635 !! options
19636 section=1
19637 !! wikitext
19638 ==a==
19639 ==bogus== <nowiki>not a legal section</nowiki>
19640 ==b==
19641 !! html/php
19642 ==a==
19643 ==bogus== <nowiki>not a legal section</nowiki>
19644 !! end
19645
19646 !! test
19647 Section extraction test with bogus <nowiki> heading (section 2)
19648 !! options
19649 section=2
19650 !! wikitext
19651 ==a==
19652 ==bogus== <nowiki>not a legal section</nowiki>
19653 ==b==
19654 !! html/php
19655 ==b==
19656 !! end
19657
19658 # Formerly testing for T4587, now resolved by the use of unmarked sections
19659 # instead of respecting commented sections
19660 !! test
19661 Section extraction prefixed by comment (section 1)
19662 !! options
19663 section=1
19664 !! wikitext
19665 <!-- -->==sec1==
19666 ==sec2==
19667 !! html/php
19668 ==sec2==
19669 !!end
19670
19671 !! test
19672 Section extraction prefixed by comment (section 2)
19673 !! options
19674 section=2
19675 !! wikitext
19676 <!-- -->==sec1==
19677 ==sec2==
19678 !! html/php
19679
19680 !!end
19681
19682 # Formerly testing for T4607, now resolved by the use of unmarked sections
19683 # instead of respecting HTML-style headings
19684 !! test
19685 Section extraction, mixed wiki and html (section 1)
19686 !! options
19687 section=1
19688 !! wikitext
19689 <h2>unmarked</h2>
19690 unmarked
19691 ==1==
19692 one
19693 ==2==
19694 two
19695 !! html/php
19696 ==1==
19697 one
19698 !! end
19699
19700 !! test
19701 Section extraction, mixed wiki and html (section 2)
19702 !! options
19703 section=2
19704 !! wikitext
19705 <h2>unmarked</h2>
19706 unmarked
19707 ==1==
19708 one
19709 ==2==
19710 two
19711 !! html/php
19712 ==2==
19713 two
19714 !! end
19715
19716
19717 # Formerly testing for T5342
19718 !! test
19719 Section extraction, heading surrounded by <noinclude>
19720 !! options
19721 section=1
19722 !! wikitext
19723 <noinclude>==unmarked==</noinclude>
19724 ==marked==
19725 !! html/php
19726 ==marked==
19727 !!end
19728
19729 # Test behavior of T21910
19730 !! test
19731 Sectiion with all-equals
19732 !! options
19733 section=2
19734 !! wikitext
19735 ===
19736 The line above must have a trailing space
19737 === <!--
19738 --> <!-- -->
19739 But just in case it doesn't...
19740 !! html/php
19741 === <!--
19742 --> <!-- -->
19743 But just in case it doesn't...
19744 !! end
19745
19746 !! test
19747 Section replacement test (section 0)
19748 !! options
19749 replace=0,"xxx"
19750 !! wikitext
19751 start
19752 ==a==
19753 ===aa===
19754 ====aaa====
19755 ==b==
19756 ===ba===
19757 ===bb===
19758 ====bba====
19759 ===bc===
19760 ==c==
19761 ===ca===
19762 !! html/php
19763 xxx
19764
19765 ==a==
19766 ===aa===
19767 ====aaa====
19768 ==b==
19769 ===ba===
19770 ===bb===
19771 ====bba====
19772 ===bc===
19773 ==c==
19774 ===ca===
19775 !! end
19776
19777 !! test
19778 Section replacement test (section 1)
19779 !! options
19780 replace=1,"xxx"
19781 !! wikitext
19782 start
19783 ==a==
19784 ===aa===
19785 ====aaa====
19786 ==b==
19787 ===ba===
19788 ===bb===
19789 ====bba====
19790 ===bc===
19791 ==c==
19792 ===ca===
19793 !! html/php
19794 start
19795 xxx
19796
19797 ==b==
19798 ===ba===
19799 ===bb===
19800 ====bba====
19801 ===bc===
19802 ==c==
19803 ===ca===
19804 !! end
19805
19806 !! test
19807 Section replacement test (section 2)
19808 !! options
19809 replace=2,"xxx"
19810 !! wikitext
19811 start
19812 ==a==
19813 ===aa===
19814 ====aaa====
19815 ==b==
19816 ===ba===
19817 ===bb===
19818 ====bba====
19819 ===bc===
19820 ==c==
19821 ===ca===
19822 !! html/php
19823 start
19824 ==a==
19825 xxx
19826
19827 ==b==
19828 ===ba===
19829 ===bb===
19830 ====bba====
19831 ===bc===
19832 ==c==
19833 ===ca===
19834 !! end
19835
19836 !! test
19837 Section replacement test (section 3)
19838 !! options
19839 replace=3,"xxx"
19840 !! wikitext
19841 start
19842 ==a==
19843 ===aa===
19844 ====aaa====
19845 ==b==
19846 ===ba===
19847 ===bb===
19848 ====bba====
19849 ===bc===
19850 ==c==
19851 ===ca===
19852 !! html/php
19853 start
19854 ==a==
19855 ===aa===
19856 xxx
19857
19858 ==b==
19859 ===ba===
19860 ===bb===
19861 ====bba====
19862 ===bc===
19863 ==c==
19864 ===ca===
19865 !! end
19866
19867 !! test
19868 Section replacement test (section 4)
19869 !! options
19870 replace=4,"xxx"
19871 !! wikitext
19872 start
19873 ==a==
19874 ===aa===
19875 ====aaa====
19876 ==b==
19877 ===ba===
19878 ===bb===
19879 ====bba====
19880 ===bc===
19881 ==c==
19882 ===ca===
19883 !! html/php
19884 start
19885 ==a==
19886 ===aa===
19887 ====aaa====
19888 xxx
19889
19890 ==c==
19891 ===ca===
19892 !! end
19893
19894 !! test
19895 Section replacement test (section 5)
19896 !! options
19897 replace=5,"xxx"
19898 !! wikitext
19899 start
19900 ==a==
19901 ===aa===
19902 ====aaa====
19903 ==b==
19904 ===ba===
19905 ===bb===
19906 ====bba====
19907 ===bc===
19908 ==c==
19909 ===ca===
19910 !! html/php
19911 start
19912 ==a==
19913 ===aa===
19914 ====aaa====
19915 ==b==
19916 xxx
19917
19918 ===bb===
19919 ====bba====
19920 ===bc===
19921 ==c==
19922 ===ca===
19923 !! end
19924
19925 !! test
19926 Section replacement test (section 6)
19927 !! options
19928 replace=6,"xxx"
19929 !! wikitext
19930 start
19931 ==a==
19932 ===aa===
19933 ====aaa====
19934 ==b==
19935 ===ba===
19936 ===bb===
19937 ====bba====
19938 ===bc===
19939 ==c==
19940 ===ca===
19941 !! html/php
19942 start
19943 ==a==
19944 ===aa===
19945 ====aaa====
19946 ==b==
19947 ===ba===
19948 xxx
19949
19950 ===bc===
19951 ==c==
19952 ===ca===
19953 !! end
19954
19955 !! test
19956 Section replacement test (section 7)
19957 !! options
19958 replace=7,"xxx"
19959 !! wikitext
19960 start
19961 ==a==
19962 ===aa===
19963 ====aaa====
19964 ==b==
19965 ===ba===
19966 ===bb===
19967 ====bba====
19968 ===bc===
19969 ==c==
19970 ===ca===
19971 !! html/php
19972 start
19973 ==a==
19974 ===aa===
19975 ====aaa====
19976 ==b==
19977 ===ba===
19978 ===bb===
19979 xxx
19980
19981 ===bc===
19982 ==c==
19983 ===ca===
19984 !! end
19985
19986 !! test
19987 Section replacement test (section 8)
19988 !! options
19989 replace=8,"xxx"
19990 !! wikitext
19991 start
19992 ==a==
19993 ===aa===
19994 ====aaa====
19995 ==b==
19996 ===ba===
19997 ===bb===
19998 ====bba====
19999 ===bc===
20000 ==c==
20001 ===ca===
20002 !! html/php
20003 start
20004 ==a==
20005 ===aa===
20006 ====aaa====
20007 ==b==
20008 ===ba===
20009 ===bb===
20010 ====bba====
20011 xxx
20012
20013 ==c==
20014 ===ca===
20015 !!end
20016
20017 !! test
20018 Section replacement test (section 9)
20019 !! options
20020 replace=9,"xxx"
20021 !! wikitext
20022 start
20023 ==a==
20024 ===aa===
20025 ====aaa====
20026 ==b==
20027 ===ba===
20028 ===bb===
20029 ====bba====
20030 ===bc===
20031 ==c==
20032 ===ca===
20033 !! html/php
20034 start
20035 ==a==
20036 ===aa===
20037 ====aaa====
20038 ==b==
20039 ===ba===
20040 ===bb===
20041 ====bba====
20042 ===bc===
20043 xxx
20044 !! end
20045
20046 !! test
20047 Section replacement test (section 10)
20048 !! options
20049 replace=10,"xxx"
20050 !! wikitext
20051 start
20052 ==a==
20053 ===aa===
20054 ====aaa====
20055 ==b==
20056 ===ba===
20057 ===bb===
20058 ====bba====
20059 ===bc===
20060 ==c==
20061 ===ca===
20062 !! html/php
20063 start
20064 ==a==
20065 ===aa===
20066 ====aaa====
20067 ==b==
20068 ===ba===
20069 ===bb===
20070 ====bba====
20071 ===bc===
20072 ==c==
20073 xxx
20074 !! end
20075
20076 !! test
20077 Section replacement test with initial whitespace (T15728)
20078 !! options
20079 replace=2,"xxx"
20080 !! wikitext
20081 Preformatted initial line
20082 ==a==
20083 ===a===
20084 !! html/php
20085 Preformatted initial line
20086 ==a==
20087 xxx
20088 !! end
20089
20090
20091 !! test
20092 Section extraction, heading followed by pre with 20 spaces (T8398)
20093 !! options
20094 section=1
20095 !! wikitext
20096 ==a==
20097 a
20098 !! html/php
20099 ==a==
20100 a
20101 !! end
20102
20103 !! test
20104 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20105 !! options
20106 section=1
20107 !! wikitext
20108 ==a==
20109 a
20110 !! html/php
20111 ==a==
20112 a
20113 !! end
20114
20115
20116 !! test
20117 Section extraction, <pre> around bogus header (T12309)
20118 !! options
20119 section=2
20120 !! wikitext
20121 == Section One ==
20122 <pre>
20123 =======
20124 </pre>
20125
20126 == Section Two ==
20127 stuff
20128 !! html/php
20129 == Section Two ==
20130 stuff
20131 !! end
20132
20133 !! test
20134 Section replacement, <pre> around bogus header (T12309)
20135 !! options
20136 replace=2,"xxx"
20137 !! wikitext
20138 == Section One ==
20139 <pre>
20140 =======
20141 </pre>
20142
20143 == Section Two ==
20144 stuff
20145 !! html/php
20146 == Section One ==
20147 <pre>
20148 =======
20149 </pre>
20150
20151 xxx
20152 !! end
20153
20154 !! test
20155 Handling of &#x0A; in URLs
20156 !! wikitext
20157 *irc://&#x0A;a
20158 !! html/php
20159 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20160
20161 !! html/parsoid
20162 <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>
20163 !! end
20164
20165 !! test
20166 Handling of %0A in URLs
20167 !! wikitext
20168 *irc://%0Aa
20169 !! html/php
20170 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20171
20172 !! html/parsoid
20173 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20174 !! end
20175
20176 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20177 !! test
20178 5 quotes, code coverage +1 line
20179 !! options
20180 parsoid=wt2html
20181 !! wikitext
20182 '''''
20183 !! html/php
20184 !! html/parsoid
20185 <b><i></i></b>
20186 !! end
20187
20188 # same html as previous, but wikitext adjusted to match parsoid html2wt
20189 # note that wt2html and html2html will put the <i> before the <b>
20190 !! test
20191 5 quotes, code coverage +1 line w/ nowiki (1)
20192 !! options
20193 parsoid=wt2wt,html2wt
20194 !! wikitext
20195 '''''<nowiki/>'''''
20196 !! html/php
20197 <p><i></i>
20198 </p>
20199 !! html/parsoid
20200 <p><b><i></i></b></p>
20201 !! end
20202
20203 # same as previous, just swapping the <i> and <b>
20204 !! test
20205 5 quotes, code coverage +1 line w/ nowiki (2)
20206 !! wikitext
20207 '''''<nowiki/>'''''
20208 !! html/php
20209 <p><i></i>
20210 </p>
20211 !! html/parsoid
20212 <p><i><b></b></i></p>
20213 !! end
20214
20215 !! test
20216 Special:Search page linking.
20217 !! wikitext
20218 {{Special:search}}
20219 !! html
20220 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20221 </p>
20222 !! end
20223
20224 !! test
20225 {{!}} is a magic word
20226 !! wikitext
20227 {{!}} is a magic word there and {{!}} is still a magic word here
20228 | is not a magic word here but {{!}} is still a magic word here
20229 !! html/php
20230 <p>| is a magic word there and | is still a magic word here
20231 | is not a magic word here but | is still a magic word here
20232 </p>
20233 !! html/parsoid
20234 <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
20235 | 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>
20236 !! end
20237
20238 !! test
20239 Say the magic word
20240 !! options
20241 title=[[Parser test]]
20242 !! wikitext
20243 *{{PAGENAME}}
20244 *{{PAGENAMEE}}
20245 *{{FULLPAGENAME}}
20246 *{{FULLPAGENAMEE}}
20247 *{{BASEPAGENAME}}
20248 *{{BASEPAGENAMEE}}
20249 *{{SUBPAGENAME}}
20250 *{{SUBPAGENAMEE}}
20251 *{{ROOTPAGENAME}}
20252 *{{ROOTPAGENAMEE}}
20253 *{{TALKPAGENAME}}
20254 *{{TALKPAGENAMEE}}
20255 *{{SUBJECTPAGENAME}}
20256 *{{SUBJECTPAGENAMEE}}
20257 *{{NAMESPACEE}}
20258 *{{NAMESPACE}}
20259 *{{NAMESPACENUMBER}}
20260 *{{TALKSPACE}}
20261 *{{TALKSPACEE}}
20262 *{{SUBJECTSPACE}}
20263 *{{SUBJECTSPACEE}}
20264 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20265 !! html
20266 <ul><li>Parser test</li>
20267 <li>Parser_test</li>
20268 <li>Parser test</li>
20269 <li>Parser_test</li>
20270 <li>Parser test</li>
20271 <li>Parser_test</li>
20272 <li>Parser test</li>
20273 <li>Parser_test</li>
20274 <li>Parser test</li>
20275 <li>Parser_test</li>
20276 <li>Talk:Parser test</li>
20277 <li>Talk:Parser_test</li>
20278 <li>Parser test</li>
20279 <li>Parser_test</li>
20280 <li></li>
20281 <li></li>
20282 <li>0</li>
20283 <li>Talk</li>
20284 <li>Talk</li>
20285 <li></li>
20286 <li></li>
20287 <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>
20288
20289 !! end
20290 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20291
20292 !! test
20293 Gallery with valid attributes
20294 !! wikitext
20295 <gallery type="123" summary="345">
20296 File:File:Foobar.jpg
20297 </gallery>
20298 !! html/php
20299 <ul class="gallery mw-gallery-traditional" type="123">
20300 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20301 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20302 <div class="gallerytext">
20303 </div>
20304 </div></li>
20305 </ul>
20306
20307 !! html/parsoid
20308 <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"}}'>
20309 <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>
20310 </ul>
20311 !! end
20312
20313 ## Parsoid thinks the "centre" here is a property, not a caption.
20314 !! test
20315 Gallery
20316 !! options
20317 parsoid={
20318 "modes": ["wt2html"],
20319 "nativeGallery": true
20320 }
20321 !! wikitext
20322 <gallery>
20323 image1.png |
20324 image2.gif|||||
20325
20326 image3|
20327 image4 |300px| centre
20328 image5.svg| http://///////
20329 [[x|xx]]]]
20330 * image6
20331 </gallery>
20332 !! html/php
20333 <ul class="gallery mw-gallery-traditional">
20334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20335 <div class="thumb" style="height: 150px;">Image1.png</div>
20336 <div class="gallerytext">
20337 </div>
20338 </div></li>
20339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20340 <div class="thumb" style="height: 150px;">Image2.gif</div>
20341 <div class="gallerytext">
20342 </div>
20343 </div></li>
20344 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20345 <div class="thumb" style="height: 150px;">Image3</div>
20346 <div class="gallerytext">
20347 </div>
20348 </div></li>
20349 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20350 <div class="thumb" style="height: 150px;">Image4</div>
20351 <div class="gallerytext">
20352 <pre>centre
20353 </pre>
20354 </div>
20355 </div></li>
20356 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20357 <div class="thumb" style="height: 150px;">Image5.svg</div>
20358 <div class="gallerytext">
20359 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20360 </p>
20361 </div>
20362 </div></li>
20363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20364 <div class="thumb" style="height: 150px;">* image6</div>
20365 <div class="gallerytext">
20366 </div>
20367 </div></li>
20368 </ul>
20369
20370 !! html/parsoid
20371 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20372 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20373 <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>
20374 <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>
20375 <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>
20376 <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>
20377 <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>
20378 </ul>
20379 !! end
20380
20381 !! test
20382 Gallery (with options, html)
20383 !! options
20384 parsoid={
20385 "modes": ["wt2html", "html2html"],
20386 "nativeGallery": true
20387 }
20388 !! wikitext
20389 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20390 File:Nonexistent.jpg|caption
20391 File:Nonexistent.jpg
20392 image:foobar.jpg|some '''caption''' [[Main Page]]
20393 image:foobar.jpg
20394 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20395 </gallery>
20396 !! html/php
20397 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20398 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20399 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20400 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20401 <div class="gallerytext">
20402 <p>caption
20403 </p>
20404 </div>
20405 </div></li>
20406 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20407 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20408 <div class="gallerytext">
20409 </div>
20410 </div></li>
20411 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20412 <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>
20413 <div class="gallerytext">
20414 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20415 </p>
20416 </div>
20417 </div></li>
20418 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20419 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
20420 <div class="gallerytext">
20421 </div>
20422 </div></li>
20423 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20424 <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>
20425 <div class="gallerytext">
20426 <p>blabla.
20427 </p>
20428 </div>
20429 </div></li>
20430 </ul>
20431
20432 !! html/parsoid
20433 <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":{}}'>
20434 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20435 <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>
20436 <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>
20437 <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>
20438 <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>
20439 <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>
20440 </ul>
20441 !! end
20442
20443 !! test
20444 Gallery (with options, extsrc)
20445 !! options
20446 parsoid={
20447 "nativeGallery": false
20448 }
20449 !! wikitext
20450 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20451 File:Nonexistent.jpg|caption
20452 File:Nonexistent.jpg
20453 image:foobar.jpg|some '''caption''' [[Main Page]]
20454 image:foobar.jpg
20455 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20456 </gallery>
20457 !! html/php
20458 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20459 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20460 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20461 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20462 <div class="gallerytext">
20463 <p>caption
20464 </p>
20465 </div>
20466 </div></li>
20467 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20468 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20469 <div class="gallerytext">
20470 </div>
20471 </div></li>
20472 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20473 <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>
20474 <div class="gallerytext">
20475 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20476 </p>
20477 </div>
20478 </div></li>
20479 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20480 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
20481 <div class="gallerytext">
20482 </div>
20483 </div></li>
20484 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20485 <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>
20486 <div class="gallerytext">
20487 <p>blabla.
20488 </p>
20489 </div>
20490 </div></li>
20491 </ul>
20492
20493 !! html/parsoid
20494 <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"}}'>
20495 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20496 <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>
20497 <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>
20498 <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>
20499 <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>
20500 <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>
20501 </ul>
20502 !! end
20503
20504 !! test
20505 Gallery (without px units)
20506 !! wikitext
20507 <gallery widths="70" heights="40">
20508 File:Foobar.jpg
20509 </gallery>
20510 !! html/php
20511 <ul class="gallery mw-gallery-traditional">
20512 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20513 <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>
20514 <div class="gallerytext">
20515 </div>
20516 </div></li>
20517 </ul>
20518
20519 !! html/parsoid
20520 <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"}}'>
20521 <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>
20522 </ul>
20523 !! end
20524
20525 !! test
20526 Gallery (with invalid units)
20527 !! wikitext
20528 <gallery widths="70em" heights="40em">
20529 File:Foobar.jpg
20530 </gallery>
20531 !! html/php
20532 <ul class="gallery mw-gallery-traditional">
20533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20534 <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>
20535 <div class="gallerytext">
20536 </div>
20537 </div></li>
20538 </ul>
20539
20540 !! html/parsoid
20541 <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"}}'>
20542 <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>
20543 </ul>
20544 !! end
20545
20546 !! test
20547 Gallery with link that has fragment
20548 !! options
20549 parsoid={
20550 "modes": ["wt2html", "html2html"],
20551 "nativeGallery": true
20552 }
20553 !! wikitext
20554 <gallery>
20555 image:foobar.jpg|link=Main_Page
20556 image:foobar.jpg|link=Main_Page#section
20557 image:foobar.jpg|link=Main Page#section|caption
20558 </gallery>
20559 !! html/php
20560 <ul class="gallery mw-gallery-traditional">
20561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20562 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20563 <div class="gallerytext">
20564 </div>
20565 </div></li>
20566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20567 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="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>
20568 <div class="gallerytext">
20569 </div>
20570 </div></li>
20571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20572 <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>
20573 <div class="gallerytext">
20574 <p>caption
20575 </p>
20576 </div>
20577 </div></li>
20578 </ul>
20579
20580 !! html/parsoid
20581 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20582 <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>
20583 <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>
20584 <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>
20585 </ul>
20586 !! end
20587
20588 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20589 !! test
20590 Gallery with template inside caption
20591 !! options
20592 parsoid={
20593 "nativeGallery": true
20594 }
20595 !! wikitext
20596 <gallery caption="{{echo|hi}}">
20597 File:Foobar.jpg|{{echo|ho}}
20598 </gallery>
20599 !! html/php
20600 <ul class="gallery mw-gallery-traditional">
20601 <li class='gallerycaption'>{{echo|hi}}</li>
20602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20603 <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>
20604 <div class="gallerytext">
20605 <p>ho
20606 </p>
20607 </div>
20608 </div></li>
20609 </ul>
20610
20611 !! html/parsoid
20612 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20613 <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>
20614 <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>
20615 </ul>
20616 !! end
20617
20618 !! test
20619 Gallery with wikitext inside caption
20620 !! options
20621 parsoid={
20622 "nativeGallery": true
20623 }
20624 !! wikitext
20625 <gallery>
20626 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20627 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20628 </gallery>
20629 !! html/php
20630 <ul class="gallery mw-gallery-traditional">
20631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20632 <div class="thumb" style="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>
20633 <div class="gallerytext">
20634 <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>
20635 </p>
20636 </div>
20637 </div></li>
20638 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20639 <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>
20640 <div class="gallerytext">
20641 <p>This is a test template
20642 </p>
20643 </div>
20644 </div></li>
20645 </ul>
20646
20647 !! html/parsoid
20648 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20649 <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>
20650 <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>
20651 </ul>
20652 !! end
20653
20654 !! test
20655 Gallery (with showfilename option)
20656 !! options
20657 parsoid={
20658 "nativeGallery": true
20659 }
20660 !! wikitext
20661 <gallery showfilename="">
20662 File:Nonexistent.jpg|caption
20663 File:Nonexistent.jpg
20664 File:Foobar.jpg|some '''caption''' [[Main Page]]
20665 File:Foobar.jpg
20666 </gallery>
20667 !! html/php
20668 <ul class="gallery mw-gallery-traditional">
20669 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20670 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20671 <div class="gallerytext">
20672 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20673 caption
20674 </p>
20675 </div>
20676 </div></li>
20677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20678 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20679 <div class="gallerytext">
20680 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20681 </p>
20682 </div>
20683 </div></li>
20684 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20685 <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>
20686 <div class="gallerytext">
20687 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20688 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20689 </p>
20690 </div>
20691 </div></li>
20692 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20693 <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>
20694 <div class="gallerytext">
20695 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20696 </p>
20697 </div>
20698 </div></li>
20699 </ul>
20700
20701 !! html/parsoid
20702 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20703 <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>
20704 <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>
20705 <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>
20706 <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>
20707 </ul>
20708 !! end
20709
20710 ## Should Parsoid be preserving these variations? See T151367
20711 !! test
20712 Gallery (with namespace-less filenames)
20713 !! options
20714 parsoid={
20715 "modes": ["wt2html", "html2html"],
20716 "nativeGallery": true
20717 }
20718 !! wikitext
20719 <gallery>
20720 File:Nonexistent.jpg
20721 Nonexistent.jpg
20722 image:foobar.jpg
20723 foobar.jpg
20724 </gallery>
20725 !! html/php
20726 <ul class="gallery mw-gallery-traditional">
20727 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20728 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20729 <div class="gallerytext">
20730 </div>
20731 </div></li>
20732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20733 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20734 <div class="gallerytext">
20735 </div>
20736 </div></li>
20737 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20738 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20739 <div class="gallerytext">
20740 </div>
20741 </div></li>
20742 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20743 <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>
20744 <div class="gallerytext">
20745 </div>
20746 </div></li>
20747 </ul>
20748
20749 !! html/parsoid
20750 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20751 <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>
20752 <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>
20753 <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>
20754 <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>
20755 </ul>
20756 !! end
20757
20758 !! test
20759 Gallery override link with wikilink (T36852)
20760 !! options
20761 parsoid={
20762 "nativeGallery": true
20763 }
20764 !! wikitext
20765 <gallery>
20766 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20767 </gallery>
20768 !! html/php
20769 <ul class="gallery mw-gallery-traditional">
20770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20771 <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>
20772 <div class="gallerytext">
20773 </div>
20774 </div></li>
20775 </ul>
20776
20777 !! html/parsoid
20778 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20779 <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>
20780 </ul>
20781 !! end
20782
20783 !! test
20784 Gallery override link with absolute external link (T36852)
20785 !! options
20786 parsoid={
20787 "nativeGallery": true
20788 }
20789 !! wikitext
20790 <gallery>
20791 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20792 </gallery>
20793 !! html/php
20794 <ul class="gallery mw-gallery-traditional">
20795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20796 <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>
20797 <div class="gallerytext">
20798 </div>
20799 </div></li>
20800 </ul>
20801
20802 !! html/parsoid
20803 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20804 <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>
20805 </ul>
20806 !! end
20807
20808 !! test
20809 Gallery override link with absolute external link with LanguageConverter
20810 !! options
20811 language=zh
20812 !! wikitext
20813 <gallery>
20814 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20815 </gallery>
20816 !! html/php
20817 <ul class="gallery mw-gallery-traditional">
20818 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20819 <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>
20820 <div class="gallerytext">
20821 <p>caption
20822 </p>
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":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
20829 <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>
20830 </ul>
20831 !! end
20832
20833 !! test
20834 Gallery override link with malicious javascript (T36852)
20835 !! options
20836 parsoid={
20837 "modes": ["wt2html", "html2html"],
20838 "nativeGallery": true
20839 }
20840 !! wikitext
20841 <gallery>
20842 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20843 </gallery>
20844 !! html/php
20845 <ul class="gallery mw-gallery-traditional">
20846 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20847 <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>
20848 <div class="gallerytext">
20849 </div>
20850 </div></li>
20851 </ul>
20852
20853 !! html/parsoid
20854 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20855 <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>
20856 </ul>
20857 !! end
20858
20859 # Note that parsoid uses the invalid link as a caption, PHP does not.
20860 !! test
20861 Gallery with invalid title as link (T45964)
20862 !! options
20863 parsoid={
20864 "modes": ["wt2html", "html2html"],
20865 "nativeGallery": true
20866 }
20867 !! wikitext
20868 <gallery>
20869 File:Foobar.jpg|link=<
20870 </gallery>
20871 !! html/php
20872 <ul class="gallery mw-gallery-traditional">
20873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20874 <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>
20875 <div class="gallerytext">
20876 </div>
20877 </div></li>
20878 </ul>
20879
20880 !! html/parsoid
20881 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20882 <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>
20883 </ul>
20884 !! end
20885
20886 !! test
20887 Serialize gallery without attrs in data-mw
20888 !! options
20889 parsoid={
20890 "modes": ["html2wt"],
20891 "nativeGallery": true
20892 }
20893 !! html/parsoid
20894 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20895 <li class="gallerycaption">123</li>
20896 <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>
20897 </ul>
20898 !! wikitext
20899 <gallery caption="123">
20900 File:Test.png
20901 </gallery>
20902 !! end
20903
20904 !! test
20905 Gallery with class and style attributes
20906 !! options
20907 parsoid={
20908 "nativeGallery": true
20909 }
20910 !! wikitext
20911 <gallery class="center" style="text-align: center;">
20912 File:Foobar.jpg
20913 </gallery>
20914 !! html/php
20915 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20916 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20917 <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>
20918 <div class="gallerytext">
20919 </div>
20920 </div></li>
20921 </ul>
20922
20923 !! html/parsoid
20924 <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":{}}'>
20925 <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>
20926 </ul>
20927 !! end
20928
20929 !! test
20930 Gallery in slideshow mode
20931 !! options
20932 parsoid={
20933 "nativeGallery": true
20934 }
20935 !! wikitext
20936 <gallery mode="slideshow" showthumbnails="">
20937 File:Foobar.jpg
20938 </gallery>
20939 !! html/php
20940 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20942 <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>
20943 <div class="gallerytext">
20944 </div>
20945 </div></li>
20946 </ul>
20947
20948 !! html/parsoid
20949 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20950 <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>
20951 </ul>
20952 !! end
20953
20954 !! test
20955 HTML Hex character encoding (spells the word "JavaScript")
20956 !! options
20957 parsoid=wt2html,wt2wt,html2html
20958 !! wikitext
20959 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20960 !! html/php
20961 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20962 </p>
20963 !! html/parsoid
20964 <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>
20965 !! end
20966
20967 !! test
20968 HTML Hex character encoding bogus encoding (T28437 regression check)
20969 !! wikitext
20970 &#xsee;&#XSEE;
20971 !! html
20972 <p>&amp;#xsee;&amp;#XSEE;
20973 </p>
20974 !! end
20975
20976 !! test
20977 HTML Hex character encoding mixed case
20978 !! options
20979 parsoid=wt2html,wt2wt,html2html
20980 !! wikitext
20981 &#xEE;&#Xee;
20982 !! html/php
20983 <p>&#xee;&#xee;
20984 </p>
20985 !! html/parsoid
20986 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20987 !! end
20988
20989 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20990 # Note that U+000C (form feed) is not a valid XML character, so
20991 # it is banned even though allowed in HTML5.
20992 !! test
20993 Illegal character references (T106578)
20994 !! wikitext
20995 ; Null: &#00;
20996 ; FF: &#xC;
20997 ; CR: &#xD;
20998 ; Control (low): &#8;
20999 ; Control (high): &#x7F; &#x9F;
21000 ; Surrogate: &#xD83D;&#xDCA9;
21001 ; This is an okay astral character: &#x1F4A9;
21002 !! html+tidy
21003 <dl><dt>Null</dt>
21004 <dd>&amp;#00;</dd>
21005 <dt>FF</dt>
21006 <dd>&amp;#xC;</dd>
21007 <dt>CR</dt>
21008 <dd>&amp;#xD;</dd>
21009 <dt>Control (low)</dt>
21010 <dd>&amp;#8;</dd>
21011 <dt>Control (high)</dt>
21012 <dd>&amp;#x7F; &amp;#x9F;</dd>
21013 <dt>Surrogate</dt>
21014 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21015 <dt>This is an okay astral character</dt>
21016 <dd>&#x1f4a9;</dd></dl>
21017 !! end
21018
21019 !! test
21020 __FORCETOC__ override
21021 !! wikitext
21022 __NEWSECTIONLINK__
21023 __FORCETOC__
21024 !! html/php
21025 <p><br />
21026 </p>
21027 !! end
21028
21029 !! test
21030 ISBN code coverage
21031 !! wikitext
21032 ISBN 978-0-1234-56&#x20;789
21033 !! html/php
21034 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21035 </p>
21036 !! html/parsoid
21037 <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>
21038 !! end
21039
21040 !! test
21041 ISBN followed by 5 spaces
21042 !! wikitext
21043 ISBN
21044 !! html
21045 <p>ISBN
21046 </p>
21047 !! end
21048
21049 !! test
21050 Double ISBN
21051 !! wikitext
21052 ISBN ISBN 1234567890
21053 !! html/php
21054 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21055 </p>
21056 !! html/parsoid
21057 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21058 !! end
21059
21060 # Uppercase X and lowercase x as well
21061 !! test
21062 ISBN with an X
21063 !! wikitext
21064 ISBN 3-462-04561-X
21065 ISBN 3-462-04561-x
21066 ISBN 080442957X
21067 ISBN 080442957x
21068 ISBN 978080442957X
21069 ISBN 978080442957x
21070 !! html/php
21071 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21072 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21073 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21074 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21075 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21076 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21077 </p>
21078 !! html/parsoid
21079 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21080 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21081 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21082 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21083 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21084 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21085 !! end
21086
21087 !! test
21088 ISBN with empty prefix (parsoid test)
21089 !! wikitext
21090 ISBN 1234567890
21091 !! html/php
21092 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21093 </p>
21094 !! html/parsoid
21095 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21096 !! end
21097
21098 !! test
21099 T24905: <abbr> followed by ISBN followed by </a>
21100 !! wikitext
21101 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21102 !! html/php
21103 <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>
21104 </p>
21105 !! html/parsoid
21106 <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>
21107 !! end
21108
21109 !! test
21110 Double RFC
21111 !! wikitext
21112 RFC RFC 1234
21113 !! html
21114 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21115 </p>
21116 !! end
21117
21118 !! test
21119 Double RFC with a wiki link
21120 !! wikitext
21121 RFC [[RFC 1234]]
21122 !! html
21123 <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>
21124 </p>
21125 !! end
21126
21127 !! test
21128 RFC code coverage
21129 !! wikitext
21130 RFC 983&#x20;987
21131 !! html/php
21132 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21133 </p>
21134 !! html/parsoid
21135 <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>
21136 !! end
21137
21138 !! test
21139 Centre-aligned image
21140 !! wikitext
21141 [[Image:foobar.jpg|centre]]
21142 !! html/php
21143 <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>
21144
21145 !! html/parsoid
21146 <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>
21147 !! end
21148
21149 !! test
21150 None-aligned image
21151 !! wikitext
21152 [[Image:foobar.jpg|none]]
21153 !! html/php
21154 <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>
21155
21156 !! html/parsoid
21157 <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>
21158 !! end
21159
21160 !! test
21161 Width + Height sized image (using px) (height is ignored)
21162 !! wikitext
21163 [[Image:foobar.jpg|640x480px]]
21164 !! html/php
21165 <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>
21166 </p>
21167 !! html/parsoid
21168 <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>
21169 !! end
21170
21171 !! test
21172 Width-sized image (using px, no following whitespace)
21173 !! wikitext
21174 [[Image:foobar.jpg|640px]]
21175 !! html/php
21176 <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>
21177 </p>
21178 !! html/parsoid
21179 <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>
21180 !! end
21181
21182 !! test
21183 Width-sized image (using px, with following whitespace - test regression from r39467)
21184 !! wikitext
21185 [[Image:foobar.jpg|640px ]]
21186 !! html/php
21187 <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>
21188 </p>
21189 !! html/parsoid
21190 <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>
21191 !!end
21192
21193 !! test
21194 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21195 !! wikitext
21196 [[Image:foobar.jpg| 640px]]
21197 !! html/php
21198 <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>
21199 </p>
21200 !! html/parsoid
21201 <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>
21202 !! end
21203
21204 !! test
21205 Image with page parameter
21206 !! options
21207 djvu
21208 !! wikitext
21209 [[File:LoremIpsum.djvu|page=2]]
21210 !! html/php
21211 <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>
21212 </p>
21213 !! html/parsoid
21214 <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>
21215 !! end
21216
21217 !! test
21218 Another italics / bold test
21219 !! wikitext
21220 ''' ''x'
21221 !! html
21222 <pre>'<i> </i>x'
21223 </pre>
21224 !!end
21225
21226 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21227 !! test
21228 dt/dd/dl test
21229 !! wikitext
21230 :;;;::
21231 !! html/php
21232 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21233
21234 !! html/parsoid
21235 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21236
21237 !!end
21238
21239 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21240 !! test
21241 Images with the "|" character in the comment
21242 !! wikitext
21243 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21244 !! html/php
21245 <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>
21246
21247 !! html/parsoid
21248 <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>
21249 !! end
21250
21251 !! test
21252 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21253 !! wikitext
21254 <html><script>alert(1);</script></html>
21255 !! html
21256 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21257 </p>
21258 !! end
21259
21260 !! test
21261 HTML with raw HTML ($wgRawHtml==true)
21262 !! options
21263 wgRawHtml=1
21264 !! wikitext
21265 <html><script>alert(1);</script></html>
21266 !! html/php
21267 <p><script>alert(1);</script>
21268 </p>
21269 !! end
21270
21271 !! test
21272 Parents of subpages, one level up
21273 !! options
21274 subpage title=[[Subpage test/L1/L2/L3]]
21275 !! wikitext
21276 [[../|L2]]
21277 !! html
21278 <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>
21279 </p>
21280 !! end
21281
21282
21283 !! test
21284 Parents of subpages, one level up, not named
21285 !! options
21286 subpage title=[[Subpage test/L1/L2/L3]]
21287 !! wikitext
21288 [[../]]
21289 !! html
21290 <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>
21291 </p>
21292 !! end
21293
21294
21295
21296 !! test
21297 Parents of subpages, two levels up
21298 !! options
21299 subpage title=[[Subpage test/L1/L2/L3]]
21300 !! wikitext
21301 [[../../|L1]]2
21302
21303 [[../../|L1]]l
21304 !! html
21305 <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
21306 </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>
21307 </p>
21308 !! end
21309
21310 !! test
21311 Parents of subpages, two levels up, without trailing slash or name.
21312 !! options
21313 subpage title=[[Subpage test/L1/L2/L3]]
21314 !! wikitext
21315 [[../..]]
21316 !! html
21317 <p>[[../..]]
21318 </p>
21319 !! end
21320
21321 !! test
21322 Parents of subpages, two levels up, with lots of extra trailing slashes.
21323 !! options
21324 subpage title=[[Subpage test/L1/L2/L3]]
21325 !! wikitext
21326 [[../../////]]
21327 !! html
21328 <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>
21329 </p>
21330 !! end
21331
21332 !! article
21333 Subpage test/L1/L2/L3Sibling
21334 !! text
21335 Sibling article
21336 !! endarticle
21337
21338 !! test
21339 Transclusion of a sibling page (one level up)
21340 !! options
21341 subpage title=[[Subpage test/L1/L2/L3]]
21342 !! wikitext
21343 {{../L3Sibling}}
21344 !! html
21345 <p>Sibling article
21346 </p>
21347 !! end
21348
21349 !! test
21350 Transclusion of a child page
21351 !! options
21352 subpage title=[[Subpage test/L1/L2]]
21353 !! wikitext
21354 {{/L3Sibling}}
21355 !! html
21356 <p>Sibling article
21357 </p>
21358 !! end
21359
21360 # This is wt2html only in Parsoid because we add <nowiki>
21361 # because of {{..}} and we don't expect to fix that to
21362 # eliminate the nowikis selective for {{..}} markup.
21363 !! test
21364 Non-transclusion because of too many up levels
21365 !! options
21366 subpage title=[[Subpage test/L1/L2/L3]]
21367 parsoid=wt2html
21368 !! wikitext
21369 {{../../../../More than parent}}
21370 !! html/php
21371 <p>{{../../../../More than parent}}
21372 </p>
21373 !! html/parsoid
21374 <p>{{../../../../More than parent}}</p>
21375 !! end
21376
21377 !! test
21378 Definition list code coverage
21379 !! wikitext
21380 ;title : def
21381 ;title : def
21382 ;title: def
21383 !! html/php
21384 <dl><dt>title &#160;</dt>
21385 <dd>def</dd>
21386 <dt>title&#160;</dt>
21387 <dd>def</dd>
21388 <dt>title</dt>
21389 <dd>def</dd></dl>
21390
21391 !! html/parsoid
21392 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21393 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21394 <dt>title</dt><dd> def</dd></dl>
21395 !! end
21396
21397 !! test
21398 Don't fall for the self-closing div
21399 !! wikitext
21400 <div>hello world</div/>
21401 !! html
21402 <div>hello world</div>
21403
21404 !! end
21405
21406 !! test
21407 MSGNW magic word
21408 !! wikitext
21409 {{MSGNW:msg}}
21410 !! html/php
21411 <p>&#91;&#91;:Template:Msg&#93;&#93;
21412 </p>
21413 !! end
21414
21415 !! test
21416 RAW magic word
21417 !! wikitext
21418 {{RAW:QUERTY}}
21419 !! html
21420 <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>
21421 </p>
21422 !! end
21423
21424 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21425 !! test
21426 Always escape literal '>' in output, not just after '<'
21427 !! wikitext
21428 ><>
21429 !! html
21430 <p>&gt;&lt;&gt;
21431 </p>
21432 !! end
21433
21434 !! test
21435 Template caching
21436 !! wikitext
21437 {{Test}}
21438 {{Test}}
21439 !! html
21440 <p>This is a test template
21441 This is a test template
21442 </p>
21443 !! end
21444
21445
21446 !! article
21447 MediaWiki:Fake
21448 !! text
21449 ==header==
21450 !! endarticle
21451
21452 !! test
21453 Inclusion of !userCanEdit() content
21454 !! wikitext
21455 {{MediaWiki:Fake}}
21456 !! html
21457 <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>
21458
21459 !! end
21460
21461
21462 !! test
21463 Out-of-order TOC heading levels
21464 !! wikitext
21465 ==2==
21466 ======6======
21467 ===3===
21468 =1=
21469 =====5=====
21470 ==2==
21471 !! html
21472 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21473 <ul>
21474 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21475 <ul>
21476 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21477 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21478 </ul>
21479 </li>
21480 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21481 <ul>
21482 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21483 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21484 </ul>
21485 </li>
21486 </ul>
21487 </div>
21488
21489 <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>
21490 <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>
21491 <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>
21492 <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>
21493 <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>
21494 <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>
21495
21496 !! end
21497
21498
21499 !! test
21500 ISBN with a dummy number
21501 !! wikitext
21502 ISBN ---
21503 !! html
21504 <p>ISBN ---
21505 </p>
21506 !! end
21507
21508
21509 !! test
21510 ISBN with space-delimited number
21511 !! wikitext
21512 ISBN 92 9017 032 8
21513 !! html/php
21514 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21515 </p>
21516 !! html/parsoid
21517 <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>
21518 !! end
21519
21520
21521 !! test
21522 ISBN with multiple spaces, no number
21523 !! wikitext
21524 ISBN foo
21525 !! html
21526 <p>ISBN foo
21527 </p>
21528 !! end
21529
21530
21531 !! test
21532 ISBN length
21533 !! wikitext
21534 ISBN 123456789
21535
21536 ISBN 1234567890
21537
21538 ISBN 12345678901
21539 !! html/php
21540 <p>ISBN 123456789
21541 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21542 </p><p>ISBN 12345678901
21543 </p>
21544 !! html/parsoid
21545 <p>ISBN 123456789</p>
21546
21547 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21548
21549 <p>ISBN 12345678901</p>
21550 !! end
21551
21552
21553 !! test
21554 ISBN with trailing year (T9110)
21555 !! wikitext
21556 ISBN 1-234-56789-0 - 2006
21557
21558 ISBN 1 234 56789 0 - 2006
21559 !! html/php
21560 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21561 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21562 </p>
21563 !! html/parsoid
21564 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21565
21566 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21567 !! end
21568
21569
21570 !! test
21571 anchorencode
21572 !! config
21573 wgFragmentMode=[ 'html5', 'legacy' ]
21574 !! wikitext
21575 {{anchorencode:foo bar©#%n}}
21576 !! html/php
21577 <p>foo_bar©#%n
21578 </p>
21579 !! html/parsoid
21580 <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>
21581 !! end
21582
21583 !! test
21584 anchorencode (legacy)
21585 !! config
21586 wgFragmentMode=[ 'legacy' ]
21587 !! wikitext
21588 {{anchorencode:foo bar©#%n}}
21589 !! html/php
21590 <p>foo_bar.C2.A9.23.25n
21591 </p>
21592 !! end
21593
21594 !! test
21595 anchorencode trims spaces
21596 !! config
21597 wgFragmentMode=[ 'html5', 'legacy' ]
21598 !! wikitext
21599 {{anchorencode: __pretty__please__}}
21600 !! html/php
21601 <p>pretty_please
21602 </p>
21603 !! html/parsoid
21604 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21605 !! end
21606
21607 !! test
21608 anchorencode deals with links
21609 !! config
21610 wgFragmentMode=[ 'html5', 'legacy' ]
21611 !! wikitext
21612 {{anchorencode: [[hello|world]] [[hi]]}}
21613 !! html/php
21614 <p>world_hi
21615 </p>
21616 !! html/parsoid
21617 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21618 !! end
21619
21620 !! test
21621 anchorencode deals with templates
21622 !! config
21623 wgFragmentMode=[ 'html5', 'legacy' ]
21624 !! wikitext
21625 {{anchorencode: {{Foo}} x}}
21626 !! html/php
21627 <p>FOO_x
21628 </p>
21629 !! html/parsoid
21630 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21631 !! end
21632
21633 !! test
21634 anchorencode encodes like the TOC generator: (T20431)
21635 !! config
21636 wgFragmentMode=[ 'html5', 'legacy' ]
21637 !! wikitext
21638 ===_ +:.3A%3A _ &&amp;]] x===
21639 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21640 __NOEDITSECTION__
21641 !! html/php
21642 <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>
21643 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21644 </p>
21645 !! html/parsoid
21646 <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>
21647 <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>
21648 <meta property="mw:PageProp/noeditsection"/>
21649 !! end
21650
21651 !! test
21652 anchorencode encodes like the TOC generator: (T20431) (legacy)
21653 !! config
21654 wgFragmentMode=[ 'legacy' ]
21655 !! wikitext
21656 ===_ +:.3A%3A&&amp;]]===
21657 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21658 __NOEDITSECTION__
21659 !! html/php
21660 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21661 <p>.2B:.3A.253A.26.26.5D.5D
21662 </p>
21663 !! end
21664
21665 !! test
21666 T8200: blockquotes and paragraph formatting
21667 !! wikitext
21668 <blockquote>
21669 foo
21670 </blockquote>
21671
21672 bar
21673
21674 baz
21675 !! html
21676 <blockquote>
21677 <p>foo
21678 </p>
21679 </blockquote>
21680 <p>bar
21681 </p>
21682 <pre>baz
21683 </pre>
21684 !! end
21685
21686 !! test
21687 T10293: Use of center tag ruins paragraph formatting
21688 !! wikitext
21689 <center>
21690 foo
21691 </center>
21692
21693 bar
21694
21695 baz
21696 !! html
21697 <center>
21698 <p>foo
21699 </p>
21700 </center>
21701 <p>bar
21702 </p>
21703 <pre>baz
21704 </pre>
21705 !! end
21706
21707 !!test
21708 Parsing of overlapping (improperly nested) inline html tags
21709 !! wikitext
21710 <span><s>x</span></s>
21711 !! html/php
21712 <p><span><s>x&lt;/span&gt;</s></span>
21713 </p>
21714 !! html/parsoid
21715 <p><span><s>x</s></span>
21716 </p>
21717 !!end
21718
21719 ###
21720 ### Language variants related tests
21721 ###
21722
21723 # Parsoid does not mark self-links.
21724 # Parsoid does not convert links; PHP will do any necessary redirects.
21725
21726 !! test
21727 Self-link in language variants
21728 !! options
21729 title=[[Dunav]] language=sr
21730 !! wikitext
21731 Both [[Dunav]] and [[Дунав]] are names for this river.
21732 !! html/php
21733 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21734 </p>
21735 !! html/parsoid
21736 <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>
21737 !! end
21738
21739 !! article
21740 Дуна
21741 !! text
21742 content
21743 !! endarticle
21744
21745 !! test
21746 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21747 !! options
21748 title=[[Duna]] language=sr
21749 !! wikitext
21750 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21751 !! html/php
21752 <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.
21753 </p>
21754 !! html/parsoid
21755 <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>
21756 !! end
21757
21758 !! test
21759 Link to a section of a variant of this title shouldn't be parsed as self-link
21760 !! options
21761 title=[[Duna]] language=sr
21762 !! wikitext
21763 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21764 !! html/php
21765 <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.
21766 </p>
21767 !! html/parsoid
21768 <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>
21769 !! end
21770
21771 !! test
21772 Link to pages in language variants
21773 !! options
21774 language=sr
21775 !! wikitext
21776 Main Page can be written as [[Маин Паге]]
21777 !! html/php
21778 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21779 </p>
21780 !! html/parsoid
21781 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21782 !! end
21783
21784
21785 !! test
21786 Multiple links to pages in language variants
21787 !! options
21788 language=sr
21789 !! wikitext
21790 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21791 !! html/php
21792 <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>.
21793 </p>
21794 !! html/parsoid
21795 <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>
21796 !! end
21797
21798
21799 !! test
21800 Simple template in language variants
21801 !! options
21802 language=sr
21803 !! wikitext
21804 {{тест}}
21805 !! html/php
21806 <p>This is a test template
21807 </p>
21808 !! end
21809
21810
21811 !! test
21812 Template with explicit namespace in language variants
21813 !! options
21814 language=sr
21815 !! wikitext
21816 {{Template:тест}}
21817 !! html/php
21818 <p>This is a test template
21819 </p>
21820 !! end
21821
21822
21823 !! test
21824 Basic test for template parameter in language variants
21825 !! options
21826 language=sr
21827 !! wikitext
21828 {{парамтест|param=foo}}
21829 !! html/php
21830 <p>This is a test template with parameter foo
21831 </p>
21832 !! end
21833
21834 !! test
21835 Simple category in language variants
21836 !! options
21837 language=sr cat
21838 !! wikitext
21839 [[Category:МедиаWики Усер'с Гуиде]]
21840 !! html/php
21841 cat=МедиаWики_Усер'с_Гуиде sort=
21842 !! html/parsoid
21843 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21844 !! end
21845
21846 !! article
21847 Category:分类
21848 !! text
21849 blah
21850 !! endarticle
21851
21852 !! article
21853 Category:分類
21854 !! text
21855 blah
21856 !! endarticle
21857
21858 ## We used to, but no longer wt2wt this test since the default serializer
21859 ## will normalize all categories to serialize on their own line.
21860 ## This wikitext usage is going to be fairly uncommon in production and
21861 ## selser will take care of preserving formatting in those scenarios.
21862 !! test
21863 Don't convert blue categorylinks to another variant (T35210)
21864 !! options
21865 cat
21866 language=zh
21867 parsoid=wt2html
21868 !! wikitext
21869 [[A]][[Category:分类]]
21870 !! html/php
21871 cat=分类 sort=
21872 !! html/parsoid
21873 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21874 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21875 !! end
21876
21877 !! test
21878 Stripping -{}- tags (language variants)
21879 !! options
21880 language=sr
21881 !! wikitext
21882 Latin proverb: -{Ne nuntium necare}-
21883 !! html/php
21884 <p>Latin proverb: Ne nuntium necare
21885 </p>
21886 !! html/parsoid
21887 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21888 !! end
21889
21890
21891 !! test
21892 Prevent conversion with -{}- tags (language variants)
21893 !! options
21894 language=sr variant=sr-ec
21895 !! wikitext
21896 Latinski: -{Ne nuntium necare}-
21897 !! html/php
21898 <p>Латински: Ne nuntium necare
21899 </p>
21900 !! html/parsoid
21901 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21902 !! end
21903
21904
21905 !! test
21906 Prevent conversion of text with -{}- tags (language variants)
21907 !! options
21908 language=sr variant=sr-ec
21909 !! wikitext
21910 Latinski: -{Ne nuntium necare}-
21911 !! html/php
21912 <p>Латински: Ne nuntium necare
21913 </p>
21914 !! html/parsoid
21915 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21916 !! end
21917
21918
21919 !! test
21920 Prevent conversion of links with -{}- tags (language variants)
21921 !! options
21922 language=sr variant=sr-ec
21923 !! wikitext
21924 -{[[Main Page]]}-
21925 !! html/php
21926 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21927 </p>
21928 !! html/parsoid
21929 <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>
21930 !! end
21931
21932
21933 !! test
21934 -{}- tags within headlines (within html for parserConvert())
21935 !! config
21936 wgFragmentMode=[ 'html5', 'legacy' ]
21937 !! options
21938 language=sr variant=sr-ec
21939 !! wikitext
21940 ==-{Naslov}-==
21941
21942 Note that even an unprotected headline ID is not affected by language
21943 conversion:
21944
21945 ==Latinski==
21946 !! html/php
21947 <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>
21948 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21949 цонверсион:
21950 </p>
21951 <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>
21952
21953 !! html/parsoid
21954 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21955
21956 <p>Note that even an unprotected headline ID is not affected by language
21957 conversion:</p>
21958
21959 <h2 id="Latinski">Latinski</h2>
21960 !! end
21961
21962 !! test
21963 Explicit definition of language variant alternatives
21964 !! options
21965 language=zh variant=zh-tw
21966 !! wikitext
21967 -{zh:China;zh-tw:Taiwan}-, not China
21968 !! html/php
21969 <p>Taiwan, not China
21970 </p>
21971 !! html/parsoid
21972 <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>
21973 !! end
21974
21975 !! test
21976 Filter syntax for language variants
21977 !! options
21978 language=zh variant=zh-tw
21979 !! wikitext
21980 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21981 !! html/php
21982 <p>fooblog, WEBJOURNAL, WEBLOGquux
21983 </p>
21984 !! html/parsoid
21985 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21986 !! end
21987
21988 # Note that Parsoid post-processing for language variants needs to
21989 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21990 !! test
21991 Conversion around HTML tags
21992 !! options
21993 language=sr variant=sr-ec
21994 !! wikitext
21995 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21996 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21997 !! html/php
21998 <p>
21999 <span title="ЛаCтин">ски</span>
22000 </p>
22001 !! html/parsoid
22002 <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"}]}'/>
22003 <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>
22004 !! end
22005
22006 !! test
22007 Explicit session-wise two-way language variant mapping (A flag and - flag)
22008 !! options
22009 language=zh variant=zh-tw
22010 !! wikitext
22011 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22012
22013 Taiwan is not China.
22014
22015 But -{A|zh:China; zh-tw:Taiwan}- is China,
22016
22017 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22018
22019 and -{China}- is China.
22020 !! html/php
22021 <p>This is Taiwan, but we'll forget that now.
22022 </p><p>Taiwan is not China.
22023 </p><p>But Taiwan is Taiwan,
22024 </p><p>(This should be stripped!)
22025 </p><p>and China is China.
22026 </p>
22027 !! html/parsoid
22028 <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>
22029 <p>Taiwan is not China.</p>
22030 <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>
22031 <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>
22032 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22033 !! end
22034
22035 !! test
22036 Explicit session-wise one-way language variant mapping (A flag and - flag)
22037 !! options
22038 language=zh variant=zh-tw
22039 !! wikitext
22040 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22041
22042 COUNTRY is China or Taiwan.
22043
22044 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22045
22046 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22047
22048 and -{COUNTRY}- is COUNTRY.
22049 !! html/php
22050 <p>This is Taiwan, but we'll forget that now.
22051 </p><p>COUNTRY is China or Taiwan.
22052 </p><p>But Taiwan is Taiwan,
22053 </p><p>(This should be stripped!)
22054 </p><p>and COUNTRY is COUNTRY.
22055 </p>
22056 !! html/parsoid
22057 <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>
22058 <p>COUNTRY is China or Taiwan.</p>
22059 <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>
22060 <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>
22061 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22062 !! end
22063
22064 !! test
22065 Explicit session-wise two-way language variant mapping (H flag for hide)
22066 !! options
22067 language=zh variant=zh-tw
22068 !! wikitext
22069 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22070
22071 Taiwan is China.
22072 !! html/php
22073 <p>(This should be stripped!)
22074 </p><p>Taiwan is Taiwan.
22075 </p>
22076 !! html/parsoid
22077 <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>
22078 <p>Taiwan is China.</p>
22079 !! end
22080
22081 !! test
22082 Explicit session-wise one-way language variant mapping (H flag for hide)
22083 !! options
22084 language=zh variant=zh-tw
22085 !! wikitext
22086 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22087
22088 COUNTRY is Taiwan or China.
22089 !! html/php
22090 <p>(This should be stripped!)
22091 </p><p>Taiwan is Taiwan or China.
22092 </p>
22093 !! html/parsoid
22094 <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>
22095 <p>COUNTRY is Taiwan or China.</p>
22096 !! end
22097
22098 ## Note that parsoid test runner does not support 'showtitle' option.
22099 !! test
22100 Adding explicit conversion rule for title (T flag)
22101 !! options
22102 language=zh variant=zh-tw showtitle
22103 !! wikitext
22104 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22105
22106 Taiwan is China.
22107 !! html/php
22108 Taiwan
22109 <p>Should be stripped!
22110 </p><p>Taiwan is China.
22111 </p>
22112 !! html/parsoid
22113 <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>
22114 <p>Taiwan is China.</p>
22115 !! end
22116
22117 !! test
22118 Code coverage: T combined with H flag
22119 !! options
22120 language=zh variant=zh-tw showtitle
22121 !! wikitext
22122 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22123
22124 Taiwan is China.
22125 !! html/php
22126 Taiwan
22127 <p>Should be stripped!
22128 </p><p>Taiwan is Taiwan.
22129 </p>
22130 !! html/parsoid
22131 <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>
22132 <p>Taiwan is China.</p>
22133 !! end
22134
22135 !! test
22136 Code coverage: T with no variants
22137 !! options
22138 language=zh variant=zh-tw showtitle
22139 !! wikitext
22140 -{H|zh:China; zh-tw:Taiwan}-
22141 Taiwan is China.-{T|Taiwan is China}-
22142 !! html/php
22143 Taiwan is China
22144 <p>
22145 Taiwan is Taiwan.
22146 </p>
22147 !! html/parsoid
22148 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22149 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22150 !! end
22151
22152 !! test
22153 Code coverage: rules with no variants
22154 !! options
22155 language=zh variant=zh-tw
22156 !! wikitext
22157 -{H|zh:China; zh-tw:Taiwan}-
22158 Taiwan is China.
22159 -{H|China}-
22160 Taiwan is China.
22161 !! html/php
22162 <p>
22163 Taiwan is Taiwan.
22164
22165 Taiwan is China.
22166 </p>
22167 !! html/parsoid
22168 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22169 Taiwan is China.
22170 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22171 Taiwan is China.</p>
22172 !! end
22173
22174
22175 !! test
22176 Code coverage: D flag for conversion rule
22177 !! options
22178 language=zh variant=zh-tw
22179 !! wikitext
22180 -{D|zh-cn:XA; zh-tw:YA}-
22181 -{A;D|zh-cn:XB; zh-tw:YB}-
22182 -{D;H|zh-cn:XC; zh-tw:YC}-
22183
22184 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22185
22186 -{D|0=>zh-tw:1}-
22187 -{A;D|2=>zh-tw:3}-
22188 -{D;H|4=>zh-tw:5}-
22189
22190 XA XB XC YA YB YC FOO BAR BAT 012345
22191 !! html/php
22192 <p>大陆:XA;台灣:YA;
22193
22194 大陆:XC;台灣:YC;
22195 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22196 </p><p>0⇒台灣:1;
22197
22198 4⇒台灣:5;
22199 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22200 </p>
22201 !! html/parsoid
22202 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22203 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22204 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22205 <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>
22206 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22207 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22208 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22209 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22210 !! end
22211
22212 !! test
22213 Code coverage: N flag for conversion rule
22214 !! options
22215 language=zh variant=zh-cn
22216 !! wikitext
22217 -{N|zh-cn}-
22218
22219 -{N|zh-tw}-
22220
22221 -{N|sr-ec}-
22222 !! html/php
22223 <p>大陆
22224 </p><p>台灣
22225 </p><p>српски (ћирилица)‎
22226 </p>
22227 !! html/parsoid
22228 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22229 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22230 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22231 !! end
22232
22233 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22234 !! test
22235 Code coverage: N flag for conversion rule (wt2html only)
22236 !! options
22237 language=zh variant=zh-cn
22238 parsoid=wt2html,html2html
22239 !! wikitext
22240 -{D;N|en}-
22241 !! html/php
22242 <p>English
22243 </p>
22244 !! html/parsoid
22245 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22246 !! end
22247
22248 !! test
22249 Testing that changing the language variant here in the tests actually works
22250 !! options
22251 language=zh variant=zh showtitle
22252 !! wikitext
22253 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22254 !! html/php
22255 China
22256 <p>Should be stripped!
22257 </p>
22258 !! html/parsoid
22259 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22260 !! end
22261
22262 !! test
22263 Recursive conversion of alt and title attrs shouldn't clear converter state
22264 !! options
22265 language=zh variant=zh-cn
22266 showtitle
22267 !! wikitext
22268 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22269 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22270 !! html/php
22271 China
22272 <p>
22273 Should be stripped<span title="Exclamation">!</span>
22274 </p>
22275 !! html/parsoid
22276 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22277 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>
22278 !! end
22279
22280 !! test
22281 T26072: more test on conversion rule for title
22282 !! options
22283 language=zh variant=zh-tw showtitle
22284 !! wikitext
22285 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22286
22287 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22288 !! html/php
22289 Taiwan
22290 <p>This should be stripped!
22291 </p><p>This won't take interferes with the title rule.
22292 </p>
22293 !! html/parsoid
22294 <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>
22295 <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>
22296 !! end
22297
22298 !! test
22299 Partly disable title conversion if variant == main language code
22300 !! options
22301 language=zh variant=zh title=[[ZH]] showtitle
22302 !! wikitext
22303 -{T|zh-cn:CN;zh-tw:TW}-
22304 !! html/php
22305 ZH
22306 <p>
22307 </p>
22308 !! html/parsoid
22309 <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>
22310 !! end
22311
22312 !! test
22313 Partly disable title conversion if variant == main language code, more
22314 !! options
22315 language=zh variant=zh title=[[ZH]] showtitle
22316 !! wikitext
22317 -{T|TW}-
22318 !! html/php
22319 ZH
22320 <p>
22321 </p>
22322 !! html/parsoid
22323 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22324 !! end
22325
22326 !! test
22327 Raw output of variant escape tags (R flag)
22328 !! options
22329 language=zh variant=zh-tw
22330 !! wikitext
22331 Raw: -{R|zh:China;zh-tw:Taiwan}-
22332 !! html/php
22333 <p>Raw: zh:China;zh-tw:Taiwan
22334 </p>
22335 !! html/parsoid
22336 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22337 !! end
22338
22339 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22340 !! test
22341 Raw output of variant escape tags (R flag) (wt2html only)
22342 !! options
22343 language=zh variant=zh-tw
22344 parsoid=wt2html,html2html
22345 !! wikitext
22346 -{Variant}- -{D|syntax}- -{D;R|options}-
22347 !! html/php
22348 <p>Variant syntax options
22349 </p>
22350 !! html/parsoid
22351 <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>
22352 !! end
22353
22354 !! test
22355 Nested markup inside raw output of variant escape tags (R flag)
22356 !! options
22357 language=zh variant=zh-tw
22358 !! wikitext
22359 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22360 !! html/php
22361 <p>Nested raw: nested Taiwan nested
22362 </p>
22363 !! html/parsoid
22364 <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>
22365 !! end
22366
22367 !! test
22368 Nested markup and spaces inside raw output of variant escape tags (R flag)
22369 !! options
22370 language=zh variant=zh-tw
22371 !! wikitext
22372 X-{ outer -{ inner }- outer }-X
22373 !! html/php
22374 <p>X outer inner outer X
22375 </p>
22376 !! html/parsoid
22377 <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>
22378 !! end
22379
22380 !! test
22381 Templates inside raw output of variant escape tags (R flag)
22382 !! options
22383 language=zh variant=zh-tw
22384 !! wikitext
22385 Nested raw: -{R|nested {{echo|hi}} templates}-
22386 !! html/php
22387 <p>Nested raw: nested hi templates
22388 </p>
22389 !! html/parsoid
22390 <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>
22391 !! end
22392
22393 !! test
22394 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22395 !! options
22396 language=zh variant=zh-cn
22397 !! wikitext
22398 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22399 !! html/php
22400 <p>0
22401 </p>
22402 !! html/parsoid
22403 <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>
22404 !! end
22405
22406 !! test
22407 Conversion rules from [numeric-only string] to [something else] (T48634)
22408 !! options
22409 language=zh variant=zh-cn
22410 !! wikitext
22411 -{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
22412 !! html/php
22413 <p>D12345EE12345
22414 </p>
22415 !! html/parsoid
22416 <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>
22417 !! end
22418
22419 !! test
22420 Two-way converter rule entries with an empty value should be ignored (T53551)
22421 !! options
22422 language=zh variant=zh-cn
22423 !! wikitext
22424 -{H|zh-cn:foo;zh-tw:;}-foobar
22425 !! html/php
22426 <p>foobar
22427 </p>
22428 !! html/parsoid
22429 <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>
22430 !! end
22431
22432 !! test
22433 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22434 !! options
22435 language=zh variant=zh-cn
22436 !! wikitext
22437 -{H|=>zh-cn:foo;}-foobar
22438 !! html/php
22439 <p>foobar
22440 </p>
22441 !! html/parsoid
22442 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22443 !! end
22444
22445 !! test
22446 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22447 !! options
22448 language=zh variant=zh-cn
22449 !! wikitext
22450 -{H|}-foobar
22451 !! html/php
22452 <p>foobar
22453 </p>
22454 !! html/parsoid
22455 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22456 !! end
22457
22458 !! test
22459 Nested using of manual convert syntax
22460 !! options
22461 language=zh variant=zh-hk
22462 !! wikitext
22463 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22464 !! html/php
22465 <p>Nested: Hello Hong Kong!
22466 </p>
22467 !! html/parsoid
22468 <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>
22469 !! end
22470
22471 !! test
22472 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22473 !! options
22474 language=zh variant=zh-cn
22475 !! wikitext
22476 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22477 !! html/php
22478 <p><span title="X">A</span>
22479 </p>
22480 !! html/parsoid
22481 <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>
22482 !! end
22483
22484 !! test
22485 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22486 !! options
22487 language=zh variant=zh-cn
22488 !! wikitext
22489 -{<span title="-{X}-">A</span>}-
22490 !! html/php+disabled
22491 <p><span title="X">A</span>
22492 </p>
22493 !! html/parsoid
22494 <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>
22495 !! end
22496
22497 # Parsoid and PHP disagree on how to parse this example: Parsoid
22498 # insists that the content of a language converter element be a valid
22499 # DOM fragment or attribute string
22500 !! test
22501 Language converter markup with block content
22502 !! options
22503 language=zh variant=zh-cn
22504 !! wikitext
22505 <span>a-{b<div>c}-d
22506
22507 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22508
22509 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22510 !! html/php+tidy
22511 <span>ab<div>cd
22512 <span>ab<div>cd
22513 <span>ad
22514 </span></div></span></div></span>
22515 !! html/parsoid
22516 <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>
22517
22518 <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>
22519
22520 <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>
22521 !! end
22522
22523 !! test
22524 LanguageConverter selser (1)
22525 !! options
22526 language=zh variant=zh-cn
22527 parsoid={
22528 "modes": ["wt2wt", "selser"],
22529 "changes": [
22530 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22531 ]
22532 }
22533 !! wikitext
22534 -{raw}-
22535 !! wikitext/edited
22536 -{edited}-
22537 !! end
22538
22539 !! test
22540 LanguageConverter selser (2)
22541 !! options
22542 language=zh variant=zh-cn
22543 parsoid={
22544 "modes": ["wt2wt", "selser"],
22545 "changes": [
22546 ["span[class='x']", "contents", "text", "-{foo}-"],
22547 ["a", "contents", "text", "-{"],
22548 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22549 ]
22550 }
22551 !! wikitext
22552 <span class="x">TEXT1</span>
22553 [http://example.com TEXT2]
22554 [[Foo|TEXT3]]
22555 {{echo|TEXT4}}
22556 !! wikitext/edited
22557 <span class="x"><nowiki>-{foo}-</nowiki></span>
22558 [http://example.com -{]
22559 [[Foo|<nowiki>-{</nowiki>]]
22560 {{1x|<nowiki>-{</nowiki>}}
22561 !! end
22562
22563 # Tests LanguageVariantText in ConstrainedText
22564 !! test
22565 LanguageConverter selser (3)
22566 !! options
22567 language=zh variant=zh-cn
22568 parsoid={
22569 "modes": ["wt2wt", "selser"],
22570 "changes": [
22571 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22572 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22573 ]
22574 }
22575 !! wikitext
22576 {|
22577 |-
22578 |<span>Foo</span>
22579 |}
22580 !! wikitext/edited
22581 {|
22582 |-
22583 |<nowiki/>-{edited}-
22584 |}
22585 !! end
22586
22587 # Tests LanguageVariantText._fromSelSer
22588 !! test
22589 LanguageConverter selser (4)
22590 !! options
22591 language=zh variant=zh-cn
22592 parsoid={
22593 "modes": ["wt2wt", "selser"],
22594 "changes": [
22595 ["td > span.x", "remove"]
22596 ]
22597 }
22598 !! wikitext
22599 {|
22600 |-
22601 |<span class="x">Foo</span>-{Bar}-
22602 ||<span class="x">Foo</span>-{Bar}-
22603 |}
22604 !! wikitext/edited
22605 {|
22606 |-
22607 |<nowiki/>-{Bar}-
22608 ||-{Bar}-
22609 |}
22610 !! end
22611
22612 # Since Parsoid is starting to emit canonical wikitext for links,
22613 # [http://example.com http://example.com] will not RT back to that
22614 # form anymore.
22615 # Parsoid does not language-convert links (it is done in a
22616 # post-processing step)
22617 !! test
22618 Proper conversion of text in external links
22619 !! options
22620 language=sr variant=sr-ec
22621 parsoid=wt2html
22622 !! wikitext
22623 http://www.google.com
22624 gopher://www.google.com
22625 [http://www.google.com http://www.google.com]
22626 [gopher://www.google.com gopher://www.google.com]
22627 [https://www.google.com irc://www.google.com]
22628 [ftp://www.google.com www.google.com/ftp://dir]
22629 [//www.google.com www.google.com]
22630 !! html/php
22631 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22632 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22633 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22634 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22635 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22636 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22637 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22638 </p>
22639 !! html/parsoid
22640 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22641 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22642 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22643 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22644 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22645 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22646 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22647 !! end
22648
22649 !! test
22650 Do not convert roman numbers to language variants
22651 !! options
22652 language=sr variant=sr-ec
22653 !! wikitext
22654 Fridrih IV je car.
22655 !! html/php
22656 <p>Фридрих IV је цар.
22657 </p>
22658 !! html/parsoid
22659 <p>Fridrih IV je car.</p>
22660 !! end
22661
22662 !! test
22663 Unclosed language converter markup "-{"
22664 !! options
22665 language=sr
22666 !! wikitext
22667 -{T|hello
22668 !! html
22669 <p>-{T|hello
22670 </p>
22671 !! end
22672
22673 !! test
22674 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22675 !! options
22676 language=sr
22677 !! wikitext
22678 -{R|=&gt;}-
22679 !! html/php
22680 <p>=&gt;
22681 </p>
22682 !! html/parsoid
22683 <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>
22684 !!end
22685
22686 !! test
22687 Don't break link parsing if language converter markup is in the caption.
22688 !! options
22689 language=sr variant=sr-ec
22690 !! wikitext
22691 [[Main Page|-{R|main page}-]]
22692 !! html/php
22693 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22694 </p>
22695 !! html/parsoid
22696 <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>
22697 !! end
22698
22699 !! test
22700 T146304: Don't break template parsing if language converter markup is in the parameter.
22701 !! options
22702 language=sr variant=sr-ec
22703 !! wikitext
22704 {{echo|-{R|foo}-}}
22705 !! html/php
22706 <p>foo
22707 </p>
22708 !! html/parsoid
22709 <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>
22710 !! end
22711
22712 !! test
22713 T146305: Don't break image parsing if language converter markup is in the caption.
22714 !! options
22715 language=sr
22716 !! wikitext
22717 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22718 !! html/php
22719 <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>
22720
22721 !! html/parsoid
22722 <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>
22723 !! end
22724
22725 !! test
22726 T146305: Don't break image parsing if nested language converter markup is in the caption.
22727 !! options
22728 language=zh variant=zh-cn
22729 !! wikitext
22730 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22731 !! html/php
22732 <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>
22733
22734 !! html/parsoid
22735 <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>
22736 !! end
22737
22738 # XXX html2wt disabled because rich markup in alt is not preserved.
22739 !! test
22740 Don't break gallery if language converter markup is inside.
22741 !! options
22742 language=zh
22743 !! wikitext
22744 <gallery>
22745 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22746 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22747 </gallery>
22748 !! html/php
22749 <ul class="gallery mw-gallery-traditional">
22750 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22751 <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>
22752 <div class="gallerytext">
22753 <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>
22754 </p>
22755 </div>
22756 </div></li>
22757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22758 <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>
22759 <div class="gallerytext">
22760 <p>This is a test template
22761 </p>
22762 </div>
22763 </div></li>
22764 </ul>
22765
22766 !! html/parsoid
22767 <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"}}'>
22768 <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>
22769 <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>
22770 </ul>
22771 !! end
22772
22773 !! test
22774 T153135: Don't break list handling if language converter markup is in the item.
22775 !! options
22776 language=zh variant=zh-cn
22777 !! wikitext
22778 ;-{zh-cn:AAA;zh-tw:BBB}-
22779 ;-{R|foo:bar}-
22780 !! html/php
22781 <dl><dt>AAA</dt>
22782 <dt>foo:bar</dt></dl>
22783
22784 !! html/parsoid
22785 <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>
22786 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22787 </dl>
22788 !! end
22789
22790 // Note that parsoid does not protect colons unless language converter
22791 // markup is properly nested, because it is a backtracking parser.
22792 !! test
22793 T153135: Unclosed markup in definition list (code coverage)
22794 !! options
22795 language=zh variant=zh-cn
22796 !! wikitext
22797 ;<b>foo:bar
22798 ;-{zh-cn:AAA
22799 !! html/php+tidy
22800 <dl><dt><b>foo:bar</b></dt><b>
22801 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22802 </b></p>
22803 !! html/parsoid
22804 <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}'>
22805 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22806 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22807 </b></dl>
22808 !! end
22809
22810 !! test
22811 T153135: Nested language converter markup in definition list (code coverage)
22812 !! options
22813 language=zh variant=zh-cn
22814 !! wikitext
22815 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22816 !! html/php
22817 <dl><dt>AAA foo:bar bat:baz</dt>
22818 <dd>def</dd></dl>
22819
22820 !! html/parsoid
22821 <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>
22822 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22823 </dl>
22824 !! end
22825
22826 # html2wt mode disabled due to <nowiki> insertion.
22827 !! test
22828 T153140: Don't break table handling if language converter markup is in the cell.
22829 !! options
22830 language=sr variant=sr-ec
22831 parsoid=wt2html,wt2wt,html2html
22832 !! wikitext
22833 {|
22834 |-
22835 | -{R|B}-
22836 |}
22837 !! html/php
22838 <table>
22839
22840 <tr>
22841 <td>B
22842 </td></tr></table>
22843
22844 !! html/parsoid
22845 <table>
22846 <tbody>
22847 <tr>
22848 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22849 </tr>
22850 </tbody>
22851 </table>
22852 !! end
22853
22854 !! test
22855 Language converter tricky html2wt cases (1)
22856 !! options
22857 language=sr
22858 parsoid=html2wt,wt2wt
22859 !! html/parsoid
22860 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22861 !! wikitext
22862 -{<nowiki>}-</nowiki>}-
22863 !! html/php
22864 <p>&#125;-
22865 </p>
22866 !! end
22867
22868 !! test
22869 Language converter tricky html2wt cases (2)
22870 !! options
22871 language=sr
22872 parsoid=html2wt,wt2wt
22873 !! html/parsoid
22874 <p>-{foo}-</p>
22875 !! wikitext
22876 <nowiki>-{foo}-</nowiki>
22877 !! html/php
22878 <p>-&#123;foo&#125;-
22879 </p>
22880 !! end
22881
22882 !! test
22883 Language converter tricky html2wt cases (3)
22884 !! options
22885 language=sr
22886 parsoid=html2wt,wt2wt
22887 !! html/parsoid
22888 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22889 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22890 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22891 !! wikitext
22892 -{R||}-
22893
22894 -{R|R|raw}-
22895
22896 -{<nowiki>-{foo}-</nowiki>}-
22897 !! html/php
22898 <p>|
22899 </p><p>R|raw
22900 </p><p>-&#123;foo&#125;-
22901 </p>
22902 !! end
22903
22904 !! test
22905 Language converter tricky html2wt cases (4)
22906 !! options
22907 language=sr
22908 parsoid=html2wt,wt2wt
22909 !! html/parsoid
22910 <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>
22911 !! wikitext
22912 -{R|{{echo|hey}}}-
22913 !! html/php
22914 <p>hey
22915 </p>
22916 !! end
22917
22918 # Note that the <nowiki> escaping added by parsoid for source text,
22919 # destination text, and language names only works on the PHP side
22920 # for *destination text*. (HTML entity escaping wouldn't work
22921 # any better.) This is probably a bug, at least for source texts.
22922 # (For language names PHP uses a precise regexp based on the languages
22923 # it currently knows have variants, which is fragile since this set
22924 # can grow/shrink over time.)
22925 !! test
22926 Language converter tricky html2wt cases (5)
22927 !! options
22928 language=zh variant=zh-cn
22929 !! html/parsoid
22930 <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>
22931 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22932 <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>
22933 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22934 <p>a:b=>c xyz</p>
22935 !! wikitext
22936 -{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
22937
22938 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22939
22940 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22941
22942 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22943
22944 a:b=>c xyz
22945 !! html/php+disabled
22946 <p>foobat;xyz=&gt;zh-cn:abc
22947 </p><p>A
22948 </p><p>0;zh-tw:bar
22949 </p><p>abc
22950 </p><p>a:b=&gt;c 0;zh-tw:bar
22951 </p>
22952 !! end
22953
22954 !! test
22955 T179579: Nowiki and lc interaction
22956 !! options
22957 parsoid=wt2html
22958 language=sr
22959 !! wikitext
22960 -{</nowiki>123}-
22961
22962 -{123<nowiki>|</nowiki>456}-
22963 !! html/parsoid
22964 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22965
22966 <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>
22967 !! end
22968
22969 !! test
22970 T2529: Uncovered bullet
22971 !! wikitext
22972 *Foo {{bullet}}
22973 !! html
22974 <ul><li>Foo</li>
22975 <li>Bar</li></ul>
22976
22977 !! end
22978
22979 !! test
22980 T2529: Uncovered bullet in a deeply nested list
22981 !! wikitext
22982 *******Foo {{bullet}}
22983 !! html
22984 <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>
22985 <li>Bar</li></ul>
22986
22987 !! end
22988
22989 !! test
22990 T2529: Uncovered table already at line-start
22991 !! wikitext
22992 x
22993
22994 {{table}}
22995 y
22996 !! html
22997 <p>x
22998 </p>
22999 <table>
23000 <tr>
23001 <td>1</td>
23002 <td>2
23003 </td></tr>
23004 <tr>
23005 <td>3</td>
23006 <td>4
23007 </td></tr></table>
23008 <p>y
23009 </p>
23010 !! end
23011
23012 !! test
23013 T2529: Uncovered bullet in parser function result
23014 !! wikitext
23015 *Foo {{lc:{{bullet}} }}
23016 !! html
23017 <ul><li>Foo</li>
23018 <li>bar</li></ul>
23019
23020 !! end
23021
23022 !! test
23023 T7678: Double-parsed template argument
23024 !! wikitext
23025 {{lc:{{{1}}}|hello}}
23026 !! html
23027 <p>{{{1}}}
23028 </p>
23029 !! end
23030
23031 !! test
23032 T7678: Double-parsed template invocation
23033 !! wikitext
23034 {{lc:{{paramtest {{!}} param = hello }} }}
23035 !! html
23036 <p>{{paramtest | param = hello }}
23037 </p>
23038 !! end
23039
23040 !! test
23041 Case insensitivity of parser functions for non-ASCII characters (T10143)
23042 !! options
23043 language=cs
23044 title=[[Main Page]]
23045 !! wikitext
23046 {{PRVNÍVELKÉ:ěščř}}
23047 {{prvnívelké:ěščř}}
23048 {{PRVNÍMALÉ:ěščř}}
23049 {{prvnímalé:ěščř}}
23050 {{MALÁ:ěščř}}
23051 {{malá:ěščř}}
23052 {{VELKÁ:ěščř}}
23053 {{velká:ěščř}}
23054 !! html
23055 <p>Ěščř
23056 Ěščř
23057 ěščř
23058 ěščř
23059 ěščř
23060 ěščř
23061 ĚŠČŘ
23062 ĚŠČŘ
23063 </p>
23064 !! end
23065
23066 !! test
23067 Morwen/13: Unclosed link followed by heading
23068 !! wikitext
23069 [[link
23070 ==heading==
23071 !! html
23072 <p>[[link
23073 </p>
23074 <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>
23075
23076 !! end
23077
23078 !! test
23079 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23080 !! wikitext
23081 {{foo|
23082 =heading=
23083 !! html
23084 <p>{{foo|
23085 </p>
23086 <h1><span class="mw-headline" id="heading">heading</span></h1>
23087
23088 !! end
23089
23090 !! test
23091 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23092 !! wikitext
23093 {{foo|
23094 ==heading==
23095 !! html
23096 <p>{{foo|
23097 </p>
23098 <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>
23099
23100 !! end
23101
23102 !! test
23103 Tildes in comments
23104 !! options
23105 pst
23106 !! wikitext
23107 <!-- ~~~~ -->
23108 !! html/php
23109 <!-- ~~~~ -->
23110 !! end
23111
23112 !! test
23113 Paragraphs inside divs (no extra line breaks)
23114 !! wikitext
23115 <div>Line one
23116
23117 Line two</div>
23118 !! html
23119 <div>Line one
23120 Line two</div>
23121
23122 !! end
23123
23124 !! test
23125 Paragraphs inside divs (extra line break on open)
23126 !! wikitext
23127 <div>
23128 Line one
23129
23130 Line two</div>
23131 !! html
23132 <div>
23133 <p>Line one
23134 </p>
23135 Line two</div>
23136
23137 !! end
23138
23139 !! test
23140 Paragraphs inside divs (extra line break on close)
23141 !! wikitext
23142 <div>Line one
23143
23144 Line two
23145 </div>
23146 !! html
23147 <div>Line one
23148 <p>Line two
23149 </p>
23150 </div>
23151
23152 !! end
23153
23154 !! test
23155 Paragraphs inside divs (extra line break on open and close)
23156 !! wikitext
23157 <div>
23158 Line one
23159
23160 Line two
23161 </div>
23162 !! html
23163 <div>
23164 <p>Line one
23165 </p><p>Line two
23166 </p>
23167 </div>
23168
23169 !! end
23170
23171 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23172 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23173 !! test
23174 Nesting tags, paragraphs on lines which begin with <div>
23175 !! wikitext
23176 <div></div><strong>A
23177 B</strong>
23178 !! html/php+tidy
23179 <div></div><p><strong>A
23180 </strong></p><strong></strong><p><strong>B</strong>
23181 </p>
23182 !! html/parsoid
23183 <div></div>
23184 <p><strong>A
23185 B</strong>
23186 </p>
23187 !! end
23188
23189 # T8200: <blockquote> should behave like <div> with respect to line breaks
23190 !! test
23191 T8200: paragraphs inside blockquotes (no extra line breaks)
23192 !! wikitext
23193 <blockquote>Line one
23194
23195 Line two</blockquote>
23196 !! html
23197 <blockquote>Line one
23198 Line two</blockquote>
23199
23200 !! html+tidy
23201 <blockquote><p>Line one
23202 Line two</p></blockquote>
23203 !! end
23204
23205 !! test
23206 T8200: paragraphs inside blockquotes (extra line break on open)
23207 !! wikitext
23208 <blockquote>
23209 Line one
23210
23211 Line two</blockquote>
23212 !! html
23213 <blockquote>
23214 <p>Line one
23215 </p>
23216 Line two</blockquote>
23217
23218 !! html+tidy
23219 <blockquote>
23220 <p>Line one
23221 </p><p>
23222 Line two</p></blockquote>
23223 !! end
23224
23225 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23226 !! test
23227 T8200: paragraphs inside blockquotes (extra line break on close)
23228 !! wikitext
23229 <blockquote>Line one
23230
23231 Line two
23232 </blockquote>
23233 !! html
23234 <blockquote>Line one
23235 <p>Line two
23236 </p>
23237 </blockquote>
23238
23239 !! html+tidy
23240 <blockquote><p>Line one
23241 </p><p>Line two
23242 </p>
23243 </blockquote>
23244 !! end
23245
23246 !! test
23247 T8200: paragraphs inside blockquotes (extra line break on open and close)
23248 !! wikitext
23249 <blockquote>
23250 Line one
23251
23252 Line two
23253 </blockquote>
23254 !! html
23255 <blockquote>
23256 <p>Line one
23257 </p><p>Line two
23258 </p>
23259 </blockquote>
23260
23261 !! end
23262
23263 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23264 !! test
23265 Paragraphs inside blockquotes/divs (no extra line breaks)
23266 !! wikitext
23267 <blockquote><div>Line one
23268
23269 Line two</div></blockquote>
23270 !! html
23271 <blockquote><div>Line one
23272 Line two</div></blockquote>
23273
23274 !! end
23275
23276 !! test
23277 Paragraphs inside blockquotes/divs (extra line break on open)
23278 !! wikitext
23279 <blockquote><div>
23280 Line one
23281
23282 Line two</div></blockquote>
23283 !! html
23284 <blockquote><div>
23285 <p>Line one
23286 </p>
23287 Line two</div></blockquote>
23288
23289 !! end
23290
23291 !! test
23292 Paragraphs inside blockquotes/divs (extra line break on close)
23293 !! wikitext
23294 <blockquote><div>Line one
23295
23296 Line two
23297 </div></blockquote>
23298 !! html
23299 <blockquote><div>Line one
23300 <p>Line two
23301 </p>
23302 </div></blockquote>
23303
23304 !! end
23305
23306 !! test
23307 Paragraphs inside blockquotes/divs (extra line break on open and close)
23308 !! wikitext
23309 <blockquote><div>
23310 Line one
23311
23312 Line two
23313 </div></blockquote>
23314 !! html
23315 <blockquote><div>
23316 <p>Line one
23317 </p><p>Line two
23318 </p>
23319 </div></blockquote>
23320
23321 !! end
23322
23323 !! test
23324 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23325 !! options
23326 wgLinkHolderBatchSize=0
23327 !! wikitext
23328 [[meatball:1]]
23329 [[meatball:2]]
23330 [[meatball:3]]
23331 !! html
23332 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23333 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23334 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23335 </p>
23336 !! end
23337
23338 !! test
23339 Free external link invading image caption
23340 !! wikitext
23341 [[Image:Foobar.jpg|thumb|http://x|hello]]
23342 !! html/php
23343 <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>
23344
23345 !! html/parsoid
23346 <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>
23347 !! end
23348
23349 !! test
23350 T17196: localised external link numbers
23351 !! options
23352 language=fa
23353 !! wikitext
23354 [http://en.wikipedia.org/]
23355 !! html/php
23356 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23357 </p>
23358 !! html/parsoid
23359 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23360 !! end
23361
23362 !! test
23363 Multibyte character in padleft
23364 !! wikitext
23365 {{padleft:-Hello|7|Æ}}
23366 !! html/php
23367 <p>Æ-Hello
23368 </p>
23369 !! html/parsoid
23370 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23371 !! end
23372
23373 !! test
23374 Multibyte character in padright
23375 !! wikitext
23376 {{padright:Hello-|7|Æ}}
23377 !! html/php
23378 <p>Hello-Æ
23379 </p>
23380 !! html/parsoid
23381 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23382 !! end
23383
23384 !!test
23385 formatdate parser function
23386 !! wikitext
23387 {{#formatdate:2009-03-24}}
23388 !! html
23389 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23390 </p>
23391 !! end
23392
23393 !!test
23394 formatdate parser function, with default format
23395 !! wikitext
23396 {{#formatdate:2009-03-24|mdy}}
23397 !! html
23398 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23399 </p>
23400 !! end
23401
23402 !! test
23403 Spacing of numbers in formatted dates
23404 !! wikitext
23405 {{#formatdate:January 15}}
23406 !! html
23407 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23408 </p>
23409 !! end
23410
23411 !! test
23412 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
23413 !! options
23414 language=nl title=[[MediaWiki:Common.css]]
23415 !! wikitext
23416 {{#formatdate:2009-03-24|dmy}}
23417 !! html
23418 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23419 </p>
23420 !! end
23421
23422 #
23423 #
23424 #
23425
23426 #
23427 # Edit comments
23428 #
23429
23430 !! test
23431 Edit comment with link
23432 !! options
23433 comment
23434 !! wikitext
23435 I like the [[Main Page]] a lot
23436 !! html/php
23437 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23438 !!end
23439
23440 !! test
23441 Edit comment with link and link text
23442 !! options
23443 comment
23444 !! wikitext
23445 I like the [[Main Page|best pages]] a lot
23446 !! html/php
23447 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23448 !!end
23449
23450 !! test
23451 Edit comment with link and link text with suffix
23452 !! options
23453 comment
23454 !! wikitext
23455 I like the [[Main Page|best page]]s a lot
23456 !! html/php
23457 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23458 !!end
23459
23460 !! test
23461 Edit comment with section link (non-local, eg in history list)
23462 !! options
23463 comment title=[[Main Page]]
23464 !! wikitext
23465 /* External links */ removed bogus entries
23466 !! html/php
23467 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23468 !!end
23469
23470 !! test
23471 Edit comment with section link and text before it (non-local, eg in history list)
23472 !! options
23473 comment title=[[Main Page]]
23474 !! wikitext
23475 pre-comment text /* External links */ removed bogus entries
23476 !! html/php
23477 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>
23478 !!end
23479
23480 !! test
23481 Edit comment with section link (local, eg in diff view)
23482 !! options
23483 comment local title=[[Main Page]]
23484 !! wikitext
23485 /* External links */ removed bogus entries
23486 !! html/php
23487 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23488 !!end
23489
23490 !! test
23491 Edit comment with subpage link (T16080)
23492 !! options
23493 comment
23494 subpage
23495 title=[[Subpage test]]
23496 !! wikitext
23497 Poked at a [[/subpage]] here...
23498 !! html/php
23499 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23500 !!end
23501
23502 !! test
23503 Edit comment with subpage link and link text (T16080)
23504 !! options
23505 comment
23506 subpage
23507 title=[[Subpage test]]
23508 !! wikitext
23509 Poked at a [[/subpage|neat little page]] here...
23510 !! html/php
23511 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23512 !!end
23513
23514 !! test
23515 Edit comment with bogus subpage link in non-subpage NS (T16080)
23516 !! options
23517 comment
23518 title=[[Subpage test]]
23519 !! wikitext
23520 Poked at a [[/subpage]] here...
23521 !! html/php
23522 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...
23523 !!end
23524
23525 !! test
23526 Edit comment with bare anchor link (local, as on diff)
23527 !! options
23528 comment
23529 local
23530 title=[[Main Page]]
23531 !! wikitext
23532 [[#section]]
23533 !! html/php
23534 <a href="#section">#section</a>
23535 !! end
23536
23537 !! test
23538 Edit comment with bare anchor link (non-local, as on history)
23539 !! options
23540 comment
23541 title=[[Main Page]]
23542 !! wikitext
23543 [[#section]]
23544 !! html/php
23545 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23546 !! end
23547
23548 !! test
23549 Anchor starting with underscore
23550 !! options
23551 title=[[Foo]]
23552 !! wikitext
23553 [[#_ref|One]]
23554 !! html/php
23555 <p><a href="#_ref">One</a>
23556 </p>
23557 !! html/parsoid
23558 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23559 !! end
23560
23561 !! test
23562 Id starting with underscore
23563 !! wikitext
23564 <div id="_ref"></div>
23565 !! html/*
23566 <div id="_ref"></div>
23567
23568 !! end
23569
23570 !! test
23571 Edit comment with link with more than one pipe (T99346)
23572 !! options
23573 comment
23574 !! wikitext
23575 [[Main Page|Many|pipes]]
23576 !! html/php
23577 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23578 !! end
23579
23580 !! test
23581 Complex edit comment with link with more than one pipe (T99346)
23582 !! options
23583 comment
23584 !! wikitext
23585 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23586 !! html/php
23587 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;
23588 !! end
23589
23590 !! test
23591 Space normalisation on autocomment (T24784)
23592 !! options
23593 comment
23594 title=[[Main Page]]
23595 !! wikitext
23596 /* __hello__world__ */
23597 !! html/php
23598 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23599 !! end
23600
23601 !! test
23602 percent-encoding and + signs in comments (T28410)
23603 !! options
23604 comment
23605 !! wikitext
23606 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23607 !! html/php
23608 <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>
23609 !! end
23610
23611 # Parsoid doesn't support this yet: see T75581
23612 # but it *should* omit the 'src' attribute if the image is bad.
23613 # PHP side of tests was disabled in
23614 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23615 # because of issues in the PHP parserTests infrastructure
23616 # (but the output below is indeed what the PHP side emits)
23617 !! test
23618 Bad images - basic functionality
23619 !! wikitext
23620 [[File:Bad.jpg]]
23621 !! html/php+disabled
23622 !! html/parsoid
23623 <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>
23624 !! end
23625
23626 !! test
23627 Bad images - T18039: text after bad image disappears
23628 !! wikitext
23629 Foo bar
23630 [[File:Bad.jpg]]
23631 Bar foo
23632 !! html/php+disabled
23633 <p>Foo bar
23634 </p><p>Bar foo
23635 </p>
23636 !! html/parsoid
23637 <p>Foo bar
23638 <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>
23639 Bar foo</p>
23640 !! end
23641
23642 !! test
23643 Verify that displaytitle works (T24501) no displaytitle
23644 !! options
23645 showtitle
23646 !! config
23647 wgAllowDisplayTitle=true
23648 wgRestrictDisplayTitle=false
23649 !! wikitext
23650 this is not the the title
23651 !! html/php
23652 Parser test
23653 <p>this is not the the title
23654 </p>
23655 !! end
23656
23657 !! test
23658 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23659 !! options
23660 showtitle
23661 title=[[Screen]]
23662 !! config
23663 wgAllowDisplayTitle=true
23664 wgRestrictDisplayTitle=false
23665 !! wikitext
23666 this is not the the title
23667 {{DISPLAYTITLE:whatever}}
23668 !! html/php
23669 whatever
23670 <p>this is not the the title
23671 </p>
23672 !! end
23673
23674 !! test
23675 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23676 !! options
23677 showtitle
23678 title=[[Screen]]
23679 !! config
23680 wgAllowDisplayTitle=true
23681 wgRestrictDisplayTitle=true
23682 !! wikitext
23683 this is not the the title
23684 {{DISPLAYTITLE:whatever}}
23685 !! html/php
23686 Screen
23687 <p>this is not the the title
23688 </p>
23689 !! end
23690
23691 !! test
23692 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23693 !! options
23694 showtitle
23695 title=[[Screen]]
23696 !! config
23697 wgAllowDisplayTitle=true
23698 wgRestrictDisplayTitle=true
23699 !! wikitext
23700 this is not the the title
23701 {{DISPLAYTITLE:screen}}
23702 !! html/php
23703 screen
23704 <p>this is not the the title
23705 </p>
23706 !! end
23707
23708 !! test
23709 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23710 !! options
23711 showtitle
23712 title=[[Screen]]
23713 !! config
23714 wgAllowDisplayTitle=false
23715 !! wikitext
23716 this is not the the title
23717 {{DISPLAYTITLE:screen}}
23718 !! html/php
23719 Screen
23720 <p>this is not the the title
23721 <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>
23722 </p>
23723 !! end
23724
23725 !! test
23726 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23727 !! options
23728 showtitle
23729 title=[[Screen]]
23730 !! config
23731 wgAllowDisplayTitle=false
23732 !! wikitext
23733 this is not the the title
23734 !! html/php
23735 Screen
23736 <p>this is not the the title
23737 </p>
23738 !! end
23739
23740 !! test
23741 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23742 !! options
23743 showtitle
23744 title=[[Screen]]
23745 !! config
23746 wgAllowDisplayTitle=true
23747 wgRestrictDisplayTitle=true
23748 !! wikitext
23749 this is not the the title
23750 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23751 !! html/php
23752 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23753 <p>this is not the the title
23754 </p>
23755 !! end
23756
23757 !! test
23758 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23759 !! options
23760 showtitle
23761 title=[[Screen]]
23762 !! config
23763 wgAllowDisplayTitle=true
23764 wgRestrictDisplayTitle=true
23765 !! wikitext
23766 this is not the the title
23767 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23768 !! html/php
23769 <span style="color: red;">s</span>creen
23770 <p>this is not the the title
23771 </p>
23772 !! end
23773
23774 !! test
23775 Page status indicators: Empty name is invalid
23776 !! options
23777 showindicators
23778 !! wikitext
23779 <indicator name=" "></indicator>
23780 <indicator></indicator>
23781 !! html/php
23782 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23783 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23784 </p>
23785 !! end
23786
23787 !! test
23788 Page status indicators: Weird syntaxes that are okay
23789 !! options
23790 showindicators
23791 !! wikitext
23792 <indicator name="empty" />
23793 <indicator name="name"></indicator>
23794 !! html/php
23795 empty=
23796 name=
23797 <p><br />
23798 </p>
23799 !! end
23800
23801 !! test
23802 Page status indicators: Torture test
23803 !! options
23804 showindicators
23805 !! wikitext
23806 <indicator name="01">hello world</indicator>
23807 <indicator name="02">[[Main Page]]</indicator>
23808 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23809 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23810 <indicator name="05">*foo
23811 *bar</indicator>
23812 <indicator name="06"><nowiki>foo</nowiki></indicator>
23813 <indicator name="07"> Preformatted</indicator>
23814 <indicator name="08"><div>Broken tag</indicator>
23815 <indicator name="09">{| class=wikitable
23816 |cell
23817 |}</indicator>
23818 <indicator name="10">Two
23819
23820 paragraphs</indicator>
23821 !! html/php
23822 01=hello world
23823 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23824 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" />
23825 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>
23826 05=<ul><li>foo</li>
23827 <li>bar</li></ul>
23828
23829 06=foo
23830 07=<pre>Preformatted
23831 </pre>
23832 08=<div>Broken tag</div>
23833
23834 09=<table class="wikitable">
23835 <tr>
23836 <td>cell
23837 </td></tr></table>
23838
23839 10=<p>Two
23840 </p><p>paragraphs
23841 </p>
23842 <p><br />
23843 </p><p><br />
23844 </p><p><br />
23845 </p><p><br />
23846 </p><p><br />
23847 </p>
23848 !! end
23849
23850 !! test
23851 preload: check <noinclude> and <includeonly>
23852 !! options
23853 preload
23854 !! wikitext
23855 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23856 !! html/php
23857 Hello kind world.
23858 !! end
23859
23860 !! test
23861 preload: check <onlyinclude>
23862 !! options
23863 preload
23864 !! wikitext
23865 Goodbye <onlyinclude>Hello world</onlyinclude>
23866 !! html/php
23867 Hello world
23868 !! end
23869
23870 !! test
23871 preload: can pass tags through if we want to
23872 !! options
23873 preload
23874 !! wikitext
23875 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23876 !! html/php
23877 <includeonly>Hello world</includeonly>
23878 !! end
23879
23880 !! test
23881 preload: check that it doesn't try to do tricks
23882 !! options
23883 preload
23884 !! wikitext
23885 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23886 !! html/php
23887 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23888 !! end
23889
23890 !! test
23891 Play a bit with r67090 and T5158
23892 !! wikitext
23893 <div style="width:50% !important">&nbsp;</div>
23894 <div style="width:50%&nbsp;!important">&nbsp;</div>
23895 <div style="width:50%&#160;!important">&nbsp;</div>
23896 <div style="border : solid;">&nbsp;</div>
23897 !! html/php
23898 <div style="width:50% !important">&#160;</div>
23899 <div style="width:50% !important">&#160;</div>
23900 <div style="width:50% !important">&#160;</div>
23901 <div style="border&#160;: solid;">&#160;</div>
23902
23903 !! html/parsoid
23904 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23905 <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>
23906 <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>
23907 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23908
23909 !! end
23910
23911 !! test
23912 HTML5 data attributes
23913 !! wikitext
23914 <span data-foo="bar">Baz</span>
23915 <p data-abc-def_hij="">Quuz</p>
23916 !! html/php
23917 <p><span data-foo="bar">Baz</span>
23918 </p>
23919 <p data-abc-def_hij="">Quuz</p>
23920
23921 !! html/parsoid
23922 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23923 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23924 !! end
23925
23926 !! test
23927 Strip reserved data attributes
23928 !! wikitext
23929 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23930 !! html/php
23931 <div data-ok="fred">d</div>
23932
23933 !! html/parsoid
23934 <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>
23935 !! end
23936
23937 !! test
23938 percent-encoding and + signs in internal links (T28410)
23939 !! wikitext
23940 [[User:+%]] [[Page+title%]]
23941 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23942 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23943 [[%33%45]] [[%33%45+]]
23944 !! html/php
23945 <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>
23946 <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>
23947 <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>
23948 <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>
23949 </p>
23950 !! html/parsoid
23951 <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>
23952 <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>
23953 <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>
23954 <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>
23955 !! end
23956
23957 !! test
23958 Special characters in embedded file links (T29679)
23959 !! wikitext
23960 [[File:Contains & ampersand.jpg]]
23961 [[File:Does not exist.jpg|Title with & ampersand]]
23962 !! html/php
23963 <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>
23964 <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>
23965 </p>
23966 !! html/parsoid
23967 <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>
23968 <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>
23969 !! end
23970
23971 !! test
23972 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23973 !! wikitext
23974 Text&apos;s been normalized?
23975 !! html
23976 <p>Text&#39;s been normalized?
23977 </p>
23978 !! end
23979
23980 !! test
23981 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23982 !! wikitext
23983 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23984 !! html
23985 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23986 </p>
23987 !! end
23988
23989 !! test
23990 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23991 !! wikitext
23992 [http://www.example.org/ ideograms]
23993 !! html
23994 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23995 </p>
23996 !! end
23997
23998 !! test
23999 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24000 !! wikitext
24001 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24002 !! html
24003 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24004 </p>
24005 !! end
24006
24007 !! article
24008 Mediawiki:loop1
24009 !! text
24010 {{Identical|A}}
24011 !! endarticle
24012
24013 !! article
24014 Mediawiki:loop2
24015 !! text
24016 {{Identical|B}}
24017 !! endarticle
24018
24019 !! article
24020 Template:Identical
24021 !! text
24022 {{int:loop1}}
24023 {{int:loop2}}
24024 !! endarticle
24025
24026 !! test
24027 T33098 Template which includes system messages which includes the template
24028 !! wikitext
24029 {{Identical}}
24030 !! html
24031 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24032 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24033 </p>
24034 !! end
24035
24036 !! test
24037 T33490 Turkish: ucfirst 'blah'
24038 !! options
24039 language=tr
24040 !! wikitext
24041 {{ucfirst:blah}}
24042 !! html
24043 <p>Blah
24044 </p>
24045 !! end
24046
24047 !! test
24048 T33490 Turkish: ucfirst 'ix'
24049 !! options
24050 language=tr
24051 !! wikitext
24052 {{ucfirst:ix}}
24053 !! html
24054 <p>İx
24055 </p>
24056 !! end
24057
24058 !! test
24059 T33490 Turkish: lcfirst 'BLAH'
24060 !! options
24061 language=tr
24062 !! wikitext
24063 {{lcfirst:BLAH}}
24064 !! html
24065 <p>bLAH
24066 </p>
24067 !! end
24068
24069 !! test
24070 T33490 Turkish: ucfırst (with a dotless i)
24071 !! options
24072 language=tr
24073 !! wikitext
24074 {{ucfırst:blah}}
24075 !! html
24076 <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>
24077 </p>
24078 !! end
24079
24080 !! test
24081 T33490 ucfırst (with a dotless i) with English language
24082 !! options
24083 language=en
24084 !! wikitext
24085 {{ucfırst:blah}}
24086 !! html
24087 <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>
24088 </p>
24089 !! end
24090
24091 # Note that Parsoid doesn't emit an explicit TOC.
24092 # Note also that the html2wt direction tends to emit an extra newline
24093 # between the __TOC__ magicword and the first heading unless *both*
24094 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24095 # it's "{}").
24096
24097 !! test
24098 T28375: TOC with italics
24099 !! options
24100 title=[[Main Page]]
24101 !! wikitext
24102 __TOC__
24103 ==''Lost'' episodes==
24104 !! html/php
24105 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24106 <ul>
24107 <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>
24108 </ul>
24109 </div>
24110
24111 <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>
24112
24113 !! html/parsoid
24114 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24115 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24116 !! end
24117
24118 !! test
24119 T28375: TOC with bold
24120 !! options
24121 title=[[Main Page]]
24122 !! wikitext
24123 __TOC__
24124 =='''should be bold''' then normal text==
24125 !! html/php
24126 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24127 <ul>
24128 <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>
24129 </ul>
24130 </div>
24131
24132 <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>
24133
24134 !! html/parsoid
24135 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24136 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24137 !! end
24138
24139 !! test
24140 T35845: Headings become cursive in TOC when they contain an image
24141 !! options
24142 title=[[Main Page]]
24143 !! wikitext
24144 __TOC__
24145 ==Image [[Image:foobar.jpg]]==
24146 !! html/php
24147 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24148 <ul>
24149 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24150 </ul>
24151 </div>
24152
24153 <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>
24154
24155 !! html/parsoid
24156 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24157 <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>
24158 !! end
24159
24160 !! test
24161 T35845 (2): Headings become bold in TOC when they contain a blockquote
24162 !! options
24163 title=[[Main Page]]
24164 !! wikitext
24165 __TOC__
24166 ==<blockquote>Quote</blockquote>==
24167 !! html/php
24168 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24169 <ul>
24170 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24171 </ul>
24172 </div>
24173
24174 <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>
24175
24176 !! html/php+tidy
24177 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24178 <ul>
24179 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24180 </ul>
24181 </div>
24182
24183 <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>
24184 !! html/parsoid
24185 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24186 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24187 !! end
24188
24189 !! test
24190 Unclosed tags in TOC
24191 !! config
24192 wgFragmentMode=[ 'html5', 'legacy' ]
24193 !! options
24194 title=[[Main Page]]
24195 !! wikitext
24196 __TOC__
24197 ==Proof: 2 < 3==
24198 <small>Hanc marginis exiguitas non caperet.</small>
24199 QED
24200 !! html/php
24201 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24202 <ul>
24203 <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>
24204 </ul>
24205 </div>
24206
24207 <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>
24208 <p><small>Hanc marginis exiguitas non caperet.</small>
24209 QED
24210 </p>
24211 !! html/parsoid
24212 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24213 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24214 <p><small>Hanc marginis exiguitas non caperet.</small>
24215 QED</p>
24216 !! end
24217
24218 !! test
24219 Multiple tags in TOC
24220 !! wikitext
24221 __TOC__
24222 ==<i>Foo</i> <b>Bar</b>==
24223
24224 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24225 !! html/php
24226 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24227 <ul>
24228 <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>
24229 <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>
24230 </ul>
24231 </div>
24232
24233 <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>
24234 <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>
24235
24236 !! html/php+tidy
24237 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24238 <ul>
24239 <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>
24240 <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>
24241 </ul>
24242 </div>
24243
24244 <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>
24245 <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>
24246 !! html/parsoid
24247 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24248 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24249
24250 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24251 !! end
24252
24253 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24254 # html5 tag parsing.
24255 !! test
24256 Tags with parameters in TOC
24257 !! options
24258 parsoid=wt2html
24259 !! wikitext
24260 __TOC__
24261 ==<sup class="in-h2">Hello</sup>==
24262
24263 ==<sup class="a > b">Evilbye</sup>==
24264 !! html/php
24265 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24266 <ul>
24267 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24268 <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>
24269 </ul>
24270 </div>
24271
24272 <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>
24273 <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>
24274
24275 !! html/parsoid
24276 <meta property="mw:PageProp/toc" />
24277 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24278
24279 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24280 !! end
24281
24282 !! test
24283 span tags with directionality in TOC
24284 !! wikitext
24285 __TOC__
24286 ==<span dir="ltr">C++</span>==
24287
24288 ==<span dir="rtl">זבנג!</span>==
24289
24290 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24291
24292 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24293
24294 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24295 !! html/php
24296 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24297 <ul>
24298 <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>
24299 <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>
24300 <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>
24301 <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>
24302 <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>
24303 </ul>
24304 </div>
24305
24306 <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>
24307 <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>
24308 <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>
24309 <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>
24310 <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>
24311
24312 !! html/parsoid
24313 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24314 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24315 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24316 <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>
24317 <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>
24318 <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>
24319 !! end
24320
24321 !! test
24322 T74884: bdi element in ToC
24323 !! wikitext
24324 __TOC__
24325 ==<bdi>test</bdi>==
24326 !! html/php
24327 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24328 <ul>
24329 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24330 </ul>
24331 </div>
24332
24333 <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>
24334
24335 !! html/parsoid
24336 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24337 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24338 !! end
24339
24340 !! test
24341 T35715: s/strike element in ToC
24342 !! wikitext
24343 __TOC__
24344 ==<s>test</s> test <strike>test</strike>==
24345 !! html/php
24346 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24347 <ul>
24348 <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>
24349 </ul>
24350 </div>
24351
24352 <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>
24353
24354 !! html/parsoid
24355 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24356 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24357 !! end
24358
24359 !! test
24360 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24361 !! wikitext
24362 __TOC__
24363 ==x==
24364 !! html/php
24365 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24366 <ul>
24367 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24368 </ul>
24369 </div>
24370
24371 <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>
24372
24373 !! html/parsoid
24374 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24375 <h2 id="x" data-parsoid='{}'>x</h2>
24376 !! end
24377
24378 !! article
24379 MediaWiki:T34057
24380 !! text
24381 == {{int:headline_sample}} ==
24382 !! endarticle
24383
24384 !! test
24385 T34057: Title needed when expanding <h> nodes.
24386 !! options
24387 title=[[Main Page]]
24388 !! wikitext
24389 {{int:T34057}}
24390 !! html
24391 <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>
24392
24393 !! end
24394
24395 !! test
24396 Strip marker in urlencode
24397 !! wikitext
24398 {{urlencode:x<nowiki/>y}}
24399 {{urlencode:x<nowiki/>y|wiki}}
24400 {{urlencode:x<nowiki/>y|path}}
24401 {{urlencode:x<pre id="one">two</pre>y}}
24402 !! html/php
24403 <p>xy
24404 xy
24405 xy
24406 xy
24407 </p>
24408 !! end
24409
24410 !! test
24411 Strip marker in lc
24412 !! wikitext
24413 {{lc:x<nowiki/>y}}
24414 !! html
24415 <p>xy
24416 </p>
24417 !! end
24418
24419 !! test
24420 Strip marker in uc
24421 !! wikitext
24422 {{uc:x<nowiki/>y}}
24423 !! html
24424 <p>XY
24425 </p>
24426 !! end
24427
24428 !! test
24429 Strip marker in formatNum
24430 !! wikitext
24431 {{formatnum:1<nowiki/>2}}
24432 {{formatnum:1<nowiki/>2|R}}
24433 !! html
24434 <p>12
24435 12
24436 </p>
24437 !! end
24438
24439 !! test
24440 Check noCommafy in formatNum
24441 !! options
24442 language=be-tarask
24443 !! wikitext
24444 {{formatnum:123456.78}}
24445 {{formatnum:123456.78|NOSEP}}
24446 !! html
24447 <p>123 456,78
24448 123456.78
24449 </p>
24450 !! end
24451
24452 !! test
24453 Wrong option for formatNum (T58199)
24454 !! wikitext
24455 {{formatnum:1,234.56|Random}}
24456 {{formatnum:1,234.56|EVERYTHING}}
24457 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24458 !! html
24459 <p>1,234.56
24460 1,234.56
24461 1,234.56
24462 </p>
24463 !! end
24464
24465 !! test
24466 Strip marker in grammar
24467 !! options
24468 language=fi
24469 !! wikitext
24470 {{grammar:elative|foo<nowiki/>bar}}
24471 !! html
24472 <p>foobarista
24473 </p>
24474 !! end
24475
24476 !! test
24477 Strip marker in padleft
24478 !! wikitext
24479 {{padleft:|2|x<nowiki/>y}}
24480 !! html
24481 <p>xy
24482 </p>
24483 !! end
24484
24485 !! test
24486 Strip marker in padright
24487 !! wikitext
24488 {{padright:|2|x<nowiki/>y}}
24489 !! html
24490 <p>xy
24491 </p>
24492 !! end
24493
24494 !! test
24495 Strip marker in anchorencode
24496 !! wikitext
24497 {{anchorencode:x<nowiki/>y}}
24498 !! html/php
24499 <p>xy
24500 </p>
24501 !! html/parsoid
24502 <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>
24503 !! end
24504
24505 !! test
24506 nowiki inside link inside heading (T20295)
24507 !! wikitext
24508 ==[[foo|x<nowiki>y</nowiki>z]]==
24509 !! html
24510 <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>
24511
24512 !! end
24513
24514 !! test
24515 new support for bdi element (T33817)
24516 !! wikitext
24517 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24518 !! html
24519 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24520
24521 !!end
24522
24523 !! test
24524 Ignore pipe between table row attributes
24525 !! wikitext
24526 {|
24527 |quux
24528 |- id=foo | style='color: red'
24529 |bar
24530 |}
24531 !! html
24532 <table>
24533 <tr>
24534 <td>quux
24535 </td></tr>
24536 <tr id="foo" style="color: red">
24537 <td>bar
24538 </td></tr></table>
24539
24540 !! end
24541
24542 !!test
24543 Language parser function
24544 !! wikitext
24545 {{#language:ar}}
24546 !! html
24547 <p>العربية
24548 </p>
24549 !! end
24550
24551 !!test
24552 Padleft and padright (default 0-padding)
24553 !! wikitext
24554 {{padleft:xyz|5}}
24555 {{padright:xyz|5}}
24556 !! html/php
24557 <p>00xyz
24558 xyz00
24559 </p>
24560 !! html/parsoid
24561 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24562 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24563 !! end
24564
24565 !!test
24566 Padleft and padright (partial fill)
24567 !! wikitext
24568 {{padleft:xyz|6|ab}}
24569 {{padright:xyz|6|ab}}
24570 !! html/php
24571 <p>abaxyz
24572 xyzaba
24573 </p>
24574 !! html/parsoid
24575 <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>
24576 <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>
24577 !! end
24578
24579 !!test
24580 Padleft and padright as substr
24581 !! wikitext
24582 {{padleft:|3|abcde}}
24583 {{padright:|3|abcde}}
24584 !! html/php
24585 <p>abc
24586 abc
24587 </p>
24588 !! html/parsoid
24589 <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>
24590 <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>
24591 !! end
24592
24593 !! test
24594 Padleft and padright with non-numerical length (T180403)
24595 !! wikitext
24596 {{padleft:abcdef|junk}}
24597 {{padright:abcdef|junk}}
24598 !! html/php
24599 <p>abcdef
24600 abcdef
24601 </p>
24602 !! end
24603
24604 !!test
24605 Special parser function
24606 !! wikitext
24607 {{#special:RandomPage}}
24608 {{#special:BaDtItLe}}
24609 {{#special:Foobar}}
24610 !! html
24611 <p>Special:Random
24612 Special:Badtitle
24613 Special:Foobar
24614 </p>
24615 !! end
24616
24617 !!test
24618 T36939 - Case insensitive link parsing ([HttP://])
24619 !! wikitext
24620 [HttP://MediaWiki.Org/]
24621 !! html/php
24622 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24623 </p>
24624 !! html/parsoid
24625 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24626 !! end
24627
24628 !!test
24629 T36939 - Case insensitive link parsing ([HttP:// title])
24630 !! wikitext
24631 [HttP://MediaWiki.Org/ MediaWiki]
24632 !! html
24633 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24634 </p>
24635 !! end
24636
24637 !!test
24638 T36939 - Case insensitive link parsing (HttP://)
24639 !! wikitext
24640 HttP://MediaWiki.Org/
24641 !! html/php
24642 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24643 </p>
24644 !! html/parsoid
24645 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24646 !! end
24647
24648 !!test
24649 Disable TOC
24650 !! options
24651 notoc
24652 !! wikitext
24653 Lead
24654 ==Section 1==
24655 ==Section 2==
24656 ==Section 3==
24657 ==Section 4==
24658 ==Section 5==
24659 !! html
24660 <p>Lead
24661 </p>
24662
24663 <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>
24664 <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>
24665 <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>
24666 <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>
24667 <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>
24668
24669 !! end
24670
24671
24672 ###
24673 ### Parsoid-specific tests
24674 ### Parsoid-PHP parser incompatibilities
24675 ###
24676 !!test
24677 1. SOL-sensitive wikitext tokens as template-args
24678 !!options
24679 parsoid=wt2html,wt2wt
24680 !! wikitext
24681 {{echo|*a}}
24682 {{echo|#a}}
24683 {{echo|:a}}
24684 !! html
24685 <span about="#mwt1" typeof="mw:Transclusion">
24686 </span><ul about="#mwt1"><li>a</li>
24687 </ul>
24688 <span about="#mwt2" typeof="mw:Transclusion">
24689 </span><ol about="#mwt2"><li>a</li>
24690 </ol>
24691 <span about="#mwt3" typeof="mw:Transclusion">
24692 </span><dl about="#mwt3"><dd>a</dd>
24693 </dl>
24694 !!end
24695
24696 #### -----------------------------------------------------------------
24697 #### Parsoid-specific functionality tests
24698 #### -----------------------------------------------------------------
24699
24700 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24701 # We know wt2wt will fail, but we expect selser to pass.
24702 # Due to the nature of our testing, wt2wt and selser tests will enter the
24703 # blacklist and we'll catch selser regressions based on changes to the
24704 # blacklist entries for selser tests.
24705 !! test
24706 1. Bad treebuilder fixup of formatting elt is cleaned up
24707 !! options
24708 parsoid=wt2html,wt2wt
24709 !! wikitext
24710 {|
24711 |
24712 <small>
24713 [[Image:Foobar.jpg|right|Test]]
24714 </small>
24715 |}
24716 !! html/parsoid
24717 <table>
24718 <tbody><tr><td>
24719 <small>
24720 <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>
24721 </small>
24722 </td></tr>
24723 </tbody></table>
24724 !! end
24725
24726 !! test
24727 2. Bad treebuilder fixup of formatting elt is cleaned up
24728 !! options
24729 parsoid=wt2html,wt2wt
24730 !! wikitext
24731 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24732
24733 <small>[[Image:Foobar.jpg|right|300px]]</small>
24734 !! html/parsoid
24735
24736 <p><b>foo</b></p>
24737 <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>
24738 <p><b>bar</b></p>
24739 <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>
24740 !! end
24741
24742 !! test
24743 3. Bad treebuilder fixup of formatting elt is cleaned up
24744 !! options
24745 parsoid=wt2html,wt2wt
24746 !! wikitext
24747 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24748 !! html/parsoid
24749 <p><small><b>foo</b></small></p>
24750 <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>
24751 <p><small><b>bar</b></small></p>
24752 !! end
24753
24754 !! test
24755 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24756 !! options
24757 parsoid=wt2html,wt2wt
24758 !! wikitext
24759 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24760 !! html/parsoid
24761 <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>
24762 !! end
24763
24764 #### ----------------------------------------------------------------
24765 #### Parsoid-only testing of Parsoid's impl of LST
24766 #### Not implemented yet, see
24767 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24768 #### ----------------------------------------------------------------
24769
24770 ## We still need to support serializing the older format while content is stored.
24771 !! test
24772 LST Sections: Backwards compatibility
24773 !! options
24774 parsoid={
24775 "suppressErrors": true,
24776 "modes": ["html2wt"]
24777 }
24778 !! wikitext
24779 <section begin="2011-05-16" />
24780 <section end="2014-04-10 (MW 1.23wmf22)" />
24781 !! html/parsoid
24782 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24783 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24784 !! end
24785
24786 !! test
24787 LST Sections: Newfangled approach
24788 !! wikitext
24789 <section begin="2011-05-16" />
24790 <section end="2014-04-10 (MW 1.23wmf22)" />
24791 !! html/parsoid
24792 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24793 </span>
24794 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24795 </span></p>
24796 !! end
24797
24798 #--------- Test stripping of empty nodes in template content ----------
24799
24800 !! test
24801 Empty LI and TR nodes should be stripped from template content
24802 !! wikitext
24803 {{EmptyLITest}}
24804 {{EmptyTRTest}}
24805 !! html/parsoid
24806 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24807 <li>a</li>
24808 <li>b</li>
24809 </ul>
24810 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24811 <tbody>
24812 <tr>
24813 <td>foo</td>
24814 </tr>
24815 <tr>
24816 <td>bar</td>
24817 </tr>
24818 </tbody>
24819 </table>
24820 !! end
24821
24822 !! test
24823 Empty LI and TR nodes should not be stripped from top-level content
24824 !! wikitext
24825 * a
24826 *
24827 * b
24828
24829 {|
24830 |-
24831 |-
24832 |foo
24833 |}
24834 !! html/parsoid
24835 <ul>
24836 <li> a</li>
24837 <li class='mw-empty-elt'></li>
24838 <li> b</li>
24839 </ul>
24840 <table>
24841 <tbody>
24842 <tr class='mw-empty-elt'></tr>
24843 <tr>
24844 <td>foo</td>
24845 </tr>
24846 </tbody>
24847 </table>
24848 !! end
24849
24850 !! test
24851 Empty TR nodes should not be stripped if they have any attributes set
24852 !! wikitext
24853 {{EmptyTRWithHTMLAttrTest}}
24854 !! html/parsoid
24855 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24856 <tr align='center'></tr>
24857 <tr><td>foo</td></tr>
24858 <tr align='center'></tr>
24859 <tr><td>bar</td></tr>
24860 </table>
24861 !! end
24862
24863 #### ----------------------------------------------------------------
24864 #### The following section of tests are primarily to test
24865 #### wikitext escaping capabilities of Parsoid. Given that
24866 #### escaping can be done any number of ways, the wikitext (input)
24867 #### is always adjusted to reflect how Parsoid adds nowiki
24868 #### escape tags.
24869 ####
24870 #### We are marking several tests as parsoid-only since the
24871 #### HTML in the result section is different from what the
24872 #### PHP parser generates for it.
24873 #### ----------------------------------------------------------------
24874
24875
24876 #### --------------- Headings ---------------
24877 #### 0. Unnested
24878 #### 1. Nested inside html <h1>=foo=</h1>
24879 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24880 #### 3. Nested inside html with wikitext split by html tags
24881 #### 4. No escape needed
24882 #### 5. Empty headings <h1></h1>
24883 #### 6. Heading chars in SOL context
24884 #### ----------------------------------------
24885 !! test
24886 Headings: 0. Unnested
24887 !! options
24888 parsoid=html2wt
24889 !! html/parsoid
24890 <p>=foo=</p>
24891
24892 <p> =foo=
24893 <!--cmt-->
24894 =foo=</p>
24895
24896 <p>=foo<i>a</i>=</p>
24897 !! wikitext
24898 <nowiki>=foo=</nowiki>
24899
24900 <nowiki> </nowiki>=foo=
24901 <!--cmt-->
24902 <nowiki>=foo=</nowiki>
24903
24904 =foo''a''<nowiki>=</nowiki>
24905 !!end
24906
24907 # New headings and existing headings are handled differently
24908 !! test
24909 Headings: 1. Nested inside html
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <h1>=foo=</h1>
24914 <h2>=foo=</h2>
24915 <h3>=foo=</h3>
24916
24917 <h1 data-parsoid=''>=foo=</h1>
24918 <h2 data-parsoid=''>=foo=</h2>
24919 <h3 data-parsoid=''>=foo=</h3>
24920 <h4 data-parsoid=''>=foo=</h4>
24921 <h5 data-parsoid=''>=foo=</h5>
24922 <h6 data-parsoid=''>=foo=</h6>
24923 !! wikitext
24924 = =foo= =
24925
24926 == =foo= ==
24927
24928 === =foo= ===
24929
24930 =<nowiki>=foo=</nowiki>=
24931 ==<nowiki>=foo=</nowiki>==
24932 ===<nowiki>=foo=</nowiki>===
24933 ====<nowiki>=foo=</nowiki>====
24934 =====<nowiki>=foo=</nowiki>=====
24935 ======<nowiki>=foo=</nowiki>======
24936
24937 !!end
24938
24939 !! test
24940 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24941 !! options
24942 parsoid=html2wt
24943 !! html/parsoid
24944 <h1>foo</h1>*bar
24945 <h1>foo</h1>=bar
24946 <h1>foo</h1>=bar=
24947 !! wikitext
24948 = foo =
24949 <nowiki>*</nowiki>bar
24950
24951 = foo =
24952 =bar
24953
24954 = foo =
24955 <nowiki>=bar=</nowiki>
24956 !!end
24957
24958 !! test
24959 Headings: 3. Nested inside html with wikitext split by html tags
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 <h1>=<b>bold</b>foo=</h1>
24964 !! wikitext
24965 = ='''bold'''foo= =
24966 !!end
24967
24968 !! test
24969 Headings: 4a. No escaping needed (testing just h1 and h2)
24970 !! options
24971 parsoid=html2wt
24972 !! html/parsoid
24973 <h1>=foo</h1>
24974 <h1>foo=</h1>
24975 <h1> =foo= </h1>
24976 <h1>=foo= bar</h1>
24977 <h2>=foo</h2>
24978 <h2>foo=</h2>
24979 <h1>=</h1>
24980 <h1><i>=</i>foo=</h1>
24981 !! wikitext
24982 = =foo =
24983
24984 = foo= =
24985
24986 = =foo= =
24987
24988 = =foo= bar =
24989
24990 == =foo ==
24991
24992 == foo= ==
24993
24994 = = =
24995
24996 = ''=''foo= =
24997 !!end
24998
24999 !! test
25000 Headings: 4b. No escaping needed (inside p-tags)
25001 !! options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <p>=foo= x
25005 =foo= <s></s>
25006 </p>
25007 !! wikitext
25008 =foo= x
25009 =foo= <s></s>
25010 !! html/php
25011 <p>=foo= x
25012 =foo= <s></s>
25013 </p>
25014 !!end
25015
25016 !! test
25017 Headings: 4c. Short headings (1)
25018 !! options
25019 parsoid=html2wt
25020 !! html/parsoid
25021 <p>===
25022 </p>
25023 !! wikitext
25024 <nowiki>===</nowiki>
25025 !! html/php
25026 <p>===
25027 </p>
25028 !! end
25029
25030 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25031 !! test
25032 Headings: 4d. Short headings (2)
25033 !! options
25034 parsoid=wt2html,html2html
25035 !! wikitext
25036 =
25037 ==
25038 ===
25039 ====
25040 =====
25041 !! html/php
25042 <p>=
25043 ==
25044 </p>
25045 <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>
25046 <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>
25047 <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>
25048
25049 !! html/parsoid
25050 <p>=
25051 ==</p>
25052 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25053 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25054 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25055 !! end
25056
25057 !! test
25058 Headings: 5. Empty headings
25059 !! options
25060 parsoid=html2wt
25061 !! html/parsoid
25062 <h1 data-parsoid='{}'></h1>
25063
25064 <h2 data-parsoid='{}'></h2>
25065
25066 <h3 data-parsoid='{}'></h3>
25067
25068 <h4 data-parsoid='{}'></h4>
25069
25070 <h5 data-parsoid='{}'></h5>
25071
25072 <h6 data-parsoid='{}'></h6>
25073 !! wikitext
25074 =<nowiki/>=
25075
25076 ==<nowiki/>==
25077
25078 ===<nowiki/>===
25079
25080 ====<nowiki/>====
25081
25082 =====<nowiki/>=====
25083
25084 ======<nowiki/>======
25085 !!end
25086
25087 !! test
25088 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25089 !! options
25090 parsoid=html2wt
25091 !! html/parsoid
25092 <p>=a=</p>
25093
25094 <p>=a=</p>
25095
25096 <p>=a=</p>
25097 !! wikitext
25098 <nowiki>=a=</nowiki>
25099
25100 <nowiki>=a=</nowiki>
25101
25102 <nowiki>=a=</nowiki>
25103 !!end
25104
25105 !! test
25106 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25107 !! options
25108 parsoid=html2wt
25109 !! html/parsoid
25110 <p>=a=
25111 b</p>
25112
25113 <p>=a=
25114 b</p>
25115
25116 <p>=a=
25117 b</p>
25118 !! wikitext
25119 <nowiki>=a=</nowiki>
25120 b
25121
25122 <nowiki>=a=</nowiki>
25123 b
25124
25125 <nowiki>=a=</nowiki>
25126 b
25127 !!end
25128
25129 !! test
25130 Headings: 6c. Heading chars in SOL context (leading newline break)
25131 !! options
25132 parsoid=html2wt
25133 !! html/parsoid
25134 <p>a
25135 =b=</p>
25136 !! wikitext
25137 a
25138 <nowiki>=b=</nowiki>
25139 !!end
25140
25141 !! test
25142 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25143 !! options
25144 parsoid=html2wt
25145 !! html/parsoid
25146 <!--c0--><p>=a=</p>
25147
25148 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25149 !! wikitext
25150 <!--c0--><nowiki>=a=</nowiki>
25151
25152 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25153 !!end
25154
25155 !! test
25156 Headings: 6d. Heading chars in SOL context (No escaping needed)
25157 !! options
25158 parsoid=html2wt
25159 !! html/parsoid
25160 =a=<div>b</div>
25161 !! wikitext
25162 =a=<div>b</div>
25163 !!end
25164
25165 !! test
25166 Headings: 7. Insert a newline between new content and headings
25167 !! options
25168 parsoid=html2wt
25169 !! html/parsoid
25170 <h2>NEW</h2>
25171 <p>new</p>
25172 <h2 data-parsoid='{}'>A</h2>
25173 <p data-parsoid='{}'>a</p>
25174 !! wikitext
25175 == NEW ==
25176 new
25177
25178 ==A==
25179 a
25180
25181 !! end
25182
25183 !! test
25184 Headings: Used as horizontal rule
25185 !! config
25186 wgFragmentMode=[ 'html5', 'legacy' ]
25187 !! options
25188 parsoid=wt2html
25189 !! wikitext
25190 ===============
25191 !! html/php
25192 <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>
25193
25194 !! html/parsoid
25195 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25196 !! end
25197
25198 #### --------------- Lists ---------------
25199 #### 0. Outside nests (*foo, etc.)
25200 #### 1. Nested inside html <ul><li>*foo</li></ul>
25201 #### 2. Inside definition lists
25202 #### 3. Only bullets at start should be escaped
25203 #### 4. No escapes needed
25204 #### 5. No unnecessary escapes
25205 #### 6. Escape bullets in SOL position
25206 #### 7. Escape bullets in a multi-line context
25207 #### ----------------------------------------
25208
25209 !! test
25210 Lists: 0. Outside nests
25211 !! options
25212 parsoid=html2wt
25213 !! html/parsoid
25214 <p>*foo</p>
25215
25216 <p>#foo</p>
25217
25218 <p>;Foo:bar</p>
25219 !! wikitext
25220 <nowiki>*</nowiki>foo
25221
25222 <nowiki>#</nowiki>foo
25223
25224 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25225 !!end
25226
25227 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25228 ## to test wikitext escaping, and insignificant whitespace diffs
25229 ## cause PHP parser tests to barf
25230 !! test
25231 Lists: 1. Nested inside html (No unnecessary escapes)
25232 !! options
25233 parsoid=html2wt
25234 !! html/parsoid
25235 <ul>
25236 <li>*foo</li>
25237 <li>#foo</li>
25238 <li>:foo</li>
25239 <li>;foo</li>
25240 <li data-parsoid='{}'>*foo</li>
25241 <li data-parsoid='{}'>#foo</li>
25242 <li data-parsoid='{}'>:foo</li>
25243 <li data-parsoid='{}'>;foo</li>
25244 </ul>
25245
25246 <ol>
25247 <li>*foo</li>
25248 <li>#foo</li>
25249 <li>:foo</li>
25250 <li>;foo</li>
25251 <li data-parsoid='{}'>*foo</li>
25252 <li data-parsoid='{}'>#foo</li>
25253 <li data-parsoid='{}'>:foo</li>
25254 <li data-parsoid='{}'>;foo</li>
25255 </ol>
25256 !! wikitext
25257 * *foo
25258 * #foo
25259 * :foo
25260 * ;foo
25261 *<nowiki>*foo</nowiki>
25262 *<nowiki>#foo</nowiki>
25263 *<nowiki>:foo</nowiki>
25264 *<nowiki>;foo</nowiki>
25265
25266 # *foo
25267 # #foo
25268 # :foo
25269 # ;foo
25270 #<nowiki>*foo</nowiki>
25271 #<nowiki>#foo</nowiki>
25272 #<nowiki>:foo</nowiki>
25273 #<nowiki>;foo</nowiki>
25274 !!end
25275
25276 !! test
25277 Lists: 2. Inside definition lists
25278 !! options
25279 parsoid=html2wt
25280 !! html/parsoid
25281 <dl><dt>;foo</dt></dl>
25282 <dl><dt>:foo</dt></dl>
25283 <dl><dt>:foo</dt>
25284 <dd>bar</dd></dl>
25285 <dl><dd>:foo</dd></dl>
25286 !! wikitext
25287 ; ;foo
25288
25289 ; <nowiki>:foo</nowiki>
25290
25291 ; <nowiki>:foo</nowiki>
25292 : bar
25293
25294 : :foo
25295 !!end
25296
25297 !! test
25298 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25299 !! options
25300 parsoid=html2wt
25301 !! html/parsoid
25302 <ul>
25303 <li>*foo*bar</li>
25304 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25305 </ul>
25306 !! wikitext
25307 * *foo*bar
25308 *<nowiki>*foo</nowiki>''it''*bar
25309 !!end
25310
25311 !! test
25312 Lists: 4. No escapes needed
25313 !! options
25314 parsoid=html2wt
25315 !! html/parsoid
25316 <ul>
25317 <li>foo*bar
25318 </li>
25319 </ul>
25320 <ul>
25321 <li><i>foo</i>*bar
25322 </li>
25323 </ul>
25324 <ul>
25325 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25326 </li>
25327 </ul>
25328 <ul>
25329 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25330 </li>
25331 </ul>
25332 !! wikitext
25333 *foo*bar
25334
25335 *''foo''*bar
25336
25337 *[[Foo]]: bar
25338
25339 *[[Foo]]*bar
25340 !!end
25341
25342 !! test
25343 Lists: 5. No unnecessary escapes
25344 !! options
25345 parsoid=html2wt
25346 !! html/parsoid
25347 <ul><li> bar <span>[[foo]]</span></li></ul>
25348 <ul><li> =bar <span>[[foo]]</span></li></ul>
25349 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25350 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25351 <ul><li> =bar <span>foo]]</span>=</li></ul>
25352 <ul><li> <s></s>: a</li></ul>
25353 <ul><li> <i>* foo</i></li></ul>
25354
25355 !! wikitext
25356 * bar <span><nowiki>[[foo]]</nowiki></span>
25357
25358 * =bar <span><nowiki>[[foo]]</nowiki></span>
25359
25360 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25361
25362 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25363
25364 * =bar <span>foo]]</span>=
25365
25366 * <s></s>: a
25367
25368 * ''* foo''
25369 !!end
25370
25371 !! test
25372 Lists: 6. Escape bullets in SOL position
25373 !! options
25374 parsoid=html2wt
25375 !! html/parsoid
25376 <p><!--cmt-->*foo</p>
25377 !! wikitext
25378 <!--cmt--><nowiki>*</nowiki>foo
25379 !!end
25380
25381 !! test
25382 Lists: 7. Escape bullets in a multi-line context
25383 !! options
25384 parsoid=html2wt
25385 !! html/parsoid
25386 <p>a
25387 *b
25388 </p>
25389 !! wikitext
25390 a
25391 <nowiki>*</nowiki>b
25392 !!end
25393
25394 !! test
25395 Lists: 8. Escape colons only if not present in tags
25396 !! options
25397 parsoid=html2wt
25398 !! html/parsoid
25399 <dl><dt>a:b<i>c:d</i></dt></dl>
25400 !! wikitext
25401 ; <nowiki>a:b</nowiki>''c:d''
25402 !! end
25403
25404 #### --------------- HRs ---------------
25405 #### 1. Single line
25406 #### -----------------------------------
25407
25408 !! test
25409 HRs: 1. Single line
25410 !! options
25411 parsoid=html2wt
25412 !! html/parsoid
25413 <hr />----
25414 <hr />=foo=
25415 <hr />*foo
25416 !! wikitext
25417 ----<nowiki>----</nowiki>
25418 ----=foo=
25419 ----*foo
25420 !! end
25421
25422 #### --------------- Tables ---------------
25423 #### 1a. Simple example
25424 #### 1b. No escaping needed (!foo)
25425 #### 1c. No escaping needed (|foo)
25426 #### 1d. No escaping needed (|}foo)
25427 ####
25428 #### 2a. Nested in td (<td>foo|bar</td>)
25429 #### 2b. Nested in td (<td>foo||bar</td>)
25430 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25431 ####
25432 #### 3a. Nested in th (<th>foo!bar</th>)
25433 #### 3b. Nested in th (<th>foo!!bar</th>)
25434 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25435 ####
25436 #### 4a. Escape -
25437 #### 4b. Escape +
25438 #### 4c. No escaping needed
25439 #### --------------------------------------
25440
25441 !! test
25442 Tables: 1a. Simple example
25443 !! options
25444 parsoid=html2wt
25445 !! html/parsoid
25446 <p>{|
25447 |}
25448 </p>
25449 !! wikitext
25450 <nowiki>{|</nowiki>
25451 |}
25452 !! end
25453
25454 !! test
25455 Tables: 1b. No escaping needed
25456 !! options
25457 parsoid=html2wt
25458 !! html/parsoid
25459 <p>!foo
25460 </p>
25461 !! wikitext
25462 !foo
25463 !! end
25464
25465 !! test
25466 Tables: 1c. No escaping needed
25467 !! options
25468 parsoid=html2wt
25469 !! html/parsoid
25470 <p>|foo
25471 </p>
25472 !! wikitext
25473 |foo
25474 !! end
25475
25476 !! test
25477 Tables: 1d. No escaping needed
25478 !! options
25479 parsoid=html2wt
25480 !! html/parsoid
25481 <p>|}foo
25482 </p>
25483 !! wikitext
25484 |}foo
25485 !! end
25486
25487 !! test
25488 Tables: 2a. Nested in td
25489 !! options
25490 parsoid=html2wt
25491 !! html/parsoid
25492 <table><tbody><tr>
25493 <td>foo|bar</td></tr>
25494 <tr><td>x<div>a|b</div></td>
25495 </tbody></table>
25496 !! wikitext
25497 {|
25498 |<nowiki>foo|bar</nowiki>
25499 |-
25500 |x<div><nowiki>a|b</nowiki></div>
25501 |}
25502 !! html/php+tidy
25503 <table>
25504 <tbody><tr>
25505 <td>foo|bar
25506 </td></tr>
25507 <tr>
25508 <td>x<div>a|b</div>
25509 </td></tr></tbody></table>
25510 !! end
25511
25512 !! test
25513 Tables: 2b. Nested in td
25514 !! options
25515 parsoid=html2wt
25516 !! html/parsoid
25517 <table><tbody><tr>
25518 <td>foo||bar</td>
25519 <td>a<i>b||c</i></td>
25520 <td>a<i><div>b||c</div></i></td>
25521 </tr></tbody></table>
25522 !! wikitext
25523 {|
25524 |<nowiki>foo||bar</nowiki>
25525 |a''<nowiki>b||c</nowiki>''
25526 |a''<div><nowiki>b||c</nowiki></div>''
25527 |}
25528 !! html/php
25529 <table>
25530 <tr>
25531 <td>foo||bar
25532 </td>
25533 <td>a<i>b||c</i>
25534 </td>
25535 <td>a<i><div>b||c</div></i>
25536 </td></tr></table>
25537
25538 !! end
25539
25540 !! test
25541 Tables: 2c. Nested in td -- no escaping needed
25542 !! options
25543 parsoid=html2wt
25544 !! html/*
25545 <table>
25546 <tr>
25547 <td>foo!!bar
25548 </td></tr></table>
25549
25550 !! wikitext
25551 {|
25552 |foo!!bar
25553 |}
25554 !! end
25555
25556 !! test
25557 Tables: 3a. Nested in th
25558 !! options
25559 parsoid=html2wt
25560 !! html/*
25561 <table>
25562 <tr>
25563 <th>foo!bar
25564 </th></tr></table>
25565
25566 !! wikitext
25567 {|
25568 !foo!bar
25569 |}
25570 !! end
25571
25572 !! test
25573 Tables: 3b. Nested in th
25574 !! options
25575 parsoid=html2wt
25576 !! html/parsoid
25577 <table><tbody>
25578 <tr><th>foo!!bar</th>
25579 <th><i>foo|bar</i></th>
25580 <th><i>foo!!bar</i></th>
25581 <th><i><span>foo!!bar</span></i></th>
25582 </tr></tbody></table>
25583 !! wikitext
25584 {|
25585 !<nowiki>foo!!bar</nowiki>
25586 !''<nowiki>foo|bar</nowiki>''
25587 !''<nowiki>foo!!bar</nowiki>''
25588 !''<span><nowiki>foo!!bar</nowiki></span>''
25589 |}
25590 !! html/php
25591 <table>
25592 <tr>
25593 <th>foo!!bar
25594 </th>
25595 <th><i>foo|bar</i>
25596 </th>
25597 <th><i>foo!!bar</i>
25598 </th>
25599 <th><i><span>foo!!bar</span></i>
25600 </th></tr></table>
25601
25602 !! end
25603
25604 !! test
25605 Tables: 3c. Nested in th
25606 !! options
25607 parsoid=html2wt
25608 !! html/parsoid
25609 <table><tbody>
25610 <tr><th>foo||bar</th>
25611 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25612 </tr></tbody></table>
25613 !! wikitext
25614 {|
25615 !<nowiki>foo||bar</nowiki>
25616 !<nowiki>foo||bar</nowiki>
25617 |}
25618 !! html/php
25619 <table>
25620 <tr>
25621 <th>foo||bar
25622 </th>
25623 <th>foo||bar
25624 </th></tr></table>
25625
25626 !! end
25627
25628 !! test
25629 Tables: 4a. Escape -
25630 !! options
25631 parsoid=html2wt
25632 !! html/*
25633 <table>
25634 <tr>
25635 <th>-bar
25636 </th></tr>
25637 <tr>
25638 <td>-bar
25639 </td></tr></table>
25640
25641 !! wikitext
25642 {|
25643 !-bar
25644 |-
25645 |<nowiki>-bar</nowiki>
25646 |}
25647 !! end
25648
25649 !! test
25650 Tables: 4b. Escape +
25651 !! options
25652 parsoid=html2wt
25653 !! html/*
25654 <table>
25655 <tr>
25656 <th>+bar
25657 </th></tr>
25658 <tr>
25659 <td>+bar
25660 </td></tr></table>
25661
25662 !! wikitext
25663 {|
25664 !+bar
25665 |-
25666 |<nowiki>+bar</nowiki>
25667 |}
25668 !! end
25669
25670 !! test
25671 Tables: 4c. No escaping needed
25672 !! options
25673 parsoid=html2wt
25674 !! html/parsoid
25675 <table><tbody>
25676 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25677 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25678 <tr><td>foo
25679 <p>bar|baz
25680 +bar
25681 -bar</p></td></tr>
25682 <tr><td>x
25683 <div>a|b</div></td>
25684 </tbody></table>
25685 !! wikitext
25686 {|
25687 |foo-bar
25688 |foo+bar
25689 |-
25690 |''foo''-bar
25691 |''foo''+bar
25692 |-
25693 |foo
25694 bar|baz
25695 +bar
25696 -bar
25697 |-
25698 |x
25699 <div>a|b</div>
25700 |}
25701 !! html/php
25702 <table>
25703 <tr>
25704 <td>foo-bar
25705 </td>
25706 <td>foo+bar
25707 </td></tr>
25708 <tr>
25709 <td><i>foo</i>-bar
25710 </td>
25711 <td><i>foo</i>+bar
25712 </td></tr>
25713 <tr>
25714 <td>foo
25715 <p>bar|baz
25716 +bar
25717 -bar
25718 </p>
25719 </td></tr>
25720 <tr>
25721 <td>x
25722 <div>a|b</div>
25723 </td></tr></table>
25724
25725 !! end
25726
25727 !! test
25728 Tables: 4d. No escaping needed
25729 !! options
25730 parsoid=html2wt
25731 !! html/parsoid
25732 <table>
25733 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25734 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25735 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25736 </tbody></table>
25737 !! wikitext
25738 {|
25739 |[[Foo]]-bar
25740 ||+1
25741 ||-2
25742 |}
25743 !! html/php
25744 <table>
25745 <tr>
25746 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25747 </td>
25748 <td>+1
25749 </td>
25750 <td>-2
25751 </td></tr></table>
25752
25753 !! end
25754
25755 !! test
25756 T97430: Don't emit empty nowiki pairs around marker meta tags
25757 !! options
25758 parsoid=html2wt
25759 !! html/parsoid
25760 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25761 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25762 !! wikitext
25763 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25764 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25765 !! end
25766
25767 !! test
25768 Unclosed xmlish element in table line shouldn't eat end delimiters
25769 !! options
25770 parsoid=html2wt
25771 !! html/parsoid
25772 <table>
25773 <tbody><tr><td> &lt;foo</td>
25774 <td> bar></td></tr>
25775 </tbody></table>
25776 !! wikitext
25777 {|
25778 | <foo
25779 | bar>
25780 |}
25781 !! html/php
25782 <table>
25783 <tr>
25784 <td>&lt;foo
25785 </td>
25786 <td>bar&gt;
25787 </td></tr></table>
25788
25789 !! end
25790
25791 #### --------------- Links ----------------
25792 #### 1. Quote marks in link text
25793 #### 2. Wikilinks: Escapes needed
25794 #### 3. Wikilinks: No escapes needed
25795 #### 4. Extlinks: Escapes needed
25796 #### 5. Extlinks: No escapes needed
25797 #### --------------------------------------
25798 !! test
25799 Links 1. WikiLinks: No escapes needed
25800 !! options
25801 parsoid=html2wt
25802 !! html/parsoid
25803 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25804 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25805 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25806 !! wikitext
25807 [[Foo|Foo''boo'']]
25808 [[Foo|[Foobar]]]
25809 [[Foo|x [Foobar] x]]
25810 !! html/php
25811 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25812 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25813 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25814 </p>
25815 !! end
25816
25817 !! test
25818 Links 2. WikiLinks: Escapes needed
25819 !! options
25820 parsoid=html2wt
25821 !! html/parsoid
25822 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25823 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25824 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25825 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25826 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25827 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25828 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25829 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25830 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25831 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25832 !! wikitext
25833 [[Foo|<nowiki>Foobar]</nowiki>]]
25834 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25835 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25836 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25837 [[Foo|<nowiki>|Bar</nowiki>]]
25838 [[Foo|<nowiki>]]bar</nowiki>]]
25839 [[Foo|<nowiki>[[bar</nowiki>]]
25840 [[Foo|<nowiki>x [[ y</nowiki>]]
25841 [[Foo|<nowiki>x ]] y</nowiki>]]
25842 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25843 !! html/php
25844 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25845 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25846 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25847 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25848 <a href="/wiki/Foo" title="Foo">|Bar</a>
25849 <a href="/wiki/Foo" title="Foo">]]bar</a>
25850 <a href="/wiki/Foo" title="Foo">[[bar</a>
25851 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25852 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25853 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25854 </p>
25855 !! end
25856
25857 !! test
25858 Links 3. WikiLinks: No escapes needed
25859 !! options
25860 parsoid=html2wt
25861 !! html/parsoid
25862 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25863 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25864 !! wikitext
25865 [[Foo|[Foobar]]
25866 [[Foo|foo|bar]]
25867 !! html/php
25868 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25869 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25870 </p>
25871 !! end
25872
25873 !! test
25874 Links 4. ExtLinks: Escapes needed
25875 !! options
25876 parsoid=html2wt
25877 !! html/parsoid
25878 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25879 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25880 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25881 <p>[http://google.com]</p>
25882 <p>[http://google.com google]</p>
25883 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25884 <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>
25885 !! wikitext
25886 [http://google.com <nowiki>[google]</nowiki>]
25887 [http://google.com <nowiki>google]</nowiki>]
25888 [http://google.com <nowiki>goog] le</nowiki>]
25889
25890 <nowiki>[http://google.com]</nowiki>
25891
25892 <nowiki>[http://google.com google]</nowiki>
25893
25894 [http://google.com<nowiki>]</nowiki>
25895
25896 [{{echo|http://google.com}}<nowiki>]</nowiki>
25897 !! html/php
25898 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25899 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25900 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25901 </p><p>[http://google.com]
25902 </p><p>[http://google.com google]
25903 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25904 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25905 </p>
25906 !! end
25907
25908 !! test
25909 Links 5. ExtLinks: No escapes needed
25910 !! options
25911 parsoid=html2wt
25912 !! html/parsoid
25913 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25914 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25915 !! wikitext
25916 [http://google.com [google]
25917
25918 [[http://google.com]]
25919 !! html/php
25920 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25921 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25922 </p>
25923 !! end
25924
25925 !! test
25926 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25927 !! options
25928 parsoid=html2wt
25929 !! html/parsoid
25930 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25931 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25932 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25933 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25934 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25935 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25936 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25937 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25938 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25939 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25940 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25941 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25942 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25943 </p>
25944 !! wikitext
25945 x<nowiki/>http://example.com<nowiki/>y
25946 http://example.com<nowiki/>?x
25947 http://example.com<nowiki/>&x
25948 http://example.com<nowiki/>'x
25949 http://example.com<nowiki/>,x
25950 http://example.com<nowiki/>.x
25951 http://example.com<nowiki/>;x
25952 http://example.com<nowiki/>:x
25953 http://example.com<nowiki/>;x
25954 http://example.com<nowiki/>!x
25955 http://example.com<nowiki/>=x
25956 http://example.com<nowiki/>(x)
25957 http://example.com(x<nowiki/>)
25958 !! end
25959
25960 !! test
25961 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25962 !! options
25963 parsoid=html2wt
25964 !! html/parsoid
25965 <p>x
25966 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25967 y
25968 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25969 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25970 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25971 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25972 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25973 </p>
25974 !! wikitext
25975 x
25976 http://example.com
25977 y
25978 "http://example.com"
25979 (http://example.com)
25980 (http://example.com) foo
25981 http://example.com,
25982 http://example.com, foo
25983 !! html/php
25984 <p>x
25985 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25986 y
25987 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25988 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25989 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25990 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25991 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25992 </p>
25993 !! end
25994
25995 !! test
25996 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25997 !! options
25998 parsoid=html2wt
25999 !! html/parsoid
26000 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26001 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26002 !! wikitext
26003 http://example.com.,;:!?\
26004 -http://example.com:
26005 !! html/php
26006 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26007 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26008 </p>
26009 !! end
26010
26011 !! test
26012 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26013 !! options
26014 parsoid=html2wt
26015 !! html/parsoid
26016 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26017 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26018 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26019 !! wikitext
26020 RFC 123<nowiki/>4
26021 RFC 123<nowiki/>y
26022 X<nowiki/>RFC 123<nowiki/>y
26023 !! end
26024
26025 !! test
26026 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26027 !! options
26028 parsoid=html2wt
26029 !! html/parsoid
26030 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26031 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26032 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26033 </p>
26034 !! wikitext
26035 RFC 123?foo
26036 RFC 123&foo
26037 -RFC 123-
26038 !! html/php
26039 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26040 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26041 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26042 </p>
26043 !! end
26044
26045 !! test
26046 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26047 !! options
26048 parsoid=html2wt
26049 !! html/parsoid
26050 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26051 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26052 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26053 !! wikitext
26054 PMID 123<nowiki/>4
26055 PMID 123<nowiki/>y
26056 X<nowiki/>PMID 123<nowiki/>y
26057 !! end
26058
26059 !! test
26060 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26061 !! options
26062 parsoid=html2wt
26063 !! html/parsoid
26064 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26065 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26066 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26067 </p>
26068 !! wikitext
26069 PMID 123?foo
26070 PMID 123&foo
26071 -PMID 123-
26072 !! html/php
26073 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26074 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26075 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26076 </p>
26077 !! end
26078
26079 !! test
26080 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26081 !! options
26082 parsoid=html2wt
26083 !! html/parsoid
26084 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26085 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26086 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26087 </p>
26088 !! wikitext
26089 ISBN 1234567890<nowiki/>1
26090 ISBN 1234567890<nowiki/>x
26091 a<nowiki/>ISBN 1234567890<nowiki/>b
26092 !! end
26093
26094 !! test
26095 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26096 !! options
26097 parsoid=html2wt
26098 !! html/parsoid
26099 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26100 !! wikitext
26101 -ISBN 1234567890's
26102 !! html/php
26103 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26104 </p>
26105 !! end
26106
26107 !! test
26108 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26109 !! options
26110 parsoid=html2wt
26111 !! html/*
26112 <p>this is not a link: http://example.com
26113 </p>
26114 !! wikitext
26115 this is not a link: <nowiki>http://example.com</nowiki>
26116 !! end
26117
26118 !! test
26119 Links 15. Link trails can't become link prefixes.
26120 !! options
26121 language=is
26122 parsoid=html2wt
26123 !! html/parsoid
26124 <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>
26125 !! wikitext
26126 [[Söfnuður]]-[[00]]
26127 !! html/php
26128 <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>
26129 </p>
26130 !! end
26131
26132 #### --------------- Quotes ---------------
26133 #### 1. Quotes inside <b> and <i>
26134 #### 2. Link fragments separated by <i> and <b> tags
26135 #### 3. Link fragments inside <i> and <b>
26136 #### 4. No escaping needed
26137 #### --------------------------------------
26138 !! test
26139 1a. Quotes inside <b> and <i>
26140 !! options
26141 parsoid=html2wt
26142 !! html/*
26143 <p><i>'foo'</i>
26144 <i>''foo''</i>
26145 <i>'''foo'''</i>
26146 <i>foo</i>'s
26147 <b>'foo'</b>
26148 <b>''foo''</b>
26149 <b>'''foo'''</b>
26150 <b>foo'<i>bar'</i>baz</b>
26151 <b>foo</b>'s
26152 '<i>foo</i>
26153 <i>foo</i>'
26154 <i>foo'</i>'
26155 '<i>foo</i>'
26156 '<b>foo</b>
26157 <b>foo</b>'
26158 '<b>foo</b>'
26159 <i>fools'<span> errand</span></i>
26160 <i><span>fool</span>'s errand</i>
26161 '<i>foo</i> bar '<i>baz</i>
26162 a|!*#-:;+-~[]{}b'<i>x</i>
26163 </p>
26164 !! wikitext
26165 ''<nowiki/>'foo'''
26166 ''<nowiki>''foo''</nowiki>''
26167 ''<nowiki>'''foo'''</nowiki>''
26168 ''foo''<nowiki/>'s
26169 '''<nowiki/>'foo''''
26170 '''<nowiki>''foo''</nowiki>'''
26171 '''<nowiki>'''foo'''</nowiki>'''
26172 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26173 '''foo'''<nowiki/>'s
26174 '''foo''
26175 ''foo''<nowiki/>'
26176 ''foo'''<nowiki/>'
26177 '''foo''<nowiki/>'
26178 ''''foo'''
26179 '''foo'''<nowiki/>'
26180 ''''foo'''<nowiki/>'
26181 ''fools'<span> errand</span>''
26182 ''<span>fool</span>'s errand''
26183 '<nowiki/>''foo'' bar '''baz''
26184 a|!*#-:;+-~[]{}b'''x''
26185 !! end
26186
26187 !! test
26188 1b. Quotes inside <b> and <i> with other tags on same line
26189 !! options
26190 parsoid=html2wt
26191 !! html/parsoid
26192 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26193 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26194 <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>
26195 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26196 '<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>
26197 '<i>foo</i> <div title="name">test</div>
26198 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26199 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26200 <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>
26201 </ol>
26202 !! wikitext
26203 '''a'' foo ''[[bar]]''
26204 ''a''' foo ''[[bar]]''
26205 ''a''' foo '''{{echo|[[bar]]}}'''
26206 [[foo]] x'''[[bar]]''
26207 '''foo'' <ref>test</ref>
26208 '''foo'' <div title="name">test</div>
26209 '''foo'' and <br> bar
26210 <references />
26211 !! end
26212
26213 !! test
26214 2. Link fragments separated by <i> and <b> tags
26215 !! options
26216 parsoid=html2wt
26217 !! html/parsoid
26218 <p>[[<i>foo</i>hello]]</p>
26219 <p>[[<b>foo</b>hello]]</p>
26220 !! wikitext
26221 [[''foo''<nowiki>hello]]</nowiki>
26222
26223 [['''foo'''<nowiki>hello]]</nowiki>
26224 !! end
26225
26226 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26227 # this is one of the shortcomings of this format
26228 !! test
26229 3. Link fragments inside <i> and <b>
26230 !! options
26231 parsoid=html2wt
26232 !! html/parsoid
26233 <p><i>[[foo</i>]]</p>
26234 <p><b>[[foo</b>]]</p>
26235 !! wikitext
26236 ''[[foo''<nowiki>]]</nowiki>
26237
26238 '''[[foo'''<nowiki>]]</nowiki>
26239 !! end
26240
26241 !! test
26242 4. No escaping needed
26243 !! options
26244 parsoid=html2wt
26245 !! html/parsoid
26246 <p>'<span><i>bar</i></span>'
26247 '<span><b>bar</b></span>'
26248 'a:b'foo
26249 </p>
26250 !! wikitext
26251 '<span>''bar''</span>'
26252 '<span>'''bar'''</span>'
26253 'a:b'foo
26254 !! end
26255
26256 #### ----------- Paragraphs ---------------
26257 #### 1. No unnecessary escapes
26258 #### --------------------------------------
26259
26260 !! test
26261 1. No unnecessary escapes
26262 !! options
26263 parsoid=html2wt
26264 !! html/parsoid
26265 <p>bar <span>[[foo]]</span>
26266 </p><p>=bar <span>[[foo]]</span>
26267 </p><p>[[bar <span>[[foo]]</span>
26268 </p><p>]]bar <span>[[foo]]</span>
26269 </p><p>=bar <span>foo]]</span>=
26270 </p>
26271 !! wikitext
26272 bar <span><nowiki>[[foo]]</nowiki></span>
26273
26274 =bar <span><nowiki>[[foo]]</nowiki></span>
26275
26276 [[bar <span><nowiki>[[foo]]</nowiki></span>
26277
26278 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26279
26280 =bar <span>foo]]</span><nowiki>=</nowiki>
26281 !!end
26282
26283 #### ----------------------- PRE --------------------------
26284 #### 1. Leading whitespace in SOL context should be escaped
26285 #### ------------------------------------------------------
26286 !! test
26287 1. Leading whitespace in SOL context should be escaped
26288 !! options
26289 parsoid=html2wt
26290 !! html/parsoid
26291 <p> a</p>
26292
26293 <p> a</p>
26294
26295 <p> a(tab)</p>
26296
26297 <p> a
26298 <!--cmt-->
26299 a</p>
26300
26301 <p>a
26302 b</p>
26303
26304 <p>a
26305 b</p>
26306
26307 <p>a
26308 b</p>
26309 !! wikitext
26310 <nowiki> </nowiki>a
26311
26312 <nowiki> </nowiki> a
26313
26314 a(tab)
26315
26316 <nowiki> </nowiki> a
26317 <!--cmt-->
26318 <nowiki> </nowiki>a
26319
26320 a
26321 <nowiki> </nowiki>b
26322
26323 a
26324 b
26325
26326 a
26327 b
26328 !! html/php
26329 <p> a
26330 </p><p> a
26331 </p><p> a(tab)
26332 </p><p> a
26333 a
26334 </p><p>a
26335 b
26336 </p><p>a
26337 b
26338 </p><p>a
26339 b
26340 </p>
26341 !! end
26342
26343 !! test
26344 2. Leading whitespace in non-indent-pre contexts should not be escaped
26345 !! options
26346 parsoid=html2wt
26347 !! html/parsoid
26348 <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>
26349 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26350 <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>
26351 b</span></li>
26352 </ol>
26353 !! wikitext
26354 foo <ref>''a''
26355 b</ref>
26356 <references />
26357 !! end
26358
26359 !! test
26360 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26361 !! options
26362 parsoid=html2wt
26363 !! html/parsoid
26364 <blockquote>
26365 <p>
26366 a
26367 <span>b</span>
26368 c</p>
26369 </blockquote>
26370 !! wikitext
26371 <blockquote>
26372 a
26373 <span>b</span>
26374 c
26375 </blockquote>
26376 !! end
26377
26378 !! test
26379 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26380 !! options
26381 parsoid=html2wt
26382 !! html/parsoid
26383 <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>
26384 !! wikitext
26385 [[File:Foobar.jpg|thumb|caption]]
26386 !! end
26387
26388 !! test
26389 5. Nowiki escaping should account for indent-pres
26390 !! options
26391 parsoid=html2wt
26392 !! html/parsoid
26393 <pre>==foo==</pre>
26394 !! wikitext
26395 ==foo==
26396 !! end
26397
26398 !!test
26399 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 <pre>
26404 * foo
26405 * bar
26406 </pre>
26407 !! wikitext
26408 * foo
26409 * bar
26410 !! end
26411
26412 #### --------------- Behavior Switches --------------------
26413
26414 !! test
26415 1. Valid behavior switches should be escaped
26416 !! options
26417 parsoid=html2wt
26418 !! html/parsoid
26419 __TOC__
26420 <i>__TOC__</i>
26421 !! wikitext
26422 <nowiki>__TOC__</nowiki>
26423 ''<nowiki>__TOC__</nowiki>''
26424 !! end
26425
26426 !! test
26427 2. Invalid behavior switches should not be escaped
26428 !! options
26429 parsoid=html2wt
26430 !! html/parsoid
26431 __TOO__
26432 __|__
26433 !! wikitext
26434 __TOO__
26435 __|__
26436 !! end
26437
26438 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26439 !! test
26440 Behavior switches should be SOL-transparent
26441 !! options
26442 parsoid=html2wt
26443 !! html/parsoid
26444 <meta property="mw:PageProp/toc" />
26445
26446 <!-- this one's bogus -->
26447 <pre>__TOO__</pre>
26448
26449 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26450
26451 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26452 !! wikitext
26453 __TOC__
26454
26455 <!-- this one's bogus -->
26456 __TOO__
26457
26458 __TOC__ foo
26459
26460 __TOC__
26461 bar
26462 !! end
26463
26464 #### --------------- HTML tags ---------------
26465 #### 1. a tags
26466 #### 2. other tags
26467 #### 3. multi-line html tag
26468 #### 4. extension tags
26469 #### -----------------------------------------
26470 !! test
26471 1. a tags
26472 !! options
26473 parsoid=html2wt
26474 !! html/parsoid
26475 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26476 !! wikitext
26477 <a href="http://google.com">google</a>
26478 !! end
26479
26480 !! test
26481 2. other tags
26482 !! options
26483 parsoid=html2wt
26484 !! html/parsoid
26485 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26486 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26487 <li> &lt;td&gt;</li></ul>
26488
26489 !! wikitext
26490 * <nowiki><div>foo</div></nowiki>
26491 * <nowiki><div style="color:red">foo</div></nowiki>
26492 * <nowiki><td></nowiki>
26493 !! end
26494
26495 !! test
26496 3. multi-line html tag
26497 !! options
26498 parsoid=html2wt
26499 !! html/parsoid
26500 <p>&lt;div
26501 &gt;foo&lt;/div
26502 &gt;
26503 </p>
26504 !! wikitext
26505 <nowiki><div
26506 >foo</div
26507 ></nowiki>
26508 !! end
26509
26510 !! test
26511 4. extension tags
26512 !! options
26513 parsoid=html2wt
26514 !! html/parsoid
26515 <p>&lt;ref&gt;foo&lt;/ref&gt;
26516 </p><p>&lt;ref&gt;bar
26517 </p><p>baz&lt;/ref&gt;
26518 </p>
26519 !! wikitext
26520 <nowiki><ref>foo</ref></nowiki>
26521
26522 <nowiki><ref>bar</nowiki>
26523
26524 baz<nowiki></ref></nowiki>
26525 !! end
26526
26527 #### --------------- Others ---------------
26528 !! test
26529 Escaping nowikis
26530 !! options
26531 parsoid=html2wt
26532 !! html/parsoid
26533 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26534 </p>
26535 !! wikitext
26536 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26537 !! end
26538
26539 ## The quote-char in the input is necessary for triggering the bug
26540 !! test
26541 (T54035) Nowiki-escaping should not get tripped by " :" in text
26542 !! options
26543 parsoid=html2wt
26544 !! html/parsoid
26545 <p>foo's bar :</p>
26546 !! wikitext
26547 foo's bar :
26548 !! end
26549
26550 #----------- End of wikitext escaping tests --------------
26551
26552 !! test
26553
26554 Tag-like HTML structures are passed through as text
26555 !! wikitext
26556 <x y>
26557
26558 <x.y>
26559
26560 <x-y>
26561
26562 1>2
26563
26564 x<y
26565
26566 a>b
26567
26568 1<d e>f
26569 !! html
26570 <p>&lt;x y&gt;
26571 </p><p>&lt;x.y&gt;
26572 </p><p>&lt;x-y&gt;
26573 </p><p>1&gt;2
26574 </p><p>x&lt;y
26575 </p><p>a&gt;b
26576 </p><p>1&lt;d e&gt;f
26577 </p>
26578 !! end
26579
26580 !! test
26581 HTML tag with necessary entities in attributes
26582 !! wikitext
26583 <span title="&amp;amp;">foo</span>
26584 !! html
26585 <p><span title="&amp;amp;">foo</span>
26586 </p>
26587 !! end
26588
26589 !! test
26590 HTML tag with 'unnecessary' entity encoding in attributes
26591 !! wikitext
26592 <span title="&amp;">foo</span>
26593 !! html
26594 <p><span title="&amp;">foo</span>
26595 </p>
26596 !! end
26597
26598 !! test
26599 HTML tag with broken attribute value quoting
26600 !! options
26601 parsoid=wt2html,html2html
26602 !! wikitext
26603 <span title="Hello world>Foo</span>
26604 !! html/php
26605 <p><span title="Hello world">Foo</span>
26606 </p>
26607 !! html/parsoid
26608 <p><span title="Hello world">Foo</span></p>
26609 !! end
26610
26611 !! test
26612 Self-closed tag with broken attribute value quoting
26613 !! options
26614 parsoid=wt2html,html2html
26615 !! wikitext
26616 <div title="Hello world />Foo
26617 !! html/php+tidy
26618 <div title="Hello world"></div><p>Foo
26619 </p>
26620 !! html/parsoid
26621 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26622 !! end
26623
26624 !! test
26625 Table with broken attribute value quoting
26626 !! options
26627 parsoid=wt2html,html2html
26628 !! wikitext
26629 {|
26630 | title="Hello world|Foo
26631 |}
26632 !! html/php
26633 <table>
26634 <tr>
26635 <td title="Hello world">Foo
26636 </td></tr></table>
26637
26638 !! html/parsoid
26639 <table>
26640 <tr>
26641 <td title="Hello world">Foo
26642 </td></tr></table>
26643
26644 !! end
26645
26646 !! test
26647 Table with broken attribute value quoting on consecutive lines
26648 !! options
26649 parsoid=wt2html,html2html
26650 !! wikitext
26651 {|
26652 | title="Hello world|Foo
26653 | style="color:red|Bar
26654 |}
26655 !! html/php
26656 <table>
26657 <tr>
26658 <td title="Hello world">Foo
26659 </td>
26660 <td style="color:red">Bar
26661 </td></tr></table>
26662
26663 !! html/parsoid
26664 <table><tbody>
26665 <tr>
26666 <td title="Hello world">Foo
26667 </td><td style="color: red">Bar
26668 </td></tr></tbody></table>
26669
26670 !! end
26671
26672 !!test
26673 Accept empty td cell attribute
26674 !! wikitext
26675 {|
26676 | align="center" |foo|| |
26677 |}
26678 !! html
26679 <table>
26680 <tr>
26681 <td align="center">foo</td>
26682 <td>
26683 </td></tr></table>
26684
26685 !!end
26686
26687 !!test
26688 Non-empty attributes in th-cells
26689 !! wikitext
26690 {|
26691 !Foo!! style="color: red" |Bar
26692 |}
26693 !! html
26694 <table>
26695 <tr>
26696 <th>Foo</th>
26697 <th style="color: red">Bar
26698 </th></tr></table>
26699
26700 !!end
26701
26702 !!test
26703 Accept empty attributes in th-cells
26704 !! wikitext
26705 {|
26706 !|foo!!|bar
26707 |}
26708 !! html
26709 <table>
26710 <tr>
26711 <th>foo</th>
26712 <th>bar
26713 </th></tr></table>
26714
26715 !!end
26716
26717 !!test
26718 Empty table rows go away
26719 !! wikitext
26720 {|
26721 |Hello
26722 |there
26723 |- class="foo"
26724 |-
26725 |}
26726 !! html
26727 <table>
26728 <tr>
26729 <td>Hello
26730 </td>
26731 <td>there
26732 </td></tr>
26733
26734 </table>
26735
26736 !! end
26737
26738 ###
26739 ### Parsoid-centric tests for testing RTing of inter-element separators
26740 ### Edge cases not tested by existing parser tests and specific to
26741 ### Parsoid-specific serialization strategies.
26742 ###
26743
26744 !!test
26745 RT-ed inter-element separators should be valid separators
26746 !! wikitext
26747 {|
26748 |- [[foo]]
26749 |}
26750 !! html/php
26751 <table>
26752
26753 </table>
26754
26755 !! html/parsoid
26756 <table>
26757 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26758 </tbody></table>
26759 !!end
26760
26761 # Parsoid-only test of a DOM pass
26762 !!test
26763 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26764 !! wikitext
26765 {|
26766 |<small>foo
26767 bar
26768 |}
26769
26770 {|
26771 |<small>foo<small>
26772 |}
26773 !! html/parsoid
26774 <table>
26775 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26776 <p>bar</p></small></td></tr>
26777 </tbody></table>
26778
26779 <table>
26780 <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>
26781 </tbody></table>
26782 !!end
26783
26784 # Note that the "style" attribute is really a template parameter here.
26785 # The = would have to be {{=}} if you wanted the literal.
26786 !!test
26787 Empty TD followed by TD with tpl-generated attribute
26788 !! wikitext
26789 {|
26790 |-
26791 |
26792 |{{echo|style='color:red'}}|foo
26793 |}
26794 !! html
26795 <table>
26796
26797 <tr>
26798 <td>
26799 </td>
26800 <td>foo
26801 </td></tr></table>
26802
26803 !!end
26804
26805 !!test
26806 Indented table with an empty td
26807 !! wikitext
26808 {|
26809 |-
26810 |
26811 |foo
26812 |}
26813 !! html
26814 <table>
26815
26816 <tr>
26817 <td>
26818 </td>
26819 <td>foo
26820 </td></tr></table>
26821
26822 !!end
26823
26824 ## We have some newline diffs RT-ing this edge case
26825 ## and it is not important enough -- we seem to be emitting
26826 ## at most 2 newlines after a </tr> and this is unrelated to
26827 ## the issue from T85627 that this is testing.
26828 !!test
26829 Indented table with blank lines in between (T85627)
26830 !! options
26831 parsoid=wt2html
26832 !! wikitext
26833 {|
26834 |foo
26835
26836
26837 |}
26838 !! html
26839 <table>
26840
26841 <tr>
26842 <td>foo
26843 </td></tr></table>
26844
26845 !!end
26846
26847 !!test
26848 Indented block & table
26849 !! wikitext
26850 <div>foo</div>
26851 {|
26852 |foo
26853 |}
26854 !! html/php
26855 <div>foo</div>
26856 <table>
26857 <tr>
26858 <td>foo
26859 </td></tr></table>
26860
26861 !! html/parsoid
26862 <div data-parsoid='{"stx":"html"}'>foo</div>
26863 <table><tbody>
26864 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26865 </tbody></table>
26866 !!end
26867
26868 !! test
26869 Indent and comment before table row
26870 !! wikitext
26871 {|
26872 <!--hi-->|-
26873 |there
26874 |}
26875 !! html/php
26876 <table>
26877
26878 <tr>
26879 <td>there
26880 </td></tr></table>
26881
26882 !! html/parsoid
26883 <table>
26884 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26885 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26886 </tbody></table>
26887 !! end
26888
26889 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26890 !!test
26891 Empty TR followed by a template-generated TR
26892 !!options
26893 parsoid
26894 !! wikitext
26895 {|
26896 |-
26897 {{echo|<tr><td>foo</td></tr>}}
26898 |}
26899 !! html
26900 <table>
26901 <tbody>
26902 <tr class='mw-empty-elt'></tr>
26903 <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}}]}'>
26904 <td>foo</td></tr>
26905 </tbody></table>
26906 !!end
26907
26908 ## PHP and parsoid output differ for this, and since this is primarily
26909 ## for testing Parsoid's serializer, marking this Parsoid only
26910 !!test
26911 Empty TR followed by mixed-ws-comment line should RT correctly
26912 !!options
26913 parsoid
26914 !! wikitext
26915 {|
26916 |-
26917 <!--c-->
26918 |-
26919 <!--c--> <!--d-->
26920 |}
26921 !! html
26922 <table>
26923 <tbody>
26924 <tr class='mw-empty-elt'></tr>
26925 <!--c-->
26926 <tr>
26927 <!--c--> </tr><!--d-->
26928 </tbody></table>
26929
26930 !!end
26931
26932 !!test
26933 Multi-line image caption generated by templates with/without trailing newlines
26934 !! wikitext
26935 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26936 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26937 !! html/parsoid
26938 <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>
26939 <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>
26940 !!end
26941
26942 !! test
26943 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26944 !! options
26945 parsoid=html2wt
26946 !! html/parsoid
26947 <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>
26948
26949 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26950 !! wikitext
26951 <includeonly>foo</includeonly>
26952 new para
26953
26954 [[Category:Foo]]
26955
26956 = new heading =
26957 !! end
26958
26959 ## PHP emits broken html for this, and since this is primarily
26960 ## a Parsoid serializer test, marking this Parsoid only
26961 !!test
26962 Improperly nested inline or quotes tags with whitespace in between
26963 !! wikitext
26964 <span> <s>x</span> </s>
26965 ''' ''x''' ''
26966 !! html/parsoid
26967 <p><span> <s>x</s></span><s> </s>
26968 <b> <i>x</i></b><i> </i>
26969 </p>
26970 !!end
26971
26972 !!test
26973 Encapsulate protected attributes from wt
26974 !! wikitext
26975 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26976
26977 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26978 | ok
26979 |}
26980 !! html/parsoid
26981 <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>
26982
26983 <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">
26984 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26985 </tbody></table>
26986 !!end
26987
26988 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26989 ## Having nested or stray pre tags results in the attempt to add duplicates,
26990 ## causing an assertion fail. This test tries to prevent that situation.
26991 !!test
26992 Ensure ParagraphWrapper can deal with stray closing pre tags
26993 !!options
26994 parsoid=wt2html
26995 !! wikitext
26996 plain text</pre>
26997 !! html/parsoid
26998 plain text
26999 !!end
27000
27001 !!test
27002 1. Ensure fostered text content is wrapped in element nodes
27003 !!options
27004 parsoid=wt2html
27005 !! wikitext
27006 <table>hi</table><table>ho</table>
27007 !! html/parsoid
27008 <p>hi</p>
27009 <table></table>
27010 <p>ho</p>
27011 <table></table>
27012 !!end
27013
27014 !!test
27015 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27016 !!options
27017 parsoid=wt2html,wt2wt
27018 !! wikitext
27019 <table>
27020 <tr> || ||
27021 <td> a
27022 </table>
27023 !! html/parsoid
27024 <p> || ||
27025 </p><table>
27026 <tbody><tr><td> a</td></tr>
27027 </tbody></table>
27028 !!end
27029
27030 !!test
27031 Encapsulation properly handles null DSR information from foster box
27032 !!options
27033 parsoid=wt2html,wt2wt
27034 !! wikitext
27035 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27036 !! html/parsoid
27037 <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>
27038 !!end
27039
27040 !!test
27041 1. Encapsulate foster-parented transclusion content
27042 !!options
27043 parsoid=wt2wt,wt2html
27044 !! wikitext
27045 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27046 !! html/parsoid
27047 <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>
27048 <tbody>
27049 <tr>
27050 <td>bar</td>
27051 </tr>
27052 </tbody>
27053 </table>
27054 !!end
27055
27056 !!test
27057 2. Encapsulate foster-parented transclusion content
27058 !!options
27059 parsoid=wt2wt,wt2html
27060 !! wikitext
27061 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27062 !! html/parsoid
27063 <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>
27064 <table>
27065 <tbody>
27066 <tr>
27067 <td>bar</td>
27068 </tr>
27069 </tbody>
27070 </table>
27071 !!end
27072
27073 !!test
27074 3. Encapsulate foster-parented transclusion content
27075 !!options
27076 parsoid=wt2wt,wt2html
27077 !! wikitext
27078 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27079 !! html/parsoid
27080 <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;]}">
27081 <p>foo</p>
27082 </div>
27083 <table>
27084 <tbody>
27085 <tr>
27086 <td>bar</td>
27087 </tr>
27088 </tbody>
27089 </table>
27090 !!end
27091
27092 !!test
27093 4. Encapsulate foster-parented transclusion content
27094 !!options
27095 parsoid=wt2wt,wt2html
27096 !! wikitext
27097 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27098 !! html/parsoid
27099 <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;]}">
27100 <p>foo</p>
27101 </div>
27102 <table>
27103 <tbody>
27104 <tr>
27105 <td>bar</td>
27106 </tr>
27107 </tbody>
27108 </table>
27109 !!end
27110
27111 !!test
27112 5. Encapsulate foster-parented transclusion content
27113 !!options
27114 parsoid=wt2wt,wt2html
27115 !! wikitext
27116 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27117 !! html/parsoid
27118 <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>
27119 <table>
27120 <tbody>
27121 <tr>
27122 <td>
27123 <div>
27124 <p>foo</p>
27125 </div>
27126 </td>
27127 </tr>
27128 </tbody>
27129 </table>
27130 !!end
27131
27132 !!test
27133 6. Encapsulate foster-parented transclusion content
27134 !!options
27135 parsoid=wt2wt,wt2html
27136 !! wikitext
27137 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27138 !! html/parsoid
27139 <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>
27140 <table>
27141 <tbody>
27142 <tr>
27143 <td>
27144 <div>
27145 <p>foo</p>
27146 </div>
27147 </td>
27148 </tr>
27149 </tbody>
27150 </table>
27151 <p>ok</p>
27152 !!end
27153
27154 !!test
27155 7. Encapsulate foster-parented transclusion content
27156 !!options
27157 parsoid=wt2wt,wt2html
27158 !! wikitext
27159 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27160 !! html/parsoid
27161 <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>
27162 <table>
27163 <tbody>
27164 <tr>
27165 <td>bar</td>
27166 </tr>
27167 </tbody>
27168 </table>
27169 !!end
27170
27171 # Note that the wt is broken on purpose: the = should be {{=}} if you
27172 # don't want it to be a template parameter key.
27173 !!test
27174 8. Encapsulate foster-parented transclusion content
27175 !!options
27176 parsoid=wt2wt,wt2html
27177 !! wikitext
27178 {{echo|a
27179 }}{|{{echo|style='color:red'}}
27180 |-
27181 |b
27182 |}
27183 !! html/parsoid
27184 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27185 <span> </span>
27186 <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>
27187 <table>
27188 <tbody>
27189 <tr>
27190 <td>b</td>
27191 </tr>
27192 </tbody>
27193 </table>
27194 !!end
27195
27196 !!test
27197 9. Encapsulate foster-parented transclusion content
27198 !!options
27199 parsoid=wt2wt,wt2html
27200 !! wikitext
27201 <table>{{echo|hi</table>hello}}
27202 !! html/parsoid
27203 <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>
27204 !!end
27205
27206 !!test
27207 Table in fosterable position
27208 !!options
27209 parsoid=wt2html
27210 !! wikitext
27211 {{OpenTable}}
27212 <div>
27213 {|
27214 |}
27215 </div>
27216 |}
27217 !! html/parsoid
27218 <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">
27219 </span>
27220 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27221
27222 <table>
27223 </table>
27224 !!end
27225
27226 # Parsoid only for T66747
27227 !! test
27228 Properly encapsulate empty-content transclusions in fosterable positions
27229 !! wikitext
27230 <table>
27231 {{#if:|
27232 <td>foo</td>
27233 }}
27234 </table>
27235 !! html/parsoid
27236 <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"}]]}'>
27237
27238 </table>
27239 !! end
27240
27241 !! test
27242 Always encapsulate foster box when template range is expanded to table
27243 !! options
27244 parsoid=wt2wt
27245 !! wikitext
27246 {|
27247 hello
27248 {{OpenTable}}
27249 |}
27250 !! html/parsoid
27251
27252 !! end
27253
27254 !! test
27255 T115289: Unclosed table
27256 !! wikitext
27257 {{echo|<table>}}<!--c-->[[Category:Two]]
27258 !! html/parsoid
27259 <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>
27260 !! end
27261
27262 !! test
27263 T115289: Don't migrate newlines out of tables with fostered content
27264 !! wikitext
27265 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27266 !! html/parsoid
27267 <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>
27268 !! end
27269
27270 !! test
27271 T73074: More fostering fun
27272 !! wikitext
27273 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27274 !! html/parsoid
27275 <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>
27276 !! end
27277
27278 !!test
27279 Support <object> element with .data attribute
27280 !!options
27281 parsoid=html2wt
27282 !! html/parsoid
27283 <object data="test.swf"></object>
27284 !! wikitext
27285 <object data="test.swf"></object>
27286 !!end
27287
27288 !! test
27289 Don't block XML namespace declaration
27290 !! wikitext
27291 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27292 !! html/php
27293 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27294 </p>
27295 !! html/parsoid
27296 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27297 !! end
27298
27299 # -----------------------------------------------------------------
27300 # The following section of tests are primarily to spec requirements
27301 # around Parsoid's serialization (old, new, edited content)
27302 #
27303 # All these tests are marked Parsoid html2wt and html2html only
27304 # ----------------------------------------------------------------
27305
27306 !! test
27307 Ignore rel attribute in a-tags during serialization to url-links
27308 !! options
27309 parsoid=html2wt
27310 !! html/parsoid
27311 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27312 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27313 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27314 !! wikitext
27315 http://en.wikipedia.org/wiki/Foobar
27316 http://en.wikipedia.org/wiki/Foobar
27317 http://en.wikipedia.org/wiki/Foobar
27318 !! end
27319
27320 # 'mi' is a localinterwiki prefix as well as a language
27321 !! test
27322 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27323 !! options
27324 parsoid=html2wt
27325 !! html/parsoid
27326 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27327 !! wikitext
27328 [[Foo]]
27329 !! end
27330
27331 !! test
27332 Parsoid should accept interwiki shortcuts
27333 !! options
27334 parsoid=html2wt
27335 !! html/parsoid
27336 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27337 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27338 <a href='./fr:Foo'>Foo</a></p>
27339 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27340 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27341 <a href='fr%3AFoo'>Foo</a></p>
27342 <p><a href='FR%3AFoo'>Foo</a>
27343 <a href='./FR:Foo'>Foo</a></p>
27344 !! wikitext
27345 [[:fr:Foo|Foo]]
27346 [[:fr:Foo|Foo]]
27347 [[:fr:Foo|Foo]]
27348
27349 [[:fr:Foo|Foo]]
27350 [[:fr:Foo|Foo]]
27351 [[:fr:Foo|Foo]]
27352
27353 [[:fr:Foo|Foo]]
27354 [[:fr:Foo|Foo]]
27355 !! end
27356
27357 !! test
27358 Parsoid should not accept invalid interwiki shortcuts
27359 !! options
27360 parsoid=html2wt
27361 !! html/parsoid
27362 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27363 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27364 <a href='news:Foo'>Foo</a></p>
27365 !! wikitext
27366 [news:Foo Foo]
27367 [news:Foo Foo]
27368 [news:Foo Foo]
27369 !! end
27370
27371 # See T93839
27372 !! test
27373 New wikilinks should be serialized properly
27374 !! options
27375 parsoid=html2wt
27376 !! html/parsoid
27377 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27378 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27379 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27380 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27381 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27382 !! wikitext
27383 [[Foo]]
27384 [[Foo]]
27385 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27386 http://en.wikipedia.org/wiki/Foo
27387 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27388 !! end
27389
27390 !! test
27391 New wiki links (href variations)
27392 !! options
27393 parsoid=html2wt
27394 !! html/parsoid
27395 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27396 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27397 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27398 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27399 !! wikitext
27400 [[Foo_bar]]
27401 [[Foo_bar]]
27402 [[Foo_bar]]
27403 [[Toxine bactérienne]]
27404 !! end
27405
27406 !! test
27407 New wiki links (content string variations)
27408 !! options
27409 parsoid=html2wt
27410 !! html/parsoid
27411 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27412 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27413 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27414 !! wikitext
27415 [[Foo_bar]]
27416 [[Foo bar]]
27417 [[Foo_bar|./Foo_bar]]
27418 !! end
27419
27420 !! test
27421 New category links (href variations)
27422 !! options
27423 parsoid=html2wt
27424 !! html/parsoid
27425 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27426 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27427 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27428 !! wikitext
27429 [[Category:Toxine bactérienne]]
27430 [[Category:Toxine bactérienne]]
27431 [[Category:Toxine bactérienne]]
27432 !! end
27433
27434 !! test
27435 New sol transparent links don't need indent-pre nowiki protection
27436 !! options
27437 parsoid=html2wt
27438 language=de
27439 !! html/parsoid
27440 <link rel="mw:PageProp/redirect" href="./Main_Page">
27441 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27442 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27443 !! wikitext
27444 #WEITERLEITUNG [[Main Page]]
27445 <!-- this is good --> [[Category:Good]]
27446 <!-- this is great --> [[Kategorie:Great]]
27447 !! end
27448
27449 !! test
27450 New interlanguage links (href variations)
27451 !! options
27452 parsoid=html2wt
27453 !! html/parsoid
27454 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27455 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27456 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27457 !! wikitext
27458 [[es:Toxine bactérienne]]
27459 [[es:Toxine_bactérienne]]
27460 [[es:Toxine_bactérienne]]
27461 !! end
27462
27463 !! test
27464 Image: Modifying size of an image (1)
27465 !! options
27466 parsoid={
27467 "modes": ["wt2wt"],
27468 "changes": [
27469 ["img[height]", "attr", "height", "22"],
27470 ["img[width]", "attr", "width", "200"]
27471 ]
27472 }
27473 !! wikitext
27474 [[Image:Foobar.jpg|230x230px]]
27475 !! wikitext/edited
27476 [[Image:Foobar.jpg|200x200px]]
27477 !!end
27478
27479 !! test
27480 Image: Modifying size of an image (2)
27481 !! options
27482 parsoid={
27483 "modes": ["wt2wt"],
27484 "changes": [
27485 ["img[height]", "attr", "height", "100"],
27486 ["img[width]", "attr", "width", "500"]
27487 ]
27488 }
27489 !! wikitext
27490 [[Image:Foobar.jpg|230x230px]]
27491 !! wikitext/edited
27492 [[Image:Foobar.jpg|500x500px]]
27493 !!end
27494
27495 # Change in size is ignored so long as class='mw-default-size'
27496 !! test
27497 Image: Modifying size of an image (3)
27498 !! options
27499 parsoid={
27500 "modes": ["wt2wt"],
27501 "changes": [
27502 ["figure[class]", "removeClass", "mw-default-size"],
27503 ["figure img", "attr", "height", "19"],
27504 ["figure img", "attr", "width", "170"]
27505 ]
27506 }
27507 !! wikitext
27508 [[Image:Foobar.jpg|thumb]]
27509 !! wikitext/edited
27510 [[Image:Foobar.jpg|thumb|170x170px]]
27511 !!end
27512
27513 !! test
27514 Image: Modifying alignment of an image (T50665)
27515 !! options
27516 parsoid={
27517 "modes": ["wt2wt"],
27518 "changes": [
27519 ["figure[class]", "removeClass", "mw-halign-right"],
27520 ["figure[class]", "addClass", "mw-halign-left"]
27521 ]
27522 }
27523 !! wikitext
27524 [[Image:Foobar.jpg|thumb|caption|right]]
27525 !! wikitext/edited
27526 [[Image:Foobar.jpg|thumb|caption|left]]
27527 !! end
27528
27529 !! test
27530 Image: Modifying mw-default-size of an frameless image (T64805)
27531 !! options
27532 parsoid={
27533 "modes": ["wt2wt"],
27534 "changes": [
27535 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27536 ]
27537 }
27538 !! wikitext
27539 [[Image:Foobar.jpg|frameless|right]]
27540 !! wikitext/edited
27541 [[Image:Foobar.jpg|frameless|right|220x220px]]
27542 !! end
27543
27544 !! test
27545 Image: Modifying valign of an image (T51221)
27546 !! options
27547 parsoid={
27548 "modes": ["wt2wt"],
27549 "changes": [
27550 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27551 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27552 ]
27553 }
27554 !! wikitext
27555 [[File:Foobar.jpg|20px|middle]]
27556 !! wikitext/edited
27557 [[File:Foobar.jpg|20px|text-top]]
27558 !! end
27559
27560 !! test
27561 Image: Modifying alt attribute of an image (T58400)
27562 !! options
27563 parsoid={
27564 "modes": ["wt2wt"],
27565 "changes": [
27566 ["img[alt]", "attr", "alt", "some alternate edited text"]
27567 ]
27568 }
27569 !! wikitext
27570 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27571 !! wikitext/edited
27572 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27573 !!end
27574
27575 !! test
27576 Image: Modifying caption of an image
27577 !! options
27578 parsoid={
27579 "modes": ["wt2wt"],
27580 "changes": [
27581 ["figcaption", "text", "new caption"]
27582 ]
27583 }
27584 !! wikitext
27585 [[Image:Foobar.jpg|thumb|original caption]]
27586 !! wikitext/edited
27587 [[Image:Foobar.jpg|thumb|new caption]]
27588 !!end
27589
27590 !! test
27591 Image: empty alt attribute (T50924)
27592 !! options
27593 parsoid
27594 !! wikitext
27595 [[File:Foobar.jpg|thumb|alt=|bar]]
27596 !! html
27597 <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>
27598 !! end
27599
27600 !! test
27601 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27602 !! options
27603 parsoid=html2wt
27604 language=ar
27605 disabled
27606 !! html/parsoid
27607 <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>
27608 !! wikitext
27609 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27610 !! end
27611
27612 !! test
27613 Image: Block level image should have \n before and after
27614 !! wikitext
27615 123
27616 [[File:Foobar.jpg|right|thumb|150x150px]]
27617 456
27618 !! html/parsoid
27619 <p>123</p>
27620 <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>
27621 <p>456</p>
27622 !! end
27623
27624 !! test
27625 Image: New block level image should have \n before and after (existing content)
27626 !! wikitext
27627 123
27628 [[File:Foobar.jpg|right|thumb|150x150px]]
27629 456
27630 !! html/parsoid
27631 <p>123</p>
27632 <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>
27633 <p>456</p>
27634 !! end
27635
27636 !! test
27637 Image: upright option (parsoid)
27638 !! wikitext
27639 [[File:Foobar.jpg|thumb|upright|caption]]
27640 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27641 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27642 !! html/parsoid
27643 <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>
27644 <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>
27645 <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>
27646 !! end
27647
27648 !! test
27649 Image: upright option is ignored on inline and frame images (parsoid)
27650 !! wikitext
27651 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27652 !! html/parsoid
27653 <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>
27654 !! end
27655
27656 !! test
27657 Image: in template parameter with empty parameter
27658 !! wikitext
27659 {{echo|[[File:Foobar.jpg|link=]]}}
27660 !! html/parsoid
27661 <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>
27662 !! end
27663
27664 !! test
27665 Image: from basic HTML (1)
27666 !! options
27667 parsoid=html2wt
27668 !! html/parsoid
27669 <span typeof="mw:Image">
27670 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27671 </span>
27672 !! wikitext
27673 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27674 !! end
27675
27676 !! test
27677 Image: from basic HTML (2)
27678 !! options
27679 parsoid=html2wt
27680 !! html/parsoid
27681 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27682 !! wikitext
27683 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27684 !! end
27685
27686 !! test
27687 Image: from basic HTML (3)
27688 !! options
27689 parsoid=html2wt
27690 !! html/parsoid
27691 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27692 !! wikitext
27693 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27694 !! end
27695
27696 !! test
27697 Image: from basic HTML (4)
27698 !! options
27699 parsoid=html2wt
27700 !! html/parsoid
27701 <img src="./File:Foobar.jpg">
27702 !! wikitext
27703 [[File:Foobar.jpg|link=]]
27704 !! end
27705
27706 !! test
27707 Image: Invalid title as link
27708 !! wikitext
27709 [[File:Foobar.jpg|link=<]]
27710 !! html/php
27711 <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>
27712 </p>
27713 !! html/parsoid
27714 <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>
27715 !! end
27716
27717 !! test
27718 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27719 !! options
27720 parsoid=html2wt
27721 !! html/parsoid
27722 <ul>
27723 <li><p>foo</p></li>
27724 </ul>
27725 !! wikitext
27726 * foo
27727 !! end
27728
27729 !! test
27730 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27731 !! options
27732 parsoid=html2wt
27733 !! html/parsoid
27734 <ul> <li>foo</li></ul>
27735 !! wikitext
27736 * foo
27737 !! end
27738
27739 !! test
27740 Don't strip leading whitespace when handling indent-pre suppressing tags
27741 !! options
27742 parsoid=html2wt
27743 !! html/parsoid
27744 <table>
27745 <tr><td> indented row</td></tr>
27746 </table>
27747 <blockquote><p>
27748 <b>This is very bold of you!</b>
27749 </p>
27750 <table><tr><td>
27751 indented cell (no pre-wrapping!)
27752 </td></tr></table>
27753 </blockquote>
27754 <p>foo</p>
27755 <div>bar</div>
27756 !! wikitext
27757 {|
27758 | indented row
27759 |}
27760 <blockquote>
27761 '''This is very bold of you!'''
27762
27763 {|
27764 |
27765 indented cell (no pre-wrapping!)
27766 |}
27767 </blockquote>
27768 foo
27769 <div>bar</div>
27770 !! end
27771
27772 !! test
27773 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27774 !! options
27775 parsoid=html2wt
27776 !! html/parsoid
27777 <p>foo</p>
27778 <span>bar</span>
27779
27780 <span>foo2
27781 </span>bar2
27782
27783 <div>foo</div>
27784 <span>bar</span>
27785
27786 <div>
27787 <span>foo</span>
27788 </div>
27789 !! wikitext
27790 foo
27791
27792 <span>bar</span>
27793
27794 <span>foo2
27795 <nowiki> </nowiki></span>bar2
27796
27797 <div>foo</div>
27798 <nowiki> </nowiki><span>bar</span>
27799
27800 <div>
27801 <nowiki> </nowiki><span>foo</span>
27802 </div>
27803 !! end
27804
27805 !! test
27806 Lists: Dont insert newlines in a serialized list item.
27807 !! options
27808 parsoid=html2wt
27809 !! html/parsoid
27810 <ul><li>a<br>b</li><li>c</li></ul>
27811 !! wikitext
27812 * a<br />b
27813 * c
27814 !! end
27815
27816 !! test
27817 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27818 !! options
27819 parsoid={
27820 "modes": ["html2wt"],
27821 "scrubWikitext": false
27822 }
27823 !! html/parsoid
27824 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27825 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27826
27827 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27828 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27829
27830 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27831
27832 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27833 !! wikitext
27834 == hello there [[Category:A1]] ==
27835
27836 == [[Category:A2]] hi pal ==
27837
27838 == <!--foo--> [[Category:A3]] how goes it ==
27839
27840 == it goes well [[Category:A4]] <!--bar--> ==
27841
27842 ==howdy [[Category:A5]]==
27843
27844 == __TOC__ ok ==
27845 !! end
27846
27847 !! test
27848 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27849 !! options
27850 parsoid={
27851 "modes": ["html2wt"],
27852 "scrubWikitext": true
27853 }
27854 !! html/parsoid
27855 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27856 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27857
27858 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27859 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27860
27861 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27862 !! wikitext
27863 == hello there ==
27864 [[Category:A1]]
27865 [[Category:A2]]
27866
27867 == hi pal ==
27868
27869 <!--foo--> [[Category:A3]]
27870
27871 == how goes it ==
27872
27873 == it goes well ==
27874 [[Category:A4]] <!--bar-->
27875
27876 __TOC__
27877
27878 == ok ==
27879 !! end
27880
27881 !! test
27882 Headings: Don't hoist metas that come from templates
27883 !! options
27884 parsoid={
27885 "modes": ["html2wt"],
27886 "scrubWikitext": true
27887 }
27888 !! html/parsoid
27889 <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>
27890 !! wikitext
27891 == {{echo|foo [[Category:Foo]]}} ==
27892 !! end
27893
27894 !! test
27895 Headings: Category in ref isn't hoisted
27896 !! options
27897 parsoid={
27898 "modes": ["html2wt"],
27899 "scrubWikitext": true
27900 }
27901 !! html/parsoid
27902 <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>
27903
27904 <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>
27905 !! wikitext
27906 == foo <ref>bar
27907 [[Category:Baz]] </ref> ==
27908
27909 <references />
27910 !! end
27911
27912 !! test
27913 Parsoid: Serialize positional parameters with = in them as named parameter
27914 !! options
27915 parsoid=html2wt
27916 !! html/parsoid
27917 <p about="#mwt1" typeof="mw:Transclusion"
27918 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27919
27920 <p about="#mwt1" typeof="mw:Transclusion"
27921 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27922
27923 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27924 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27925 <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>
27926 !! wikitext
27927 {{echo|1=f=oo}}
27928
27929 {{echo|1=f=oo|2=bar}}
27930
27931 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27932 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27933 {{echo|<nowiki>f=oo</nowiki>|bar}}
27934 !! end
27935
27936 !! test
27937 Parsoid: Serialize positional parameters with = in extlink as named parameter
27938 !! options
27939 parsoid=html2wt
27940 !! html/parsoid
27941 <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>
27942 !! wikitext
27943 {{echo|1=http://stuff?is=ok}}
27944 !! end
27945
27946 !! test
27947 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27948 !! options
27949 parsoid=html2wt
27950 !! html/parsoid
27951 <div>a<p>b</p></div>
27952 <div>a
27953 <p>b</p></div>
27954 <div>
27955 a
27956 <p>b</p></div>
27957 !! wikitext
27958 <div>a
27959 b
27960 </div>
27961 <div>a
27962 b
27963 </div>
27964 <div>
27965 a
27966
27967 b
27968 </div>
27969 !! end
27970
27971 !! test
27972 Substrings resembling wikitext in hrefs should not get nowiki escapes
27973 !! options
27974 parsoid=html2wt
27975 !! html/parsoid
27976 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27977 !! wikitext
27978 [[Foo''bar''baz]]
27979 !! end
27980
27981 !! test
27982 Enforce single-line context in the serializer
27983 !! options
27984 parsoid=html2wt
27985 !! html/parsoid
27986 <h2>testing
27987 123</h2>
27988
27989 <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">
27990 </span><span about="#mwt1">you</span> </h2>
27991
27992 <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>
27993
27994 <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
27995 there</span></li></ol>
27996
27997 <ul><li>asd
27998 sdf</li></ul>
27999
28000 <ul><li>foo
28001 bar
28002 baz</li>
28003 <li>foo <b>bar</b>
28004 baz</li></ul>
28005
28006 <dl><dt>hi
28007 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28008 ho</dd></dl>
28009
28010 <dl><dd> <table>
28011 <tbody><tr><td> ha
28012 ha
28013 ha</td></tr>
28014 </tbody></table></dd></dl>
28015 !! wikitext
28016 == testing 123 ==
28017
28018 == hi {{bogus|there
28019 you}} ==
28020
28021 == foo <ref>hello
28022 there</ref> ==
28023
28024 <references />
28025
28026 * asd sdf
28027
28028 * foo bar baz
28029 * foo '''bar''' baz
28030
28031 ; hi ho : hi ho
28032
28033 : {|
28034 | ha
28035 ha
28036 ha
28037 |}
28038 !! end
28039
28040 !! test
28041 Serialize new placeholder space without spans
28042 !! options
28043 parsoid=html2wt
28044 !! html/parsoid
28045 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28046
28047 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28048
28049 <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>
28050 !! wikitext
28051 foo : bar
28052
28053 foo : bar
28054
28055 <ref>foo : bar</ref>ok
28056 !! end
28057
28058
28059 #-----------------------
28060 # Tag minimization tests
28061 #-----------------------
28062
28063 !! test
28064 1. I/B quote minimization: wikitext-only tags should be combined
28065 !! options
28066 parsoid=html2wt
28067 !! html/parsoid
28068 <p><i>A</i><i>B</i></p>
28069 <p><b>A</b><b>B</b></p>
28070 <p><i>A</i><b><i>B</i></b></p>
28071 <p><b>A</b><i><b>B</b></i></p>
28072 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28073 <p><i><b>A</b></i><i><b>B</b></i></p>
28074 <p><i><b>A</b></i><b><i>B</i></b></p>
28075 <p><b><i>A</i></b><i><b>B</b></i></p>
28076 !! wikitext
28077 ''AB''
28078
28079 '''AB'''
28080
28081 ''A'''B'''''
28082
28083 '''A''B'''''
28084
28085 '''A''BC''D'''
28086
28087 '''''AB'''''
28088
28089 '''''AB'''''
28090
28091 '''''AB'''''
28092 !! end
28093
28094 !! test
28095 2. I/B quote minimization: wikitext and html tags should not be combined
28096 !! options
28097 parsoid=html2wt
28098 !! html/parsoid
28099 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28100 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28101 !! wikitext
28102 ''A''<i>B</i>
28103
28104 ''A''<nowiki/>'''<i>B</i>'''
28105 !! end
28106
28107 !! test
28108 3. I/B quote minimization: templated content stops minimization
28109 !! options
28110 parsoid=html2wt
28111 !! html/parsoid
28112 <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>
28113 <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>
28114 !! wikitext
28115 ''A''{{echo|''B''}}
28116
28117 ''A''{{echo|'''''B'''''}}
28118 !! end
28119
28120 !! test
28121 4. I/B quote minimization: new content should be mimimized with adjacent old content
28122 !! options
28123 parsoid=html2wt
28124 !! html/parsoid
28125 <p><i>A</i><i>B</i></p>
28126 <p><b>A</b><b>B</b></p>
28127 <p><i>A</i><b><i>B</i></b></p>
28128 !! wikitext
28129 ''AB''
28130
28131 '''AB'''
28132
28133 ''A'''B'''''
28134 !! end
28135
28136 !! test
28137 5a. Merge adjacent quote nodes if they've been edited
28138 !! options
28139 parsoid={
28140 "modes": ["wt2wt", "selser"],
28141 "changes": [
28142 ["p", "contents", "remove", ":contains('b')"]
28143 ]
28144 }
28145 !! wikitext
28146 ''a''b''c''
28147 !! wikitext/edited
28148 ''ac''
28149 !! end
28150
28151 !! test
28152 5b. Merge adjacent quote nodes if they've been edited
28153 !! options
28154 parsoid={
28155 "modes": ["wt2wt", "selser"],
28156 "changes": [
28157 ["#x", "remove"]
28158 ]
28159 }
28160 !! wikitext
28161 ''a''<span id="x">b</span>''c''
28162 !! wikitext/edited
28163 ''ac''
28164 !! end
28165
28166 !! test
28167 1. Merge adjacent link nodes as long as at least one element is new
28168 !! options
28169 parsoid={
28170 "modes": ["html2wt"],
28171 "scrubWikitext": true
28172 }
28173 !! html/parsoid
28174 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28175 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28176 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28177 !! wikitext
28178 [[Football]]
28179 [[Football]]
28180 [[Football|Foot]][[Football|ball]]
28181 !! end
28182
28183 !! test
28184 2. Merge adjacent link nodes and enable additional normalizations
28185 !! options
28186 parsoid={
28187 "modes": ["html2wt"],
28188 "scrubWikitext": true
28189 }
28190 !! html/parsoid
28191 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28192 !! wikitext
28193 [[Football|''Football'']]
28194 !! end
28195
28196 !! test
28197 3. Don't merge adjacent link nodes if scrubWikitext is false
28198 !! options
28199 parsoid={
28200 "modes": ["html2wt"],
28201 "scrubWikitext": false
28202 }
28203 !! html/parsoid
28204 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28205 !! wikitext
28206 [[Football|Foot]][[Football|ball]]
28207 !! end
28208
28209 #------------------------------
28210 # End of tag minimization tests
28211 #------------------------------
28212
28213 !!test
28214 T56262: New entities
28215 !! options
28216 parsoid=html2wt
28217 !! html/parsoid
28218 <span typeof="mw:Entity">&nbsp;</span>
28219 !! wikitext
28220 &nbsp;
28221 !! end
28222
28223 ## Note that there is no wikitext output for 'unknownproperty' ##
28224 ## Unknown magic words are silently dropped ##
28225
28226 !! test
28227 Magic words
28228 !! options
28229 parsoid=html2wt
28230 !! html/parsoid
28231 <meta property='mw:PageProp/toc' />
28232 <meta property='mw:PageProp/notoc' />
28233 <meta property='mw:PageProp/forcetoc' />
28234 <meta property='mw:PageProp/index' />
28235 <meta property='mw:PageProp/noindex' />
28236 <meta property='mw:PageProp/nogallery' />
28237 <meta property='mw:PageProp/noeditsection' />
28238 <meta property='mw:PageProp/notitleconvert' />
28239 <meta property='mw:PageProp/nocontentconvert' />
28240 <meta property='mw:PageProp/unknownproperty' />
28241 !! wikitext
28242 __TOC__
28243 __NOTOC__
28244 __FORCETOC__
28245 __INDEX__
28246 __NOINDEX__
28247 __NOGALLERY__
28248 __NOEDITSECTION__
28249 __NOTITLECONVERT__
28250 __NOCONTENTCONVERT__
28251 !! end
28252
28253 !! test
28254 Consecutive <pre>s should not get merged
28255 !! options
28256 parsoid=html2wt,html2html
28257 !! html/parsoid
28258 <pre>a</pre><pre>b</pre>
28259
28260 <pre>c
28261 </pre><pre>
28262 d</pre>
28263
28264 <pre>e
28265
28266 </pre><pre>
28267
28268 f</pre>
28269 !! wikitext
28270 a
28271
28272 b
28273
28274 c
28275
28276 d
28277
28278 e
28279
28280
28281
28282 f
28283 !! end
28284
28285 !! test
28286 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28287 !! options
28288 parsoid=html2wt
28289 !! html/parsoid
28290 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28291 !! wikitext
28292 [[Special:BookSources/1234567890|ISBN 1234567895]]
28293 !! end
28294
28295 !! test
28296 Edited RFC links not serializable as RFC links should serialize as extlinks
28297 !! options
28298 parsoid=html2wt
28299 !! html/parsoid
28300 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28301 !! wikitext
28302 [https://tools.ietf.org/html/rfc123 New RFC]
28303 !! end
28304
28305 !! test
28306 Edited PMID links not serializable as PMID links should serialize as extlinks
28307 !! options
28308 parsoid=html2wt
28309 !! html/parsoid
28310 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28311 !! wikitext
28312 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28313 !! end
28314
28315 !! test
28316 WTS of autolinks with trailing/surrounding context
28317 !! options
28318 parsoid=html2wt
28319 !! html/parsoid
28320 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28321 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28322 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28323 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28324 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28325 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28326 !! wikitext
28327 http://cscott.net'''foo'''
28328
28329 http://cscott.net<b>foo</b>
28330
28331 '''http://cscott.net'''
28332
28333 '''http://cscott.net '''
28334
28335 '''http://cscott.net<nowiki/>x'''
28336
28337 http://cscott.net<nowiki/>x
28338 !! end
28339
28340 !! test
28341 WTS of autolinks with nowikis (round-trip)
28342 !! wikitext
28343 x<nowiki/>http://cscott.net<nowiki/>x
28344 !! html/parsoid
28345 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28346 !! end
28347
28348 # this is the "easy" test because it leaves in place all the
28349 # data-parsoid information indicating this is an autolink
28350 !! test
28351 WTS of autolinks with escapes (editing)
28352 !! options
28353 parsoid={
28354 "modes": ["wt2wt"],
28355 "changes": [
28356 [ "span", "remove" ]
28357 ]
28358 }
28359 !! wikitext
28360 x<nowiki/>http://cscott.net<nowiki/>x
28361 !! wikitext/edited
28362 x<nowiki/>http://cscott.net<nowiki/>x
28363 !! end
28364
28365 !! test
28366 WTS of edited autolink-like text (T103364)
28367 !! options
28368 parsoid={
28369 "modes": ["wt2wt"],
28370 "changes": [
28371 [ "span[typeof]", "removeAttr", "typeof" ]
28372 ]
28373 }
28374 !! wikitext
28375 Not a link: <nowiki>http://example.com</nowiki>.
28376 !! wikitext/edited
28377 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28378 !! end
28379
28380 !! test
28381 WTS of newly-authored autolink-like text (T103364)
28382 !! options
28383 parsoid=html2wt
28384 !! html/parsoid
28385 <p>http://example.com is not a link.</p>
28386 !! wikitext
28387 <nowiki>http://example.com</nowiki> is not a link.
28388 !! end
28389
28390 !! test
28391 WTS of autolink-like text after an autolink (T108563)
28392 !! options
28393 parsoid=html2wt
28394 !! html/parsoid
28395 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28396 !! wikitext
28397 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28398 !! end
28399
28400 !! test
28401 Magic links inside links (not autolinked)
28402 !! wikitext
28403 [[Foo|http://example.com]]
28404 [[Foo|RFC 1234]]
28405 [[Foo|PMID 1234]]
28406 [[Foo|ISBN 123456789x]]
28407
28408 [http://foo.com http://example.com]
28409 [http://foo.com RFC 1234]
28410 [http://foo.com PMID 1234]
28411 [http://foo.com ISBN 123456789x]
28412 !! html+tidy
28413 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28414 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28415 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28416 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28417 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28418 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28419 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28420 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28421 </p>
28422 !! html/parsoid
28423 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28424 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28425 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28426 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28427
28428 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28429 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28430 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28431 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28432 !! end
28433
28434 !! test
28435 Magic links inside image captions (autolinked)
28436 !! wikitext
28437 [[File:Foobar.jpg|thumb|http://example.com]]
28438 [[File:Foobar.jpg|thumb|RFC 1234]]
28439 [[File:Foobar.jpg|thumb|PMID 1234]]
28440 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28441 !! html+tidy
28442 <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>
28443 <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>
28444 <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>
28445 <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>
28446 !! html/parsoid
28447 <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>
28448 <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>
28449 <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>
28450 <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>
28451 !! end
28452
28453 !! test
28454 WTS of magic word text (T109371)
28455 !! options
28456 parsoid=html2wt
28457 !! html/parsoid
28458 <p>RFC 1234</p>
28459 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28460 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28461 !! wikitext
28462 <nowiki>RFC 1234</nowiki>
28463
28464 [http://foo.com RFC 1234]
28465
28466 [[Foo|RFC 1234]]
28467 !! end
28468
28469 !! test
28470 Edited Redirect link should emit a non-piped wikitext link
28471 !! options
28472 parsoid=html2wt
28473 !! html/parsoid
28474 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28475 !! wikitext
28476 #REDIRECT [[Bar]]
28477 !! end
28478
28479 !! test
28480 T75121: Infer extension name from typeOf if data-mw is not present
28481 !! options
28482 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28483 !! html/parsoid
28484 <div typeOf="mw:Extension/foo"></div>
28485 !! wikitext
28486 <foo />
28487 !! end
28488
28489 # Note that the <p> wrapping isn't present in PHP parser output
28490 # The important thing for this test is that P-wrapping doesn't
28491 # interfere with the <nowiki> protection for leading - in <td>
28492 # (which isn't necessary for <th>).
28493 !! test
28494 T88318: p-wrapped dash in table.
28495 !! options
28496 parsoid=html2wt,wt2wt
28497 !! html/parsoid
28498 <table><tbody>
28499 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28500 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28501 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28502 </tbody></table>
28503 !! wikitext
28504 {|
28505 !-
28506 !-
28507 |-
28508 |<nowiki>-</nowiki>
28509 |<nowiki>- </nowiki>
28510 |-
28511 |<small>-</small>
28512 |<br />
28513 -
28514 |<br />
28515 -
28516 |}
28517 !! html/php+tidy
28518 <table>
28519 <tbody><tr>
28520 <th>-
28521 </th>
28522 <th>-
28523 </th></tr>
28524 <tr>
28525 <td>-
28526 </td>
28527 <td>-
28528 </td></tr>
28529 <tr>
28530 <td><small>-</small>
28531 </td>
28532 <td><br />
28533 <p>-
28534 </p>
28535 </td>
28536 <td><br />
28537 <p>-
28538 </p>
28539 </td></tr></tbody></table>
28540 !! end
28541
28542 !! test
28543 T149209: WTS: Handle newlines in table cells properly
28544 !! options
28545 parsoid=html2wt
28546 !! html/parsoid
28547 <table>
28548 <tbody>
28549 <tr><td>a
28550 b
28551 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28552 <tr><td><p>x</p>
28553 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28554 </tbody></table>
28555 <table>
28556 <tbody>
28557 <tr><th>a
28558 b
28559 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28560 <tr><th><p>x</h>
28561 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28562 </tbody></table>
28563 !! wikitext
28564 {|
28565 |a
28566 b
28567 |c
28568 |-
28569 |x
28570 {{!}}y
28571 |}
28572 {|
28573 !a
28574 b
28575 !c
28576 |-
28577 !x
28578 !y
28579 |}
28580 !! end
28581
28582 !! test
28583 T149209: Selser: Handle newlines in table cells properly
28584 !! options
28585 parsoid={
28586 "modes": ["selser"],
28587 "changes": [
28588 [ "#h1", "html", "a\nb\n" ],
28589 [ "#h2", "html", "a\nb\n" ],
28590 [ "#c1", "html", "a\nb\n" ],
28591 [ "#c2", "html", "<p>a</p>" ],
28592 [ "#c3", "html", "<p>a</p>" ],
28593 [ "#c4", "html", "edit-me<p>a</p>" ]
28594 ]
28595 }
28596 !! wikitext
28597 {|
28598 ! id="h1" |edit-me!!1
28599 |-
28600 ! id="h2" |edit-me||2
28601 |-
28602 | id="c1" |edit-me||3
28603 |-
28604 | id="c2" |edit-me||4
28605 |-
28606 | id="c3" |edit-me||p||q||r
28607 |-
28608 | id="c4" |edit-me||p||q||r
28609 |}
28610 !! wikitext/edited
28611 {|
28612 ! id="h1" |a
28613 b
28614 !1
28615 |-
28616 ! id="h2" |a
28617 b
28618 !2
28619 |-
28620 | id="c1" |a
28621 b
28622 |3
28623 |-
28624 | id="c2" |a
28625 |4
28626 |-
28627 | id="c3" |a
28628 |p||q||r
28629 |-
28630 | id="c4" |edit-me
28631 a
28632 |p||q||r
28633 |}
28634 !! end
28635
28636 !! test
28637 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28638 !! options
28639 parsoid=html2wt
28640 !! html/parsoid
28641 <table id='mwAb'>
28642 <td id='mwAc'>foo</td>
28643 <td id='serialize-this'>bar</td>
28644 </table>
28645 !! wikitext
28646 {|
28647 |foo
28648 | id="serialize-this" |bar
28649 |}
28650 !! end
28651
28652 !! test
28653 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28654 !! options
28655 parsoid=html2wt
28656 !! html/parsoid
28657 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28658 !! wikitext
28659 <div id="hello">ok</div>
28660 !! end
28661
28662 !! test
28663 WTS change modes
28664 !! options
28665 parsoid={
28666 "modes": ["wt2wt"],
28667 "changes": [
28668 [ "#xyz", "before", "<b>before</b> stuff " ],
28669 [ "#xyz", "after", " stuff <i>after</i>" ],
28670 [ "#xyz", "html", "x <b>y</b> z" ]
28671 ]
28672 }
28673 !! wikitext
28674 <span id="xyz">hello</span>
28675 !! wikitext/edited
28676 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28677 !! end
28678
28679 !! test
28680 Never serialize a-tag as html, regardless of what data-parsoid has to say
28681 !! options
28682 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28683 !! html/parsoid
28684 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28685 !! wikitext
28686 [[Foo]]
28687 !! end
28688
28689 ## SSS FIXME: This is broken output nevertheless.
28690 ## What might be a reasonable non-broken output for this?
28691 ## This is an edge case unlikely to be seen in production
28692 ## that I am not wasting more time on this right now.
28693 !! test
28694 Never serialize a-tag as html, no matter what attributes it has
28695 !! options
28696 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28697 !! html/parsoid
28698 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28699 !! wikitext
28700 [http://boo.org http://boohoo.org]
28701 !! end
28702
28703 # Misnested is an indication that selser can reuse the source but these have
28704 # shown to sneak through on occasion. See T101768.
28705 # The original wikitext here is: [http://test.com [[one]] two three]
28706 !! test
28707 Strip span tags added to mark misnested links
28708 !! options
28709 parsoid=html2wt
28710 !! html/parsoid
28711 <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>
28712 !! wikitext
28713 [http://test.com][[one]] two three
28714 !! end
28715
28716 !! test
28717 Catch regression when unpacking misnested links
28718 !! options
28719 parsoid=wt2html
28720 !! wikitext
28721 {{echo|hi}}[http://example.com [[ho]]]
28722 !! html/parsoid
28723 <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>
28724 !! end
28725
28726 !! test
28727 Catch regression when unpacking with trailing content
28728 !! wikitext
28729 {{echo|Foo <references/> bar}}
28730 !! html/parsoid
28731 <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>
28732 !! end
28733
28734 !! test
28735 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28736 !! options
28737 parsoid=html2wt
28738 !! html/parsoid
28739 <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|}"]}'>
28740 <tbody><tr><td>d
28741 </td></tr>
28742 </tbody></table>
28743 !! wikitext
28744 {{echo|a}}
28745 {|{{echo|c
28746 {{!}}d
28747 }}
28748 |}
28749 !! end
28750
28751 ## This test verifies the presence and computation of this attribute indirectly
28752 ## by making an edit and ensuring that the serialization is correct (which it would be
28753 ## only if firstWikitextNode is properly set).
28754 !! test
28755 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28756 !! options
28757 parsoid= {
28758 "modes": ["wt2wt"],
28759 "changes": [
28760 [ "div#x", "remove" ],
28761 [ "div", "before", "<div>new</div>" ]
28762 ]
28763 }
28764 !! wikitext
28765 <div id="x">foo</div>
28766 {|
28767 {{echo|<div>boo</div>
28768 {{!}}b}}
28769 |c
28770 |}
28771 !! wikitext/edited
28772
28773 <div>new</div>
28774 {|
28775 {{echo|<div>boo</div>
28776 {{!}}b}}
28777 |c
28778 |}
28779 !! end
28780
28781 # --------------------------------------------
28782 # Tests spec'ing wikitext serialization norms |
28783 # --------------------------------------------
28784
28785 !! test
28786 Serialize multi-line indent-pre starting with wikitext syntax
28787 !! options
28788 parsoid=html2wt
28789 !! html/parsoid
28790 <pre>* 1
28791 ** 2
28792 * 3</pre>
28793 !! wikitext
28794 * 1
28795 ** 2
28796 * 3
28797 !! end
28798
28799 !! test
28800 1. Categories should always be serialized on their own line
28801 !! options
28802 parsoid=html2wt
28803 !! html/parsoid
28804 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28805 !! wikitext
28806 foo
28807 [[Category:Foo]]
28808 bar
28809 !! end
28810
28811 !! test
28812 2. Categories that are part of templates should not introduce a line break
28813 !! wikitext
28814 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28815 !! html/parsoid
28816 <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>
28817 !! end
28818
28819 # Careful while editing these next 2 tests. There are \u200f characters
28820 # before and after the <link> tags in the HTML and following some
28821 # of the categories in wikitext
28822 # Do not remove these characters in edits.
28823 #
28824 # As part of the serialization, these bidi characters will get stripped.
28825 !! test
28826 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28827 !! options
28828 parsoid={
28829 "modes": ["html2wt"],
28830 "scrubWikitext": true
28831 }
28832 !! html/parsoid
28833 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28834 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28835 !! wikitext
28836 [[קטגוריה:טקסים]]
28837 [[קטגוריה: שיטות משפט]]
28838 !! end
28839
28840 !! test
28841 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28842 !! options
28843 parsoid={
28844 "modes": ["html2wt"],
28845 "scrubWikitext": true
28846 }
28847 !! html/parsoid
28848 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28849 !! wikitext
28850 [[קטגוריה:טקסים]]
28851 ‏y
28852 !! end
28853
28854 !! test
28855 Lists: Add space after bullets
28856 !! options
28857 parsoid=html2wt
28858 !! html/parsoid
28859 <ul>
28860 <li>foo</li>
28861 <li> bar</li>
28862 <li><span> baz</span></li>
28863 </ul>
28864 !! wikitext
28865 * foo
28866 * bar
28867 * <span> baz</span>
28868 !! end
28869
28870 !! test
28871 1. Headings: Add space before/after == (T53744)
28872 !! options
28873 parsoid=html2wt
28874 !! html/parsoid
28875 <h2>foo</h2>
28876 <h2> bar</h2>
28877 <h2>baz </h2>
28878 <h2><span> baz</span></h2>
28879 !! wikitext
28880 == foo ==
28881
28882 == bar ==
28883
28884 == baz ==
28885
28886 == <span> baz</span> ==
28887 !! end
28888
28889 !! test
28890 2. Headings: Add space before/after == even after hoisted content
28891 !! options
28892 parsoid={
28893 "modes": ["html2wt"],
28894 "scrubWikitext": true
28895 }
28896 !! html/parsoid
28897 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28898 !! wikitext
28899 [[Category:A2]]
28900
28901 == ok ==
28902 !! end
28903
28904 !! test
28905 1. Headings: suppress newly created empty headings
28906 !! options
28907 parsoid={
28908 "modes": ["html2wt"],
28909 "scrubWikitext": true
28910 }
28911 !! html/parsoid
28912 <h2></h2>
28913 !! wikitext
28914 !! end
28915
28916 !! test
28917 2. Headings: don't suppress empty headings if scrubWikitext is false
28918 !! options
28919 parsoid=html2wt
28920 !! html/parsoid
28921 <h2></h2>
28922 !! wikitext
28923 ==<nowiki/>==
28924 !! end
28925
28926 !! test
28927 3. Headings: suppress empty headings on edits
28928 !! options
28929 parsoid={
28930 "modes": ["selser"],
28931 "scrubWikitext": true,
28932 "changes": [
28933 [ "#x", "remove"]
28934 ]
28935 }
28936 !! wikitext
28937 ==<span id="x">foo</span>==
28938 !! wikitext/edited
28939 !! end
28940
28941 !! test
28942 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28943 !! options
28944 parsoid={
28945 "modes": ["html2wt"],
28946 "scrubWikitext": true
28947 }
28948 !! html/parsoid
28949 <h2>foo<br/>bar</h2>
28950 <h2>foo <span><br/>bar</span> baz</h2>
28951 !! wikitext
28952 == foo bar ==
28953
28954 == foo <span> bar</span> baz ==
28955 !! end
28956
28957 !! test
28958 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28959 !! options
28960 parsoid={
28961 "modes": ["html2wt"],
28962 "scrubWikitext": false
28963 }
28964 !! html/parsoid
28965 <h2>foo<br/>bar</h2>
28966 !! wikitext
28967 == foo<br /> bar ==
28968 !! end
28969
28970 !! test
28971 1. WT Quote Tags: suppress newly created empty style tags
28972 !! options
28973 parsoid={
28974 "modes": ["html2wt"],
28975 "scrubWikitext": true
28976 }
28977 !! html/parsoid
28978 <i></i><b></b>
28979 !! wikitext
28980 !! end
28981
28982 !! test
28983 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28984 !! options
28985 parsoid=html2wt
28986 !! html/parsoid
28987 <i></i><b></b>
28988 !! wikitext
28989 ''<nowiki/>'''''<nowiki/>'''
28990 !! end
28991
28992 !! test
28993 3. WT Quote Tags: suppress empty style tags on edits
28994 !! options
28995 parsoid={
28996 "modes": ["selser"],
28997 "scrubWikitext": true,
28998 "changes": [
28999 [ "#x", "remove"]
29000 ]
29001 }
29002 !! wikitext
29003 '''<span id="x">foo</span>'''
29004 !! wikitext/edited
29005 !! end
29006
29007 !! test
29008 1. Anchors: suppress newly created empty anchors
29009 !! options
29010 parsoid={
29011 "modes": ["html2wt"],
29012 "scrubWikitext": true
29013 }
29014 !! html/parsoid
29015 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29016 !! wikitext
29017 !! end
29018
29019 !! test
29020 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29021 !! options
29022 parsoid={
29023 "modes": ["html2wt"],
29024 "scrubWikitext": false
29025 }
29026 !! html/parsoid
29027 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29028 !! wikitext
29029 [[Test|<nowiki/>]]
29030 !! end
29031
29032 !! test
29033 3. Anchors: suppress empty anchors on edits
29034 !! options
29035 parsoid={
29036 "modes": ["selser"],
29037 "scrubWikitext": true,
29038 "changes": [
29039 [ "#x", "remove"]
29040 ]
29041 }
29042 !! wikitext
29043 [[Test|<span id="x">foo</span>]]
29044 !! wikitext/edited
29045 !! end
29046
29047 !! test
29048 3a. Anchors: do not suppress numbered extlinks
29049 !! options
29050 parsoid={
29051 "modes": ["wt2wt"],
29052 "scrubWikitext": true
29053 }
29054 !! wikitext
29055 [http://foo.com]
29056 !! html/parsoid
29057 <a rel="mw:ExtLink" href="http://foo.com"></a>
29058 !! end
29059
29060 !! test
29061 3b. Anchors: do not suppress numbered extlinks
29062 !! options
29063 parsoid={
29064 "modes": ["wt2wt"],
29065 "scrubWikitext": true,
29066 "changes": [
29067 [ "#x", "remove"]
29068 ]
29069 }
29070 !! wikitext
29071 [http://foo.com <span id="x">foo</span>]
29072 !! wikitext/edited
29073 [http://foo.com]
29074 !! end
29075
29076 !!test
29077 Normalizations should be restricted to edited content
29078 !!options
29079 parsoid={
29080 "modes": ["selser"],
29081 "scrubWikitext": true,
29082 "changes": [
29083 [ "h1", "before", "<i></i>"]
29084 ]
29085 }
29086 !!wikitext
29087 a
29088 = =
29089 b
29090 !!wikitext/edited
29091 a
29092 = =
29093 b
29094 !!end
29095
29096 !! test
29097 1. Multiple normalizations (html2wt)
29098 !! options
29099 parsoid={
29100 "modes": ["html2wt"],
29101 "scrubWikitext": true
29102 }
29103 !! html
29104 <h2><i></i></h2>
29105 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29106 </a><b><i></i></b>x</p>
29107 !! wikitext
29108
29109 [[foo]]
29110 x
29111
29112 !! end
29113
29114 !! test
29115 2. Multiple normalizations (selser)
29116 !! options
29117 parsoid={
29118 "modes": ["selser"],
29119 "scrubWikitext": true,
29120 "changes": [
29121 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29122 ]
29123 }
29124 !! wikitext
29125 <span id="x">foo</span>
29126 !! wikitext/edited
29127 <span id="x">foo</span>
29128
29129 x
29130 !! end
29131
29132 !! test
29133 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29134 !! options
29135 parsoid={
29136 "modes": ["html2wt"],
29137 "scrubWikitext": true
29138 }
29139 !! html/parsoid
29140 <p> hi</p>
29141 <p> hello</p>
29142 !! wikitext
29143 hi
29144
29145 hello
29146 !! end
29147
29148 !! test
29149 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29150 !! options
29151 parsoid=html2wt
29152 !! html/parsoid
29153 <p> hi</p>
29154 <p> hello</p>
29155 !! wikitext
29156 <nowiki> </nowiki>hi
29157
29158 <nowiki> </nowiki> hello
29159 !! end
29160
29161 !! test
29162 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29163 !! options
29164 parsoid={
29165 "modes": ["html2wt"],
29166 "scrubWikitext": true
29167 }
29168 !! html/parsoid
29169 <p>Foo
29170 bar
29171 baz</p>
29172
29173 <table><tr><td>Foo
29174 bar
29175 baz bang</td></tr></table>
29176
29177 <p><!--boo--> foo
29178 bar</p>
29179
29180 <p> foo
29181 bar<span>boo</span></p>
29182 !! wikitext
29183 Foo
29184 bar
29185 baz
29186
29187 {|
29188 |Foo
29189 bar
29190 baz bang
29191 |}
29192
29193 <!--boo-->foo
29194 bar
29195
29196 foo
29197 bar<span>boo</span>
29198 !! end
29199
29200 !! test
29201 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29202 !! options
29203 parsoid={
29204 "modes": ["selser"],
29205 "scrubWikitext": true,
29206 "changes": [
29207 [ "p", "html", " a\n b" ]
29208 ]
29209 }
29210 !! wikitext
29211 xyz
29212 !! wikitext/edited
29213 a
29214 b
29215 !! end
29216
29217 !! test
29218 1. New links that end in spaces
29219 !! options
29220 parsoid={
29221 "modes": ["html2wt"],
29222 "scrubWikitext": false
29223 }
29224 !! html/parsoid
29225 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29226 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29227 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29228 !! wikitext
29229 [[Berlin ]]<nowiki/>is the capital of Germany.
29230
29231 [[Foo ]]'''bar'''
29232
29233 [[Boston ]] is a city.
29234 !! end
29235
29236 !! test
29237 2. New links that end in spaces
29238 !! options
29239 parsoid={
29240 "modes": ["html2wt"],
29241 "scrubWikitext": true
29242 }
29243 !! html/parsoid
29244 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29245 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29246 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29247 !! wikitext
29248 [[Berlin]] is the capital of Germany.
29249
29250 [[Foo]] '''bar'''
29251
29252 [[Boston]] is a city.
29253 !! end
29254
29255 !! test
29256 1. Table cells with escapable prefixes
29257 !! options
29258 parsoid={
29259 "modes": ["html2wt"],
29260 "scrubWikitext": false
29261 }
29262 !! html
29263 <table>
29264 <tr><td>a</td></tr>
29265 <tr><td>-</td></tr>
29266 <tr><td>+</td></tr>
29267 </table>
29268 !! wikitext
29269 {|
29270 |a
29271 |-
29272 |<nowiki>-</nowiki>
29273 |-
29274 |<nowiki>+</nowiki>
29275 |}
29276 !! end
29277
29278 !! test
29279 2. Table cells with escapable prefixes
29280 !! options
29281 parsoid={
29282 "modes": ["html2wt"],
29283 "scrubWikitext": true
29284 }
29285 !! html
29286 <table>
29287 <tr><td>a</td></tr>
29288 <tr><td>-</td></tr>
29289 <tr><td>+</td></tr>
29290 </table>
29291 !! wikitext
29292 {|
29293 |a
29294 |-
29295 | -
29296 |-
29297 | +
29298 |}
29299 !! end
29300
29301 !! test
29302 3a. Table cells with escapable prefixes after edits
29303 !! options
29304 parsoid={
29305 "modes": ["selser"],
29306 "scrubWikitext": true,
29307 "changes": [
29308 [ "table tbody tr:first-child td:first-child", "remove"]
29309 ]
29310 }
29311 !! wikitext
29312 {|
29313 |a||-
29314 |}
29315 !! wikitext/edited
29316 {|
29317 | -
29318 |}
29319 !! end
29320
29321 !! test
29322 3b. Table cells with escapable prefixes after edits
29323 !! options
29324 parsoid={
29325 "modes": ["selser"],
29326 "scrubWikitext": true,
29327 "changes": [
29328 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29329 [ "#x", "remove" ]
29330 ]
29331 }
29332 !! wikitext
29333 {|
29334 |pqr
29335 |<span id="x">foo</span>+
29336 |}
29337 !! wikitext/edited
29338 {|
29339 | -
29340 | +
29341 |}
29342 !! end
29343
29344 # FIXME: This test will fail because
29345 # normalization doesn't realize that the id attribute
29346 # will eliminate the escapable scenario
29347 !! test
29348 4a. Table cells without escapable prefixes after edits
29349 !! options
29350 parsoid={
29351 "modes": ["selser"],
29352 "scrubWikitext": true,
29353 "changes": [
29354 [ "#x", "html", "-" ]
29355 ]
29356 }
29357 !! wikitext
29358 {|
29359 | id="x" |abcd
29360 |}
29361 !! wikitext/edited
29362 {|
29363 | id="x" |-
29364 |}
29365 !! end
29366
29367 ## This tests normalizer's ability to discriminate between
29368 ## cells having identical content.
29369 !! test
29370 4b. Table cells without escapable prefixes after edits
29371 !! options
29372 parsoid={
29373 "modes": ["selser"],
29374 "scrubWikitext": true,
29375 "changes": [
29376 [ "td", "html", "-" ]
29377 ]
29378 }
29379 !! wikitext
29380 {|
29381 |a||b
29382 |}
29383 !! wikitext/edited
29384 {|
29385 | -||-
29386 |}
29387 !! end
29388
29389 ## This tests normalizer's ability to not be tripped by
29390 ## comments (and whitespace)
29391 !! test
29392 4c. Table cells without escapable prefixes after edits
29393 !! options
29394 parsoid={
29395 "modes": ["selser"],
29396 "scrubWikitext": true,
29397 "changes": [
29398 [ "table tbody tr td:first-child", "remove" ]
29399 ]
29400 }
29401 !! wikitext
29402 {|
29403 |-
29404 <!--foo--> |a||-
29405 |}
29406 !! wikitext/edited
29407 {|
29408 |-
29409 <!--foo--> | -
29410 |}
29411 !! end
29412
29413 ## This tests normalizer's ability to handle HTML cells
29414 !! test
29415 4d. Table cells without escapable prefixes after edits
29416 !! options
29417 parsoid={
29418 "modes": ["selser"],
29419 "scrubWikitext": true,
29420 "changes": [
29421 [ "td", "html", "-" ]
29422 ]
29423 }
29424 !! wikitext
29425 <table>
29426 <tr><td>a</td></tr>
29427 </table>
29428 !! wikitext/edited
29429 <table>
29430 <tr><td>-</td></tr>
29431 </table>
29432 !! end
29433
29434 ## T111151 Remove font elements without attributes
29435 !! test
29436 5a. font tags without attributes should be dropped in scrubWikitext mode
29437 !! options
29438 parsoid={
29439 "modes": ["html2wt"],
29440 "scrubWikitext": true
29441 }
29442 !! html
29443 <font>foo</font>
29444 <font><font>bar</font></font>
29445 <font class="x">boo</font>
29446 !! wikitext
29447 foo
29448 bar
29449 <font class="x">boo</font>
29450 !! end
29451
29452 !! test
29453 5b. font tags should not be dropped without scrubWikitext being enabled
29454 !! options
29455 parsoid={
29456 "modes": ["html2wt"],
29457 "scrubWikitext": false
29458 }
29459 !! html
29460 <font>foo</font>
29461 !! wikitext
29462 <font>foo</font>
29463 !! end
29464
29465 !! test
29466 Escape nowiki DOM elements
29467 !! options
29468 parsoid=html2wt
29469 !! html/parsoid
29470 <nowiki><i>foo</i></nowiki>
29471 !! wikitext
29472 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29473 !! end
29474
29475 # This is meant to be an interim fix while we go about figuring out
29476 # how to not introduce these trailing <nowiki/>s in the first place.
29477 !! test
29478 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29479 !! options
29480 parsoid=html2wt
29481 !! html/parsoid
29482 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29483 y</p>
29484 <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>
29485 <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>
29486 !! wikitext
29487 x
29488 y
29489
29490 {{echo|
29491 1 = <nowiki/>}}
29492
29493 {{echo|
29494 1 = <nowiki/>
29495 }}
29496 !! end
29497
29498 !! test
29499 New list is serialized on newlines
29500 !! options
29501 parsoid=html2wt
29502 !! html/parsoid
29503 <p>The quick brown fox jumps over the lazy dog.</p><ul>
29504 <li>Yesterday</li>
29505 <li>Today</li>
29506 <li>Tomorrow</li>
29507 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
29508 !! wikitext
29509 The quick brown fox jumps over the lazy dog.
29510
29511 * Yesterday
29512 * Today
29513 * Tomorrow
29514
29515 The quick onyx goblin jumps over the lazy dwarf.
29516 !! end
29517
29518 !! test
29519 New lists in formatting elements serialized w/o newlines
29520 !! options
29521 parsoid=html2wt
29522 !! html/parsoid
29523 <small>
29524
29525 <ul>
29526 <li>123</li>
29527 </ul>
29528
29529 </small>
29530
29531 <small><ul><li>hi</li></ul></small>
29532 !! wikitext
29533 <small>
29534 * 123
29535 </small>
29536
29537 <small>
29538 * hi
29539 </small>
29540 !! end
29541
29542 !! test
29543 New list in table doesn't need newlines
29544 !! options
29545 parsoid=html2wt
29546 !! html/parsoid
29547 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
29548 !! wikitext
29549 {|
29550 |
29551 * test
29552 * 123
29553 |}
29554 !! end
29555
29556 # ---------------------------------------------------
29557 # End of tests spec'ing wikitext serialization norms |
29558 # ---------------------------------------------------
29559
29560 # T104032
29561 !! test
29562 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29563 !! options
29564 parsoid=html2wt
29565 !! html/parsoid
29566 a<p>b</p>
29567 <b>c</b><p>d</p>
29568 <table><tr>
29569 <td>a<p>b</p></td>
29570 <td><b>c</b><p>d</p></td>
29571 </tr></table>
29572 !! wikitext
29573 a
29574
29575 b
29576
29577 '''c'''
29578
29579 d
29580 {|
29581 |a
29582 b
29583 |'''c'''
29584 d
29585 |}
29586 !! end
29587
29588 !! test
29589 Anchor without href scenarios
29590 !! options
29591 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29592 !! html/parsoid
29593 <a class="bc"></a>
29594 <a class="no">dice</a>
29595 <a name="foo"></a>
29596 !! wikitext
29597
29598 dice
29599 <span name="foo"></span>
29600 !! end
29601
29602 !! test
29603 New transclusion added after a list should be serialized after the list
29604 !! options
29605 parsoid=html2wt
29606 !! html/parsoid
29607 <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>
29608 !! wikitext
29609 * a
29610 {{echo|foo}}
29611 !! end
29612
29613 # -----------------------------------------------------------------
29614 # End of section for Parsoid-only html2wt tests for serialization
29615 # of new content
29616 # -----------------------------------------------------------------
29617
29618 # -----------------------------------------------------------------
29619 # The following section of tests are primarily to spec behavior of
29620 # the selective serializer. All these tests have manual selser
29621 # changes. The automated selser changes for all tests handle the
29622 # wide variation of changes, but these tests here capture specs
29623 # deterministically.
29624 # ----------------------------------------------------------------
29625
29626 ## T90517
29627 !! test
29628 Selser: New comments should not be lost
29629 !! options
29630 parsoid={
29631 "modes": ["selser"],
29632 "changes": [
29633 [ "#a", "after", "<!--c1-->" ],
29634 [ "#b", "before", "<!--c2-->" ]
29635 ]
29636 }
29637 !! wikitext
29638 <span id="a">a</span>
29639
29640 <span id="b">b</span>
29641 !! wikitext/edited
29642 <span id="a">a</span><!--c1-->
29643
29644 <!--c2--><span id="b">b</span>
29645 !! end
29646
29647 ## T89383
29648 !! test
29649 Selser: Check for validity of DSR before using it
29650 !! options
29651 parsoid={
29652 "modes": ["selser"],
29653 "changes": [
29654 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29655 ]
29656 }
29657 !! wikitext
29658 <span id="a">a</span>
29659 !! wikitext/edited
29660 {{DISPLAYTITLE:foo}}
29661 <span id="a">a</span>
29662 !! end
29663
29664 !! test
29665 1. DOMDiff: Changes to <ref> content should be looked up using id
29666 !! options
29667 parsoid={
29668 "modes": ["selser"],
29669 "changes": [
29670 ["#X", "after", "bar"],
29671 ["#Y", "after", "baz"]
29672 ]
29673 }
29674 !! wikitext
29675 X <ref><span id="X">foo</span></ref>
29676 Y <ref name="a" />
29677 <references>
29678 <ref name="a"><span id="Y">foo</span></ref>
29679 </references>
29680 !! wikitext/edited
29681 X <ref><span id="X">foo</span>bar</ref>
29682 Y <ref name="a" />
29683 <references>
29684 <ref name="a"><span id="Y">foo</span>baz</ref>
29685 </references>
29686 !! end
29687
29688 !! test
29689 2. DOMDiff: Changes to <ref> content should be looked up using id
29690 !! options
29691 parsoid={
29692 "modes": ["selser"],
29693 "changes": [
29694 ["#Z", "after", "bar"]
29695 ]
29696 }
29697 !! wikitext
29698 A <ref>foo bar for a</ref>
29699 B <ref group="X" name="b" />
29700
29701 <references />
29702
29703 <references group="X">
29704 <ref name="b"><span id="Z">foo</span></ref>
29705 </references>
29706 !! wikitext/edited
29707 A <ref>foo bar for a</ref>
29708 B <ref group="X" name="b" />
29709
29710 <references />
29711
29712 <references group="X">
29713 <ref name="b"><span id="Z">foo</span>bar</ref>
29714 </references>
29715 !! end
29716
29717 !! test
29718 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29719 !! options
29720 parsoid={
29721 "modes": ["selser"],
29722 "changes": [
29723 [ "div:first-child", "text", "bar" ]
29724 ]
29725 }
29726 !! wikitext
29727 <div style="{{1x|color:red;}}%">foo</div>
29728 !! wikitext/edited
29729 <div style="{{1x|color:red;}}%">bar</div>
29730 !! end
29731
29732 !! test
29733 Empty LI (T49673)
29734 !! wikitext
29735 *a
29736 *
29737 *
29738 *b
29739 !! html+tidy
29740 <ul><li>a</li>
29741 <li class="mw-empty-elt"></li>
29742 <li class="mw-empty-elt"></li>
29743 <li>b</li></ul>
29744 !! end
29745
29746 !! test
29747 Thumbnail output
29748 !! wikitext
29749 [[File:Thumb.png|thumb]]
29750 !! html/php+tidy
29751 <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>
29752 !! html/parsoid
29753 <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>
29754 !! end
29755
29756 !! test
29757 unclosed internal link XSS (T137264)
29758 !! wikitext
29759 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29760 !! html/php
29761 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29762 </p>
29763 !! html/parsoid
29764 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29765 !! end
29766
29767 !! test
29768 Validating that <style> isn't eaten by tidy (T167349)
29769 !! options
29770 styletag=1
29771 !! wikitext
29772 <div class="foo">
29773 <style>.foo::before { content: "<foo>"; }</style>
29774 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29775 </div>
29776 !! html/php+tidy
29777 <div class="foo">
29778 <style>.foo::before { content: "<foo>"; }</style>
29779 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29780 </div>
29781 !! end
29782
29783 !! test
29784 Validating that <style> isn't wrapped in a paragraph (T186965)
29785 !! options
29786 styletag=1
29787 !! wikitext
29788 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29789
29790 <style>.foo::before { content: "<foo>"; }</style>
29791
29792 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29793
29794 But if it's on a line with other content, let it be wrapped.
29795
29796 <style>.foo::before { content: "<foo>"; }</style> bar
29797
29798 foo <style>.foo::before { content: "<foo>"; }</style>
29799
29800 foo <style>.foo::before { content: "<foo>"; }</style> bar
29801
29802 And the same if we have non-paragraph-breaking whitespace
29803
29804 foo
29805 <style>.foo::before { content: "<foo>"; }</style>
29806 bar
29807 !! html/php
29808 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29809 </p>
29810 <style>.foo::before { content: "<foo>"; }</style>
29811 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29812 <p>But if it's on a line with other content, let it be wrapped.
29813 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29814 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29815 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29816 </p><p>And the same if we have non-paragraph-breaking whitespace
29817 </p><p>foo
29818 <style>.foo::before { content: "<foo>"; }</style>
29819 bar
29820 </p>
29821 !! end
29822
29823 !! test
29824 Validating that <link> isn't wrapped in a paragraph (T186965)
29825 !! options
29826 styletag=1
29827 !! wikitext
29828 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29829
29830 <link rel="foo" href="bar"/>
29831
29832 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29833
29834 But if it's on a line with other content, let it be wrapped.
29835
29836 <link rel="foo" href="bar"/> bar
29837
29838 foo <link rel="foo" href="bar"/>
29839
29840 foo <link rel="foo" href="bar"/> bar
29841
29842 And the same if we have non-paragraph-breaking whitespace
29843
29844 foo
29845 <link rel="foo" href="bar"/>
29846 bar
29847 !! html/php
29848 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29849 </p>
29850 <link rel="foo" href="bar"/>
29851 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29852 <p>But if it's on a line with other content, let it be wrapped.
29853 </p><p><link rel="foo" href="bar"/> bar
29854 </p><p>foo <link rel="foo" href="bar"/>
29855 </p><p>foo <link rel="foo" href="bar"/> bar
29856 </p><p>And the same if we have non-paragraph-breaking whitespace
29857 </p><p>foo
29858 <link rel="foo" href="bar"/>
29859 bar
29860 </p>
29861 !! end
29862
29863 !! test
29864 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29865 !! config
29866 wgFragmentMode=[ 'html5', 'legacy' ]
29867 !! wikitext
29868 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29869 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29870 !! html/php
29871 <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>
29872 <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>
29873 </p>
29874 !! html/parsoid
29875 <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>
29876 <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>
29877 !! end
29878
29879 !! test
29880 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29881 !! config
29882 wgFragmentMode=[ 'legacy' ]
29883 !! wikitext
29884 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29885 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29886 !! html/php
29887 <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>
29888 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29889 </p>
29890 !! end
29891
29892 !! test
29893 Decoding of HTML entities in embedded HTML tags
29894 !! wikitext
29895 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29896 !! html/php
29897 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29898
29899 !! html/parsoid
29900 <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>
29901 !! end
29902
29903 !! test
29904 Decoding of HTML entities in indicator names for IDs (T104196)
29905 !! options
29906 parsoid=wt2html,html2html
29907 showindicators
29908 !! wikitext
29909 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29910 !! html/php
29911 1&2&3&amp;4&amp;amp;5=Indicator
29912
29913 !! html/parsoid
29914 <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>
29915 !! end
29916
29917 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29918 !! test
29919 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29920 !! options
29921 showindicators
29922 !! wikitext
29923 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29924 !! html/php
29925 1&2&3&amp;4&amp;amp;5=Indicator
29926
29927 !! html/parsoid
29928 <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>
29929 !! end
29930
29931 # This fragment mode is what Parsoid supports.
29932 !! test
29933 HTML5 ids: fallback to legacy
29934 !! config
29935 wgFragmentMode=[ 'html5', 'legacy' ]
29936 !! wikitext
29937 ==Foo bar==
29938
29939 ==foo Bar==
29940
29941 ==Тест==
29942
29943 ==Тест==
29944
29945 ==тест==
29946
29947 ==Hey < # " > % : '==
29948 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29949
29950 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29951
29952 <!-- These two links should produce identical HTML -->
29953 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29954
29955 !! html/php
29956 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29957 <ul>
29958 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29959 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29960 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29961 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29962 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29963 <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>
29964 </ul>
29965 </div>
29966
29967 <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>
29968 <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>
29969 <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>
29970 <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>
29971 <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>
29972 <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>
29973 <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>
29974 </p><p>💩 <span id="💩"></span>
29975 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29976 </p>
29977 !! html/parsoid
29978 <h2 id="Foo_bar">Foo bar</h2>
29979
29980 <h2 id="foo_Bar_2">foo Bar</h2>
29981
29982 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29983
29984 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29985
29986 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29987
29988 <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>
29989 <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>
29990
29991 <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>
29992
29993 <!-- These two links should produce identical HTML -->
29994 <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>
29995 !! end
29996
29997 # Parsoid doesn't support this mode
29998 !! test
29999 HTML5 ids: legacy with a fallback to modern
30000 !! config
30001 wgFragmentMode=[ 'legacy', 'html5' ]
30002 !! wikitext
30003 ==Foo bar==
30004
30005 ==foo Bar==
30006
30007 ==Тест==
30008
30009 ==Тест==
30010
30011 ==тест==
30012
30013 ==Hey < # " > % : '==
30014 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30015
30016 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30017
30018 <!-- These two links should produce identical HTML -->
30019 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30020
30021 !! html/php
30022 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30023 <ul>
30024 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30025 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30026 <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>
30027 <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>
30028 <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>
30029 <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>
30030 </ul>
30031 </div>
30032
30033 <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>
30034 <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>
30035 <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>
30036 <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>
30037 <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>
30038 <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>
30039 <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>
30040 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30041 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30042 </p>
30043 !! end
30044
30045 # Parsoid doesn't support this mode.
30046 !! test
30047 HTML5 ids: no legacy
30048 !! config
30049 wgFragmentMode=[ 'html5' ]
30050 !! wikitext
30051 ==Foo bar==
30052
30053 ==foo Bar==
30054
30055 ==Тест==
30056
30057 ==Тест==
30058
30059 ==тест==
30060
30061 ==Hey < # " > % : '==
30062 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30063
30064 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30065
30066 <!-- These two links should produce identical HTML -->
30067 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30068
30069 !! html/php
30070 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30071 <ul>
30072 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30073 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30074 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30075 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30076 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30077 <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>
30078 </ul>
30079 </div>
30080
30081 <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>
30082 <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>
30083 <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>
30084 <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>
30085 <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>
30086 <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>
30087 <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>
30088 </p><p>💩 <span id="💩"></span>
30089 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30090 </p>
30091 !! end
30092
30093 !! test
30094 T90902: Normalize weird characters in section IDs
30095 !! config
30096 wgFragmentMode=[ 'html5', 'legacy' ]
30097 !! wikitext
30098 ==Foo&nbsp;bar==
30099 [[#Foo&nbsp;bar]]
30100
30101 !! html/php
30102 <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>
30103 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30104 </p>
30105 !! html/parsoid
30106 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30107 <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>
30108 !! end
30109
30110 !! test
30111 T51672: Test for brackets in attributes of elements in external link texts
30112 !! wikitext
30113 [http://example.com/ link <span title="title with [brackets]">span</span>]
30114 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30115
30116 !! html/php
30117 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30118 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30119 </p>
30120 !! html/parsoid
30121 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30122 <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>
30123 !! end
30124
30125 !! test
30126 T72875: Test for brackets in attributes of elements in internal link texts
30127 !! wikitext
30128 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30129 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30130
30131 !! html/php
30132 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30133 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30134 </p>
30135 !! html/parsoid
30136 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30137 <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>
30138 !! end
30139
30140 !! test
30141 T179544: {{anchorencode:}} output should be always usable in links
30142 !! config
30143 wgFragmentMode=[ 'html5' ]
30144 !! wikitext
30145 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30146 !! html/php
30147 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30148 </p>
30149 !! html/parsoid
30150 <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>
30151 !! end
30152
30153 ## ------------------------------
30154 ## Parsoid section-wrapping tests
30155 ## ------------------------------
30156 !! test
30157 Section wrapping for well-nested sections (no leading content)
30158 !! options
30159 parsoid={
30160 "wrapSections": true
30161 }
30162 !! wikitext
30163 =1=
30164 a
30165
30166 =2=
30167 b
30168
30169 ==2.1==
30170 c
30171
30172 ==2.2==
30173 d
30174
30175 ===2.2.1===
30176 e
30177
30178 =3=
30179 f
30180 !! html/parsoid
30181 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30182 <p>a</p>
30183
30184 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30185 <p>b</p>
30186
30187 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30188 <p>c</p>
30189
30190 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30191 <p>d</p>
30192
30193 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30194 <p>e</p>
30195
30196 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30197 <p>f</p>
30198
30199 </section>
30200 !! end
30201
30202 !! test
30203 Section wrapping for well-nested sections (with leading content)
30204 !! options
30205 parsoid={
30206 "wrapSections": true
30207 }
30208 !! wikitext
30209 Para 1.
30210
30211 Para 2 with a <div>nested in it</div>
30212
30213 Para 3.
30214
30215 =1=
30216 a
30217
30218 =2=
30219 b
30220
30221 ==2.1==
30222 c
30223 !! html/parsoid
30224 <section data-mw-section-id="0"><p>Para 1.</p>
30225
30226 <p>Para 2 with a </p><div>nested in it</div>
30227
30228 <p>Para 3.</p>
30229
30230 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30231 <p>a</p>
30232
30233 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30234 <p>b</p>
30235
30236 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30237 <p>c</p>
30238
30239 </section></section>
30240 !! end
30241
30242 !! test
30243 Section wrapping with template-generated sections (good nesting 1)
30244 !! options
30245 parsoid={
30246 "wrapSections": true
30247 }
30248 !! wikitext
30249 =1=
30250 a
30251
30252 {{echo|1=
30253 ==1.1==
30254 b
30255 }}
30256
30257 ==1.2==
30258 c
30259
30260 =2=
30261 d
30262 !! html/parsoid
30263 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30264 <p>a</p>
30265
30266 <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">
30267 </span><p about="#mwt1">b</p>
30268 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30269 <p>c</p>
30270
30271 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30272 <p>d</p></section>
30273 !! end
30274
30275 # In this example, the template scope is mildly expanded to incorporate the
30276 # trailing newline after the transclusion since that is part of section 1.1.1
30277 !! test
30278 Section wrapping with template-generated sections (good nesting 2)
30279 !! options
30280 parsoid={
30281 "wrapSections": true,
30282 "modes": ["wt2html", "wt2wt"]
30283 }
30284 !! wikitext
30285 =1=
30286 a
30287
30288 {{echo|1=
30289 ==1.1==
30290 b
30291 ===1.1.1===
30292 d
30293 }}
30294 =2=
30295 e
30296 !! html/parsoid
30297 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30298 <p>a</p>
30299
30300 <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">
30301 </span><p about="#mwt1">b</p><span about="#mwt1">
30302 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30303 </span><p about="#mwt1">d</p><span about="#mwt1">
30304 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30305 <p>e</p></section>
30306 !! end
30307
30308 # In this example, the template scope is mildly expanded to incorporate the
30309 # trailing newline after the transclusion since that is part of section 1.2.1
30310 !! test
30311 Section wrapping with template-generated sections (good nesting 3)
30312 !! options
30313 parsoid={
30314 "wrapSections": true,
30315 "modes": ["wt2html", "wt2wt"]
30316 }
30317 !! wikitext
30318 =1=
30319 a
30320
30321 {{echo|1=
30322 x
30323 ==1.1==
30324 b
30325 ==1.2==
30326 c
30327 ===1.2.1===
30328 d
30329 }}
30330 =2=
30331 e
30332 !! html/parsoid
30333 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30334 <p>a</p>
30335
30336 <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">
30337 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30338 </span><p about="#mwt1">b</p><span about="#mwt1">
30339 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30340 </span><p about="#mwt1">c</p><span about="#mwt1">
30341 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30342 </span><p about="#mwt1">d</p><span about="#mwt1">
30343 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30344 <p>e</p></section>
30345 !! end
30346
30347 # Because of section-wrapping and template-wrapping interactions,
30348 # the scope of the template is expanded so that the template markup
30349 # is valid in the presence of <section> tags.
30350 # This exercises the s1 is null scenario in the wrapSections code
30351 !! test
30352 Section wrapping with template-generated sections (bad nesting 1)
30353 !! options
30354 parsoid={
30355 "wrapSections": true
30356 }
30357 !! wikitext
30358 <div>
30359 a
30360
30361 {{echo|
30362 =1=
30363 b
30364 }}
30365
30366 c
30367 </div>
30368 !! html/parsoid
30369 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30370 <p>a</p>
30371
30372 <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"]}'>
30373 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30374 </span><p about="#mwt1">b
30375 </p><span about="#mwt1">
30376
30377 </span><p about="#mwt1">c</p><span about="#mwt1">
30378 </span></section></div></section>
30379 !! end
30380
30381 # Because of section-wrapping and template-wrapping interactions,
30382 # the scope of the template is expanded so that the template markup
30383 # is valid in the presence of <section> tags.
30384 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30385 !! test
30386 Section wrapping with template-generated sections (bad nesting 2)
30387 !! options
30388 parsoid={
30389 "wrapSections": true
30390 }
30391 !! wikitext
30392 =1=
30393 a
30394
30395 {{echo|1=
30396 =2=
30397 b
30398 ==2.1==
30399 c
30400 }}
30401
30402 d
30403
30404 =3=
30405 e
30406 !! html/parsoid
30407 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30408 <p>a</p>
30409
30410 </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">
30411 </span><p about="#mwt1">b</p><span about="#mwt1">
30412 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30413 </span><p about="#mwt1">c</p><span about="#mwt1">
30414
30415 </span><p about="#mwt1">d</p><span about="#mwt1">
30416
30417 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30418 <p>e</p></section>
30419 !! end
30420
30421 # Because of section-wrapping and template-wrapping interactions,
30422 # additional template wrappers are added to <section> tags
30423 # so that template wrapping semantics are valid whether section
30424 # tags are retained or stripped. But, the template scope can expand
30425 # greatly when accounting for section tags.
30426 # This exercises the s1 and s2 are in different subtrees scenario
30427 !! test
30428 Section wrapping with template-generated sections (bad nesting 3)
30429 !! options
30430 parsoid={
30431 "wrapSections": true,
30432 "modes": ["wt2html", "wt2wt"]
30433 }
30434 !! wikitext
30435 =1=
30436 a
30437
30438 {{echo|1=
30439 ==1.2==
30440 b
30441 =2=
30442 c
30443 }}
30444
30445 d
30446
30447 =3=
30448 e
30449 !! html/parsoid
30450 <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>
30451 <p>a</p>
30452
30453 <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">
30454 </span><p about="#mwt1">b</p><span about="#mwt1">
30455 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30456 </span><p about="#mwt1">c</p>
30457
30458 <p>d</p>
30459 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30460 <p>e</p></section>
30461 !! end
30462
30463 !! test
30464 Section wrapping with uneditable lead section + div wrapping multiple sections
30465 !! options
30466 parsoid={
30467 "wrapSections": true
30468 }
30469 !! wikitext
30470 foo
30471
30472 <div style="border:1px solid red;">
30473 =1=
30474 a
30475
30476 ==1.1==
30477 b
30478
30479 =2=
30480 c
30481 </div>
30482
30483 =3=
30484 d
30485
30486 ==3.1==
30487 e
30488 !! html/parsoid
30489 <section data-mw-section-id="-1"><p>foo</p>
30490
30491 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30492 <section data-mw-section-id="1"><h1 id="1">1</h1>
30493 <p>a</p>
30494
30495 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30496 <p>b</p>
30497
30498 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30499 <p>c</p>
30500 </section></div>
30501
30502 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30503 <p>d</p>
30504
30505 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30506 <p>e</p>
30507 </section></section>
30508 !! end
30509
30510 !! test
30511 Section wrapping with editable lead section + div overlapping multiple sections
30512 !! options
30513 parsoid={
30514 "wrapSections": true
30515 }
30516 !! wikitext
30517 foo
30518
30519 =1=
30520 a
30521 <div style="border:1px solid red;">
30522 b
30523
30524 ==1.1==
30525 c
30526
30527 =2=
30528 d
30529 </div>
30530 e
30531
30532 =3=
30533 f
30534
30535 ==3.1==
30536 g
30537 !! html/parsoid
30538 <section data-mw-section-id="0"><p>foo</p>
30539
30540 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30541 <p>a</p>
30542 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30543 <p>b</p>
30544
30545 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30546 <p>c</p>
30547
30548 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30549 <p>d</p>
30550 </section></div>
30551 <p>e</p>
30552
30553 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30554 <p>f</p>
30555
30556 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30557 <p>g</p>
30558 </section></section>
30559 !! end
30560
30561 !! test
30562 HTML header tags should not be wrapped in section tags
30563 !! options
30564 parsoid={
30565 "wrapSections": true
30566 }
30567 !! wikitext
30568 foo
30569
30570 <h1>a</h1>
30571
30572 =b=
30573
30574 <h1>c</h1>
30575
30576 =d=
30577 !! html/parsoid
30578 <section data-mw-section-id="0"><p>foo</p>
30579
30580 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30581
30582 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30583
30584 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30585
30586 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30587 !! end
30588
30589 !! test
30590 Lead section containing only whitespace and comments.
30591 !! options
30592 parsoid={
30593 "wrapSections": true
30594 }
30595 !! wikitext
30596
30597 <!-- this is a comment, presumably significant to editors -->
30598 =1=
30599 a
30600
30601 =2=
30602 b
30603 !! html/parsoid
30604 <section data-mw-section-id="0" data-parsoid="{}">
30605 <!-- this is a comment, presumably significant to editors -->
30606 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30607 <p>a</p>
30608
30609 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30610 <p>b</p></section>
30611 !! end
30612
30613 !! test
30614 Pseudo-sections emitted by templates should have id -2
30615 !! options
30616 parsoid={
30617 "wrapSections": true
30618 }
30619 !! wikitext
30620 foo
30621 {{echo|<div>
30622 ==a==
30623 ==b==
30624 </div>
30625 }}
30626 !! html/parsoid
30627 <section data-mw-section-id="-1"><p>foo</p>
30628 </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}}]}'>
30629 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30630 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30631 </section></div><span about="#mwt1">
30632 </span></section>
30633 !! end
30634
30635 ##########################################################################
30636 Tests demonstrating white-space insensitivity in input wikitext
30637 for wikitext headings, wikitext list items, and wikitext table captions,
30638 headings, and cells. HTML versions of the same should preserve whitespace.
30639 ##########################################################################
30640 !! test
30641 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30642 !! wikitext
30643 __NOTOC__
30644 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
30645 == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
30646 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30647 ; <!--term to define--> term : <!--term's definition--> definition
30648 {|
30649 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30650 |-
30651 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30652 |-
30653 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30654 |-
30655 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30656 |-
30657 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30658 |}
30659 : {|
30660 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30661 |} foo <!--c1-->
30662 !! html/php+tidy
30663 <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>
30664 <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>
30665 <ul><li>List item</li></ul>
30666 <dl><dt>term&#160;</dt>
30667 <dd>definition</dd></dl>
30668 <table>
30669 <caption>Table Caption
30670 </caption>
30671 <tbody><tr>
30672 <th>Table Heading 1</th>
30673 <th>Table Heading 2
30674 </th></tr>
30675 <tr>
30676 <td>Table Cell 1</td>
30677 <td>Table Cell 2
30678 </td></tr>
30679 <tr>
30680 <td>class="foo"</td>
30681 <td>Table Cell 3
30682 </td></tr>
30683 <tr>
30684 <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
30685 </td></tr></tbody></table>
30686 <dl><dd><table>
30687 <tbody><tr>
30688 <td>Table Cell 1</td>
30689 <td>Table Cell 2
30690 </td></tr></tbody></table> foo</dd></dl>
30691 !! end
30692
30693 # Looks like <caption> is not accepted in HTML
30694 !! test
30695 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30696 !! wikitext
30697 __NOTOC__
30698 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
30699 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30700 <table>
30701 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30702 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30703 </table>
30704 !! html/php+tidy
30705 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
30706 <ul><li> List item </li></ul>
30707 <table>
30708 <tbody><tr><th> Table Heading </th><th></th></tr>
30709 <tr><td> Table Cell </td><th></th></tr>
30710 </tbody></table>
30711 !! end
30712
30713 !! test
30714 Do not trim whitespace in links and quotes
30715 !! wikitext
30716 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30717 [[Foo| some text ]]
30718 !! html/php+tidy
30719 <p>foo <i> italic </i> and <b> bold </b>
30720 <a href="/wiki/Foo" title="Foo"> some text </a>
30721 </p>
30722 !! end
30723
30724 !! test
30725 Remove p tags surrounding a single element in a figcaption
30726 !! options
30727 parsoid=html2wt
30728 !! wikitext
30729 [[File:Foobar.jpg|right|200x200px|Caption]]
30730 !! html/parsoid
30731 <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>
30732 !! end
30733
30734 !! test
30735 Selser preserves lack of newline before list and allows newline after the list
30736 !! options
30737 parsoid={
30738 "modes": ["selser"],
30739 "scrubWikitext": true,
30740 "changes": [
30741 [ "ul", "after", "<p>footer</p>" ]
30742 ]
30743 }
30744 !! wikitext
30745 header
30746 *foo
30747 *bar
30748 !! wikitext/edited
30749 header
30750 *foo
30751 *bar
30752
30753 footer
30754 !! end
30755
30756
30757 !! test
30758 Selser does not introduce newlines between unedited paragraph preceding the list
30759 !! options
30760 parsoid={
30761 "modes": ["selser"],
30762 "changes": [
30763 [ "table tbody tr td p:last-child", "empty" ]
30764 ]
30765 }
30766 !! wikitext
30767 {|
30768 |
30769 header
30770 *foo
30771 *bar
30772 footer
30773 |}
30774 !! wikitext/edited
30775 {|
30776 |
30777 header
30778 *foo
30779 *bar
30780
30781 |}
30782 !! end
30783
30784 !! test
30785 Selser does not introduce newlines between unedited paragraph following the list
30786 !! options
30787 parsoid={
30788 "modes": ["selser"],
30789 "changes": [
30790 [ "table tbody tr td p:first-child", "empty" ]
30791 ]
30792 }
30793 !! wikitext
30794 {|
30795 |
30796 header
30797 *foo
30798 *bar
30799 footer
30800 |}
30801 !! wikitext/edited
30802 {|
30803 |
30804
30805 *foo
30806 *bar
30807 footer
30808 |}
30809 !! end
30810
30811 !! test
30812 Remove a list item but do not insert newline above list
30813 !! options
30814 parsoid={
30815 "modes": ["selser"],
30816 "changes": [
30817 [ "ul li:last-child", "remove" ]
30818 ]
30819 }
30820 !! wikitext
30821 header
30822 *foo
30823 *bar
30824 footer
30825 !! wikitext/edited
30826 header
30827 *foo
30828 footer
30829 !! end