Merge "RFC T157418: Trim whitespace in table cells, list items, headings"
[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 <ruby>
1261 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1262 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1263 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1264 </ruby>
1265 !! html
1266 <dl><dt>Mono-ruby for individual base characters</dt>
1267 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1268 <dt>Group ruby</dt>
1269 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1270 <dt>Jukugo ruby</dt>
1271 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1272 <dt>Inline ruby</dt>
1273 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1274 <dt>Double-sided ruby</dt>
1275 <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>
1276 <p><ruby>
1277 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1278 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1279 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1280 </ruby>
1281 </p>
1282 !! end
1283
1284 # The next two test different paths in the sanitizer.
1285 !! test
1286 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1287 !! wikitext
1288 <blockquote|>a</blockquote>
1289
1290 <b→> doesn't terminate </b→>
1291
1292 <bä> doesn't terminate </bä>
1293
1294 <boo> doesn't terminate </boo>
1295
1296 <s.foo> doesn't terminate </s.foo>
1297
1298 <sub-ID#1>
1299 !! html
1300 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1301 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1302 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1303 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1304 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1305 </p><p>&lt;sub-ID#1&gt;
1306 </p>
1307 !! end
1308
1309 !! test
1310 Non-word characters don't terminate tag names
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html+tidy
1324 <p>&lt;blockquote|&gt;a
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 ###
1334 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1335 ### This checks that HTML5 tags (with non-word characters in the tag
1336 ### name) make it safely through the parser -- the Sanitizer will
1337 ### munge them later, as it should.
1338 ###
1339 !! test
1340 Non-word characters are valid in extension tags (T19663)
1341 !! wikitext
1342 <tåg>tåg</tåg>
1343 !! html/php
1344 <pre>
1345 'tåg'
1346 array (
1347 )
1348 </pre>
1349
1350 !! html/parsoid
1351 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1352 !! end
1353
1354 !! test
1355 Isolated close tags should be treated as literal text (T54760)
1356 !! options
1357 parsoid=wt2html
1358 !! wikitext
1359 </b>
1360
1361 <s.foo>s</s>
1362 !! html/php+tidy
1363 <p class="mw-empty-elt">
1364 </p><p>&lt;s.foo&gt;s
1365 </p>
1366 !! html/parsoid
1367 <p>&lt;s.foo&gt;s</p>
1368 !! end
1369
1370 ###
1371 ### Special characters
1372 ###
1373
1374 !! test
1375 Bare pipe character (T54363)
1376 !! wikitext
1377 |
1378 !! html
1379 <p>|
1380 </p>
1381 !! end
1382
1383 !! test
1384 Bare pipe character from a template (T54363)
1385 !! wikitext
1386 {{pipe}}
1387 !! html
1388 <p>|
1389 </p>
1390 !! end
1391
1392 ###
1393 ### <nowiki> test cases
1394 ###
1395
1396 !! test
1397 <nowiki> unordered list
1398 !! wikitext
1399 <nowiki>* This is not an unordered list item.</nowiki>
1400 !! html/php
1401 <p>* This is not an unordered list item.
1402 </p>
1403 !! html/parsoid
1404 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1405 !! end
1406
1407 !! test
1408 <nowiki> spacing
1409 !! wikitext
1410 <nowiki>Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </nowiki>
1417 !! html/php
1418 <p>Lorem ipsum dolor
1419
1420 sed abit.
1421 sed nullum.
1422
1423 :and a colon
1424
1425 </p>
1426 !! html/parsoid
1427 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1428
1429 sed abit.
1430 sed nullum.
1431
1432 :and a colon
1433 </span></p>
1434 !! end
1435
1436 !! test
1437 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1438 !! wikitext
1439 <nowiki><span class="error"></nowiki>
1440 !! html/php
1441 <p>&lt;span class="error"&gt;
1442 </p>
1443 !! html/parsoid
1444 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1445 !! end
1446
1447 !! test
1448 nowiki 3
1449 !! wikitext
1450 :There is not nowiki.
1451 :There is <nowiki>nowiki</nowiki>.
1452
1453 #There is not nowiki.
1454 #There is <nowiki>nowiki</nowiki>.
1455
1456 *There is not nowiki.
1457 *There is <nowiki>nowiki</nowiki>.
1458 !! html/php
1459 <dl><dd>There is not nowiki.</dd>
1460 <dd>There is nowiki.</dd></dl>
1461 <ol><li>There is not nowiki.</li>
1462 <li>There is nowiki.</li></ol>
1463 <ul><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ul>
1465
1466 !! html/parsoid
1467 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1468 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1469
1470 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1471 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1472
1473 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1474 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1475 !! end
1476
1477 !! test
1478 Entities inside <nowiki>
1479 !! wikitext
1480 <nowiki>&lt;</nowiki>
1481 !! html/php
1482 <p>&lt;
1483 </p>
1484 !! html/parsoid
1485 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1486 !! end
1487
1488 !! test
1489 Entities inside template parameters
1490 !! wikitext
1491 {{echo|&ndash;}}
1492 !! html/php+tidy
1493 <p>&#8211;
1494 </p>
1495 !! html/parsoid
1496 <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>
1497 !! end
1498
1499 !! test
1500 Properly escape nowiki when combined with other wiki markup
1501 !! options
1502 parsoid=html2wt
1503 !! html/parsoid
1504 <p>* &lt;/nowiki&gt; tag</p>
1505 !! wikitext
1506 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1507 !! end
1508
1509 !! test
1510 T93824: Put escaped HTML tags inside nowiki
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1515 !! wikitext
1516 <nowiki><h2>foo</h2></nowiki>
1517 !! end
1518
1519 !! test
1520 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1525 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1526 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1527 !! wikitext
1528 This text: L'[[Foo]]
1529 This text: L<nowiki>''</nowiki>[[Foo]]
1530 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1531 !! end
1532
1533 # This test fails because wikitext whitespace is not normalized before comparing.
1534 !! test
1535 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 </p>
1541 !! wikitext
1542 This text : L<nowiki>''</nowiki>[[Foo]]
1543 !! end
1544
1545 # This test and the next one are html2wt only as they test that incorrect wikitext
1546 # passed in template arguments gets escaped or wrapped in nowikis where required.
1547 !! test
1548 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1549 !! options
1550 parsoid=html2wt
1551 !! html/parsoid
1552 <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>
1553 <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>
1554 !! wikitext
1555 {{echo|foo{{!}}bar}}
1556 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1557 !! end
1558
1559 !! test
1560 T53961: Output correct nowikis in template arguments
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <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>
1565 <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>
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="#mwt3"></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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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="#mwt5"></span></p>
1569 !! wikitext
1570 {{echo|a [ b}}
1571 {{echo|<nowiki>a }} b</nowiki>}}
1572 {{echo|<nowiki>a [[ b</nowiki>}}
1573 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1574 {{echo|a <nowiki>}</nowiki>}}
1575 !! end
1576
1577 !! test
1578 Cases where "!!" needs nowiki protection
1579 !! options
1580 parsoid=html2wt
1581 !! html/parsoid
1582 <table>
1583 <tr><th>this needs protection !! here</th></tr>
1584 </table>
1585
1586 <table>
1587 <tr><th>this does not need
1588 protection !! here</th></tr>
1589 </table>
1590 !! wikitext
1591 {|
1592 !<nowiki>this needs protection !! here</nowiki>
1593 |}
1594
1595 {|
1596 !this does not need
1597 protection !! here
1598 |}
1599 !! end
1600
1601 ###
1602 ### Comments
1603 ###
1604 !! test
1605 Comments and Indent-Pre
1606 !! wikitext
1607 <!-- comment 1 --> asdf
1608
1609 <!-- comment 1 --> asdf
1610 <!-- comment 2 -->
1611
1612 <!-- comment 1 --> asdf
1613 <!-- comment 2 -->xyz
1614
1615 <!-- comment 1 --> asdf
1616 <!-- comment 2 --> xyz
1617 !! html
1618 <pre>asdf
1619 </pre>
1620 <pre>asdf
1621 </pre>
1622 <pre>asdf
1623 </pre>
1624 <p>xyz
1625 </p>
1626 <pre>asdf
1627 xyz
1628 </pre>
1629 !! end
1630
1631 !! test
1632 Comment test 2a
1633 !! wikitext
1634 asdf
1635 <!-- comment 1 -->
1636 jkl
1637 !! html
1638 <p>asdf
1639 jkl
1640 </p>
1641 !! end
1642
1643 !! test
1644 Comment test 2b
1645 !! wikitext
1646 asdf
1647 <!-- comment 1 -->
1648
1649 jkl
1650 !! html
1651 <p>asdf
1652 </p><p>jkl
1653 </p>
1654 !! end
1655
1656 !! test
1657 Comment test 3
1658 !! wikitext
1659 asdf
1660 <!-- comment 1 -->
1661 <!-- comment 2 -->
1662 jkl
1663 !! html
1664 <p>asdf
1665 jkl
1666 </p>
1667 !! end
1668
1669 !! test
1670 Comment test 4
1671 !! wikitext
1672 asdf<!-- comment 1 -->jkl
1673 !! html
1674 <p>asdfjkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment spacing
1680 !! wikitext
1681 a
1682 <!-- foo --> b <!-- bar -->
1683 c
1684 !! html
1685 <p>a
1686 </p>
1687 <pre> b
1688 </pre>
1689 <p>c
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment whitespace
1695 !! wikitext
1696 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1697 !! html
1698
1699 !! end
1700
1701 !! test
1702 Comment semantics and delimiters
1703 !! wikitext
1704 <!-- --><!----><!-----><!------>
1705 !! html/php
1706
1707 !! html/parsoid
1708 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters, redux
1713 !! wikitext
1714 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1715 -- foo -- funky huh? ... -->
1716 !! html/php
1717
1718 !! html/parsoid
1719 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1720 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1721 !! end
1722
1723 !! test
1724 Comment semantics and delimiters: directors cut
1725 !! wikitext
1726 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1727 everything starting with < followed by !-- until the first -- and > we see,
1728 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1729 -->-->
1730 !! html/php
1731 <p>--&gt;
1732 </p>
1733 !! html/parsoid
1734 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1735 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1736 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1737 --><p>--></p>
1738 !! end
1739
1740 !! test
1741 Comment semantics: nesting
1742 !! wikitext
1743 <!--<!-- no, we're not going to do anything fancy here -->-->
1744 !! html/php
1745 <p>--&gt;
1746 </p>
1747 !! html/parsoid
1748 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1749 !! end
1750
1751 # Parsoid closes the unclosed comment, even if it means a slight
1752 # round-trip diff.
1753 !! test
1754 Comment semantics: unclosed comment at end
1755 !! options
1756 parsoid=wt2html,html2html
1757 !! wikitext
1758 <!--This comment will run out to the end of the document
1759 !! html/php
1760
1761 !! html/parsoid
1762 <!--This comment will run out to the end of the document-->
1763 !! end
1764
1765 !! test
1766 Comment semantics: normalize comments to play nice with XML and browsers
1767 !! wikitext
1768 <!-- Browsers --!> think this is closed -->
1769 <!--> This would normally be text -->
1770 <!---> As would this -->
1771 <!-- XML doesn't like trailing dashes -------->
1772 <!-- Nor doubled hyphens -- anywhere in the data -->
1773 But this is not a comment.
1774 !! html/php
1775 <p>But this is not a comment.
1776 </p>
1777 !! html/parsoid
1778 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1779 <!--&#x3E; This would normally be text -->
1780 <!--&#x2D;&#x3E; As would this -->
1781 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1782 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1783 <p>But this is not a comment.</p>
1784 !! end
1785
1786 !! test
1787 Comment semantics: round-trip even text which contains encoded -->
1788 !! wikitext
1789 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1790 !! html/parsoid
1791 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1792 !! end
1793
1794 !! test
1795 Comment in template title
1796 !! wikitext
1797 {{f<!---->oo}}
1798 !! html
1799 <p>FOO
1800 </p>
1801 !! end
1802
1803 !! test
1804 Comment on its own line post-expand
1805 !! wikitext
1806 a
1807 {{blank}}<!---->
1808 b
1809 !! html
1810 <p>a
1811 </p><p>b
1812 </p>
1813 !! end
1814
1815 !! test
1816 Comment on its own line post-expand with non-significant whitespace
1817 !! wikitext
1818 a
1819 {{blank}} <!---->
1820 b
1821 !! html
1822 <p>a
1823 </p><p>b
1824 </p>
1825 !! end
1826
1827 !! test
1828 Multiple comments should still parse as SOL-transparent
1829 !! options
1830 parsoid=wt2html,wt2wt
1831 !! wikitext
1832 <!--c1-->*a
1833 <!--c2--><!--c3--><!--c4-->*b
1834 !! html/php
1835 <ul><li>a</li>
1836 <li>b</li></ul>
1837
1838 !! html/parsoid
1839 <!--c1--><ul>
1840 <li>a
1841 </li>
1842 <!--c2--><!--c3--><!--c4-->
1843 <li>b
1844 </li>
1845 </ul>
1846 !! end
1847
1848 ## Make sure ">" gets escaped in comments to avoid XSS
1849 !! test
1850 IE conditional comments
1851 !! wikitext
1852 <!--[if lt IE 9]>
1853 <script>alert('hi');</script>
1854 <![endif]-->
1855 !! html/parsoid
1856 <!--[if lt IE 9]&#x3E;
1857 <script&#x3E;alert('hi');</script&#x3E;
1858 <![endif]-->
1859 !! end
1860
1861 ###
1862 ### paragraph wrapping tests
1863 ###
1864
1865 !! test
1866 No block tags
1867 !! wikitext
1868 a
1869
1870 b
1871 !! html
1872 <p>a
1873 </p><p>b
1874 </p>
1875 !! end
1876
1877 !! test
1878 Block tag on one line (<div>)
1879 !! wikitext
1880 a <div>foo</div>
1881
1882 b
1883 !! html
1884 a <div>foo</div>
1885 <p>b
1886 </p>
1887 !! html+tidy
1888 <p>a </p><div>foo</div>
1889 <p>b
1890 </p>
1891 !! end
1892
1893 # Remex wraps empty tag runs with p-tags.
1894 # Parsoid strips them out during p-wrapping.
1895 !! test
1896 No p-wrappable content
1897 !! wikitext
1898 <span><div>x</div></span>
1899 <span><s><div>x</div></s></span>
1900 <small><em></em></small><span><s><div>x</div></s></span>
1901 !! html/php+tidy
1902 <span><div>x</div></span>
1903 <span><s><div>x</div></s></span>
1904 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1905 !! html/parsoid
1906 <span><div>x</div></span>
1907 <span><s><div>x</div></s></span>
1908 <small><em></em></small><span><s><div>x</div></s></span>
1909 !! end
1910
1911 # T177612: Parsoid-only test
1912 !! test
1913 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1914 !! wikitext
1915 {{echo|<span><div>x</div></span>}}
1916 x
1917 !! html/parsoid
1918 <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>
1919 <p>x</p>
1920 !! end
1921
1922 !! test
1923 Block tag on one line (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 <p>b
1931 </p>
1932 !! html+tidy
1933 <p>a </p><blockquote><p>foo</p></blockquote>
1934 <p>b
1935 </p>
1936 !! end
1937
1938 !! test
1939 Block tag on both lines (<div>)
1940 !! wikitext
1941 a <div>foo</div>
1942
1943 b <div>foo</div>
1944 !! html
1945 a <div>foo</div>
1946 b <div>foo</div>
1947
1948 !! html+tidy
1949 <p>a </p><div>foo</div><p>
1950 b </p><div>foo</div>
1951 !! end
1952
1953 !! test
1954 Block tag on both lines (<blockquote>)
1955 !! wikitext
1956 a <blockquote>foo</blockquote>
1957
1958 b <blockquote>foo</blockquote>
1959 !! html
1960 a <blockquote>foo</blockquote>
1961 b <blockquote>foo</blockquote>
1962
1963 !! html+tidy
1964 <p>a </p><blockquote><p>foo</p></blockquote><p>
1965 b </p><blockquote><p>foo</p></blockquote>
1966 !! end
1967
1968 !! test
1969 Multiple lines without block tags
1970 !! wikitext
1971 <div>foo</div> a
1972 b
1973 c
1974 d<!--foo--> e
1975 x <div>foo</div> z
1976 !! html
1977 <div>foo</div> a
1978 <p>b
1979 c
1980 d e
1981 </p>
1982 x <div>foo</div> z
1983
1984 !! html+tidy
1985 <div>foo</div><p> a
1986 </p><p>b
1987 c
1988 d e
1989 </p><p>
1990 x </p><div>foo</div><p> z
1991 </p>
1992 !! end
1993
1994 # The difference between Parsoid & Remex here
1995 # is because of Parsoid's Tidy-emulation code
1996 # for p-wrapping. We'll start work to remove this
1997 # emulation code in Parsoid sooner than later.
1998 # Remex wraps empty tag runs with p-tags.
1999 # Parsoid strips them out in a separate pass.
2000 !! test
2001 Empty lines between lines with block tags
2002 !! wikitext
2003 <div></div>
2004
2005
2006 <div></div>a
2007
2008 b
2009 <div>a</div>b
2010
2011 <div>b</div>d
2012
2013
2014 <div>e</div>
2015 !! html
2016 <div></div>
2017 <p><br />
2018 </p>
2019 <div></div>a
2020 <p>b
2021 </p>
2022 <div>a</div>b
2023 <div>b</div>d
2024 <p><br />
2025 </p>
2026 <div>e</div>
2027
2028 !! html+tidy
2029 <div></div>
2030 <p><br />
2031 </p>
2032 <div></div><p>a
2033 </p><p>b
2034 </p>
2035 <div>a</div><p>b
2036 </p><div>b</div><p>d
2037 </p><p><br />
2038 </p>
2039 <div>e</div>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'></div>
2042
2043 <p><br /></p>
2044 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2045
2046 <p>b</p>
2047 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2048
2049 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2050
2051 <p><br /></p>
2052 <div data-parsoid='{"stx":"html"}'>e</div>
2053 !! end
2054
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div><p>foo</p></div>
2064 <p>a
2065 </p><p>b
2066 </p>
2067 !! html/parsoid
2068 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2069 <p>a</p>
2070 <p>b</p>
2071 !! end
2072
2073 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2074 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2075 ## them for now.
2076 !! test
2077 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2078 !! options
2079 parsoid=wt2html
2080 !! wikitext
2081 a [[Category:A1]] [[Category:A2]]
2082 [[Category:A3]]
2083 [[Category:A4]]
2084 !! html/parsoid
2085 <p>a</p>
2086 <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"/>
2087 !! end
2088
2089 !! test
2090 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2091 !! options
2092 parsoid=wt2html
2093 !! wikitext
2094 [[Category:A1]]a
2095 !! html/parsoid
2096 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2097 !! end
2098
2099 !! test
2100 No paragraph necessary for SOL transparent template
2101 !! wikitext
2102 <span><div>foo</div></span>
2103 [[Category:Foo]]
2104
2105 <span><div>foo</div></span>
2106 {{echo|[[Category:Foo]]}}
2107 !! html/php
2108 <span><div>foo</div></span>
2109 <span><div>foo</div></span>
2110
2111 !! html/parsoid
2112 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2113 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2114
2115 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2116 <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}}]}'/>
2117 !! end
2118
2119 !! test
2120 Avoid expanding multiline sol transparent template ranges unnecessarily
2121 !! wikitext
2122 hi
2123
2124
2125 {{echo|<br/>
2126 }}
2127
2128 [[Category:Ho]]
2129 !! html/php
2130 <p>hi
2131 </p><p><br />
2132 <br />
2133 </p>
2134 !! html/parsoid
2135 <p>hi</p>
2136
2137 <p><br />
2138 <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">
2139 </span></p>
2140
2141 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2142 !! end
2143
2144 ###
2145 ### Preformatted text
2146 ###
2147
2148 !! test
2149 Preformatted text
2150 !! wikitext
2151 This is some
2152 Preformatted text
2153 With ''italic''
2154 And '''bold'''
2155 And a [[Main Page|link]]
2156 !! html
2157 <pre>This is some
2158 Preformatted text
2159 With <i>italic</i>
2160 And <b>bold</b>
2161 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2162 </pre>
2163 !! end
2164
2165 !! test
2166 Tabs don't trigger preformatted text
2167 !! wikitext
2168 This is not
2169 preformatted text.
2170 This is preformatted text.
2171 So is this.
2172 !! html/php
2173 <p> This is not
2174 preformatted text.
2175 </p>
2176 <pre>This is preformatted text.
2177 So is this.
2178 </pre>
2179 !! html/parsoid
2180 <p> This is not
2181 preformatted text.</p>
2182 <pre>This is preformatted text.
2183 So is this.</pre>
2184 !! end
2185
2186 !! test
2187 Space before tab needs nowiki pre protection
2188 !! options
2189 parsoid=html2wt
2190 !! html/parsoid
2191 <p> a</p>
2192 !! wikitext
2193 <nowiki> </nowiki> a
2194 !! end
2195
2196 !! test
2197 Ident preformatting with inline content
2198 !! wikitext
2199 a
2200 ''b''
2201 !! html
2202 <pre>a
2203 <i>b</i>
2204 </pre>
2205 !! end
2206
2207 !! test
2208 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2209 !! wikitext
2210 <pre><nowiki>
2211 <b>
2212 <cite>
2213 <em>
2214 </nowiki></pre>
2215 !! html
2216 <pre>
2217 &lt;b&gt;
2218 &lt;cite&gt;
2219 &lt;em&gt;
2220 </pre>
2221
2222 !! end
2223
2224 !! test
2225 Regression with preformatted in <center>
2226 !! wikitext
2227 <center>
2228 Blah
2229 </center>
2230 !! html
2231 <center>
2232 <pre>Blah
2233 </pre>
2234 </center>
2235
2236 !! end
2237
2238 !! test
2239 T54763: Preformatted in <blockquote>
2240 !! wikitext
2241 <blockquote>
2242 Blah
2243 {|
2244 |
2245 indented cell (no pre-wrapping!)
2246 |}
2247 </blockquote>
2248 !! html
2249 <blockquote>
2250 <p> Blah
2251 </p>
2252 <table>
2253 <tr>
2254 <td>
2255 <p> indented cell (no pre-wrapping!)
2256 </p>
2257 </td></tr></table>
2258 </blockquote>
2259
2260 !! end
2261
2262 !! test
2263 T53086: Double newlines in blockquotes should be turned into paragraphs
2264 !! wikitext
2265 <blockquote>
2266 Foo
2267
2268 Bar
2269 </blockquote>
2270 !! html
2271 <blockquote>
2272 <p>Foo
2273 </p><p>Bar
2274 </p>
2275 </blockquote>
2276
2277 !! end
2278
2279 !! test
2280 T17491: <ins>/<del> in blockquote
2281 !! wikitext
2282 <blockquote>
2283 Foo <del>bar</del> <ins>baz</ins> quux
2284 </blockquote>
2285 !! html
2286 <blockquote>
2287 <p>Foo <del>bar</del> <ins>baz</ins> quux
2288 </p>
2289 </blockquote>
2290
2291 !! end
2292
2293 !! test
2294 T17491: <ins>/<del> in blockquote (2)
2295 !! wikitext
2296 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2297 </blockquote>
2298 !! html
2299 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2300 </blockquote>
2301
2302 !! html+tidy
2303 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2304 </p></blockquote>
2305 !! end
2306
2307 !! test
2308 <pre> with attributes (T5202)
2309 !! wikitext
2310 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2311 !! html
2312 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2313
2314 !! end
2315
2316 !! test
2317 <pre> with width attribute (T5202)
2318 !! wikitext
2319 <pre width="8">Narrow screen goodies</pre>
2320 !! html
2321 <pre width="8">Narrow screen goodies</pre>
2322
2323 !! end
2324
2325 !! test
2326 <pre> with forbidden attribute (T5202)
2327 !! wikitext
2328 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2329 !! html
2330 <pre width="8">Narrow screen goodies</pre>
2331
2332 !! end
2333
2334 !! test
2335 Entities inside <pre>
2336 !! wikitext
2337 <pre>&lt;</pre>
2338 !! html
2339 <pre>&lt;</pre>
2340
2341 !! end
2342
2343 !! test
2344 <pre> with forbidden attribute values (T5202)
2345 !! wikitext
2346 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2347 !! html
2348 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2349
2350 !! end
2351
2352 !! test
2353 <nowiki> inside <pre> (T15238)
2354 !! wikitext
2355 <pre>
2356 <nowiki>
2357 </pre>
2358 <pre>
2359 <nowiki></nowiki>
2360 </pre>
2361 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2362 !! html
2363 <pre>
2364 &lt;nowiki&gt;
2365 </pre>
2366 <pre>
2367
2368 </pre>
2369 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2370
2371 !! end
2372
2373 !! test
2374 <nowiki> inside of #tag:pre
2375 !! wikitext
2376 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2377 !! html/php
2378 <pre>Foo &#8594;bar</pre>
2379
2380 !! html/parsoid
2381 <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>
2382 !! end
2383
2384 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2385 ## aren't enclosed in nowikis.
2386 !! test
2387 <nowiki> and <pre> preference (first one wins)
2388 !! options
2389 parsoid=wt2html
2390 !! wikitext
2391 <pre>
2392 <nowiki>
2393 </pre>
2394 </nowiki>
2395 </pre>
2396
2397 <nowiki>
2398 <pre>
2399 <nowiki>
2400 </pre>
2401 </nowiki>
2402 </pre>
2403
2404 !! html/php
2405 <pre>
2406 &lt;nowiki&gt;
2407 </pre>
2408 <p>&lt;/nowiki&gt;
2409 &lt;/pre&gt;
2410 </p><p>
2411 &lt;pre&gt;
2412 &lt;nowiki&gt;
2413 &lt;/pre&gt;
2414
2415 &lt;/pre&gt;
2416 </p>
2417 !! html/parsoid
2418 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2419 </pre>
2420 <p>&lt;/nowiki></p>
2421
2422
2423 <p><span typeof="mw:Nowiki">
2424 &lt;pre>
2425 &lt;nowiki>
2426 &lt;/pre>
2427 </span></p>
2428 !! end
2429
2430 !! test
2431 </pre> inside nowiki
2432 !! wikitext
2433 <nowiki></pre></nowiki>
2434 !! html
2435 <p>&lt;/pre&gt;
2436 </p>
2437 !! end
2438
2439 !! test
2440 Empty pre; pre inside other HTML tags (T56946)
2441 !! wikitext
2442 a
2443
2444 <div><pre>
2445 foo
2446 </pre></div>
2447 <pre></pre>
2448 !! html/php+tidy
2449 <p>a
2450 </p>
2451 <div><pre>foo
2452 </pre></div>
2453 <pre></pre>
2454 !! html/parsoid
2455 <p>a</p>
2456
2457 <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
2458 </pre></div>
2459 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2460 !! end
2461
2462 !! test
2463 HTML pre followed by indent-pre
2464 !! wikitext
2465 <pre>foo</pre>
2466 bar
2467 !! html
2468 <pre>foo</pre>
2469 <pre>bar
2470 </pre>
2471 !! end
2472
2473 !! test
2474 Block tag pre
2475 !! wikitext
2476 <p><pre>foo</pre></p>
2477 !! html/php+tidy
2478 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2479 !! html/parsoid
2480 <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>
2481 !! end
2482
2483 !!test
2484 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2485 !! wikitext
2486 {{echo|}}
2487 !! html
2488
2489 !!end
2490
2491 !!test
2492 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2493 !! wikitext
2494 {{echo|
2495 foo}}
2496 !! html
2497 <p>foo
2498 </p>
2499 !!end
2500
2501 !! test
2502 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2503 !! wikitext
2504 {{echo|a
2505 b}}
2506 !! html
2507 <pre>a
2508 </pre>
2509 <p>b
2510 </p>
2511 !!end
2512
2513 !! test
2514 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2515 !! wikitext
2516 {{echo|a
2517 b
2518 c
2519 d
2520 e
2521 }}
2522 !! html
2523 <pre>a
2524 </pre>
2525 <p>b
2526 c
2527 </p>
2528 <pre>d
2529 </pre>
2530 <p>e
2531 </p>
2532 !!end
2533
2534 !!test
2535 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2536 !! wikitext
2537 {{echo| foo}}
2538
2539 {{echo| foo}}{{echo| bar}}
2540
2541 {{echo| foo}}
2542 {{echo| bar}}
2543
2544 {{echo|<!--cmt--> foo}}
2545
2546 <!--cmt-->{{echo| foo}}
2547
2548 {{echo|{{echo| }}bar}}
2549 !! html
2550 <pre>foo
2551 </pre>
2552 <pre>foo bar
2553 </pre>
2554 <pre>foo
2555 bar
2556 </pre>
2557 <pre>foo
2558 </pre>
2559 <pre>foo
2560 </pre>
2561 <pre>bar
2562 </pre>
2563 !!end
2564
2565 !! test
2566 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2567 !! wikitext
2568 {{echo| }}a
2569
2570 {{echo|
2571 }}a
2572
2573 {{echo|
2574 b}}
2575
2576 {{echo|a
2577 }}b
2578
2579 {{echo|a
2580 }} b
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p><br />
2585 </p>
2586 <pre>a
2587 </pre>
2588 <p><br />
2589 </p>
2590 <pre>b
2591 </pre>
2592 <p>a
2593 </p>
2594 <pre>b
2595 </pre>
2596 <p>a
2597 </p>
2598 <pre>b
2599 </pre>
2600 !!end
2601
2602 ## Hmm, should Parsoid rt this?
2603 !! test
2604 Pres with newline attributes
2605 !! options
2606 parsoid=wt2html,html2html
2607 !! wikitext
2608 <pre class="one
2609 two">hi</pre>
2610 !! html/php
2611 <pre class="one two">hi</pre>
2612
2613 !! html/parsoid
2614 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2615 !! end
2616
2617 !! test
2618 Things that look like <pre> tags aren't treated as such
2619 !! wikitext
2620 Barack Obama <President> of the United States
2621 <President></President>
2622 !! html
2623 <p>Barack Obama &lt;President&gt; of the United States
2624 &lt;President&gt;&lt;/President&gt;
2625 </p>
2626 !! end
2627
2628 !! test
2629 Handle broken pre-like tags (T66025)
2630 !! options
2631 parsoid=wt2html
2632 !! wikitext
2633 {{echo|<pre <pre>x</pre>}}
2634
2635 <table><pre </table>
2636 !! html/php
2637 <pre>x</pre>
2638 <table>&lt;pre </table>
2639
2640 !! html/php+tidy
2641 <pre>x</pre>
2642 &lt;pre <table></table>
2643 !! html/parsoid
2644 <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>
2645
2646
2647 <p>&lt;pre </p>
2648
2649 <table></table>
2650 !! end
2651
2652 !! test
2653 Parsoid: handle pre with space after attribute
2654 !! options
2655 parsoid=wt2html
2656 !! wikitext
2657 <pre style="width:50%;" >{{echo|foo}}</pre>
2658 !! html/php
2659 <pre style="width:50%;">{{echo|foo}}</pre>
2660
2661 !! html/parsoid
2662 <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>
2663 !! end
2664
2665 # TODO / maybe: fix wt2wt for this
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td></td>
2673 <td></td>
2674
2675
2676
2677 |}
2678 !! html
2679 <table>
2680
2681 <tbody>
2682 <tr>
2683 <td></td>
2684
2685 <td></td></tr>
2686
2687
2688
2689 </tbody></table>
2690 !! end
2691
2692 !! test
2693 Self-closed pre
2694 !! wikitext
2695 <pre />
2696 !! html/php
2697 <pre></pre>
2698
2699 !! html/parsoid
2700 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2701 !! end
2702
2703 !! test
2704 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2705 !! options
2706 parsoid=wt2html
2707 !! wikitext
2708 {|
2709 <td>
2710 <td>
2711 </td>
2712
2713
2714
2715 |}
2716 !! html
2717 <table>
2718
2719 <tbody>
2720 <tr>
2721 <td></td>
2722
2723 <td>
2724 </td></tr>
2725
2726
2727
2728 </tbody></table>
2729 !! end
2730
2731
2732 #--------------------------------------------------------------------
2733 # Transclusion parameter whitespace stripping tests
2734 # Behavior is different for positional and named parameters
2735 #--------------------------------------------------------------------
2736 !! test
2737 Templates: Strip leading and trailing whitespace from named-param values
2738 !! wikitext
2739 {{echo|1= a }}
2740
2741 {{echo|1= {{echo|b}} }}
2742
2743 {{echo| 1 =
2744 c }}
2745
2746 {{echo| 1 =
2747 * d
2748 }}
2749 !! html
2750 <p>a
2751 </p><p>b
2752 </p><p>c
2753 </p>
2754 <ul><li>d</li></ul>
2755
2756 !! end
2757
2758 !! test
2759 Templates: Don't strip whitespace from positional-param values
2760 !! wikitext
2761 {{echo|a }}
2762
2763 {{echo|{{echo|b}} }}
2764
2765 {{echo| c
2766 }}
2767
2768 {{echo| {{echo|d}}
2769 }}
2770
2771 {{echo|
2772 e}}
2773
2774 {{echo|
2775 *f}}
2776
2777 {{echo|
2778 }}g
2779 !! html
2780 <p>a
2781 </p><p>b
2782 </p>
2783 <pre>c
2784 </pre>
2785 <p><br />
2786 </p>
2787 <pre>d
2788 </pre>
2789 <p><br />
2790 </p>
2791 <pre>e
2792 </pre>
2793 <p><br />
2794 </p>
2795 <ul><li>f</li></ul>
2796 <p><br />
2797 </p>
2798 <pre>g
2799 </pre>
2800 !! end
2801
2802 !! test
2803 Templates: Don't recognize targets split by newlines
2804 !! options
2805 parsoid=wt2html
2806 !! wikitext
2807 {{ech
2808 o|foo}}
2809 !! html/php
2810 <p>{{ech
2811 o|foo}}
2812 </p>
2813 !! html/parsoid
2814 <p>{{ech
2815 o|foo}}</p>
2816 !! end
2817
2818 !! test
2819 Templates: Recognize targets when newlines and comments don't split the target
2820 !! options
2821 parsoid=wt2html
2822 !! wikitext
2823 {{
2824 <!--X--> ech<!--X-->o<!--X-->
2825 <!--X--> <!--X-->
2826
2827 |foo}}
2828 !! html/php
2829 <p>foo
2830 </p>
2831 !! html/parsoid
2832 <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>
2833 !! end
2834
2835 !! test
2836 Templates: Handle empty comment-and-ws-only lines correctly
2837 !! wikitext
2838 {{echo|foo
2839 <!--should be ignored-->
2840 <!--should be ignored as well-->
2841 bar}}
2842 !! html/php
2843 <p>foo
2844 bar
2845 </p>
2846 !! html/parsoid
2847 <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>
2848 !! end
2849
2850 !! test
2851 Templates: Handle comments in the target
2852 !! wikitext
2853 {{echo
2854 <!-- should be ignored -->
2855 |foo}}
2856
2857 {{echo
2858 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2859 |foo}}
2860
2861 {{echo<!-- should be ignored -->
2862 |foo}}
2863
2864 {{echo<!-- should be ignored -->|foo}}
2865
2866 {{<!-- should be ignored -->echo|foo}}
2867 !! html/php
2868 <p>foo
2869 </p><p>foo
2870 </p><p>foo
2871 </p><p>foo
2872 </p><p>foo
2873 </p>
2874 !! html/parsoid
2875 <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>
2876
2877 <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>
2878
2879 <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>
2880
2881 <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>
2882
2883 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2884 !! end
2885
2886 !! test
2887 Templates: Handle comments in parameter names (T69657)
2888 !! wikitext
2889 {{echo|1
2890 <!-- should be ignored -->
2891 =foo}}
2892
2893 {{echo|
2894 <!-- should be ignored -->
2895 1 = foo}}
2896
2897 {{echo|1<!-- should be ignored -->=foo}}
2898
2899 {{echo|<!-- should be ignored -->1=foo}}
2900 !! html/php
2901 <p>foo
2902 </p><p>foo
2903 </p><p>foo
2904 </p><p>foo
2905 </p>
2906 !! html/parsoid
2907 <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>
2908
2909 <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>
2910
2911 <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>
2912
2913 <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>
2914 !! end
2915
2916 !! test
2917 Templates: Other wikitext in parameter names (T69657)
2918 !! wikitext
2919 {{echo|''1''=foo}}
2920 !! html/php
2921 <p>{{{1}}}
2922 </p>
2923 !! html/parsoid
2924 <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>
2925 !! end
2926
2927 !! test
2928 Templates: With colons
2929 !! wikitext
2930 {{With: Colon}}
2931 !! html/php
2932 <p>Template with colon
2933 </p>
2934 !! html/parsoid
2935 <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>
2936 !! end
2937
2938 #--------------------------------------------------------------------
2939 # Transclusion parameter escaping tests
2940 #--------------------------------------------------------------------
2941
2942 !! test
2943 Templates: Parsoid parameter escaping test 1
2944 !! wikitext
2945 {{echo|[foo]|{{echo|[bar]}}}}
2946 !! html/php+tidy
2947 <p>[foo]
2948 </p>
2949 !! html/parsoid
2950 <p about="#mwt1" typeof="mw:Transclusion"
2951 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2952 !! end
2953
2954 !! test
2955 Parsoid: Pipes in external links in template parameter
2956 !! wikitext
2957 {{echo|[{{echo|http://example.com}} link]}}
2958 !! html/php+tidy
2959 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2960 </p>
2961 !! html/parsoid
2962 <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>
2963 !! end
2964
2965 !! test
2966 Parsoid: pipe in transclusion parameter
2967 !! wikitext
2968 {{echo|http://foo.com/a&#124;b}}
2969 !! html/php+tidy
2970 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2971 </p>
2972 !! html/parsoid
2973 <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>
2974 !! end
2975
2976 !! test
2977 Parsoid: Pipe in external link target and content in template parameter
2978 !! options
2979 parsoid=html2wt,wt2wt
2980 !! wikitext
2981 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2982 !! html/php+tidy
2983 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2984 </p>
2985 !! html/parsoid
2986 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2987 typeof="mw:Transclusion"
2988 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2989 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2990 !! end
2991
2992 !! test
2993 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2994 !! options
2995 parsoid
2996 !! wikitext
2997 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2998 !! html
2999 <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>
3000 !! end
3001
3002 !! test
3003 Templates: Don't escape already nowiki-escaped text in template parameters
3004 !! options
3005 parsoid=html2wt,wt2wt
3006 !! wikitext
3007 {{echo|foo<nowiki>|</nowiki>bar}}
3008 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3009 {{echo|<nowiki></nowiki>}}
3010 !! html/php+tidy
3011 <p>foo|bar
3012 &lt;div&gt;
3013
3014 </p>
3015 !! html/parsoid
3016 <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>
3017 <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>
3018 <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>
3019 </p>
3020 !! end
3021
3022 ## T54824
3023 !! test
3024 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3025 !! options
3026 parsoid=html2wt,wt2wt
3027 !! wikitext
3028 {{echo|{{echo|1=bar}}}}
3029 !! html/php+tidy
3030 <p>bar
3031 </p>
3032 !! html/parsoid
3033 <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>
3034 !! end
3035
3036 ## T58733
3037 !! test
3038 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3039 !! wikitext
3040 {{echo|a : b}}
3041 !! html/php+tidy
3042 <p>a&#160;: b
3043 </p>
3044 !! html/parsoid
3045 <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>
3046 !! end
3047
3048 ## T73412
3049 !! test
3050 Templates: Preserve blank parameter names
3051 !! wikitext
3052 {{echo|=foo}}
3053 !! html/php+tidy
3054 <p>{{{1}}}
3055 </p>
3056 !! html/parsoid
3057 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3058 !! end
3059
3060 !! test
3061 Templates: Preserve blank parameter names in other positions
3062 !! wikitext
3063 {{blank_param|bar|=foo}}
3064 !! html/php+tidy
3065 <p>bar
3066 foo
3067 </p>
3068 !! html/parsoid
3069 <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
3070 foo</p>
3071 !! end
3072
3073 ###
3074 ### Parsoid-centric tests for testing RT edge cases for pre
3075 ###
3076
3077 !!test
3078 1a. Indent-Pre and Comments
3079 !! wikitext
3080 a
3081 <!--a-->
3082 c
3083 !! html
3084 <pre>a
3085 </pre>
3086 <p>c
3087 </p>
3088 !!end
3089
3090 !!test
3091 1b. Indent-Pre and Comments
3092 !! wikitext
3093 a
3094 <!--a-->
3095 c
3096 !! html
3097 <pre>a
3098 </pre>
3099 <p>c
3100 </p>
3101 !!end
3102
3103 !!test
3104 1c. Indent-Pre and Comments
3105 !! wikitext
3106 <!--a--> a
3107
3108 <!--a--> a
3109 !! html
3110 <pre> a
3111 </pre>
3112 <pre> a
3113 </pre>
3114 !!end
3115
3116 !!test
3117 1d. Indent-Pre and Comments
3118 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3119 !! wikitext
3120 <!--a--> a
3121
3122 <!--b-->b
3123 !! html
3124 <pre>a
3125 </pre>
3126 <pre>b
3127 </pre>
3128 !!end
3129
3130 !!test
3131 2a. Indent-Pre and tables
3132 !! wikitext
3133 {|
3134 |-
3135 !h1!!h2
3136 |foo||bar
3137 |}
3138 !! html
3139 <table>
3140
3141 <tr>
3142 <th>h1</th>
3143 <th>h2
3144 </th>
3145 <td>foo</td>
3146 <td>bar
3147 </td></tr></table>
3148
3149 !!end
3150
3151 !!test
3152 2b. Indent-Pre and tables
3153 !! wikitext
3154 {|
3155 |-
3156 |foo
3157 |}
3158 !! html
3159 <table>
3160
3161 <tr>
3162 <td>foo
3163 </td></tr></table>
3164
3165 !!end
3166
3167 !!test
3168 2c. Indent-Pre and tables (T44252)
3169 !! wikitext
3170 {|
3171 |+foo
3172 ! |bar
3173 |}
3174 !! html
3175 <table>
3176 <caption>foo
3177 </caption>
3178 <tr>
3179 <th>bar
3180 </th></tr></table>
3181
3182 !!end
3183
3184 !!test
3185 2d. Indent-Pre and tables
3186 !! wikitext
3187 a
3188 {|
3189 |b
3190 |}
3191 !! html/php
3192 <pre>a
3193 </pre>
3194 <table>
3195 <tr>
3196 <td>b
3197 </td></tr></table>
3198
3199 !! html/parsoid
3200 <pre>a</pre>
3201 <table>
3202 <tbody><tr><td> b</td></tr>
3203 </tbody></table>
3204 !!end
3205
3206 !!test
3207 2e. Indent-Pre and table-line syntax
3208 !! wikitext
3209 a
3210 | b
3211 | c
3212 !! html/php
3213 <pre>a
3214 | b
3215 | c
3216 </pre>
3217 !!end
3218
3219 !!test
3220 2f. Indent-pre started by table-line syntax
3221 !! wikitext
3222 a
3223 | b
3224 | c
3225 !! html/php
3226 <p>a
3227 </p>
3228 <pre>| b
3229 | c
3230 </pre>
3231 !! html/parsoid
3232 <p>a</p>
3233 <pre>
3234 | b
3235 | c</pre>
3236 !!end
3237
3238 !! test
3239 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3240 !! wikitext
3241 <table>
3242 <tr>
3243 <td>
3244 Text that should be rendered preformatted
3245 </td>
3246 </tr>
3247 </table>
3248 !! html
3249 <table>
3250 <tr>
3251 <td>
3252 <pre>Text that should be rendered preformatted
3253 </pre>
3254 </td>
3255 </tr>
3256 </table>
3257
3258 !! end
3259
3260 !!test
3261 3a. Indent-Pre and block tags (single-line html)
3262 !! wikitext
3263 a <p> foo </p>
3264 b <div> foo </div>
3265 c <blockquote> foo </blockquote>
3266 <span> foo </span>
3267 !! html
3268 a <p> foo </p>
3269 b <div> foo </div>
3270 c <blockquote> foo </blockquote>
3271 <pre><span> foo </span>
3272 </pre>
3273 !! html/parsoid
3274 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3275 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3276 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3277 <pre><span> foo </span>
3278 </pre>
3279 !! html/php+tidy
3280 <p> a </p><p> foo </p><p>
3281 b </p><div> foo </div><p>
3282 c </p><blockquote><p> foo </p></blockquote>
3283 <pre><span> foo </span>
3284 </pre>
3285 !! end
3286
3287 !!test
3288 3b. Indent-Pre and block tags (multi-line html)
3289 !! wikitext
3290 a <span>foo</span>
3291 b <div> foo </div>
3292 !! html
3293 <pre>a <span>foo</span>
3294 </pre>
3295 b <div> foo </div>
3296
3297 !! html/parsoid
3298 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3299 b <div data-parsoid='{"stx":"html"}'> foo </div>
3300 !! html/php+tidy
3301 <pre>a <span>foo</span>
3302 </pre><p>
3303 b </p><div> foo </div>
3304 !!end
3305
3306 !!test
3307 3c. Indent-Pre and block tags (pre-content on separate line)
3308 !! wikitext
3309 <p>
3310 foo
3311 </p>
3312
3313 <div>
3314 foo
3315 </div>
3316
3317 <center>
3318 foo
3319 </center>
3320
3321 <blockquote>
3322 foo
3323 </blockquote>
3324
3325 <blockquote>
3326 <pre>
3327 foo
3328 </pre>
3329 </blockquote>
3330
3331 <table><tr><td>
3332 foo
3333 </td></tr></table>
3334
3335 <ul><li>
3336 foo
3337 </li></ul>
3338
3339 !! html
3340 <p>
3341 foo
3342 </p>
3343 <div>
3344 <pre>foo
3345 </pre>
3346 </div>
3347 <center>
3348 <pre>foo
3349 </pre>
3350 </center>
3351 <blockquote>
3352 <p> foo
3353 </p>
3354 </blockquote>
3355 <blockquote>
3356 <pre>
3357 foo
3358 </pre>
3359 </blockquote>
3360 <table><tr><td>
3361 <pre>foo
3362 </pre>
3363 </td></tr></table>
3364 <ul><li>
3365 foo
3366 </li></ul>
3367
3368 !!end
3369
3370 !! test
3371 4. Indent-Pre and extension tags
3372 !! wikitext
3373 a <tag />
3374 !! html/php
3375 a <pre>
3376 NULL
3377 array (
3378 )
3379 </pre>
3380
3381 !! html/parsoid
3382 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3383 !! end
3384
3385 !! test
3386 5. Indent-Pre and html pre
3387 !! wikitext
3388 <pre class="123">hi</pre>
3389 !! html/php
3390 <pre class="123">hi</pre>
3391
3392 !! html/parsoid
3393 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3394 !! end
3395
3396 !!test
3397 Render paragraphs when indent-pre is suppressed in blocklevels
3398 !! wikitext
3399 <blockquote>
3400 foo
3401
3402 bar
3403 </blockquote>
3404 !! html
3405 <blockquote>
3406 <p> foo
3407 </p><p> bar
3408 </p>
3409 </blockquote>
3410
3411 !!end
3412
3413 !!test
3414 4. Multiple spaces at start-of-line
3415 !! wikitext
3416 <p> foo </p>
3417 foo
3418 {|
3419 |foo
3420 |}
3421 !! html
3422 <p> foo </p>
3423 <pre> foo
3424 </pre>
3425 <table>
3426 <tr>
3427 <td>foo
3428 </td></tr></table>
3429
3430 !!end
3431
3432 ## NOTE: the leading white-space chars on empty line are significant
3433 !! test
3434 5a. White-space in indent-pre
3435 !! wikitext
3436 a<br />
3437
3438 b
3439 !! html
3440 <pre>a<br />
3441
3442 b
3443 </pre>
3444 !! end
3445
3446 ## NOTE: the leading white-space chars on empty line are significant
3447 !! test
3448 5b. White-space in indent-pre
3449 !! wikitext
3450 a
3451
3452 b
3453
3454
3455 c
3456 !! html
3457 <pre>a
3458
3459 b
3460
3461
3462 c
3463 </pre>
3464 !! end
3465
3466 !! test
3467 5c. White-space in indent-pre
3468 !! wikitext
3469 ''a''
3470 ''b''
3471 ''c''
3472 !! html
3473 <pre><i>a</i>
3474 <i>b</i>
3475 <i>c</i>
3476 </pre>
3477 !! end
3478
3479 !! test
3480 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3481 !! wikitext
3482 a
3483
3484 <!-- continue -->
3485 b
3486
3487 c
3488
3489 d
3490 !! html
3491 <pre>a
3492
3493 b
3494 </pre>
3495 <pre>c
3496
3497 </pre>
3498 <p>d
3499 </p>
3500 !! end
3501
3502 !! test
3503 7a. Indent-pre and category links
3504 !! options
3505 parsoid=wt2html,wt2wt
3506 !! wikitext
3507 [[Category:foo]] <!-- No pre-wrapping -->
3508 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3509 !! html/php+tidy
3510 !! html/parsoid
3511 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3512 <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 -->
3513 !! end
3514
3515 ## We used to, but no longer wt2wt this test since the default serializer
3516 ## will normalize all categories to serialize on their own line.
3517 ## This wikitext usage is going to be fairly uncommon in production and
3518 ## selser will take care of preserving formatting in those scenarios.
3519 !! test
3520 7b. Indent-pre and category links
3521 !! options
3522 parsoid=wt2html
3523 !! wikitext
3524 [[Category:foo]] a
3525 [[Category:foo]] {{echo|b}}
3526 !! html/parsoid
3527 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3528 <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>
3529 !! end
3530
3531 !! test
3532 Indent-Pre: Newlines in comments shouldn't affect sol state
3533 !! wikitext
3534 a <!--
3535 foo
3536 --> b
3537 !! html/php+tidy
3538 <p>a b
3539 </p>
3540 !! html/parsoid
3541 <p>a <!--
3542 foo
3543 --> b</p>
3544 !! end
3545
3546 ###
3547 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3548 ###
3549
3550 !!test
3551 HTML-pre: 1. embedded newlines
3552 !! wikitext
3553 <pre>foo</pre>
3554
3555 <pre>
3556 foo
3557 </pre>
3558
3559 <pre>
3560
3561 foo
3562 </pre>
3563
3564 <pre>
3565
3566
3567 foo
3568 </pre>
3569 !! html/php+tidy
3570 <pre>foo</pre>
3571 <pre>foo
3572 </pre>
3573 <pre>
3574
3575 foo
3576 </pre>
3577 <pre>
3578
3579
3580 foo
3581 </pre>
3582 !! html/parsoid
3583 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3584
3585 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3586 </pre>
3587
3588 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3589
3590 foo
3591 </pre>
3592
3593 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3594
3595
3596 foo
3597 </pre>
3598 !!end
3599
3600 !! test
3601 HTML-pre: big spaces
3602 !! wikitext
3603 <pre>
3604
3605
3606
3607
3608 haha
3609
3610
3611
3612
3613 haha
3614
3615
3616
3617
3618 </pre>
3619 !! html/php+tidy
3620 <pre>
3621
3622
3623
3624
3625 haha
3626
3627
3628
3629
3630 haha
3631
3632
3633
3634
3635 </pre>
3636 !! html/parsoid
3637 <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"}}'>
3638
3639
3640
3641
3642 haha
3643
3644
3645
3646
3647 haha
3648
3649
3650
3651
3652 </pre>
3653 !! end
3654
3655 !!test
3656 HTML-pre: 2: indented text
3657 !! wikitext
3658 <pre>
3659 foo
3660 </pre>
3661 !! html
3662 <pre>
3663 foo
3664 </pre>
3665
3666 !!end
3667
3668 !!test
3669 HTML-pre: 3: other wikitext
3670 !! wikitext
3671 <pre>
3672 * foo
3673 # bar
3674 = no-h =
3675 '' no-italic ''
3676 [[ NoLink ]]
3677 </pre>
3678 !! html/php
3679 <pre>
3680 * foo
3681 # bar
3682 = no-h =
3683 '' no-italic ''
3684 [[ NoLink ]]
3685 </pre>
3686
3687 !! html/parsoid
3688 <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
3689 # bar
3690 = no-h =
3691 '' no-italic ''
3692 [[ NoLink ]]
3693 </pre>
3694 !!end
3695
3696 ###
3697 ### Definition lists
3698 ###
3699 !! test
3700 Simple definition
3701 !! wikitext
3702 ;name :Definition
3703 !! html
3704 <dl><dt>name&#160;</dt>
3705 <dd>Definition</dd></dl>
3706
3707 !! end
3708
3709 !! test
3710 Definition list for indentation only
3711 !! wikitext
3712 :Indented text
3713 !! html
3714 <dl><dd>Indented text</dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition list with no space
3720 !! wikitext
3721 ;name:Definition
3722 !! html
3723 <dl><dt>name</dt>
3724 <dd>Definition</dd></dl>
3725
3726 !!end
3727
3728 !! test
3729 Definition list with URL link
3730 !! wikitext
3731 ;http://example.com/ :definition
3732 !! html
3733 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3734 <dd>definition</dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition list with bracketed URL link
3740 !! wikitext
3741 ;[http://www.example.com/ Example]:Something about it
3742 !! html
3743 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3744 <dd>Something about it</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition list with wikilink containing colon
3750 !! wikitext
3751 ; [[Help:FAQ]]:The least-read page on Wikipedia
3752 !! html
3753 <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>
3754 <dd>The least-read page on Wikipedia</dd></dl>
3755
3756 !! end
3757
3758 # At Brion's and JeLuF's insistence... :)
3759 !! test
3760 Definition list with news link containing colon
3761 !! wikitext
3762 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3763 !! html/php
3764 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3765 <dd>This isn't even a real newsgroup!</dd></dl>
3766
3767 !! html/parsoid
3768 <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>
3769 !! end
3770
3771 !! test
3772 Malformed definition list with colon
3773 !! wikitext
3774 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3775 !! html
3776 <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>
3777
3778 !! end
3779
3780 !! test
3781 Definition lists: colon in external link text
3782 !! wikitext
3783 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3784 !! html
3785 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3786 <dd>OK, I made that up</dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition lists: colon in HTML attribute
3792 !! wikitext
3793 ;<b style="display: inline">bold</b>
3794 !! html
3795 <dl><dt><b style="display: inline">bold</b></dt></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition lists: self-closed tag
3801 !! wikitext
3802 ;one<br/>two :two-line fun
3803 !! html
3804 <dl><dt>one<br />two&#160;</dt>
3805 <dd>two-line fun</dd></dl>
3806
3807 !! end
3808
3809 !! test
3810 Definition lists: ignore colons inside tags
3811 !! wikitext
3812 ;one <b>two : tag <i>fun:</i>:</b>:def
3813 !! html
3814 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3815 <dd>def</dd></dl>
3816
3817 !! end
3818
3819 !! test
3820 Definition lists: excess closed tags
3821 !! wikitext
3822 ;one</b>two :bad tag fun
3823 !! html/php+tidy
3824 <dl><dt>onetwo&#160;</dt>
3825 <dd>bad tag fun</dd></dl>
3826 !! html/parsoid
3827 <dl>
3828 <dt>onetwo</dt>
3829 <dd>bad tag fun</dd>
3830 </dl>
3831 !! end
3832
3833 !! test
3834 T13748: Literal closing tags
3835 !! wikitext
3836 <dl>
3837 <dt>test 1</dt>
3838 <dd>test test test test test</dd>
3839 <dt>test 2</dt>
3840 <dd>test test test test test</dd>
3841 </dl>
3842 !! html
3843 <dl>
3844 <dt>test 1</dt>
3845 <dd>test test test test test</dd>
3846 <dt>test 2</dt>
3847 <dd>test test test test test</dd>
3848 </dl>
3849
3850 !! end
3851
3852 !! test
3853 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3854 !! wikitext
3855 <ul><li>
3856 ;term :description
3857 *unordered
3858 </li></ul>
3859 !! html
3860 <ul><li>
3861 <dl><dt>term&#160;</dt>
3862 <dd>description</dd></dl>
3863 <ul><li>unordered</li></ul>
3864 </li></ul>
3865
3866 !! end
3867
3868 !! test
3869 Definition list with empty definition and following paragraph
3870 !! wikitext
3871 ;term:
3872 Paragraph text
3873 !! html
3874 <dl><dt>term</dt>
3875 <dd></dd></dl>
3876 <p>Paragraph text
3877 </p>
3878 !! end
3879
3880 !! test
3881 Nested definition lists using html syntax
3882 !! wikitext
3883 <dl><dt>x</dt>
3884 <dd>a</dd>
3885 <dd>b</dd></dl>
3886 !! html
3887 <dl><dt>x</dt>
3888 <dd>a</dd>
3889 <dd>b</dd></dl>
3890
3891 !! end
3892
3893 !! test
3894 Definition Lists: No nesting: Multiple dd's
3895 !! wikitext
3896 ;x
3897 :a
3898 :b
3899 !! html
3900 <dl><dt>x</dt>
3901 <dd>a</dd>
3902 <dd>b</dd></dl>
3903
3904 !! end
3905
3906 !! test
3907 Definition Lists: Indentation: Regular
3908 !! wikitext
3909 :i1
3910 ::i2
3911 :::i3
3912 !! html
3913 <dl><dd>i1
3914 <dl><dd>i2
3915 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3916
3917 !! end
3918
3919 !! test
3920 Definition Lists: Indentation: Missing 1st level
3921 !! wikitext
3922 ::i2
3923 :::i3
3924 !! html
3925 <dl><dd><dl><dd>i2
3926 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3927
3928 !! end
3929
3930 !! test
3931 Definition Lists: Indentation: Multi-level indent
3932 !! wikitext
3933 :::i3
3934 !! html
3935 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3936
3937 !! end
3938
3939 !! test
3940 Definition Lists: Hacky use to indent tables
3941 !! wikitext
3942 ::{|
3943 |foo
3944 |bar
3945 |}
3946 this text
3947 should be left alone
3948 !! html
3949 <dl><dd><dl><dd><table>
3950 <tr>
3951 <td>foo
3952 </td>
3953 <td>bar
3954 </td></tr></table></dd></dl></dd></dl>
3955 <p>this text
3956 should be left alone
3957 </p>
3958 !! end
3959
3960 !! test
3961 Definition Lists: Hacky use to indent tables, with comments (T65979)
3962 !! wikitext
3963 <!-- foo -->
3964 ::{|
3965 |foo
3966 |bar
3967 |}<!-- bar -->
3968 this text
3969 should be left alone
3970 !! html/parsoid
3971 <!-- foo -->
3972 <dl><dd><dl><dd><table><tr>
3973 <td>foo</td>
3974 <td>bar</td>
3975 </tr></table><!-- bar --></dd></dl></dd></dl>
3976 <p>this text
3977 should be left alone</p>
3978 !! end
3979
3980 !! test
3981 Definition Lists: Hacky use to indent tables, with comment before table
3982 !! wikitext
3983 ::<!-- foo -->{|
3984 |foo
3985 |}
3986 !! html/parsoid
3987 <dl><dd><dl><dd><!-- foo --><table><tr>
3988 <td>foo</td>
3989 </tr></table></dd></dl></dd></dl>
3990 !! end
3991
3992 # The trailing whitespace in this test is to catch a regression in
3993 # Parsoid after T54473.
3994 !! test
3995 Definition Lists: Hacky use to indent tables (WS-insensitive)
3996 !! wikitext
3997 : {|
3998 |a
3999 |}
4000 !! html/php
4001 <dl><dd><table>
4002 <tr>
4003 <td>a
4004 </td></tr></table></dd></dl>
4005
4006 !! html/parsoid
4007 <dl><dd> <table>
4008 <tbody><tr><td>a</td></tr>
4009 </tbody></table> </dd></dl>
4010 !! end
4011
4012 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4013 ## as an empty dt item. It also ignores all but the last ";" when followed
4014 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4015 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4016 ## ";"s.
4017 ##
4018 ## Ex: ";;t2 ::d2" is transformed into:
4019 ##
4020 ## <dl>
4021 ## <dt>t2 </dt>
4022 ## <dd>
4023 ## <dl>
4024 ## <dt></dt>
4025 ## <dd>d2</dd>
4026 ## </dl>
4027 ## </dd>
4028 ## </dl>
4029 ##
4030 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4031 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4032 ##
4033 ## <dl>
4034 ## <dt>
4035 ## <dl>
4036 ## <dt>t2 </dt>
4037 ## <dd>:d2</dd>
4038 ## </dl>
4039 ## </dt>
4040 ## </dl>
4041 ##
4042 ## All Parsoid only definition list tests have this difference.
4043 ##
4044 ## See also: https://phabricator.wikimedia.org/T8569
4045 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4046
4047 !! test
4048 Table / list interaction: indented table with lists in table contents
4049 !! wikitext
4050 :{|
4051 |-
4052 |a
4053 *b
4054 |-
4055 |c
4056 *d
4057 |}
4058 !! html
4059 <dl><dd><table>
4060
4061 <tr>
4062 <td>a
4063 <ul><li>b</li></ul>
4064 </td></tr>
4065 <tr>
4066 <td>c
4067 <ul><li>d</li></ul>
4068 </td></tr></table></dd></dl>
4069
4070 !! end
4071
4072 !!test
4073 Table / list interaction: lists nested in tables nested in indented lists
4074 !! wikitext
4075 :{|
4076 |
4077 :a
4078 :b
4079 |
4080 *c
4081 *d
4082 |}
4083
4084 *e
4085 *f
4086 !! html
4087 <dl><dd><table>
4088 <tr>
4089 <td>
4090 <dl><dd>a</dd>
4091 <dd>b</dd></dl>
4092 </td>
4093 <td>
4094 <ul><li>c</li>
4095 <li>d</li></ul>
4096 </td></tr></table></dd></dl>
4097 <ul><li>e</li>
4098 <li>f</li></ul>
4099
4100 !!end
4101
4102 !! test
4103 Definition Lists: Nesting: Multi-level (Parsoid only)
4104 !! wikitext
4105 ;t1 :d1
4106 ;;t2 ::d2
4107 ;;;t3 :::d3
4108 !! html/parsoid
4109 <dl>
4110 <dt>t1 </dt>
4111 <dd>d1</dd>
4112 <dt>
4113 <dl>
4114 <dt>t2 </dt>
4115 <dd>:d2</dd>
4116 <dt>
4117 <dl>
4118 <dt>t3 </dt>
4119 <dd>::d3</dd>
4120 </dl>
4121 </dt>
4122 </dl>
4123 </dt>
4124 </dl>
4125
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Nesting: Test 2
4132 !! wikitext
4133 ;t1
4134 ::d2
4135 !! html+tidy
4136 <dl><dt>t1</dt>
4137 <dd>
4138 <dl><dd>d2</dd></dl></dd></dl>
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Nesting: Test 3
4144 !! wikitext
4145 :;t1
4146 ::::d2
4147 !! html+tidy
4148 <dl><dd><dl><dt>t1</dt>
4149 <dd>
4150 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Nesting: Test 4
4156 !! wikitext
4157 ::;t3
4158 :::d3
4159 !! html
4160 <dl><dd><dl><dd><dl><dt>t3</dt>
4161 <dd>d3</dd></dl></dd></dl></dd></dl>
4162
4163 !! end
4164
4165
4166 ## The Parsoid team believes the following three test exposes a
4167 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4168 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4169 ## It also exposes a "misfeature" in tidy, which doesn't like
4170 ## <dl> tags with a single <dt> child; it converts the <dt> into
4171 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4172 !! test
4173 Definition Lists: Mixed Lists: Test 1
4174 !! wikitext
4175 :;*foo
4176 ::*bar
4177 :;baz
4178 !! html/php
4179 <dl><dd><dl><dt><ul><li>foo</li>
4180 <li>bar</li></ul></dt></dl>
4181 <dl><dt>baz</dt></dl></dd></dl>
4182
4183 !! html/php+tidy
4184 <dl><dd><dl><dt><ul><li>foo</li>
4185 <li>bar</li></ul></dt></dl>
4186 <dl><dt>baz</dt></dl></dd></dl>
4187 !! html/parsoid
4188 <dl>
4189 <dd><dl>
4190 <dt><ul>
4191 <li>foo
4192 </li>
4193 </ul></dt>
4194 <dd><ul>
4195 <li>bar
4196 </li>
4197 </ul></dd>
4198 <dt>baz</dt>
4199 </dl></dd>
4200 </dl>
4201 !! end
4202
4203 !! test
4204 Definition Lists: Mixed Lists: Test 2
4205 !! wikitext
4206 *:d1
4207 *:d2
4208 !! html
4209 <ul><li><dl><dd>d1</dd>
4210 <dd>d2</dd></dl></li></ul>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 3
4217 !! wikitext
4218 *:::d1
4219 *:::d2
4220 !! html
4221 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4222 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4223
4224 !! end
4225
4226
4227 !! test
4228 Definition Lists: Mixed Lists: Test 4
4229 !! wikitext
4230 *;d1 :d2
4231 *;d3 :d4
4232 !! html
4233 <ul><li><dl><dt>d1&#160;</dt>
4234 <dd>d2</dd>
4235 <dt>d3&#160;</dt>
4236 <dd>d4</dd></dl></li></ul>
4237
4238 !! end
4239
4240
4241 !! test
4242 Definition Lists: Mixed Lists: Test 5
4243 !! wikitext
4244 *:d1
4245 *::d2
4246 !! html
4247 <ul><li><dl><dd>d1
4248 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 6
4255 !! wikitext
4256 #*:d1
4257 #*:::d3
4258 !! html
4259 <ol><li><ul><li><dl><dd>d1
4260 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4261
4262 !! end
4263
4264
4265 !! test
4266 Definition Lists: Mixed Lists: Test 7
4267 !! wikitext
4268 :*d1
4269 :*d2
4270 !! html
4271 <dl><dd><ul><li>d1</li>
4272 <li>d2</li></ul></dd></dl>
4273
4274 !! end
4275
4276
4277 !! test
4278 Definition Lists: Mixed Lists: Test 8
4279 !! wikitext
4280 :*d1
4281 ::*d2
4282 !! html
4283 <dl><dd><ul><li>d1</li></ul>
4284 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4285
4286 !! end
4287
4288
4289 !! test
4290 Definition Lists: Mixed Lists: Test 9
4291 !! wikitext
4292 *;foo :bar
4293 !! html
4294 <ul><li><dl><dt>foo&#160;</dt>
4295 <dd>bar</dd></dl></li></ul>
4296
4297 !! end
4298
4299
4300 !! test
4301 Definition Lists: Mixed Lists: Test 10
4302 !! wikitext
4303 *#;foo :bar
4304 !! html
4305 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4306 <dd>bar</dd></dl></li></ol></li></ul>
4307
4308 !! end
4309
4310 # The Parsoid team disagrees with the PHP parser's seemingly-random
4311 # rules regarding dd/dt on the next few tests. Parsoid is more
4312 # consistent, and recognizes the shared nesting and keeps the
4313 # still-open tags around until the nesting is complete.
4314
4315 # This is a regression test for T175099
4316 !! test
4317 Definition Lists: Mixed Lists: Test 11
4318 !! wikitext
4319 ;a
4320 :*b
4321 !! html/php
4322 <dl><dt>a</dt>
4323 <dd>
4324 <ul><li>b</li></ul></dd></dl>
4325
4326 !! html/parsoid
4327 <dl><dt>a
4328 <dd><ul><li>b</li></ul></dd></dl>
4329 !! end
4330
4331 # FIXME: Maybe get rid of this test?
4332 !! test
4333 Definition Lists: Mixed Lists: Test 12
4334 !! wikitext
4335 *#*#;*;;foo :bar
4336 *#*#;boo :baz
4337 !! html/php
4338 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4339 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4340 <dl><dt>boo&#160;</dt>
4341 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4342
4343 !! html/php+tidy
4344 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4345 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4346 <dl><dt>boo&#160;</dt>
4347 <dd>baz</dd></dl></li></ol></li></ul>
4348 !! html/parsoid
4349 <ul>
4350 <li>
4351 <ol>
4352 <li>
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dt>
4363 <dl>
4364 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4365 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4366 </dl></dt>
4367 </dl></li>
4368 </ul></dt>
4369 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4370 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4371 </dl></li>
4372 </ol></li>
4373 </ul></li>
4374 </ol></li>
4375 </ul>
4376 !! end
4377
4378 # FIXME: Maybe get rid of this test?
4379 # From whitelist:
4380 # * The test is wrong, there are two colons where there should be :;
4381 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4382 !! test
4383 Definition Lists: Weird Ones: Test 1
4384 !! wikitext
4385 *#;*::;;foo :bar (who uses this?)
4386 !! html/php+tidy
4387 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4388 <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>
4389 !! html/parsoid
4390 <ul>
4391 <li>
4392 <ol>
4393 <li>
4394 <dl>
4395 <dt>
4396 <ul>
4397 <li>
4398 <dl>
4399 <dd>
4400 <dl>
4401 <dd>
4402 <dl>
4403 <dt>
4404 <dl>
4405 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4406 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4407 </dl></dt>
4408 </dl></dd>
4409 </dl></dd>
4410 </dl></li>
4411 </ul></dt>
4412 </dl></li>
4413 </ol></li>
4414 </ul>
4415 !! end
4416
4417 !! test
4418 Definition Lists: colons occurring in tags
4419 !! wikitext
4420 ;a:b
4421 ;'''a:b'''
4422 ;<i>a:b</i>
4423 ;<span>a:b</span>
4424 ;<div>a:b</div>
4425 ;<div>a
4426 :b</div>
4427 ;{{echo|a:b}}
4428 ;{{echo|''a:b''}}
4429 ;;;''a:b''
4430 !! html+tidy
4431 <dl><dt>a</dt>
4432 <dd>b</dd>
4433 <dt><b>a:b</b></dt>
4434 <dt><i>a:b</i></dt>
4435 <dt><span>a:b</span></dt>
4436 <dt><div>a:b</div></dt>
4437 <dt><div>a</div></dt>
4438 <dd>b</dd>
4439 <dt>a</dt>
4440 <dd>b</dd>
4441 <dt><i>a:b</i></dt></dl>
4442 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4443 !! html/parsoid
4444 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4445 <dt><b>a:b</b></dt>
4446 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4447 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4448 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4449 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4450 <dd>b</dd>
4451 <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>
4452 <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>
4453 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4454 !! end
4455
4456 # Parsoid's output differs here again because it shares
4457 # nesting between the two lists unlike the PHP parser.
4458 # Unsure which is more desirable.
4459 !! test
4460 Definition Lists: colons and tables 1
4461 !! wikitext
4462 :{|
4463 |x
4464 |}
4465 :{|
4466 |y
4467 |}
4468 !! html/php
4469 <dl><dd><table>
4470 <tr>
4471 <td>x
4472 </td></tr></table></dd></dl>
4473 <dl><dd><table>
4474 <tr>
4475 <td>y
4476 </td></tr></table></dd></dl>
4477
4478 !! html/parsoid
4479 <dl><dd><table>
4480 <tr>
4481 <td>x
4482 </td></tr></table></dd>
4483 <dd><table>
4484 <tr>
4485 <td>y
4486 </td></tr></table></dd></dl>
4487 !! end
4488
4489 # FIXME: Does this need a html/php section?
4490 !! test
4491 Definition Lists: template interaction
4492 !! wikitext
4493 ::{{definition_list}}
4494
4495 :one
4496 ::{{definition_list}}
4497 :::two
4498 :::three
4499 ::four
4500 !! html/parsoid
4501 <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">
4502 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4503
4504 <dl><dd data-parsoid='{}'>one
4505 <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">
4506 </span><dd about="#mwt2">two
4507 <dl><dd>two</dd>
4508 <dd>three</dd></dl></dd>
4509 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4510 !! end
4511
4512
4513 ###
4514 ### External links
4515 ###
4516 !! test
4517 External links: non-bracketed
4518 !! wikitext
4519 Non-bracketed: http://example.com
4520 !! html
4521 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4522 </p>
4523 !! end
4524
4525 # parsoid doesn't explicitly mark autonumbered links, see T55505
4526 !! test
4527 External links: numbered
4528 !! wikitext
4529 Numbered: [http://example.com]
4530 Numbered: [http://example.net]
4531 Numbered: [http://example.com]
4532 !! html/php
4533 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4534 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4535 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4536 </p>
4537 !! html/parsoid
4538 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4539 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4540 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4541 !!end
4542
4543 !! test
4544 External links: specified text
4545 !! wikitext
4546 Specified text: [http://example.com link]
4547 !! html
4548 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4549 </p>
4550 !!end
4551
4552 !! test
4553 External links: trail
4554 !! wikitext
4555 Linktrails should not work for external links: [http://example.com link]s
4556 !! html
4557 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: dollar sign in URL
4563 !! wikitext
4564 http://example.com/1$2345
4565 !! html
4566 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4567 </p>
4568 !! end
4569
4570 # parsoid doesn't explicitly mark autonumbered links, see T55505
4571 !! test
4572 External links: dollar sign in URL (autonumber)
4573 !! wikitext
4574 [http://example.com/1$2345]
4575 !! html/php
4576 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4577 </p>
4578 !! html/parsoid
4579 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4580 !!end
4581
4582 !! test
4583 External links: open square bracket forbidden in URL (T6377)
4584 !! options
4585 parsoid=wt2html,wt2wt,html2html
4586 !! wikitext
4587 http://example.com/1[2345
4588 !! html/php
4589 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4590 </p>
4591 !! html/parsoid
4592 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4593 !! end
4594
4595 !! test
4596 External links: open square bracket forbidden in URL (named) (T6377)
4597 !! options
4598 parsoid=wt2html,html2html
4599 !! wikitext
4600 [http://example.com/1[2345]
4601 !! html/php
4602 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4603 </p>
4604 !! html/parsoid
4605 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4606 !!end
4607
4608 # parsoid adds a space before the link name
4609 !! test
4610 External links: open square bracket forbidden in URL (named) (T6377)
4611 Parsoid variant.
4612 !! wikitext
4613 [http://example.com/1 [2345]
4614 !! html
4615 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: nowiki in URL link text (T8230)
4621 !! wikitext
4622 [http://example.com/ <nowiki>''example site''</nowiki>]
4623 !! html
4624 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: newline forbidden in text (T8230 regression check)
4630 !! wikitext
4631 [http://example.com/ first
4632 second]
4633 !! html
4634 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4635 second]
4636 </p>
4637 !!end
4638
4639 !! test
4640 External links: Pipe char between url and text
4641 !! wikitext
4642 [http://example.com | link]
4643 !! html
4644 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 External links: protocol-relative URL in brackets
4650 !! wikitext
4651 [//example.com/ Test]
4652 !! html
4653 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4654 </p>
4655 !! end
4656
4657 # parsoid doesn't explicitly mark autonumbered links, see T55505
4658 !! test
4659 External links: protocol-relative URL in brackets without text
4660 !! wikitext
4661 [//example.com]
4662 !! html/php
4663 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4667 !! end
4668
4669 !! test
4670 External links: protocol-relative URL in free text is left alone
4671 !! wikitext
4672 //example.com/Foo
4673 !! html
4674 <p>//example.com/Foo
4675 </p>
4676 !!end
4677
4678 !! test
4679 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4680 !! wikitext
4681 foo//example.com/Foo
4682 !! html
4683 <p>foo//example.com/Foo
4684 </p>
4685 !! end
4686
4687 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4688 !! test
4689 External links: with no contents
4690 !! options
4691 parsoid=wt2html,wt2wt
4692 !! wikitext
4693 [http://en.wikipedia.org/wiki/Foo]
4694
4695 [[wikipedia:Foo|Bar]]
4696
4697 [[wikipedia:Foo|<span>Bar</span>]]
4698 !! html/php
4699 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4701 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4702 </p>
4703 !! html/parsoid
4704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4705 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4706 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4707 !! end
4708
4709 !! test
4710 External links: Free with trailing punctuation
4711 !! wikitext
4712 http://example.com,
4713 http://example.com;
4714 http://example.com\
4715 http://example.com.
4716 http://example.com:
4717 http://example.com!
4718 http://example.com?
4719 http://example.com)
4720 http://example.com/url_with_(brackets)
4721 (http://example.com/url_without_brackets)
4722 http://example.com/url_with_entity&amp;
4723 http://example.com/url_with_entity&#x26;
4724 http://example.com/url_with_entity&#038;
4725 http://example.com/url_with_entity&nbsp;
4726 http://example.com/url_with_entity&#xA0;
4727 http://example.com/url_with_entity&#160;
4728 http://example.com/url_with_entity&lt;
4729 http://example.com/url_with_entity&#x3C;
4730 http://example.com/url_with_entity&#60;
4731 !! html/php
4732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4739 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4741 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4750 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4751 </p>
4752 !! html/parsoid
4753 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4754 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4755 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4756 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4757 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4758 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4759 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4760 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4761 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4762 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4763 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4766 <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>
4767 <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>
4768 <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>
4769 <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>
4770 <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>
4771 <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>
4772 !! end
4773
4774 !! test
4775 External links: tricky Parsoid html2html case
4776 !! options
4777 parsoid=wt2html,wt2wt,html2html
4778 !! wikitext
4779 http://example.com/url_with_entity&amp;amp;
4780 !! html/php
4781 <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>;
4782 </p>
4783 !! html/parsoid
4784 <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>
4785 !! end
4786
4787 !! test
4788 External links: Free with trailing quotes (T113666)
4789 !! wikitext
4790 '''News:''' Stuff here
4791
4792 news:'a'b''c''d e
4793 !! html/php
4794 <p><b>News:</b> Stuff here
4795 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4796 </p>
4797 !! html/parsoid
4798 <p><b>News:</b> Stuff here</p>
4799 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4800 !! end
4801
4802 !! test
4803 External links: with entity
4804 !! wikitext
4805 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4806 !! html/php
4807 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4808 </p>
4809 !! html/parsoid
4810 <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>
4811 !! end
4812
4813 !! test
4814 External links: Lone protocols are never linked (T105697)
4815 !! wikitext
4816 http://
4817 http://;
4818 (http://)
4819 bitcoin:
4820 bitcoin:;
4821 (bitcoin:)
4822 !! html
4823 <p>http://
4824 http://;
4825 (http://)
4826 bitcoin:
4827 bitcoin:;
4828 (bitcoin:)
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: No preceding word characters allowed (T67278)
4834 !! wikitext
4835 NOPEhttp://example.com
4836 N0http://example.com
4837 ok:http://example.com
4838 ok-http://example.com
4839 !! html
4840 <p>NOPEhttp://example.com
4841 N0http://example.com
4842 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4843 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: nofollow domain exception
4849 !! wikitext
4850 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4851 !! html
4852 <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>.
4853 </p>
4854 !!end
4855
4856 !! test
4857 External image
4858 !! wikitext
4859 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image from https
4867 !! wikitext
4868 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4869 !! html
4870 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External image (when not allowed)
4876 !! options
4877 wgAllowExternalImages=0
4878 !! wikitext
4879 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4880 !! html
4881 <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>
4882 </p>
4883 !! end
4884
4885 !! test
4886 Link to non-http image, no img tag
4887 !! wikitext
4888 Link to non-http image, no img tag: ftp://example.com/test.jpg
4889 !! html
4890 <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>
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: terminating separator
4896 !! wikitext
4897 Terminating separator: http://example.com/thing,
4898 !! html
4899 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: intervening separator
4905 !! wikitext
4906 Intervening separator: http://example.com/1,2,3
4907 !! html
4908 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old bug with URL in query
4914 !! wikitext
4915 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4916 !! html
4917 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: old URL-in-URL bug, mixed protocols
4923 !! wikitext
4924 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4925 !! html
4926 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4927 </p>
4928 !!end
4929
4930 # Since Parsoid is starting to emit canonical wikitext for links,
4931 # [http://example.com http://example.com] will not RT back to that
4932 # form anymore.
4933 !! test
4934 External links: URL in text
4935 !! options
4936 parsoid=wt2html
4937 !! wikitext
4938 URL in text: [http://example.com http://example.com]
4939 !! html/php
4940 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4941 </p>
4942 !! html/parsoid
4943 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4944 !! end
4945
4946 !! test
4947 External links: Clickable images
4948 !! wikitext
4949 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4950 !! html/php
4951 <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>
4952 </p>
4953 !! html/parsoid
4954 <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>
4955 !! end
4956
4957 !! test
4958 External links: raw ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&y
4961 !! html
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: encoded ampersand
4968 !! wikitext
4969 Old &amp; use: http://x&amp;y
4970 !! html/php
4971 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4972 </p>
4973 !! html/parsoid
4974 <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>
4975 !! end
4976
4977 !! test
4978 External links: encoded equals (T8102)
4979 !! wikitext
4980 http://example.com/?foo&#61;bar
4981 !! html/php
4982 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4983 </p>
4984 !! html/parsoid
4985 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4986 !! end
4987
4988 ##
4989 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4990 ## does it number them. As discussed in T55505, we can identify
4991 ## autonumbered links via CSS.
4992 ##
4993
4994 !! test
4995 External links: [raw ampersand]
4996 !! wikitext
4997 Old &amp; use: [http://x&y]
4998 !! html/php
4999 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5000 </p>
5001 !! html/parsoid
5002 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5003 !! end
5004
5005 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5006 # mode will return the [raw ampersand] wikitext
5007 !! test
5008 External links: [encoded ampersand]
5009 !! options
5010 parsoid=wt2html,wt2wt,html2html
5011 !! wikitext
5012 Old &amp; use: [http://x&amp;y]
5013 !! html/php
5014 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5015 </p>
5016 !! html/parsoid
5017 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5018 !! end
5019
5020 !! test
5021 External links: [raw equals]
5022 !! wikitext
5023 [http://example.com/?foo=bar]
5024 !! html/php
5025 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5026 </p>
5027 !! html/parsoid
5028 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5029 !! end
5030
5031 # note that parsoid html is identical to [raw equals] case; so html2wt
5032 # mode will return the [raw equals] wikitext
5033 !! test
5034 External links: [encoded equals] (T8102)
5035 !! options
5036 parsoid=wt2html,wt2wt,html2html
5037 !! wikitext
5038 [http://example.com/?foo&#61;bar]
5039 !! html/php
5040 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5041 </p>
5042 !! html/parsoid
5043 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5044 !! end
5045
5046 # xxx parsoid strips the IDN character, so the round-trip tests will
5047 # obviously fail and are disabled. --cscott
5048 !! test
5049 External links: [IDN ignored character reference in hostname; strip it right off]
5050 !! options
5051 parsoid=wt2html,wt2wt,html2html
5052 !! wikitext
5053 [http://e&zwnj;xample.com/]
5054 !! html/php
5055 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5056 </p>
5057 !! html/parsoid
5058 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5059 !! end
5060
5061 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5062 # Where an external link could easily circumvent the sanitization of the text of
5063 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5064 # test demands a higher standard. That's a bit strange.
5065 #
5066 # Example:
5067 #
5068 # http://e‌xample.com -> [http://example.com|http://example.com]
5069 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5070 #
5071 # The first example is sanitized, but the second is not. Any security benefits
5072 # from this production are trivial to circumvent. Either remove this test and
5073 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5074 # the test accordingly.
5075 #
5076 # All our love,
5077 # The Parsoid team.
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,html2html
5084 !! wikitext
5085 http://e&zwnj;xample.com/
5086 !! html/php
5087 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5091 !! end
5092
5093 !! test
5094 External links: www.jpeg.org (T2554)
5095 !! wikitext
5096 http://www.jpeg.org
5097 !! html
5098 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5099 </p>
5100 !! end
5101
5102 # parsoid doesn't explicitly mark autonumbered links, see T55505
5103 !! test
5104 External links: URL within URL (T2002)
5105 !! wikitext
5106 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5107 !! html/php
5108 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5109 </p>
5110 !! html/parsoid
5111 <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>
5112 !! end
5113
5114 !! test
5115 T2361: URL inside bracketed URL
5116 !! wikitext
5117 [http://www.example.com/foo http://www.example.com/bar]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 T2361: URL within URL, not bracketed
5125 !! wikitext
5126 http://www.example.com/foo?=http://www.example.com/bar
5127 !! html
5128 <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>
5129 </p>
5130 !! end
5131
5132 !! test
5133 T2289: ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<hello>
5136 !! html
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5138 </p>
5139 !!end
5140
5141 !! test
5142 T2289: literal ">"-token in URL-tail
5143 !! wikitext
5144 http://www.example.com/<b>html</b>
5145 !! html/php
5146 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5147 </p>
5148 !! html/parsoid
5149 <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>
5150 !! end
5151
5152 !! test
5153 T2289: ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<hello> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 T2289: literal ">"-token in bracketed URL
5163 !! wikitext
5164 [http://www.example.com/<b>html</b> stuff]
5165 !! html
5166 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5167 </p>
5168 !!end
5169
5170 !! test
5171 T2289: literal double quote at end of URL
5172 !! wikitext
5173 http://www.example.com/"hello"
5174 !! html
5175 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5176 </p>
5177 !!end
5178
5179 !! test
5180 T2289: literal double quote in bracketed URL
5181 !! wikitext
5182 [http://www.example.com/"hello" stuff]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5185 </p>
5186 !!end
5187
5188 !! test
5189 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5190 !! wikitext
5191 [http://www.example.com test]
5192 !! html
5193 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 External links: link text with spaces
5199 !! wikitext
5200 [http://www.example.com a b c]
5201 [http://www.example.com ''a'' ''b'']
5202 !! html
5203 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5204 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5205 </p>
5206 !! end
5207
5208 # Note edge case difference between PHP and Parsoid here.
5209 !! test
5210 External links: wiki links within external link (T5695)
5211 !! options
5212 parsoid=wt2html,html2html
5213 !! wikitext
5214 [http://example.com [[wikilink]] embedded in ext link]
5215
5216 [http://example.com test [[wikilink]] embedded in ext link]
5217 !! html/php
5218 <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>
5219 </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>
5220 </p>
5221 !! html/parsoid
5222 <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>
5223 <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>
5224 !! end
5225
5226 !! test
5227 T2787: Links with one slash after the url protocol are invalid
5228 !! wikitext
5229 http:/example.com
5230
5231 [http:/example.com title]
5232 !! html
5233 <p>http:/example.com
5234 </p><p>[http:/example.com title]
5235 </p>
5236 !! end
5237
5238 !! test
5239 Bracketed external links with template-generated invalid target
5240 !! wikitext
5241 [{{echo|http:/example.com}} title]
5242 !! html
5243 <p>[http:/example.com title]
5244 </p>
5245 !! end
5246
5247 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5248 !! test
5249 Broken wikilinks (but not external links) prevent templates from closing
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 [http://example.com x
5254
5255 {{echo|[http://example.com x}}
5256
5257 [[Foo
5258
5259 {{echo|[[Foo}}
5260 !! html/php
5261 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5262 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5263 </p><p>[[Foo
5264 </p><p>{{echo|[[Foo}}
5265 </p>
5266 !! html/parsoid
5267 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5268 <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>
5269 <p>[[Foo</p>
5270 <p>{{echo|[[Foo}}</p>
5271 !! end
5272
5273 !! test
5274 Wikilinks with embedded newlines are not broken
5275 !! wikitext
5276 {{echo|[[ Foo
5277 B
5278 C]]}}
5279 !! html/php
5280 <p>[[ Foo
5281 B
5282 C]]
5283 </p>
5284 !! html/parsoid
5285 <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>
5286 !! end
5287
5288 !! test
5289 Broken templates
5290 !! options
5291 parsoid=wt2html
5292 !! wikitext
5293 {{echo|[[Foo|}}]]
5294
5295 [[Foo|{{echo|]]}}
5296 !! html/php
5297 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5298 </p><p>[[Foo|]]
5299 </p>
5300 !! html/parsoid
5301 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5302 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5303 !! end
5304
5305 !! test
5306 T4702: Mismatched <i>, <b> and <a> tags are invalid
5307 !! wikitext
5308 ''[http://example.com text'']
5309 [http://example.com '''text]'''
5310 ''Something [http://example.com in italic'']
5311 ''Something [http://example.com mixed''''', even bold]'''
5312 '''''Now [http://example.com both''''']
5313 !! html
5314 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5315 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5316 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5317 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5318 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5319 </p>
5320 !! end
5321
5322
5323 !! test
5324 T6781: %26 in URL
5325 !! wikitext
5326 http://www.example.com/?title=AT%26T
5327 !! html/php
5328 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5329 </p>
5330 !! html/parsoid
5331 <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>
5332 !! end
5333
5334 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5335 # % is actually legal in HTML5. Any change in output would need testing though.
5336 !! test
5337 T6781, T7267: %25 in URL
5338 !! wikitext
5339 http://www.example.com/?title=100%25_Bran
5340 !! html/php
5341 <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>
5342 </p>
5343 !! html/parsoid
5344 <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>
5345 !! end
5346
5347 !! test
5348 T6781, T7267: %28, %29 in URL
5349 !! wikitext
5350 http://www.example.com/?title=Ben-Hur_%281959_film%29
5351 !! html/php
5352 <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>
5353 </p>
5354 !! html/parsoid
5355 <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>
5356 !! end
5357
5358
5359 !! test
5360 T6781: %26 in autonumber URL
5361 !! wikitext
5362 [http://www.example.com/?title=AT%26T]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5368 !! end
5369
5370 !! test
5371 T6781, T7267: %26 in autonumber URL
5372 !! wikitext
5373 [http://www.example.com/?title=100%25_Bran]
5374 !! html/php
5375 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5379 !! end
5380
5381 !! test
5382 T6781, T7267: %28, %29 in autonumber URL
5383 !! wikitext
5384 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5390 !! end
5391
5392
5393 !! test
5394 T6781: %26 in bracketed URL
5395 !! wikitext
5396 [http://www.example.com/?title=AT%26T link]
5397 !! html/php
5398 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5399 </p>
5400 !! html/parsoid
5401 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5402 !! end
5403
5404 !! test
5405 T6781, T7267: %25 in bracketed URL
5406 !! wikitext
5407 [http://www.example.com/?title=100%25_Bran link]
5408 !! html
5409 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5410 </p>
5411 !! end
5412
5413 !! test
5414 T6781, T7267: %28, %29 in bracketed URL
5415 !! wikitext
5416 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5422 !! end
5423
5424 !! test
5425 External link containing a period in the anchor. (T65947)
5426 !! wikitext
5427 [//foo.org/bar#baz. bang]
5428
5429 [//foo.org/bar. bang]
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5432 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5436 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5437 !! end
5438
5439 !! test
5440 External link containing a single quote. (T65947)
5441 !! wikitext
5442 [//foo.org/bar'baz]
5443
5444 [//foo.org/bar'baz bang]
5445 !! html/php
5446 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5447 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5451 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5452 !! end
5453
5454 !! test
5455 External link containing double-single-quotes in text '' (T6598 sanity check)
5456 !! wikitext
5457 Some [http://example.com/ pretty ''italics'' and stuff]!
5458 !! html
5459 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5460 </p>
5461 !! end
5462
5463 !! test
5464 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5465 !! wikitext
5466 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5467 !! html
5468 <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>
5469 </p>
5470 !! end
5471
5472 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5473 !! test
5474 External link containing double-single-quotes with no space separating the url from text in italics
5475 !! wikitext
5476 [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]].]
5477 !! html/php+tidy
5478 <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>.
5479 </p>
5480 !! html/parsoid
5481 <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>
5482 !! end
5483
5484 !! test
5485 External link with comments in link text
5486 !! wikitext
5487 [http://www.google.com Google <!-- comment -->]
5488 !! html/php
5489 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5493 !! end
5494
5495 !! test
5496 External link to bare IPv4 address
5497 !! wikitext
5498 [http://192.168.0.1 Link]
5499 !! html/php
5500 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5504 !! end
5505
5506 !! test
5507 URL-encoding in URL functions (single parameter)
5508 !! wikitext
5509 {{localurl:Some page|amp=&}}
5510 !! html
5511 <p>/index.php?title=Some_page&amp;amp=&amp;
5512 </p>
5513 !! end
5514
5515 !! test
5516 URL-encoding in URL functions (multiple parameters)
5517 !! wikitext
5518 {{localurl:Some page|q=?&amp=&}}
5519 !! html
5520 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5521 </p>
5522 !! end
5523
5524 !! test
5525 Brackets in urls
5526 !! wikitext
5527 http://example.com/index.php?foozoid%5B%5D=bar
5528
5529 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5530 !! html/php
5531 <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>
5532 </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>
5533 </p>
5534 !! html/parsoid
5535 <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>
5536
5537 <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>
5538 !! end
5539
5540 !! test
5541 IPv6 urls, autolink format (T23261)
5542 !! wikitext
5543 http://[2404:130:0:1000::187:2]/index.php
5544
5545 Examples from RFC 2373, section 2.2:
5546 *http://[1080::8:800:200C:417A]/unicast
5547 *http://[FF01::101]/multicast
5548 *http://[::1]/loopback
5549 *http://[::]/unspecified
5550 *http://[::13.1.68.3]/ipv4compat
5551 *http://[::FFFF:129.144.52.38]/ipv4compat
5552
5553 Examples from RFC 2732, section 2:
5554 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5555 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5556 *http://[3ffe:2a00:100:7031::1]
5557 *http://[1080::8:800:200C:417A]/foo
5558 *http://[::192.9.5.5]/ipng
5559 *http://[::FFFF:129.144.52.38]:80/index.html
5560 *http://[2010:836B:4179::836B:4179]
5561
5562 !! html/php
5563 <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>
5564 </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:
5565 </p>
5566 <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>
5567 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5568 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5569 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5570 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5571 <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>
5572 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5573 </p>
5574 <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>
5575 <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>
5576 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5577 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5578 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5579 <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>
5580 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5581
5582 !! html/parsoid
5583 <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>
5584
5585 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5586 <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>
5587 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5588 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5589 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5590 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5591 <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>
5592
5593 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5594 <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>
5595 <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>
5596 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5597 <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>
5598 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5599 <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>
5600 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5601 !! end
5602
5603 !! test
5604 IPv6 urls, bracketed format (T23261)
5605 !! wikitext
5606 [http://[2404:130:0:1000::187:2]/index.php test]
5607
5608 Examples from RFC 2373, section 2.2:
5609 *[http://[1080::8:800:200C:417A] unicast]
5610 *[http://[FF01::101] multicast]
5611 *[http://[::1]/ loopback]
5612 *[http://[::] unspecified]
5613 *[http://[::13.1.68.3] ipv4compat]
5614 *[http://[::FFFF:129.144.52.38] ipv4compat]
5615
5616 Examples from RFC 2732, section 2:
5617 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5618 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5619 *[http://[3ffe:2a00:100:7031::1] 3]
5620 *[http://[1080::8:800:200C:417A]/foo 4]
5621 *[http://[::192.9.5.5]/ipng 5]
5622 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5623 *[http://[2010:836B:4179::836B:4179] 7]
5624
5625 !! html/php
5626 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5627 </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:
5628 </p>
5629 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5630 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5631 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5632 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5633 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5634 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5635 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5636 </p>
5637 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5638 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5639 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5640 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5641 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5642 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5643 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5644
5645 !! html/parsoid
5646 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5647
5648 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5649 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5650 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5651 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5652 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5653 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5654 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5655
5656 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5657 <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>
5658 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5659 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5660 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5661 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5662 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5663 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5664 !! end
5665
5666 !! test
5667 Non-extlinks in brackets
5668 !! wikitext
5669 [foo]
5670 [foo bar]
5671 [foo ''bar'']
5672 [fool's] errand
5673 [fool's errand]
5674 [{{echo|foo}}]
5675 [{{echo|foo}} bar]
5676 [{{echo|foo}} ''bar'']
5677 [{{echo|foo}}l's] errand
5678 [{{echo|foo}}l's errand]
5679 [url={{echo|foo}}]
5680 [url=http://example.com]
5681 [http:// bare protocols don't count]
5682 !! html/php
5683 <p>[foo]
5684 [foo bar]
5685 [foo <i>bar</i>]
5686 [fool's] errand
5687 [fool's errand]
5688 [foo]
5689 [foo bar]
5690 [foo <i>bar</i>]
5691 [fool's] errand
5692 [fool's errand]
5693 [url=foo]
5694 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5695 [http:// bare protocols don't count]
5696 </p>
5697 !! html/parsoid
5698 <p>[foo]
5699 [foo bar]
5700 [foo <i>bar</i>]
5701 [fool's] errand
5702 [fool's errand]
5703 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5704 [<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]
5705 [<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>]
5706 [<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
5707 [<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]
5708 [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>]
5709 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5710 [http:// bare protocols don't count]</p>
5711 !! end
5712
5713 !! test
5714 Percent encoding in external links
5715 !! wikitext
5716 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5717 !! html/php
5718 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5719 </p>
5720 !! html/parsoid
5721 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5722 !! end
5723
5724 !! test
5725 Use url link syntax for links where the content is equal the link target
5726 !! wikitext
5727 http://example.com
5728 !! html/php
5729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5733 !! end
5734
5735 !! test
5736 Parenthesis in external links, especially URL links
5737 !! wikitext
5738 http://example.com)
5739
5740 http://example.com/test)
5741
5742 http://example.com/(test)
5743
5744 http://example.com/((test)
5745
5746 (http://example.com/(test))
5747
5748 (http://example.com/(test)))))
5749
5750 http://example.com/a)b
5751
5752 [http://example.com) foo]
5753 !! html/php
5754 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5755 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5756 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5757 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5758 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5759 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5760 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5761 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5762 </p>
5763 !! html/parsoid
5764 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5765 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5766 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5767 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5768 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5769 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5770 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5771 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5772 !! end
5773
5774 !! test
5775 Parenthesis in external links, w/ transclusion or comment
5776 !! wikitext
5777 (http://example.com/{{echo|hi}})
5778
5779 (http://example.com<!-- hi -->)
5780 !! html/php
5781 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5782 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5783 </p>
5784 !! html/parsoid
5785 <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>
5786
5787 <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>
5788 !! end
5789
5790 !! test
5791 Serialize <a> tags with invalid link targets as plain text
5792 !! options
5793 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5794 !! html/parsoid
5795 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5796 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5797 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5798 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5799 !! wikitext
5800 text
5801 <nowiki>*</nowiki>text
5802 <nowiki>[[foo]]</nowiki>
5803 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5804 !! end
5805
5806 !! test
5807 mw:ExtLink -vs- mw:WikiLink (T94723)
5808 !! options
5809 parsoid=html2wt
5810 !! html/parsoid
5811 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5812 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5813 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5814 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5815 <p>
5816 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5817 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5818 </p>
5819 !! wikitext
5820 [[Foo|Bar]]
5821 [[Foo|Bar]]
5822 [[:en:Foo|Bar]]
5823 [[:en:Foo|Bar]]
5824
5825 [[:en:European_Robin|European Robin]]
5826 [[:en:European_Robin|European Robin]]
5827 !! end
5828
5829 !! test
5830 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5831 !! options
5832 parsoid=wt2wt
5833 !! wikitext
5834 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5835 !! html/parsoid
5836 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5837 !! end
5838
5839
5840 ###
5841 ### Quotes
5842 ###
5843
5844 !! test
5845 Quotes
5846 !! wikitext
5847 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5848
5849 Normal text. '''''Bold italic text.''''' Normal text.
5850 !! html
5851 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5852 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5853 </p>
5854 !! end
5855
5856
5857 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5858 # parser strips. The wikitext contains just the first half of the bold
5859 # quote pair.
5860 !! test
5861 Unclosed and unmatched quotes
5862 !! wikitext
5863 '''''Bold italic text '''with bold deactivated''' in between.'''''
5864
5865 '''''Bold italic text ''with italic deactivated'' in between.'''''
5866
5867 '''Bold text..
5868
5869 ..spanning two paragraphs (should not work).'''
5870
5871 '''Bold tag left open
5872
5873 ''Italic tag left open
5874
5875 Normal text.
5876
5877 <!-- Unmatching number of opening, closing tags: -->
5878 '''This year''''s election ''should'' beat '''last year''''s.
5879
5880 ''Tom'''s car is bigger than ''Susan'''s.
5881
5882 Plain ''italic'''s plain
5883 !! html/php
5884 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5885 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5886 </p><p><b>Bold text..</b>
5887 </p><p>..spanning two paragraphs (should not work).
5888 </p><p><b>Bold tag left open</b>
5889 </p><p><i>Italic tag left open</i>
5890 </p><p>Normal text.
5891 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5892 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5893 </p><p>Plain <i>italic'</i>s plain
5894 </p>
5895 !! html/parsoid
5896 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5897 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5898 </p><p><b>Bold text..</b>
5899 </p><p>..spanning two paragraphs (should not work).<b></b>
5900 </p><p><b>Bold tag left open</b>
5901 </p><p><i>Italic tag left open</i>
5902 </p><p>Normal text.
5903 </p>
5904 <!-- Unmatching number of opening, closing tags: -->
5905 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5906 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5907 </p><p>Plain <i>italic'</i>s plain
5908 </p>
5909 !! end
5910
5911 ###
5912 ### Tables
5913 ###
5914 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5915 ###
5916
5917 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5918 # is the bare minimum required by the spec, see:
5919 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5920 # Parsoid team replies: empty table tags are legal in HTML5
5921 !! test
5922 A table with no data.
5923 !! options
5924 parsoid=wt2html
5925 !! wikitext
5926 {||}
5927 !! html/php
5928
5929 !! html/parsoid
5930 <table></table>
5931
5932 !! end
5933
5934 !! test
5935 A table with stray table end tags on start tag line (wt2html)
5936 !! options
5937 parsoid=wt2html
5938 !! wikitext
5939 {|style="color: red;"|}
5940
5941 {|style="color: red;" |}
5942 |foo
5943 |}
5944
5945 {|style="color: red;"|} id="foo"
5946 |foo
5947 |}
5948
5949 {|style="color: red;" |} id="foo"
5950 |foo
5951 |}
5952 !! html
5953 <table style="color: red;"></table>
5954
5955 <table style="color: red;">
5956 <tbody><tr>
5957 <td>foo</td>
5958 </tr></tbody>
5959 </table>
5960
5961 <table style="color: red;" id="foo">
5962 <tbody><tr>
5963 <td>foo</td>
5964 </tr></tbody>
5965 </table>
5966
5967 <table style="color: red;" id="foo">
5968 <tbody><tr>
5969 <td>foo</td>
5970 </tr></tbody>
5971 </table>
5972
5973 !! end
5974
5975 !! test
5976 A table with no data (take 2)
5977 !! wikitext
5978 {|
5979 |}
5980 !! html/parsoid
5981 <table></table>
5982 !! end
5983
5984 # A table with nothing but a caption is invalid XHTML, we might want to render
5985 # this as <p>caption</p>
5986 # Parsoid team replies: table with only a caption is legal in HTML5
5987 !! test
5988 A table with nothing but a caption
5989 !! wikitext
5990 {|
5991 |+caption
5992 |}
5993 !! html/php
5994 <table>
5995 <caption>caption
5996 </caption><tr><td></td></tr></table>
5997
5998 !! html/parsoid
5999 <table><caption>caption</caption></table>
6000 !! end
6001
6002 !! test
6003 A table with caption with default-spaced attributes and a table row
6004 !! wikitext
6005 {|
6006 |+ style="color: red;" | caption1
6007 |-
6008 |foo
6009 |}
6010 !! html
6011 <table>
6012 <caption style="color: red;">caption1
6013 </caption>
6014 <tr>
6015 <td>foo
6016 </td></tr></table>
6017
6018 !! end
6019
6020 !! test
6021 A table with captions with non-default spaced attributes and a table row
6022 !! wikitext
6023 {|
6024 |+style="color: red;"|caption2
6025 |+ style="color: red;"|caption3
6026 |-
6027 |foo
6028 |}
6029 !! html
6030 <table>
6031 <caption style="color: red;">caption2
6032 </caption>
6033 <caption style="color: red;">caption3
6034 </caption>
6035 <tr>
6036 <td>foo
6037 </td></tr></table>
6038
6039 !! end
6040
6041 !! test
6042 Table td-cell syntax variations
6043 !! wikitext
6044 {|
6045 |foo bar foo|baz
6046 |foo bar foo||baz
6047 |style='color:red;'|baz
6048 |style='color:red;'||baz
6049 |}
6050 !! html
6051 <table>
6052 <tr>
6053 <td>baz
6054 </td>
6055 <td>foo bar foo</td>
6056 <td>baz
6057 </td>
6058 <td style="color:red;">baz
6059 </td>
6060 <td>style='color:red;'</td>
6061 <td>baz
6062 </td></tr></table>
6063
6064 !! end
6065
6066 !! test
6067 Simple table
6068 !! wikitext
6069 {|
6070 |1||2
6071 |-
6072 |3||4
6073 |}
6074 !! html
6075 <table>
6076 <tr>
6077 <td>1</td>
6078 <td>2
6079 </td></tr>
6080 <tr>
6081 <td>3</td>
6082 <td>4
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 Simple table but with multiple dashes for row wikitext
6089 !! wikitext
6090 {|
6091 |foo
6092 |-----
6093 |bar
6094 |}
6095 !! html
6096 <table>
6097 <tr>
6098 <td>foo
6099 </td></tr>
6100 <tr>
6101 <td>bar
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !! test
6107 Multiplication table
6108 !! wikitext
6109 {| border="1" cellpadding="2"
6110 |+Multiplication table
6111 |-
6112 !&times;!!1!!2!!3
6113 |-
6114 !1
6115 |1||2||3
6116 |-
6117 !2
6118 |2||4||6
6119 |-
6120 !3
6121 |3||6||9
6122 |-
6123 !4
6124 |4||8||12
6125 |-
6126 !5
6127 |5||10||15
6128 |}
6129 !! html
6130 <table border="1" cellpadding="2">
6131 <caption>Multiplication table
6132 </caption>
6133 <tr>
6134 <th>&#215;</th>
6135 <th>1</th>
6136 <th>2</th>
6137 <th>3
6138 </th></tr>
6139 <tr>
6140 <th>1
6141 </th>
6142 <td>1</td>
6143 <td>2</td>
6144 <td>3
6145 </td></tr>
6146 <tr>
6147 <th>2
6148 </th>
6149 <td>2</td>
6150 <td>4</td>
6151 <td>6
6152 </td></tr>
6153 <tr>
6154 <th>3
6155 </th>
6156 <td>3</td>
6157 <td>6</td>
6158 <td>9
6159 </td></tr>
6160 <tr>
6161 <th>4
6162 </th>
6163 <td>4</td>
6164 <td>8</td>
6165 <td>12
6166 </td></tr>
6167 <tr>
6168 <th>5
6169 </th>
6170 <td>5</td>
6171 <td>10</td>
6172 <td>15
6173 </td></tr></table>
6174
6175 !! end
6176
6177 !! test
6178 Accept "||" in table headings
6179 !! wikitext
6180 {|
6181 !h1||h2
6182 |}
6183 !! html
6184 <table>
6185 <tr>
6186 <th>h1</th>
6187 <th>h2
6188 </th></tr></table>
6189
6190 !! end
6191
6192 !! test
6193 Accept "!!" in table data
6194 !! wikitext
6195 {|
6196 |Foo!!||
6197 |}
6198 !! html
6199 <table>
6200 <tr>
6201 <td>Foo!!</td>
6202 <td>
6203 </td></tr></table>
6204
6205 !! html/parsoid
6206 <table>
6207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6208 </tbody></table>
6209 !! end
6210
6211 !! test
6212 Accept "||" in indented table headings
6213 !! wikitext
6214 :{|
6215 !h1||h2
6216 |}
6217 !! html
6218 <dl><dd><table>
6219 <tr>
6220 <th>h1</th>
6221 <th>h2
6222 </th></tr></table></dd></dl>
6223
6224 !! end
6225
6226 !! test
6227 Accept "!!" in templates
6228 !! wikitext
6229 {|
6230 !a {{echo|b!!c}}
6231 |}
6232 !! html/php
6233 <table>
6234 <tr>
6235 <th>a b</th>
6236 <th>c
6237 </th></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <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>
6242 !! end
6243
6244 !! test
6245 Accept "!!" in table headings after newline
6246 !! wikitext
6247 {|
6248 !a
6249 b!!c
6250 |}
6251 !! html/php
6252 <table>
6253 <tr>
6254 <th>a
6255 <p>b!!c
6256 </p>
6257 </th></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><th>a
6262 <p>b!!c</p></th></tr>
6263 </tbody></table>
6264 !! end
6265
6266 !! test
6267 Accept "!!" in table data of mixed wikitext / html syntax
6268 !! wikitext
6269 {|
6270 !a
6271 <tr><td>b!!c</td></tr>
6272 |}
6273 !! html/php+tidy
6274 <table>
6275 <tbody><tr>
6276 <th>a
6277 </th></tr><tr><td>b!!c</td></tr>
6278 </tbody></table>
6279 !! html/parsoid
6280 <table>
6281 <tbody><tr><th>a</th></tr>
6282 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6283 </tbody></table>
6284 !! end
6285
6286 !! test
6287 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6288 !! wikitext
6289 {|
6290 !| h1
6291 || a
6292 |}
6293 !! html
6294 <table>
6295 <tr>
6296 <th>h1
6297 </th>
6298 <td>a
6299 </td></tr></table>
6300
6301 !! end
6302
6303 !!test
6304 Accept "| !" at start of line in tables (ignore !-attribute)
6305 !! wikitext
6306 {|
6307 |-
6308 |!style="color:red"|bar
6309 |}
6310 !! html
6311 <table>
6312
6313 <tr>
6314 <td>bar
6315 </td></tr></table>
6316
6317 !!end
6318
6319 !!test
6320 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 +/-
6321 !! wikitext
6322 {|
6323 |-
6324 |style='color:red;'|+1
6325 |style='color:blue;'|-1
6326 |-
6327 |1||2||3
6328 |1||+2||-3
6329 |-
6330 | +1
6331 | -1
6332 |}
6333 !! html
6334 <table>
6335
6336 <tr>
6337 <td style="color:red;">+1
6338 </td>
6339 <td style="color:blue;">-1
6340 </td></tr>
6341 <tr>
6342 <td>1</td>
6343 <td>2</td>
6344 <td>3
6345 </td>
6346 <td>1</td>
6347 <td>+2</td>
6348 <td>-3
6349 </td></tr>
6350 <tr>
6351 <td>+1
6352 </td>
6353 <td>-1
6354 </td></tr></table>
6355
6356 !!end
6357
6358 !! test
6359 Table rowspan
6360 !! wikitext
6361 {| border=1
6362 |Cell 1, row 1
6363 |rowspan=2|Cell 2, row 1 (and 2)
6364 |Cell 3, row 1
6365 |-
6366 |Cell 1, row 2
6367 |Cell 3, row 2
6368 |}
6369 !! html
6370 <table border="1">
6371 <tr>
6372 <td>Cell 1, row 1
6373 </td>
6374 <td rowspan="2">Cell 2, row 1 (and 2)
6375 </td>
6376 <td>Cell 3, row 1
6377 </td></tr>
6378 <tr>
6379 <td>Cell 1, row 2
6380 </td>
6381 <td>Cell 3, row 2
6382 </td></tr></table>
6383
6384 !! end
6385
6386 !! test
6387 Nested table
6388 !! wikitext
6389 {| border=1
6390 | &alpha;
6391 |
6392 {| bgcolor=#ABCDEF border=2
6393 |nested
6394 |-
6395 |table
6396 |}
6397 |the original table again
6398 |}
6399 !! html
6400 <table border="1">
6401 <tr>
6402 <td>&#945;
6403 </td>
6404 <td>
6405 <table bgcolor="#ABCDEF" border="2">
6406 <tr>
6407 <td>nested
6408 </td></tr>
6409 <tr>
6410 <td>table
6411 </td></tr></table>
6412 </td>
6413 <td>the original table again
6414 </td></tr></table>
6415
6416 !! end
6417
6418 !! test
6419 Invalid attributes in table cell (T3830)
6420 !! wikitext
6421 {|
6422 |Cell:|broken
6423 |}
6424 !! html
6425 <table>
6426 <tr>
6427 <td>broken
6428 </td></tr></table>
6429
6430 !! end
6431
6432 !! test
6433 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6434 !! wikitext
6435 {|
6436 | title="foo" |bar
6437 | title="foo<nowiki>|</nowiki>" |bar
6438 | title="foo<nowiki>|</nowiki>" bar
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td title="foo">bar
6444 </td>
6445 <td title="foo&#124;">bar
6446 </td>
6447 <td>title="foo|" bar
6448 </td></tr></table>
6449
6450 !! html/parsoid
6451 <table>
6452 <tbody><tr><td title="foo">bar</td>
6453 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6454 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6455 </tbody></table>
6456 !! end
6457
6458 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6459 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6460 # *2wt modes will fail.
6461 !! test
6462 Table security: embedded pipes
6463 !! options
6464 parsoid=wt2html,html2html
6465 !! wikitext
6466 {|
6467 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6468 !! html/php
6469 <table>
6470 <tr>
6471 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6472 <td>]" onmouseover="alert(document.cookie)"&gt;test
6473 </td>
6474 </tr>
6475 </table>
6476
6477 !! html/parsoid
6478 <table><tbody>
6479 <tr>
6480 <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>
6481 !! end
6482
6483 !! test
6484 Element attributes with double ! should not be broken up by <th>
6485 !! wikitext
6486 {|
6487 !hi <div class="!!">ha</div> ho
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th>hi <div class="!!">ha</div> ho
6493 </th></tr></table>
6494
6495 !! html/parsoid
6496 <table>
6497 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 ! and || in element attributes should not be parsed as <th>/<td>
6503 !! wikitext
6504 {|
6505 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6506 |}
6507 !! html/php
6508 <table>
6509 <tr>
6510 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6516 </tbody></table>
6517 !! end
6518
6519 # FIXME: The output seems broken. Filed as T110268.
6520 !! test
6521 ! and || in td attributes should not be parsed as <th>/<td>
6522 !! options
6523 parsoid=wt2html
6524 !! wikitext
6525 {|
6526 |style="color: red !important;" data-contrived="put this here ||"|foo
6527 |}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <td>style="color: red !important;" data-contrived="put this here</td>
6532 <td>foo
6533 </td></tr></table>
6534
6535 !! html/parsoid
6536 <table>
6537 <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>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Break on | in element attribute in template
6543 !! options
6544 parsoid=wt2html,html2html
6545 !! wikitext
6546 {{echo|1=<div class="hi|ho">ha</div>}}
6547 !! html/php
6548 <p>ho"&gt;ha&lt;/div&gt;
6549 </p>
6550 !! html/parsoid
6551 <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>
6552 !! end
6553
6554 !! test
6555 Break on | in element attribute name in template
6556 !! wikitext
6557 {{echo|<div cla|ss="hiho">ha</div>}}
6558 !! html/parsoid
6559 <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>
6560 !! end
6561
6562 !! test
6563 Don't break on | in extension attribute in template
6564 !! wikitext
6565 {{echo|<ref name="hi|ho">ha</ref>}}
6566
6567 <references />
6568 !! html/parsoid
6569 <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>
6570
6571 <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>
6572 !! end
6573
6574 ## We don't support roundtripping of these attributes in Parsoid.
6575 ## Selective serialization takes care of preventing dirty diffs.
6576 ## But, on edits, we dirty-diff the invalid attribute text.
6577 !! test
6578 Invalid text in table attributes should be discarded
6579 !! options
6580 parsoid=wt2html
6581 !! wikitext
6582 {| <span>boo</span> style='border:1px solid black'
6583 | <span>boo</span> style='color:blue' |1
6584 |<span>boo</span> style='color:blue'|2
6585 |}
6586 !! html/php
6587 <table style="border:1px solid black">
6588 <tr>
6589 <td style="color:blue">1
6590 </td>
6591 <td style="color:blue">2
6592 </td></tr></table>
6593
6594 !! html/parsoid
6595 <table style="border:1px solid black">
6596 <tr>
6597 <td style="color:blue">1</td>
6598 <td style="color:blue">2</td>
6599 </tr>
6600 </table>
6601 !! end
6602
6603 !! test
6604 Invalid text in table attributes should be preserved by selective serializer
6605 !! options
6606 parsoid={
6607 "modes": ["selser"],
6608 "changes": [
6609 ["td:first-child", "text", "abc"],
6610 ["td + td", "text", "xyz"]
6611 ]
6612 }
6613 !! wikitext
6614 {| <span>boo</span> style='border:1px solid black'
6615 | <span>boo</span> style='color:blue' | 1
6616 |<span>boo</span> style='color:blue'| 2
6617 |}
6618 !! wikitext/edited
6619 {| <span>boo</span> style='border:1px solid black'
6620 | <span>boo</span> style='color:blue' |abc
6621 |<span>boo</span> style='color:blue'|xyz
6622 |}
6623 !! end
6624
6625 !! test
6626 1. Template-generated table cell attributes and cell content
6627 !! wikitext
6628 {|
6629 |{{table_attribs}}
6630 | {{table_attribs}}
6631 || {{table_attribs_5}}
6632 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6633 |align=center {{table_attribs}}
6634 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6635 |}
6636 !! html
6637 <table>
6638 <tr>
6639 <td style="color:red;">Foo
6640 </td>
6641 <td style="color:red;">Foo
6642 </td>
6643 <td>style="color:red;"</td>
6644 <td>Bar
6645 </td>
6646 <td style="color:red;">Foo
6647 </td>
6648 <td align="center" style="color:red;">Foo
6649 </td>
6650 <td align="center" style="color:red;">Foo
6651 </td></tr></table>
6652
6653 !! end
6654
6655 !! test
6656 2. Template-generated table cell attributes and cell content
6657 !! wikitext
6658 {|
6659 |{{table_attribs_2}}
6660 |}
6661 !! html/php
6662 <table>
6663 <tr>
6664 <td style="color:red;">Foo
6665 </td>
6666 <td>Bar</td>
6667 <td>Baz
6668 </td></tr></table>
6669
6670 !! html/parsoid
6671 <table>
6672 <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>
6673 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6674 </tbody></table>
6675 !! end
6676
6677 !! test
6678 3. Template-generated table cell attributes and cell content
6679 !! wikitext
6680 {|
6681 !align=center {{table_header_cells}}
6682 |-
6683 |align=center {{table_cells}}
6684 |}
6685 !! html/php
6686 <table>
6687 <tr>
6688 <th align="center" style="color:red;">Foo</th>
6689 <th style="color:red;"><i>Bar</i></th>
6690 <th style="color:brown;"><i>Foo</i> and Baz
6691 </th></tr>
6692 <tr>
6693 <td align="center" style="color:red;">Foo</td>
6694 <td style="color:red;"><i>Bar</i></td>
6695 <td style="color:brown;"><i>Foo</i> and Baz
6696 </td></tr></table>
6697
6698 !! html/parsoid
6699 <table>
6700 <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>
6701 <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>
6702 </tbody></table>
6703 !! end
6704
6705 !! test
6706 4. Template-generated table cell attributes and cell content inside a templated table
6707 !! wikitext
6708 {{tbl-start}}
6709 !align=center {{table_header_cells}}
6710 |-
6711 |align=center {{table_cells}}
6712 {{tbl-end}}
6713 !! html/php
6714 <table>
6715 <tr>
6716 <th align="center" style="color:red;">Foo</th>
6717 <th style="color:red;"><i>Bar</i></th>
6718 <th style="color:brown;"><i>Foo</i> and Baz
6719 </th></tr>
6720 <tr>
6721 <td align="center" style="color:red;">Foo</td>
6722 <td style="color:red;"><i>Bar</i></td>
6723 <td style="color:brown;"><i>Foo</i> and Baz
6724 </td></tr></table>
6725
6726 !! html/parsoid
6727 <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}}]}'>
6728 <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>
6729 <tr>
6730 <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>
6731 </tbody></table>
6732 !! end
6733
6734 ## Edge case fix to prevent future regressions
6735 !! test
6736 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6737 !! wikitext
6738 {|
6739 |{{table_attribs_7}}
6740 |}
6741 <references />
6742 !! html/parsoid
6743 <table>
6744 <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>
6745 </tbody></table>
6746 <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>
6747 !! end
6748
6749 !! test
6750 Table with row followed by newlines and table heading
6751 !! options
6752 parsoid=wt2html,html2html
6753 !! wikitext
6754 {|
6755 |-
6756
6757 !foo
6758 |}
6759 !! html/*
6760 <table>
6761
6762
6763 <tr>
6764 <th>foo
6765 </th></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Table with empty line following the start tag
6771 !! options
6772 parsoid=wt2html,html2html
6773 !! wikitext
6774 {|
6775
6776 |-
6777 |foo
6778 |}
6779 !! html/*
6780 <table>
6781
6782
6783 <tr>
6784 <td>foo
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table attributes with empty value
6791 !! options
6792 parsoid=wt2html,html2html
6793 !! wikitext
6794 {|
6795 | style=|hello
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td style="">hello
6801 </td></tr></table>
6802
6803 !! html/parsoid
6804 <table>
6805 <tbody><tr><td style="">hello</td></tr>
6806 </tbody></table>
6807 !! end
6808
6809 !! test
6810 Wikitext table with a lot of comments
6811 !! wikitext
6812 {|
6813 <!-- c0 -->
6814 |foo
6815 <!-- c1 -->
6816 |-<!-- c2 -->
6817 <!-- c3 -->
6818 |<!-- c4 -->
6819 <!-- c5 -->
6820 |}
6821 !! html
6822 <table>
6823 <tr>
6824 <td>foo
6825 </td></tr>
6826 <tr>
6827 <td>
6828 </td></tr></table>
6829
6830 !! end
6831
6832 !! test
6833 Wikitext table comments represented in parsoid dom
6834 !! wikitext
6835 {|<!--c1--><!--c2-->
6836 |-<!--c3-->
6837 |x
6838 |}
6839 !! html/php+tidy
6840 <table>
6841
6842 <tbody><tr>
6843 <td>x
6844 </td></tr></tbody></table>
6845 !! html/parsoid
6846 <table><!--c1--><!--c2-->
6847 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6848 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
6849 </tbody></table>
6850 !! end
6851
6852 !! test
6853 Wikitext table with double-line table cell
6854 !! wikitext
6855 {|
6856 |a
6857 b
6858 |}
6859 !! html
6860 <table>
6861 <tr>
6862 <td>a
6863 <p>b
6864 </p>
6865 </td></tr></table>
6866
6867 !! end
6868
6869 !! test
6870 Table cell with a single comment
6871 !! wikitext
6872 {|
6873 | <!-- c1 -->
6874 |a
6875 |}
6876 !! html
6877 <table>
6878 <tr>
6879 <td>
6880 </td>
6881 <td>a
6882 </td></tr></table>
6883
6884 !! end
6885
6886 !! test
6887 Table-cell after a comment-only-empty-line
6888 !! wikitext
6889 {|
6890 |a
6891 <!--c1-->
6892 <!--c2-->|b
6893 |}
6894 !! html
6895 <table>
6896 <tr>
6897 <td>a
6898 </td>
6899 <td>b
6900 </td></tr></table>
6901
6902 !! html/parsoid
6903 <table>
6904 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6905 <!--c1-->
6906 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
6907 </tbody></table>
6908
6909 !! end
6910
6911 !! test
6912 Build table with {{!}}
6913 !! wikitext
6914 {{{!}} class="wikitable"
6915 !header
6916 !second header
6917 {{!}}- style="color:red;"
6918 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
6919 {{!}}}
6920 !! html
6921 <table class="wikitable">
6922 <tr>
6923 <th>header
6924 </th>
6925 <th>second header
6926 </th></tr>
6927 <tr style="color:red;">
6928 <td>data</td>
6929 <td style="color:red;">second data
6930 </td></tr></table>
6931
6932 !! end
6933
6934 !! test
6935 Build table with pipe as data
6936 !! wikitext
6937 {| class="wikitable"
6938 !header
6939 !second header
6940 |- style="color:red;"
6941 |data|| style="color:red;" |second data
6942 |-
6943 | style="color:red;" |data with | || style="color:red;" | second data with |
6944 |-
6945 ||data with | |||second data with |
6946 |}
6947 !! html
6948 <table class="wikitable">
6949 <tr>
6950 <th>header
6951 </th>
6952 <th>second header
6953 </th></tr>
6954 <tr style="color:red;">
6955 <td>data</td>
6956 <td style="color:red;">second data
6957 </td></tr>
6958 <tr>
6959 <td style="color:red;">data with |</td>
6960 <td style="color:red;">second data with |
6961 </td></tr>
6962 <tr>
6963 <td>data with |</td>
6964 <td>second data with |
6965 </td></tr></table>
6966
6967 !! end
6968
6969 !! test
6970 Build table with wikilink
6971 !! wikitext
6972 {| class="wikitable"
6973 !header||second header
6974 |- style="color:red;"
6975 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
6976 |-
6977 |data||second data [[Main Page|link|text with pipe]]
6978 |}
6979 !! html
6980 <table class="wikitable">
6981 <tr>
6982 <th>header</th>
6983 <th>second header
6984 </th></tr>
6985 <tr style="color:red;">
6986 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
6987 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6988 </td></tr>
6989 <tr>
6990 <td>data</td>
6991 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6992 </td></tr></table>
6993
6994 !! end
6995
6996 # The expected HTML structure in this test is debatable. The PHP parser does
6997 # not parse this kind of table at all. The main focus for Parsoid is on
6998 # round-tripping, so this output is ok for now. TODO: revisit!
6999 !! test
7000 Wikitext table with html-syntax row
7001 !! wikitext
7002 {|
7003 |-
7004 <td>foo</td>
7005 |}
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr>
7010 <td>foo</td></tr></tbody></table>
7011 !! end
7012
7013 !! test
7014 Fostered content in tables: Plain text
7015 !! options
7016 parsoid=wt2html,html2html
7017 !! wikitext
7018 {|
7019 |-
7020 a
7021 |}
7022 !! html/php
7023 <table>
7024
7025 a
7026 </table>
7027
7028 !! html/php+tidy
7029
7030
7031 a
7032 <table></table>
7033 !! html/parsoid
7034 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7035 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7036
7037 </tr></tbody></table>
7038 !! end
7039
7040 !! test
7041 Fostered content in tables: Lists
7042 !! options
7043 parsoid=wt2html,html2html
7044 !! wikitext
7045 {|
7046 |-
7047 *a
7048 |}
7049 !! html/php
7050 <table>
7051
7052 <ul><li>a</li></ul>
7053 </table>
7054
7055 !! html/php+tidy
7056 <ul><li>a</li></ul><table>
7057
7058
7059 </table>
7060 !! html/parsoid
7061 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7062 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7063
7064 </tr></tbody></table>
7065 !! end
7066
7067 !! test
7068 Template generated table cell with attributes
7069 !! wikitext
7070 {|
7071 |-
7072 {{table_attribs_4}} ||a||b
7073 |}
7074 !! html/php+tidy
7075 <table>
7076
7077 <tbody><tr>
7078 <td style="background-color:#DC241f;" width="10px"></td>
7079 <td>a</td>
7080 <td>b
7081 </td></tr></tbody></table>
7082 !! html/parsoid
7083 <table>
7084 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7085 <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>
7086 !! end
7087
7088 !! test
7089 Parsoid: Round-trip tables directly followed by content (T53219)
7090 !! options
7091 parsoid=wt2html,wt2wt
7092 !! wikitext
7093 {|
7094 |foo
7095 |} bar
7096
7097 {|
7098 |baz
7099 |}<b>quux</b>
7100 !! html+tidy
7101 <table>
7102 <tbody><tr>
7103 <td>foo
7104 </td></tr></tbody></table><p> bar
7105 </p><table>
7106 <tbody><tr>
7107 <td>baz
7108 </td></tr></tbody></table><p><b>quux</b>
7109 </p>
7110 !! end
7111
7112 !! test
7113 Parsoid: Default to a newline after tables in new content (T53219)
7114 !! options
7115 parsoid=html2wt
7116 !! html/parsoid
7117 <table><tbody>
7118 <tr><td>foo</td></tr></tbody></table> bar
7119 <table><tbody>
7120 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7121 !! wikitext
7122 {|
7123 |foo
7124 |}
7125 <nowiki> </nowiki>bar
7126 {|
7127 |baz
7128 |}
7129 '''quux'''
7130 !! end
7131
7132 !! test
7133 Parsoid: newline inducing block nodes don't suppress <nowiki>
7134 !! options
7135 parsoid=html2wt
7136 !! html/parsoid
7137 a<h1>foo</h1>
7138 !! wikitext
7139 <nowiki> </nowiki>a
7140
7141 = foo =
7142 !! end
7143
7144 !! test
7145 Parsoid: Row-syntax table headings followed by comment & table cells
7146 !! options
7147 parsoid=wt2html,wt2wt
7148 !! wikitext
7149 {|
7150 !foo||bar
7151 <!-- foo --> ||baz||quux
7152 |}
7153 !! html/php
7154 <table>
7155 <tr>
7156 <th>foo</th>
7157 <th>bar
7158 </th>
7159 <td>baz</td>
7160 <td>quux
7161 </td></tr></table>
7162
7163 !! html/parsoid
7164 <table>
7165 <tbody><tr><th> foo </th><th> bar
7166 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7167 </tbody></table>
7168 !! end
7169
7170 !!test
7171 Parsoid: Recover better from broken table attributes
7172 !!options
7173 parsoid=wt2html
7174 !!wikitext
7175 {| class="foo
7176 | class="bar" |
7177 foo
7178 |}
7179 !!html/php+tidy
7180 <table class="foo">
7181 <tbody><tr>
7182 <td class="bar">
7183 <p>foo
7184 </p>
7185 </td></tr></tbody></table>
7186 !!html/parsoid
7187 <table class="foo">
7188 <tr>
7189 <td class="bar">
7190 <p>foo</p></td></tr>
7191 </tbody></table>
7192 !!end
7193
7194 !! test
7195 Tables: Digest broken attributes on table and tr tag
7196 !! options
7197 parsoid=wt2html
7198 !! wikitext
7199 {| || |} ++
7200 |- || || ++ --
7201 |- > [
7202 |}
7203 !! html
7204 <table>
7205 <tbody>
7206 <tr class='mw-empty-elt'></tr>
7207 <tr class='mw-empty-elt'></tr>
7208 </tbody></table>
7209 !! end
7210
7211 # T137406: Whitespace in the HTML
7212 !! test
7213 1. Generate correct wikitext for tables with thead/tbody/tfoot
7214 !! options
7215 parsoid=html2wt
7216 !! html/parsoid
7217 <table>
7218 <caption>Test</caption>
7219 <thead>
7220 <tr>
7221 <th>Month</th>
7222 <th>Savings</th>
7223 </tr>
7224 </thead>
7225 <tbody>
7226 <tr>
7227 <td>January</td>
7228 <td>$100</td>
7229 </tr>
7230 <tr>
7231 <td>February</td>
7232 <td>$80</td>
7233 </tr>
7234 </tbody>
7235 <tfoot>
7236 <tr>
7237 <td>Sum</td>
7238 <td>$180</td>
7239 </tr>
7240 </tfoot>
7241 </table>
7242 !! wikitext
7243 {|
7244 |+Test
7245 !Month
7246 !Savings
7247 |-
7248 |January
7249 |$100
7250 |-
7251 |February
7252 |$80
7253 |-
7254 |Sum
7255 |$180
7256 |}
7257 !! html/php+tidy
7258 <table>
7259 <caption>Test
7260 </caption>
7261 <tbody><tr>
7262 <th>Month
7263 </th>
7264 <th>Savings
7265 </th></tr>
7266 <tr>
7267 <td>January
7268 </td>
7269 <td>$100
7270 </td></tr>
7271 <tr>
7272 <td>February
7273 </td>
7274 <td>$80
7275 </td></tr>
7276 <tr>
7277 <td>Sum
7278 </td>
7279 <td>$180
7280 </td></tr></tbody></table>
7281 !! end
7282
7283 # T137406: No whitespace in the HTML
7284 !! test
7285 2. Generate correct wikitext for tables with thead/tbody/tfoot
7286 !! options
7287 parsoid=html2wt
7288 !! html/parsoid
7289 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7290 !! wikitext
7291 {|
7292 !heading
7293 |-
7294 |foo
7295 |}
7296 !! end
7297
7298 !! test
7299 Testing serialization after deletion in references
7300 !! options
7301 parsoid={
7302 "modes": ["wt2wt"],
7303 "changes": [
7304 ["#x", "remove"]
7305 ]
7306 }
7307 !! wikitext
7308 hi <ref><div id="x">ho</div></ref>
7309
7310 <references />
7311 !! wikitext/edited
7312 hi <ref></ref>
7313
7314 <references />
7315 !! end
7316
7317 !!test
7318 Testing serialization after deletion of table cells
7319 !!options
7320 parsoid={
7321 "modes": ["wt2wt", "selser"],
7322 "changes": [
7323 ["#x", "remove"]
7324 ]
7325 }
7326 !!wikitext
7327 {|
7328 !h1 !!h2 !!h3
7329 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7330 |}
7331 !! wikitext/edited
7332 {|
7333 !h1 !!h2 !!h3
7334 |c2 |||c3
7335 |}
7336 !!end
7337
7338 !! test
7339 Testing selser after addition of new row before first row (T125419)
7340 !! options
7341 parsoid={
7342 "modes": ["wt2wt", "selser"],
7343 "changes": [
7344 [ "tr", "before", "<tr><td>X</td></tr>" ]
7345 ]
7346 }
7347 !! wikitext
7348 {|
7349 |a
7350 |}
7351 !! wikitext/edited
7352 {|
7353 |X
7354 |-
7355 |a
7356 |}
7357 !! end
7358
7359 !! test
7360 Serialize new table rows in a HTML table using HTML tags
7361 !! options
7362 parsoid={
7363 "modes": ["wt2wt", "selser"],
7364 "changes": [
7365 [ "tr", "before", "<tr><td>X</td></tr>" ]
7366 ]
7367 }
7368 !! wikitext
7369 <table><tr><td>a</td></tr></table>
7370 !! wikitext/edited
7371 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7372 !! end
7373
7374 !! test
7375 Serialize new table cells in a HTML row using HTML tags
7376 !! options
7377 parsoid={
7378 "modes": ["wt2wt", "selser"],
7379 "changes": [
7380 [ "td", "before", "<td>X</td>" ]
7381 ]
7382 }
7383 !! wikitext
7384 <table><tr><td>a</td></tr></table>
7385 !! wikitext/edited
7386 <table><tr><td>X</td><td>a</td></tr></table>
7387 !! end
7388
7389 !! test
7390 Wikitext tables can be nested inside HTML tables
7391 !! options
7392 parsoid=html2wt
7393 !! html
7394 <table data-parsoid='{"stx":"html"}'>
7395 <tr><td>
7396 <table>
7397 <tr><td>foo</td></tr>
7398 </table>
7399 </td></tr>
7400 </table>
7401 !! wikitext
7402 <table>
7403 <tr><td>
7404 {|
7405 |foo
7406 |}
7407 </td></tr>
7408 </table>
7409 !! end
7410
7411 !! test
7412 Serialize wikitext list items as HTML list items when embedded in a HTML list
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{}'>a</li>
7418 <li>b</li>
7419 </ul>
7420 !! wikitext
7421 <ul>
7422 <li>a</li>
7423 <li>b</li>
7424 </ul>
7425 !! end
7426
7427 # SSS FIXME: Is this actually a good thing given the
7428 # odd nested list output that is generated by MW?
7429 # <ul><li>foo<ul>..</ul></li></ul> instead of
7430 # <ul><li>foo</li><ul>..</ul></ul>
7431 !! test
7432 Wikitext lists can be nested inside HTML lists
7433 !! options
7434 parsoid=html2wt
7435 !! html
7436 <ul data-parsoid='{"stx": "html"}'>
7437 <li data-parsoid='{"stx": "html"}'>a
7438 <ul><li>b</li></ul>
7439 </li>
7440 </ul>
7441
7442 <ul data-parsoid='{"stx": "html"}'>
7443 <li>x
7444 <ul><li>y</li></ul>
7445 </li>
7446 </ul>
7447 !! wikitext
7448 <ul>
7449 <li>a
7450 * b
7451 </li>
7452 </ul>
7453
7454 <ul>
7455 <li>x
7456 * y
7457 </li>
7458 </ul>
7459 !! end
7460
7461 ###
7462 ### Internal links
7463 ###
7464 !! test
7465 Plain link, capitalized
7466 !! wikitext
7467 [[Main Page]]
7468 !! html
7469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7470 </p>
7471 !! end
7472
7473 !! test
7474 Plain link, uncapitalized
7475 !! wikitext
7476 [[main Page]]
7477 !! html
7478 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7479 </p>
7480 !! end
7481
7482 !! test
7483 Piped link
7484 !! wikitext
7485 [[Main Page|The Main Page]]
7486 !! html
7487 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Piped link with comment in link text
7493 !! wikitext
7494 [[Main Page|The Main<!--front--> Page]]
7495 !! html
7496 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Piped link with multiple pipe characters in link text
7502 !! wikitext
7503 [[Main Page||The|Main|Page|]]
7504 !! html/php
7505 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7506 </p>
7507 !! html/parsoid
7508 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7509 !! end
7510
7511 !! test
7512 Piped link with no link text
7513 !! wikitext
7514 [[Thomas Bek (bishop of St David's)|]]
7515 !! html/php
7516 <p>[[Thomas Bek (bishop of St David's)|]]
7517 </p>
7518 !! html/parsoid
7519 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7520 !! end
7521
7522 !! test
7523 Piped link with empty link text
7524 !! wikitext
7525 [[Main Page|<nowiki/>]] - empty nowiki
7526 [[Main Page| ]] - empty space
7527 [[Main Page|&nbsp;]] - empty non breaking space
7528 !! html/php
7529 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7530 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7531 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7532 </p>
7533 !! html/parsoid
7534 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7535 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7536 <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>
7537 !! end
7538
7539 !! test
7540 Broken link
7541 !! wikitext
7542 [[Zigzagzogzagzig]]
7543 !! html
7544 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7545 </p>
7546 !! end
7547
7548 !! test
7549 Broken link with fragment
7550 !! wikitext
7551 [[Zigzagzogzagzig#zug]]
7552 !! html
7553 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Special page link with fragment
7559 !! wikitext
7560 [[Special:Version#anchor]]
7561 !! html
7562 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7563 </p>
7564 !! end
7565
7566 !! test
7567 Nonexistent special page link with fragment
7568 !! wikitext
7569 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7570 !! html
7571 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Link with prefix
7577 !! wikitext
7578 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7579 !! html
7580 <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>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Link with suffix
7586 !! wikitext
7587 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7588 !! html
7589 <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>!!!
7590 </p>
7591 !! end
7592
7593 !! article
7594 prefixed article
7595 !! text
7596 Some text
7597 !! endarticle
7598
7599 !! test
7600 T45661: Piped links with identical prefixes
7601 !! wikitext
7602 [[prefixed article|prefixed articles with spaces]]
7603
7604 [[prefixed article|prefixed articlesaoeu]]
7605
7606 [[Main Page|Main Page test]]
7607 !! html
7608 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7609 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7610 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7611 </p>
7612 !! end
7613
7614
7615 !! test
7616 Link with HTML entity in suffix / tail
7617 !! wikitext
7618 [[Main Page]]&quot;, [[Main Page]]&#97;
7619 !! html/php
7620 <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;
7621 </p>
7622 !! html/parsoid
7623 <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>
7624 !! end
7625
7626 !! test
7627 Link with 3 brackets
7628 !! wikitext
7629 [[[Main Page]]]
7630 Foo [[[Main Page]]]
7631 !! html
7632 <p>[[[Main Page]]]
7633 Foo [[[Main Page]]]
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with 4 brackets
7639 !! wikitext
7640 [[[[Main Page]]]]
7641 !! html
7642 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7643 </p>
7644 !! end
7645
7646 !! test
7647 Piped link with 3 brackets
7648 !! wikitext
7649 [[[main page|the main page]]]
7650 !! html
7651 <p>[[[main page|the main page]]]
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link with extlink-like text
7657 !! wikitext
7658 [[Main Page|[bar]]]
7659 [[Main Page|This is a [bar]]]
7660 [[Main Page|[bar]]
7661 !! html/php
7662 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7663 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7664 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7665 </p>
7666 !! html/parsoid
7667 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7668 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7669 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7670 !! end
7671
7672 !! test
7673 Link with multiple pipes
7674 !! wikitext
7675 [[Main Page|The|Main|Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Anchor containing a #. (T65430)
7683 !! config
7684 wgFragmentMode=[ 'html5', 'legacy' ]
7685 !! wikitext
7686 [[Main Page#And#Link]]
7687 !! html/php
7688 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7689 </p>
7690 !! html/parsoid
7691 <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>
7692 !! end
7693
7694 !! test
7695 Link to namespaces
7696 !! wikitext
7697 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7698 !! html
7699 <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>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Link with space in namespace
7705 !! wikitext
7706 [[User talk:Foo bar]]
7707 !! html
7708 <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>
7709 </p>
7710 !! end
7711
7712 !! article
7713 MemoryAlpha:AlphaTest
7714 !! text
7715 This is an article in the MemoryAlpha namespace
7716 (which shadows the memoryalpha interwiki link).
7717 !! endarticle
7718
7719 !! test
7720 Namespace takes precedence over interwiki link (T53680)
7721 !! wikitext
7722 [[MemoryAlpha:AlphaTest]]
7723 !! html
7724 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7725 </p>
7726 !! end
7727
7728 # The previous test doesn't work correctly in html2*, due to not recognizing the
7729 # link as an internal one. This one checks for the correct behavior.
7730 !! test
7731 Link to namespace preferred over interwiki with correct rel attribute
7732 !! options
7733 parsoid=html2wt,html2html
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7736 !! wikitext
7737 [[MemoryAlpha:AlphaTest]]
7738 !! end
7739
7740 !! test
7741 Piped link to namespace
7742 !! wikitext
7743 [[Meta:Disclaimers|The disclaimers]]
7744 !! html
7745 <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>
7746 </p>
7747 !! end
7748
7749 !! test
7750 Link containing }
7751 !! wikitext
7752 [[Usually caused by a typo (oops}]]
7753 !! html
7754 <p>[[Usually caused by a typo (oops}]]
7755 </p>
7756 !! end
7757
7758 !! article
7759 7% Solution
7760 !! text
7761 Just a test of an article title containing a percent.
7762 !! endarticle
7763
7764 !! test
7765 Link containing % (not as a hex sequence)
7766 !! wikitext
7767 [[7% Solution]]
7768 [[7% Solution|7%25 Solution]]
7769 !! html/php
7770 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7771 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7775 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7776 !! end
7777
7778 # note that the parsoid HTML is identical to the previous test output,
7779 # so the previous test ensures that the html2wt mode will generate the
7780 # "not as a hex sequence" wikitext.
7781 !! test
7782 Link containing % as a single hex sequence interpreted to char
7783 !! options
7784 parsoid=wt2wt,wt2html,html2html
7785 !! wikitext
7786 [[7%25 Solution]]
7787 [[7%25 Solution|7%25 Solution]]
7788 !! html/php
7789 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7790 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7791 </p>
7792 !! html/parsoid
7793 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7794 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7795 !!end
7796
7797 !! test
7798 Link containing % as a double hex sequence interpreted to hex sequence
7799 !! wikitext
7800 [[7%2525 Solution]]
7801 !! html
7802 <p>[[7%2525 Solution]]
7803 </p>
7804 !!end
7805
7806 ## Example for such a section: == < ==
7807 !! test
7808 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7809 !! config
7810 wgFragmentMode=[ 'html5', 'legacy' ]
7811 !! wikitext
7812 [[%23%3c]][[%23%3e]]
7813 !! html/php
7814 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7815 </p>
7816 !! html/parsoid
7817 <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>
7818 !! end
7819
7820 ## Example for such a section: == < ==
7821 !! test
7822 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7823 !! config
7824 wgFragmentMode=[ 'legacy' ]
7825 !! wikitext
7826 [[%23%3c]][[%23%3e]]
7827 !! html/php
7828 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Link containing "<#" and ">#" as a hex sequences
7834 !! wikitext
7835 [[%3c%23]][[%3e%23]]
7836 !! html
7837 <p>[[%3c%23]][[%3e%23]]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Link containing an equals sign
7843 !! wikitext
7844 [[Special:BookSources/isbn=4-00-026157-6]]
7845 !! html/php
7846 <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>
7847 </p>
7848 !! html/parsoid
7849 <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>
7850 !! end
7851
7852 !! article
7853 Foo~bar
7854 !! text
7855 Just a test of an article title containing a tilde.
7856 !! endarticle
7857
7858 # note that links containing signatures, like [[Foo~~~~]], are
7859 # massaged by the pre-save transform (PST) and so the tildes are never
7860 # seen by the parser.
7861 !! test
7862 Link containing a tilde
7863 !! wikitext
7864 [[Foo~bar]]
7865 !! html/php
7866 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7867 </p>
7868 !! html/parsoid
7869 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' (T6598)
7874 !! wikitext
7875 [[Lista d''e paise d''o munno]]
7876 !! html/php
7877 <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>
7878 </p>
7879 !! html/parsoid
7880 <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>
7881 !! end
7882
7883 !! test
7884 Link containing double quotes and spaces
7885 !! wikitext
7886 [[Cool "Gator"]]
7887 !! html/php
7888 <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>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7892 !! end
7893
7894 !! test
7895 File containing double quotes and spaces
7896 !! wikitext
7897 [[File:Cool "Gator".png]]
7898 !! html/parsoid
7899 <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>
7900 !! end
7901
7902 !! test
7903 Redirect containing double quotes and spaces
7904 !! wikitext
7905 #REDIRECT [[Cool "Gator"]]
7906 !! html/parsoid
7907 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7908 !! end
7909
7910 !! test
7911 Link containing double-single-quotes '' in text (T6598 sanity check)
7912 !! wikitext
7913 Some [[Link|pretty ''italics'' and stuff]]!
7914 !! html/php
7915 <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>!
7916 </p>
7917 !! html/parsoid
7918 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7919 !! end
7920
7921 !! test
7922 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7923 !! wikitext
7924 ''Some [[Link|pretty ''italics'' and stuff]]!''
7925 !! html
7926 <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>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link with double quotes in title part (literal) and alternate part (interpreted)
7932 !! wikitext
7933 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7934
7935 [[''Pentecoste'']]
7936
7937 [[''Pentecoste''|Pentecoste]]
7938
7939 [[''Pentecoste''|''Pentecoste'']]
7940 !! html/php
7941 <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>
7942 </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>
7943 </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>
7944 </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>
7945 </p>
7946 !! html/parsoid
7947 <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>
7948 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7949 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7950 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7951 !! end
7952
7953 !! test
7954 Broken image links with HTML captions (T41700)
7955 !! wikitext
7956 [[File:Nonexistent|<script></script>]]
7957 [[File:Nonexistent|100x100px|<script></script>]]
7958 [[File:Nonexistent|&lt;]]
7959 [[File:Nonexistent|a<i>b</i>c]]
7960 !! html/php
7961 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7962 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7963 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7964 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7965 </p>
7966 !! html/parsoid
7967 <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>
7968 <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>
7969 <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>
7970 <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>
7971 !! end
7972
7973 !! test
7974 Plain link to URL
7975 !! wikitext
7976 [[http://www.example.com]]
7977 !! html/php
7978 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7979 </p>
7980 !! html/parsoid
7981 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
7982 !! end
7983
7984 !! test
7985 Plain link to URL with link text
7986 !! wikitext
7987 [[http://www.example.com Link text]]
7988 !! html
7989 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Plain link to protocol-relative URL
7995 !! wikitext
7996 [[//www.example.com]]
7997 !! html/php
7998 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7999 </p>
8000 !! html/parsoid
8001 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8002 !! end
8003
8004 !! test
8005 Plain link to protocol-relative URL with link text
8006 !! wikitext
8007 [[//www.example.com Link text]]
8008 !! html
8009 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8010 </p>
8011 !! end
8012
8013 !! test
8014 Plain link to page with question mark in title
8015 !! wikitext
8016 [[A?b]]
8017
8018 [[A?b|Baz]]
8019 !! html
8020 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8021 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8022 </p>
8023 !! end
8024
8025 # I'm fairly sure the expected result here is wrong.
8026 # We want these to be URL links, not pseudo-pages with URLs for titles....
8027 # However the current output is also pretty screwy.
8028 #
8029 # ----
8030 # I'm changing it to match the current output--it arguably makes more
8031 # sense in the light of the test above. Old expected result was:
8032 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8033 #</p>
8034 # But I think this test is bordering on "garbage in, garbage out" anyway.
8035 # -- wtm
8036 !! test
8037 Piped link to URL
8038 !! wikitext
8039 Piped link to URL: [[http://www.example.com|an example URL]]
8040 !! html/php
8041 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8042 </p>
8043 !! html/parsoid
8044 <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>
8045 !! end
8046
8047 !! test
8048 Plain link in template argument
8049 !! options
8050 parsoid=wt2html
8051 !! wikitext
8052 {{echo|[http://www.example.com |123]}}
8053
8054 {{echo|[[http://www.example.com |123]]}}
8055
8056 {{echo|[[http://www.example.com |123]}}
8057
8058 {{echo|[http://www.example.com |123]]}}
8059 !! html/php
8060 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8061 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8062 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8063 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8064 </p>
8065 !! html/parsoid
8066 <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>
8067
8068 <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>
8069
8070 <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>
8071
8072 <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>
8073 !! end
8074
8075 !! test
8076 T2002: [[page|http://url/]] should link to page, not http://url/
8077 !! wikitext
8078 [[Main Page|http://url/]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8084 !! end
8085
8086 # Parsoid does not mark self-links, by design.
8087 !! test
8088 T2337: Escaped self-links should be bold
8089 !! options
8090 title=[[Bug462]]
8091 !! wikitext
8092 [[Bu&#103;462]] [[Bug462]]
8093 !! html/php+tidy
8094 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8095 </p>
8096 !! html/parsoid
8097 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8098 !! end
8099
8100 !! test
8101 Self-link to section should not be bold
8102 !! options
8103 title=[[Main Page]]
8104 !! wikitext
8105 [[Main Page#section]]
8106 !! html
8107 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8108 </p>
8109 !! end
8110
8111 !! article
8112 00
8113 !! text
8114 This is 00.
8115 !! endarticle
8116
8117 !!test
8118 Self-link to numeric title
8119 !!options
8120 title=[[0]]
8121 !! wikitext
8122 [[0]]
8123 !! html
8124 <p><a class="mw-selflink selflink">0</a>
8125 </p>
8126 !!end
8127
8128 !!test
8129 Link to numeric-equivalent title
8130 !!options
8131 title=[[0]]
8132 !! wikitext
8133 [[00]]
8134 !! html
8135 <p><a href="/wiki/00" title="00">00</a>
8136 </p>
8137 !!end
8138
8139 !! test
8140 <nowiki> inside a link
8141 !! wikitext
8142 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8143 !! html
8144 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8145 </p>
8146 !! end
8147
8148 !! test
8149 Non-breaking spaces in title
8150 !! wikitext
8151 [[&nbsp; Main &nbsp; Page &nbsp;]]
8152 !! html
8153 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8154 </p>
8155 !!end
8156
8157 # Add new article for the test below so that it doesn't red-link
8158 !! article
8159 Foo bar baz
8160 !! text
8161 boo
8162 !! endarticle
8163
8164 !! test
8165 Multiple spaces in titles should normalize to a single underscore
8166 !! options
8167 parsoid=wt2html,wt2wt
8168 !! wikitext
8169 [[Foo bar baz|x]]
8170 [[Foo bar baz|x]]
8171 [[Foo bar baz|x]]
8172 !! html/php
8173 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8174 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8175 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8179 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8180 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8186 !! options
8187 language=ca
8188 !! wikitext
8189 '''[[Main Page]]'''
8190 !! html
8191 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8197 !! options
8198 language=ca
8199 !! wikitext
8200 ''[[Main Page]]''
8201 !! html
8202 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8203 </p>
8204 !! end
8205
8206 !! test
8207 Internal link with en linktrail: no apostrophes (T29473)
8208 !! options
8209 language=en
8210 !! wikitext
8211 [[Something]]'nice
8212 !! html
8213 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8214 </p>
8215 !! end
8216
8217 !! test
8218 Internal link with ca linktrail with apostrophes (T29473)
8219 !! options
8220 language=ca
8221 !! wikitext
8222 [[Something]]'nice
8223 !! html
8224 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8225 </p>
8226 !! end
8227
8228 !! test
8229 Internal link with kaa linktrail with apostrophes (T29473)
8230 !! options
8231 language=kaa
8232 !! wikitext
8233 [[Something]]'nice
8234 !! html
8235 <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>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Link with multiple ":" in a subpage-supporting namespace (T65636)
8241 !! wikitext
8242 [[User:Foo/Test/63636:Bar|Test]]
8243 !! html/php
8244 <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>
8245 </p>
8246 !! html/parsoid
8247 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8248 !! end
8249
8250 ## Mainly a sanity check for Parsoid
8251 !! test
8252 Handle title parsing for subpages
8253 !! options
8254 title=[[/123123]]
8255 subpage
8256 !! wikitext
8257 123
8258 !! html/php
8259 <p>123
8260 </p>
8261 !! html/parsoid
8262 <p>123</p>
8263 !! end
8264
8265 !! article
8266 User:Test/123
8267 !! text
8268 test 123
8269 !! endarticle
8270
8271 !! test
8272 Link to a subpage from a namespace other than main
8273 !! options
8274 title=[[User:Test]]
8275 subpage
8276 !! wikitext
8277 [[/123]]
8278 !! html/php
8279 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8280 </p>
8281 !! html/parsoid
8282 <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>
8283 !! end
8284
8285 !! test
8286 Ensure that transclusion titles are not url-decoded
8287 !! options
8288 subpage title=[[Test]]
8289 parsoid=wt2html
8290 !! wikitext
8291 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8292 !! html/php
8293 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8294 </p>
8295 !! html/parsoid
8296 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8297 !! end
8298
8299 !! test
8300 Purely hash wikilink
8301 !! options
8302 title=[[User:Test/123]]
8303 subpage
8304 !! wikitext
8305 [[#a|b]]
8306 !! html/php
8307 <p><a href="#a">b</a>
8308 </p>
8309 !! html/parsoid
8310 <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>
8311 !! end
8312
8313 !! test
8314 Serialization of purely hash wikilink
8315 !! options
8316 title=[[User:Test/123]]
8317 subpage
8318 parsoid=html2wt
8319 !! html/parsoid
8320 <p><a href="#a">[[</a></p>
8321 !! wikitext
8322 [[#a|<nowiki>[[</nowiki>]]
8323 !! html/php
8324 <p><a href="#a">[[</a>
8325 </p>
8326 !! end
8327
8328 !! test
8329 1. Interaction of linktrail and template encapsulation
8330 !! wikitext
8331 {{echo|[[Foo]]}}l
8332 !! html/parsoid
8333 <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>
8334 !! end
8335
8336 !! test
8337 2. Interaction of linktrail and template encapsulation
8338 !! options
8339 parsoid
8340 !! wikitext
8341 {{echo|Some [[Fool]]}}s
8342 !! html
8343 <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>
8344 !! end
8345
8346 !! test
8347 3. Interaction of linktrail and template encapsulation
8348 !! options
8349 parsoid
8350 !! wikitext
8351 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8352 !! html
8353 <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>
8354 !! end
8355
8356 !! article
8357 Söfnuður
8358 !! text
8359 Test.
8360 !! endarticle
8361
8362 !! test
8363 Internal link with is link prefix
8364 !! options
8365 language=is
8366 !! wikitext
8367 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8368 !! html
8369 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8370 </p>
8371 !! end
8372
8373 !! article
8374 Mótmælendatrú
8375 !! text
8376 Test.
8377 !! endarticle
8378
8379 !! test
8380 Internal link with is link trail and link prefix
8381 !! options
8382 language=is
8383 !! wikitext
8384 [[mótmælendatrú|xxx]]ar
8385 [[mótmælendatrú]]ar
8386 mótmælenda[[söfnuður]]
8387 mótmælenda[[söfnuður|söfnuðir]]
8388 mótmælenda[[söfnuður|söfnuðir]]xxx
8389 !! html
8390 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8391 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8392 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8393 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8394 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid link trail escaping
8400 !! options
8401 parsoid=html2wt,html2html
8402 !! html/parsoid
8403 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8404 !! wikitext
8405 [[apple]]<nowiki/>s
8406 !! end
8407
8408 !! test
8409 Parsoid link prefix escaping
8410 !! options
8411 language=is
8412 parsoid=html2wt,html2html
8413 !! html/parsoid
8414 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8415 !! wikitext
8416 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8417 !! end
8418
8419 !! test
8420 Parsoid link bracket escaping
8421 !! options
8422 parsoid=html2wt,html2html
8423 !! html/parsoid
8424 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8425 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8426 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8427 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8428 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8429 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8430 !! wikitext
8431 [[Test]]
8432
8433 [<nowiki/>[[Test]]]
8434
8435 [[[[Test]]]]
8436
8437 [[[<nowiki/>[[Test]]]]]
8438
8439 [[[[[[Test]]]]]]
8440
8441 [[[[[<nowiki/>[[Test]]]]]]]
8442 !! end
8443
8444 !! test
8445 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8446 !! wikitext
8447 [[Foo| bar]]
8448
8449 [[Foo| ''bar'']]
8450
8451 [http://wp.org foo]
8452
8453 [http://wp.org ''foo'']
8454 !! html
8455 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8456 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8457 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8458 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8459 </p>
8460 !! end
8461
8462 !! test
8463 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8464 !! wikitext
8465 [[Foo|{{echo|a}} b {{echo|c}}]]
8466 !! html/parsoid
8467 <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>
8468 !! end
8469
8470 !! test
8471 Link with angle bracket after anchor
8472 !! config
8473 wgFragmentMode=[ 'html5', 'legacy' ]
8474 !! wikitext
8475 [[Foo#<bar>]]
8476 !! html/php
8477 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8478 </p>
8479 !! html/parsoid
8480 <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>
8481 !! end
8482
8483 !! test
8484 Link with angle bracket after anchor (legacy)
8485 !! config
8486 wgFragmentMode=[ 'legacy' ]
8487 !! wikitext
8488 [[Foo#<bar>]]
8489 !! html/php
8490 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8491 </p>
8492 !! end
8493
8494 ###
8495 ### Interwiki links (see maintenance/interwiki.sql)
8496 ###
8497
8498 !! test
8499 Inline interwiki link
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[MeatBall:SoftSecurity]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8509 !! end
8510
8511 !! test
8512 Inline interwiki link with empty title (T4372)
8513 !! options
8514 parsoid=wt2html,wt2wt,html2html
8515 !! wikitext
8516 [[MeatBall:]]
8517 !! html/php
8518 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8522 !! end
8523
8524 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8525 !! test
8526 Interwiki link encoding conversion (T3636)
8527 !! options
8528 parsoid=wt2html,wt2wt
8529 !! wikitext
8530 *[[Wikipedia:ro:Olteni&#0355;a]]
8531 *[[Wikipedia:ro:Olteni&#355;a]]
8532 !! html
8533 <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>
8534 <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>
8535
8536 !! html/php+tidy
8537 <ul>
8538 <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>
8539 <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>
8540 </ul>
8541 !! html/parsoid
8542 <ul>
8543 <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>
8544 <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>
8545 </ul>
8546 !! end
8547
8548 !! test
8549 Interwiki link with fragment (T4130)
8550 !! wikitext
8551 [[MeatBall:SoftSecurity#foo]]
8552 !! html
8553 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8554 </p>
8555 !! end
8556
8557 !! test
8558 Link scenarios with escaped fragments
8559 !! config
8560 wgFragmentMode=[ 'html5', 'legacy' ]
8561 !! wikitext
8562 [[#Is this great?]]
8563 [[Foo#Is this great?]]
8564 [[meatball:Foo#Is this great?]]
8565 !! html/php
8566 <p><a href="#Is_this_great?">#Is this great?</a>
8567 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8568 <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>
8569 </p>
8570 !! html/parsoid
8571 <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>
8572 <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>
8573 <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>
8574 !! end
8575
8576 !! test
8577 Link scenarios with escaped fragments (legacy)
8578 !! config
8579 wgFragmentMode=[ 'legacy' ]
8580 !! wikitext
8581 [[#Is this great?]]
8582 [[Foo#Is this great?]]
8583 [[meatball:Foo#Is this great?]]
8584 !! html/php
8585 <p><a href="#Is_this_great.3F">#Is this great?</a>
8586 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8587 <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>
8588 </p>
8589 !! end
8590
8591 # Ideally the wikipedia: prefix here should be proto-relative too
8592 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8593 # define the 'en' prefix, and originally the test used 'wikipedia',
8594 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8595 # article.
8596 !! test
8597 Different interwiki prefixes mapping to the same URL
8598 !! wikitext
8599 [[:en:Foo]]
8600
8601 [[:en:Foo|Foo]]
8602
8603 [[wikipedia:Foo]]
8604
8605 [[:wikipedia:Foo|Foo]]
8606
8607 [[wikipedia:en:Foo]]
8608
8609 [[:wikipedia:en:Foo]]
8610
8611 [[ wikiPEdia :Foo]]
8612 !! html/parsoid
8613 <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>
8614
8615 <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>
8616
8617 <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>
8618
8619 <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>
8620
8621 <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>
8622
8623 <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>
8624
8625 <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>
8626 !! end
8627
8628 !! test
8629 Interwiki links that cannot be represented in wiki syntax
8630 !! wikitext
8631 [[meatball:ok]]
8632 [[meatball:ok#foo|ok with fragment]]
8633 [[meatball:ok_as_well?|ok ending with ? mark]]
8634 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8635 [http://de.wikipedia.org/wiki/#foo is just fragment]
8636
8637 !! html/php
8638 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8639 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8640 <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>
8641 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8642 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8643 </p>
8644 !! html/parsoid
8645 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8646 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8647 <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>
8648 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8649 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8650 !! end
8651
8652 !! test
8653 Interwiki links: trail
8654 !! wikitext
8655 [[wikipedia:Foo|Ba]]r
8656 !! html/php
8657 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8658 </p>
8659 !! html/parsoid
8660 <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>
8661 !! end
8662
8663 !! test
8664 Local interwiki link
8665 !! options
8666 parsoid=wt2html,wt2wt,html2html
8667 !! wikitext
8668 [[local:Template:Foo]]
8669 !! html/php
8670 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8671 </p>
8672 !! html/parsoid
8673 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8674 !! end
8675
8676 # Parsoid does not mark self-links, by design.
8677 !! test
8678 Local interwiki link: self-link to current page
8679 !! options
8680 title=[[Main Page]]
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 [[local:Main Page]]
8684 !! html/php
8685 <p><a class="mw-selflink selflink">local:Main Page</a>
8686 </p>
8687 !! html/parsoid
8688 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8689 !! end
8690
8691 !! test
8692 Local interwiki link: prefix only (T66167)
8693 !! options
8694 parsoid=wt2html,wt2wt,html2html
8695 !! wikitext
8696 [[local:]]
8697 !! html/php
8698 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8699 </p>
8700 !! html/parsoid
8701 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8702 !! end
8703
8704 !! test
8705 Local interwiki link: with additional interwiki prefix (T63357)
8706 !! options
8707 parsoid=wt2html,wt2wt,html2html
8708 !! wikitext
8709 [[local:meatball:Hello]]
8710 !! html/php
8711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8712 </p>
8713 !! html/parsoid
8714 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8715 !! end
8716
8717 !! test
8718 Multiple local interwiki link prefixes
8719 !! wikitext
8720 [[local:local:local:local:mi:local:Foo]]
8721 !! options
8722 parsoid=wt2html,wt2wt,html2html
8723 !! html/php
8724 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8725 </p>
8726 !! html/parsoid
8727 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8728 !! end
8729
8730 ###
8731 ### Interlanguage links
8732 ### Language links (so that searching for '### language' matches..)
8733 ###
8734
8735 !! test
8736 Interlanguage link
8737 !! wikitext
8738 Blah blah blah
8739 [[zh:Chinese]]
8740 !! html/php
8741 <p>Blah blah blah
8742 </p>
8743 !! html/parsoid
8744 <p>Blah blah blah</p>
8745 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8746 !! end
8747
8748 ## parsoid html2wt will lose the space variations
8749 !! test
8750 Interlanguage link with spacing
8751 !! options
8752 parsoid=wt2html,wt2wt,html2html
8753 !! wikitext
8754 Blah blah blah
8755 [[ zh : Chinese ]]
8756 !! html/php
8757 <p>Blah blah blah
8758 </p>
8759 !! html/parsoid
8760 <p>Blah blah blah</p>
8761 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8762 !! end
8763
8764 !! test
8765 Double interlanguage link
8766 !! wikitext
8767 Blah blah blah
8768 [[es:Spanish]]
8769 [[zh:Chinese]]
8770 !! html/php
8771 <p>Blah blah blah
8772 </p>
8773 !! html/parsoid
8774 <p>Blah blah blah</p>
8775 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8776 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8777 !! end
8778
8779 ## parsoid html2wt will lose the space variations
8780 !! test
8781 Interlanguage link variations
8782 !! options
8783 parsoid=wt2html,wt2wt,html2html
8784 !! wikitext
8785 Blah blah blah
8786 [[ es :Spanish]]
8787 [[ ZH :Chinese]]
8788 [[es:Foo_bar]]
8789 !! html/php
8790 <p>Blah blah blah
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah</p>
8794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8797 !! end
8798
8799 !! test
8800 Escaping of interlanguage links (T129218, T156308)
8801 !! wikitext
8802 Blah blah blah
8803 [[:es:Spanish]]
8804 [[ : zh : Chinese ]]
8805 !! html/php
8806 <p>Blah blah blah
8807 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8808 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8809 </p>
8810 !! html/parsoid
8811 <p>Blah blah blah
8812 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8813 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8814 !! end
8815
8816 !! test
8817 Multiple colons escaping interlanguage links
8818 !! options
8819 parsoid=wt2html
8820 !! wikitext
8821 [[:es:Spanish]]
8822 [[::es:Spanish]]
8823 [[:::es:Spanish]]
8824 !! html/php
8825 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8826 [[::es:Spanish]]
8827 [[:::es:Spanish]]
8828 </p>
8829 !! html/parsoid
8830 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8831 [[::es:Spanish]]
8832 [[:::es:Spanish]]</p>
8833 !! end
8834
8835 ## parsoid html2wt will normalize the space to _
8836 !! test
8837 Space and question mark encoding in interlanguage links (T95473)
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 Blah blah blah
8842 [[es:Foo bar?]]
8843 !! html/php
8844 <p>Blah blah blah
8845 </p>
8846 !! html/parsoid
8847 <p>Blah blah blah</p>
8848 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8849 !! end
8850
8851 !! test
8852 Interlanguage link, with prefix links
8853 !! options
8854 language=ln
8855 !! wikitext
8856 Blah blah blah
8857 [[zh:Chinese]]
8858 !! html/php
8859 <p>Blah blah blah
8860 </p>
8861 !! html/parsoid
8862 <p>Blah blah blah</p>
8863 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8864 !! end
8865
8866 !! test
8867 Double interlanguage link, with prefix links (T10897)
8868 !! options
8869 language=ln
8870 !! wikitext
8871 Blah blah blah
8872 [[es:Spanish]]
8873 [[zh:Chinese]]
8874 !! html/php
8875 <p>Blah blah blah
8876 </p>
8877 !! html/parsoid
8878 <p>Blah blah blah</p>
8879 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8880 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8881 !! end
8882
8883 !! test
8884 "Extra" interlanguage links (T34189 / gerrit 111390)
8885 !! wikitext
8886 Blah blah blah
8887 [[mul:Article]]
8888 !! html/php
8889 <p>Blah blah blah
8890 </p>
8891 !! html/parsoid
8892 <p>Blah blah blah</p>
8893 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8894 !! end
8895
8896 ## PHP parser tests script needs an update
8897 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8898 !! test
8899 Language links render as inline links if $wgInterwikiMagic=false
8900 !! options
8901 wgInterwikiMagic=false
8902 parsoid=wt2html,wt2wt,html2html
8903 !! wikitext
8904 Blah blah blah
8905 [[zh:Chinese]]
8906 !! html/parsoid
8907 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8908 !! end
8909
8910 ## PHP parser tests script needs an update
8911 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8912 !! test
8913 Language links render as inline links in the Talk namespace
8914 !! options
8915 title=Talk:Foo
8916 parsoid=wt2html,wt2wt,html2html
8917 !! wikitext
8918 Blah blah blah
8919 [[zh:Chinese]]
8920 !! html/parsoid
8921 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8922 !! end
8923
8924 !! test
8925 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8926 !! options
8927 language=ln
8928 !! wikitext
8929 [[WW&nbsp;II]]
8930 !! html
8931 <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>
8932 </p>
8933 !! end
8934
8935 !! test
8936 Parsoid T55221: Wikilinks should be properly entity-escaped
8937 !! options
8938 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8939 !! html/parsoid
8940 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8941 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8942 !! wikitext
8943 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8944
8945 He&amp;nbsp;llo He&amp;nbsp;llo
8946 !! html/php
8947 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8948 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8949 </p>
8950 !! end
8951
8952 # html2wt will fail because of title normalization without data-parsoid
8953 !! test
8954 Parsoid: handle constructor well
8955 !! options
8956 parsoid=wt2html,wt2wt
8957 !! wikitext
8958 [[constructor]]
8959
8960 [[constructor:foo]]
8961 !! html/php
8962 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8963 </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>
8964 </p>
8965 !! html/parsoid
8966 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8967
8968 <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>
8969 !! end
8970
8971 !! article
8972 ko:
8973 !! text
8974 Test.
8975 !! endarticle
8976
8977 # Note that `ko` isn't a known interlanguage prefix
8978 !! test
8979 Parsoid: recognize interlanguage links without a target page
8980 !! options
8981 ill
8982 !! wikitext
8983 [[es:]]
8984
8985 [[ko:]]
8986 !! html/php
8987 es:
8988 !! html/parsoid
8989 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8990
8991 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8992 !! end
8993
8994 # Note that `ko` isn't a known interwiki prefix
8995 !! test
8996 Parsoid: recognize interwiki links without a target page
8997 !! options
8998 parsoid=wt2html,wt2wt,html2html
8999 !! wikitext
9000 [[:es:]]
9001
9002 [[:ko:]]
9003 !! html/php
9004 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9005 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9006 </p>
9007 !! html/parsoid
9008 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9009 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9010 !! end
9011
9012 !! test
9013 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9014 !! wikitext
9015 [[mi:Foo]]
9016 !! html/php
9017 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9018 </p>
9019 !! html/parsoid
9020 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9021 !! end
9022
9023 !! test
9024 Interlanguage link with preceding local interwiki link (T70085)
9025 !! options
9026 parsoid=wt2html,wt2wt,html2html
9027 !! wikitext
9028 Blah blah blah
9029 [[local:es:Spanish]]
9030 !! html/php
9031 <p>Blah blah blah
9032 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9033 </p>
9034 !! html/parsoid
9035 <p>Blah blah blah
9036 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9037 !! end
9038
9039 !! test
9040 Looks like an interlanguage link, but is actually a local interwiki
9041 !! options
9042 parsoid=wt2html,wt2wt,html2html
9043 !! wikitext
9044 Blah blah blah
9045 [[mi:Template:Foo]]
9046 !! html/php
9047 <p>Blah blah blah
9048 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9049 </p>
9050 !! html/parsoid
9051 <p>Blah blah blah
9052 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9053 !! end
9054
9055 ###
9056 ### Redirects, Parsoid-only
9057 ###
9058
9059 !! test
9060 1. Simple redirect to page
9061 !! wikitext
9062 #REDIRECT [[Main Page]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9065 !! end
9066
9067 !! test
9068 2. Other redirect variants
9069 !! wikitext
9070 #REDIRECT [[Main_Page]]
9071 !! html/parsoid
9072 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9073 !! end
9074
9075 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9076 # This tests the Parsoid bail-out code.
9077 !! test
9078 3. Other redirect variants
9079 !! options
9080 parsoid=wt2html
9081 !! wikitext
9082 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9083 !! html/parsoid
9084 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9085 !! end
9086
9087 !! test
9088 4. Redirect to a templated destination
9089 !! wikitext
9090 #REDIRECT [[{{echo|Foo}}bar]]
9091 !! html/parsoid
9092 <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"}]]}'/>
9093 !! end
9094
9095 !! test
9096 Empty redirect
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 #REDIRECT [[]]
9101 !! html/parsoid
9102 <ol>
9103 <li>REDIRECT [[]]</li></ol>
9104 !! end
9105
9106 !! test
9107 Optional colon in #REDIRECT
9108 !! options
9109 # the colon is archaic syntax. we support it for wt2html, but we
9110 # don't care that it roundtrips back to the modern syntax.
9111 parsoid=wt2html,html2html
9112 !! wikitext
9113 #REDIRECT:[[Main Page]]
9114 !! html/parsoid
9115 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9116 !! end
9117
9118 !! test
9119 Whitespace in #REDIRECT with optional colon
9120 !! options
9121 # the colon and gratuitous whitespace is archaic syntax. we support
9122 # it for wt2html, but we don't care that it roundtrips back to the
9123 # modern syntax (without extra whitespace)
9124 parsoid=wt2html,html2html
9125 !! wikitext
9126
9127 #REDIRECT
9128 :
9129 [[Main Page]]
9130 !! html/parsoid
9131 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9132 !! end
9133
9134 !! test
9135 Piped link in #REDIRECT
9136 !! options
9137 # content after piped link is ignored. we support this syntax,
9138 # but don't care that the piped link is lost when we roundtrip this.
9139 parsoid=wt2html
9140 !! wikitext
9141 #REDIRECT [[Main Page|bar]]
9142 !! html/parsoid
9143 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9144 !! end
9145
9146 !! test
9147 Redirect to category (T104502)
9148 !! options
9149 parsoid=wt2html,wt2wt
9150 !! wikitext
9151 #REDIRECT [[Category:Foo]]
9152 !! html/parsoid
9153 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9154 !! end
9155
9156 !! test
9157 Redirect to category with URL encoding (T104502)
9158 !! options
9159 parsoid=wt2html
9160 !! wikitext
9161 #REDIRECT [[Category%3AFoo]]
9162 !! html/parsoid
9163 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9164 !! end
9165
9166 !! test
9167 Redirect to category page
9168 !! wikitext
9169 #REDIRECT [[:Category:Foo]]
9170 !! html/parsoid
9171 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9172 !! end
9173
9174 !! test
9175 Redirect to image page (1)
9176 !! wikitext
9177 #REDIRECT [[File:Wiki.png]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9180 !! end
9181
9182 !! test
9183 Redirect to image page (2)
9184 !! wikitext
9185 #REDIRECT [[Image:Wiki.png]]
9186 !! html/parsoid
9187 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9188 !! end
9189
9190 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9191 # Next test confirms this.
9192 !! test
9193 Redirect to language (1) (T104918)
9194 !! options
9195 parsoid=wt2html,wt2wt,html2html
9196 !! wikitext
9197 #REDIRECT [[en:File:Wiki.png]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9200 !! end
9201
9202 !! test
9203 Redirect to language (2) (T104918)
9204 !! wikitext
9205 #REDIRECT [[:en:File:Wiki.png]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9208 !! end
9209
9210 !! test
9211 Redirect to interwiki (T104918)
9212 !! wikitext
9213 #REDIRECT [[meatball:File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Non-English #REDIRECT
9220 !! options
9221 language=is
9222 !! wikitext
9223 #TILVÍSUN [[Main Page]]
9224 !! html/parsoid
9225 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9226 !! end
9227
9228 !! test
9229 Redirect syntax under text isn't considered a redirect
9230 !! wikitext
9231 some text
9232 #redirect [[Main Page]]
9233 !! html/parsoid
9234 <p>some text</p>
9235 <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>
9236 !! end
9237
9238 !! test
9239 New redirect
9240 !! options
9241 parsoid=html2wt
9242 !! html/parsoid
9243 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9244 !! wikitext
9245 #REDIRECT [[Foo]]
9246 Foo
9247 !! end
9248
9249 !! test
9250 Redirect followed by block on the same line
9251 !! options
9252 parsoid=wt2html
9253 !! wikitext
9254 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9257 !! end
9258
9259 !! test
9260 Redirect followed by a newline
9261 !! wikitext
9262 #REDIRECT [[Main Page]]
9263 A newline
9264 !! html/parsoid
9265 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9266 <p>A newline</p>
9267 !! end
9268
9269 !! test
9270 Redirect followed by multiple newlines
9271 !! wikitext
9272 #REDIRECT [[Main Page]]
9273
9274
9275 A newline
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9278
9279 <p><br/>
9280 A newline</p>
9281 !! end
9282
9283 !! test
9284 Drop duplicate redirects
9285 !! options
9286 parsoid=html2wt
9287 !! html/parsoid
9288 <link rel="mw:PageProp/redirect" href="./Foo"/>
9289 <link rel="mw:PageProp/redirect" href="./Bar"/>
9290 <link rel="mw:PageProp/redirect" href="./Baz"/>
9291 !! wikitext
9292 #REDIRECT [[Foo]]
9293 !! end
9294
9295 ##
9296 ## XHTML tidiness
9297 ###
9298
9299 !! test
9300 <br> to <br />
9301 !! wikitext
9302 1<br>2<br />3
9303 !! html
9304 <p>1<br />2<br />3
9305 </p>
9306 !! end
9307
9308 !! test
9309 Broken br tag sanitization
9310 !! wikitext
9311 </br>
9312 !! html/php
9313 <p>&lt;/br&gt;
9314 </p>
9315 !! end
9316
9317 # TODO: Fix html2html mode (T53055)!
9318 !! test
9319 Parsoid: Broken br tag recognition
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 </br>
9324
9325 <br/ >
9326 !! html+tidy
9327 <p><br />
9328 </p><p><br />
9329 </p>
9330 !! end
9331
9332 !! test
9333 Incorrecly removing closing slashes from correctly formed XHTML
9334 !! wikitext
9335 <br style="clear:both;" />
9336 !! html
9337 <p><br style="clear:both;" />
9338 </p>
9339 !! end
9340
9341 !! test
9342 Failing to transform badly formed HTML into correct XHTML
9343 !! wikitext
9344 <br style="clear: left;">
9345 <br style="clear: right;">
9346 <br style="clear: both;">
9347 !! html
9348 <p><br style="clear: left;" />
9349 <br style="clear: right;" />
9350 <br style="clear: both;" />
9351 </p>
9352 !!end
9353
9354 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9355 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9356 !! test
9357 Handling html with a div self-closing tag
9358 !! wikitext
9359 <div title />
9360 <div title/>
9361 <div title/ >
9362 <div title=bar />
9363 <div title=bar/>
9364 <div title=bar/ >
9365 !! html/php
9366 <p>&lt;div title /&gt;
9367 &lt;div title/&gt;
9368 </p>
9369 <div>
9370 <p>&lt;div title=bar /&gt;
9371 &lt;div title=bar/&gt;
9372 </p>
9373 <div title="bar/"></div>
9374 </div>
9375
9376 !! html/parsoid
9377 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9378 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9379 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9380 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9381 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9382 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9383 !! end
9384
9385 !! test
9386 Handling html with a br self-closing tag
9387 !! wikitext
9388 <br title />
9389 <br title/>
9390 <br title/ >
9391 <br title=bar />
9392 <br title=bar/>
9393 <br title=bar/ >
9394 !! html/php
9395 <p><br title="" />
9396 <br title="" />
9397 <br />
9398 <br title="bar" />
9399 <br title="bar" />
9400 <br title="bar/" />
9401 </p>
9402 !! html/parsoid
9403 <p><br title="" />
9404 <br title="" />
9405 <br title="" />
9406 <br title="bar" />
9407 <br title="bar" />
9408 <br title="bar/" />
9409 </p>
9410 !! end
9411
9412 !! test
9413 Horizontal ruler (should it add that extra space?)
9414 !! wikitext
9415 <hr>
9416 <hr >
9417 foo <hr
9418 > bar
9419 !! html+tidy
9420 <hr />
9421 <hr /><p>
9422 foo </p><hr /><p> bar
9423 </p>
9424 !! end
9425
9426 !! test
9427 Horizontal ruler -- 4+ dashes render hr
9428 !! wikitext
9429 ----
9430 !! html
9431 <hr />
9432
9433 !! end
9434
9435 !! test
9436 Horizontal ruler -- eats additional dashes on the same line
9437 !! wikitext
9438 ---------
9439 !! html
9440 <hr />
9441
9442 !! end
9443
9444 !! test
9445 Horizontal ruler -- does not collapse dashes on consecutive lines
9446 !! wikitext
9447 ----
9448 ----
9449 !! html
9450 <hr />
9451 <hr />
9452
9453 !! end
9454
9455 !! test
9456 Horizontal ruler -- <4 dashes render as plain text
9457 !! wikitext
9458 ---
9459 !! html
9460 <p>---
9461 </p>
9462 !! end
9463
9464 !! test
9465 Horizontal ruler -- Supports content following dashes on same line
9466 !! wikitext
9467 ---- Foo
9468 !! html
9469 <hr /> Foo
9470
9471 !! html+tidy
9472 <hr /><p> Foo
9473 </p>
9474 !! end
9475
9476 ###
9477 ### Block-level elements
9478 ###
9479 !! test
9480 Common list
9481 !! wikitext
9482 *Common list
9483 *item 2
9484 *item 3
9485 !! html
9486 <ul><li>Common list</li>
9487 <li>item 2</li>
9488 <li>item 3</li></ul>
9489
9490 !! end
9491
9492 !! test
9493 Numbered list
9494 !! wikitext
9495 #Numbered list
9496 #item 2
9497 #item 3
9498 !! html
9499 <ol><li>Numbered list</li>
9500 <li>item 2</li>
9501 <li>item 3</li></ol>
9502
9503 !! end
9504
9505 !! test
9506 Mixed list
9507 !! wikitext
9508 *Mixed list
9509 *#with numbers
9510 **and bullets
9511 *#and numbers
9512 *bullets again
9513 **bullet level 2
9514 ***bullet level 3
9515 ***#Number on level 4
9516 **bullet level 2
9517 **#Number on level 3
9518 **#Number on level 3
9519 *#number level 2
9520 *Level 1
9521 ***Level 3
9522 #**Level 3, but ordered
9523 !! html
9524 <ul><li>Mixed list
9525 <ol><li>with numbers</li></ol>
9526 <ul><li>and bullets</li></ul>
9527 <ol><li>and numbers</li></ol></li>
9528 <li>bullets again
9529 <ul><li>bullet level 2
9530 <ul><li>bullet level 3
9531 <ol><li>Number on level 4</li></ol></li></ul></li>
9532 <li>bullet level 2
9533 <ol><li>Number on level 3</li>
9534 <li>Number on level 3</li></ol></li></ul>
9535 <ol><li>number level 2</li></ol></li>
9536 <li>Level 1
9537 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9538 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9539
9540 !! end
9541
9542 !! test
9543 1. Nested mixed wikitext and html list
9544 !! wikitext
9545 *hi
9546 *<ul><li>ho</li></ul>
9547 *hi
9548 **ho
9549 !! html/php
9550 <ul><li>hi</li>
9551 <li><ul><li>ho</li></ul></li>
9552 <li>hi
9553 <ul><li>ho</li></ul></li></ul>
9554
9555 !! html/parsoid
9556 <ul><li>hi</li>
9557 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9558 <li>hi
9559 <ul><li>ho</li></ul></li></ul>
9560 !! end
9561
9562 !! test
9563 2. Nested mixed wikitext and html list (incompatible)
9564 !! wikitext
9565 ;hi
9566 :{{echo|<li>ho</li>}}
9567 !! html/php
9568 <dl><dt>hi</dt>
9569 <dd><li>ho</li></dd></dl>
9570
9571 !! html/parsoid
9572 <dl><dt>hi</dt>
9573 <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>
9574 !! end
9575
9576 !! test
9577 Nested lists 1
9578 !! wikitext
9579 *foo
9580 **bar
9581 !! html
9582 <ul><li>foo
9583 <ul><li>bar</li></ul></li></ul>
9584
9585 !! end
9586
9587 !! test
9588 Nested lists 2
9589 !! wikitext
9590 **foo
9591 *bar
9592 !! html
9593 <ul><li><ul><li>foo</li></ul></li>
9594 <li>bar</li></ul>
9595
9596 !! end
9597
9598 !! test
9599 Nested lists 3 (first element empty)
9600 !! wikitext
9601 *
9602 **bar
9603 !! html
9604 <ul><li>
9605 <ul><li>bar</li></ul></li></ul>
9606
9607 !! end
9608
9609 !! test
9610 Nested lists 4 (first element empty)
9611 !! wikitext
9612 **
9613 *bar
9614 !! html
9615 <ul><li><ul><li></li></ul></li>
9616 <li>bar</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 Nested lists 5 (both elements empty)
9622 !! wikitext
9623 **
9624 *
9625 !! html
9626 <ul><li><ul><li></li></ul></li>
9627 <li></li></ul>
9628
9629 !! end
9630
9631 !! test
9632 Nested lists 6 (both elements empty)
9633 !! wikitext
9634 *
9635 **
9636 !! html
9637 <ul><li>
9638 <ul><li></li></ul></li></ul>
9639
9640 !! end
9641
9642 !! test
9643 Nested lists 7 (skip initial nesting levels)
9644 !! wikitext
9645 ***foo
9646 !! html
9647 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9648
9649 !! end
9650
9651 !! test
9652 Nested lists 8 (multiple nesting transitions)
9653 !! wikitext
9654 *foo
9655 ***bar
9656 **baz
9657 *boo
9658 !! html
9659 <ul><li>foo
9660 <ul><li><ul><li>bar</li></ul></li>
9661 <li>baz</li></ul></li>
9662 <li>boo</li></ul>
9663
9664 !! end
9665
9666 !! test
9667 Nested lists 9 (extension interaction)
9668 !! options
9669 parsoid
9670 !! wikitext
9671 *<references />
9672 !! html/parsoid
9673 <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>
9674 !! end
9675
9676 !! test
9677 1. Lists with start-of-line-transparent tokens before bullets: Comments
9678 !! wikitext
9679 *foo
9680 *<!--cmt-->bar
9681 <!--cmt-->*baz
9682 !! html
9683 <ul><li>foo</li>
9684 <li>bar</li>
9685 <li>baz</li></ul>
9686
9687 !! end
9688
9689 !! test
9690 2. Lists with start-of-line-transparent tokens before bullets: Template close
9691 !! wikitext
9692 *foo {{echo|bar
9693 }}*baz
9694 !! html
9695 <ul><li>foo bar</li>
9696 <li>baz</li></ul>
9697
9698 !! end
9699
9700 !! test
9701 List items are not parsed correctly following a <pre> block (T2785)
9702 !! wikitext
9703 *<pre>foo</pre>
9704 *<pre>bar</pre>
9705 *zar
9706 !! html/php
9707 <ul><li><pre>foo</pre></li>
9708 <li><pre>bar</pre></li>
9709 <li>zar</li></ul>
9710
9711 !! html/parsoid
9712 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9713 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9714 <li>zar</li></ul>
9715 !! end
9716
9717 # FIXME: Might benefit from a html/parsoid since this has a template
9718 !! test
9719 List items from template
9720 !! wikitext
9721
9722 {{inner list}}
9723 *item 2
9724
9725 *item 0
9726 {{inner list}}
9727 *item 2
9728
9729 *item 0
9730 *notSOL{{inner list}}
9731 *item 2
9732 !! html
9733 <ul><li>item 1</li>
9734 <li>item 2</li></ul>
9735 <ul><li>item 0</li>
9736 <li>item 1</li>
9737 <li>item 2</li></ul>
9738 <ul><li>item 0</li>
9739 <li>notSOL</li>
9740 <li>item 1</li>
9741 <li>item 2</li></ul>
9742
9743 !! end
9744
9745 !! test
9746 List interrupted by empty line or heading
9747 !! wikitext
9748 *foo
9749
9750 **bar
9751 ==A heading==
9752 *Another list item
9753 !! html
9754 <ul><li>foo</li></ul>
9755 <ul><li><ul><li>bar</li></ul></li></ul>
9756 <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>
9757 <ul><li>Another list item</li></ul>
9758
9759 !!end
9760
9761 !!test
9762 Multiple list tags generated by templates
9763 !! wikitext
9764 {{echo|<li>}}a
9765 {{echo|<li>}}b
9766 {{echo|<li>}}c
9767 !! html
9768 <li>a
9769 <li>b
9770 <li>c</li>
9771 </li>
9772 </li>
9773
9774 !! html+tidy
9775 <li>a
9776 </li><li>b
9777 </li><li>c
9778 </li>
9779 !!end
9780
9781 !!test
9782 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9783 !! wikitext
9784 *a
9785 <!--This line will NOT split the list-->
9786 *b
9787 <!--This line will NOT split the list either-->
9788 *c
9789 <!--foo--> <!----> <!--This line NOT split the list either-->
9790 *d
9791 !! html
9792 <ul><li>a</li>
9793 <li>b</li>
9794 <li>c</li>
9795 <li>d</li></ul>
9796
9797 !!end
9798
9799 !!test
9800 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9801 !! wikitext
9802 *a
9803 <!--This line will NOT split the list-->
9804 *b
9805 <!--This line will NOT split the list either-->
9806 *c
9807 <!--foo--> <!----> <!--This line NOT split the list
9808 either-->
9809 *d
9810 !! html
9811 <ul><li>a</li>
9812 <li>b</li>
9813 <li>c</li>
9814 <li>d</li></ul>
9815
9816 !!end
9817
9818 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9819 # That pass could possibly be removed.
9820 !!test
9821 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9822 !!options
9823 parsoid=wt2html,wt2wt
9824 !! wikitext
9825 *foo
9826 *<li>li-hack
9827 *{{echo|<li>templated li-hack}}
9828 *<!--foo--><li> unsupported li-hack with preceding comments
9829
9830 <ul>
9831 <li><li>not a li-hack
9832 </li>
9833 </ul>
9834 !! html+tidy
9835 <ul><li>foo</li>
9836 <li class="mw-empty-elt"></li><li>li-hack</li>
9837 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9838 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9839 <ul>
9840 <li class="mw-empty-elt"></li><li>not a li-hack
9841 </li>
9842 </ul>
9843 !! html/parsoid
9844 <ul><li> foo</li>
9845 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9846 <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>
9847 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9848
9849 <ul data-parsoid='{"stx":"html"}'>
9850 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9851 </li>
9852 </ul>
9853
9854 !!end
9855
9856 !! test
9857 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9858 !! options
9859 parsoid
9860 !! wikitext
9861 #foo
9862 ##bar
9863 *foo
9864 **bar
9865 :foo
9866 ::bar
9867 !! html
9868 <ol>
9869 <li>foo<ol>
9870 <li>bar</li>
9871 </ol></li>
9872 </ol><ul>
9873 <li>foo<ul>
9874 <li>bar</li>
9875 </ul></li>
9876 </ul><dl>
9877 <dd>foo<dl>
9878 <dd>bar</dd>
9879 </dl></dd>
9880 </dl>
9881 !! end
9882
9883 !! test
9884 Parsoid: Test of whitespace serialization with Templated bullets
9885 !! options
9886 parsoid
9887 !! wikitext
9888 * {{bullet}}
9889 !! html/parsoid
9890 <ul>
9891 <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>
9892 </ul>
9893 !! end
9894
9895 # ------------------------------------------------------------------------
9896 # The next set of tests are about Parsoid's ability to handle badly nested
9897 # tags (parse, minimize scope of fixup, and roundtrip back)
9898 # ------------------------------------------------------------------------
9899
9900 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9901 # Parsoid's list handling is more aware of block structure.
9902 !! test
9903 Unbalanced closing block tags break a list
9904 !! wikitext
9905 <div>
9906 *a</div><div>
9907 *b</div>
9908 !! html+tidy
9909 <div>
9910 <ul><li>a</li></ul></div><div>
9911 <li>b</li></div>
9912 !! html/parsoid
9913 <div><ul>
9914 <li>a</li>
9915 </ul></div>
9916 <div><ul>
9917 <li>b</li>
9918 </ul></div>
9919 !! end
9920
9921 !! test
9922 Unbalanced closing non-block tags don't break a list
9923 !! wikitext
9924 <span>
9925 *a</span><span>
9926 *b</span>
9927 !! html/php+tidy
9928 <p><span>
9929 </span></p>
9930 <ul><li>a<span></span></li>
9931 <li>b</li></ul>
9932 !! html/parsoid
9933 <span>
9934 <ul>
9935 <li>a<span></span></li>
9936 <li>b</li>
9937 </ul>
9938 </span>
9939 !! end
9940
9941 # Parsoid does some post-dom-building cleanup
9942 # which is why its output differs from Remex.
9943 !! test
9944 Unclosed formatting tags that straddle lists are closed and reopened
9945 !! options
9946 parsoid=wt2html,wt2wt,html2html
9947 !! wikitext
9948 #<s> a
9949 #b </s>
9950 !! html/php+tidy
9951 <ol><li><s> a</s></li><s>
9952 </s><li><s>b </s></li></ol>
9953 !! html/parsoid
9954 <ol><li><s> a</s></li>
9955 <li><s>b </s></li></ol>
9956 !! end
9957
9958 # Output is ugly because of all the misnested tag fixups.
9959 # Remex is wrapping p-tags around empty elements.
9960 # Parsoid has special-case handling of this pattern of
9961 # wrapping lists in formatting tags.
9962 # FIXME: Should we remove this code from Parsoid? Or add
9963 # special support in Remex? If the latter, maybe just wait
9964 # for Parsoid to become the default parser.
9965 # See T70395.
9966 !!test
9967 1. List embedded in a formatting tag
9968 !! wikitext
9969 <small>
9970 *foo
9971 </small>
9972 !! html/php+tidy
9973 <p><small>
9974 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
9975 </p>
9976 !! html/parsoid
9977 <small>
9978 <ul>
9979 <li>foo</li>
9980 </ul>
9981 </small>
9982 !!end
9983
9984 # Output is ugly because of all the misnested tag fixups
9985 # Remex is wrapping p-tags around empty elements.
9986 # Parsoid has code that strips useless p-tags.
9987 !!test
9988 2. List embedded in a formatting tag in a misnested way
9989 !! wikitext
9990 <small>
9991 *a
9992 *b</small>
9993 !! html/php+tidy
9994 <p><small>
9995 </small></p><small></small><ul><small><li>a</li>
9996 </small><li><small>b</small></li></ul>
9997 !! html/parsoid
9998 <small></small>
9999 <ul><small>
10000 <li>a</li>
10001 </small>
10002 <li><small>b</small></li>
10003 </ul>
10004 !!end
10005
10006 !! test
10007 Table with missing opening <tr> tag
10008 !! options
10009 parsoid=wt2html,wt2wt
10010 !! wikitext
10011 <table>
10012 <td>foo</td>
10013 </tr>
10014 </table>
10015 !! html+tidy
10016 <table>
10017 <tbody><tr><td>foo</td>
10018 </tr>
10019 </tbody></table>
10020 !! end
10021
10022 ###
10023 ### Magic Words
10024 ###
10025
10026 # Note that the current date is hard-coded as
10027 # 1970-01-01T00:02:03Z (a Thursday)
10028 # when running parser tests. The timezone is also fixed to GMT, so
10029 # local date will be identical to current date.
10030
10031 !! test
10032 Magic Word: {{CURRENTDAY}}
10033 !! wikitext
10034 {{CURRENTDAY}}
10035 !! html
10036 <p>1
10037 </p>
10038 !! end
10039
10040 !! test
10041 Magic Word: {{CURRENTDAY2}}
10042 !! wikitext
10043 {{CURRENTDAY2}}
10044 !! html
10045 <p>01
10046 </p>
10047 !! end
10048
10049 !! test
10050 Magic Word: {{CURRENTDAYNAME}}
10051 !! wikitext
10052 {{CURRENTDAYNAME}}
10053 !! html
10054 <p>Thursday
10055 </p>
10056 !! end
10057
10058 !! test
10059 Magic Word: {{CURRENTDOW}}
10060 !! wikitext
10061 {{CURRENTDOW}}
10062 !! html
10063 <p>4
10064 </p>
10065 !! end
10066
10067 !! test
10068 Magic Word: {{CURRENTMONTH}}
10069 !! wikitext
10070 {{CURRENTMONTH}}
10071 !! html
10072 <p>01
10073 </p>
10074 !! end
10075
10076 !! test
10077 Magic Word: {{CURRENTMONTH1}}
10078 !! wikitext
10079 {{CURRENTMONTH1}}
10080 !! html
10081 <p>1
10082 </p>
10083 !! end
10084
10085 !! test
10086 Magic Word: {{CURRENTMONTHABBREV}}
10087 !! wikitext
10088 {{CURRENTMONTHABBREV}}
10089 !! html
10090 <p>Jan
10091 </p>
10092 !! end
10093
10094 !! test
10095 Magic Word: {{CURRENTMONTHNAME}}
10096 !! wikitext
10097 {{CURRENTMONTHNAME}}
10098 !! html
10099 <p>January
10100 </p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{CURRENTMONTHNAMEGEN}}
10105 !! wikitext
10106 {{CURRENTMONTHNAMEGEN}}
10107 !! html
10108 <p>January
10109 </p>
10110 !! end
10111
10112 !! test
10113 Magic Word: {{CURRENTTIME}}
10114 !! wikitext
10115 {{CURRENTTIME}}
10116 !! html
10117 <p>00:02
10118 </p>
10119 !! end
10120
10121 !! test
10122 Magic Word: {{CURRENTHOUR}}
10123 !! wikitext
10124 {{CURRENTHOUR}}
10125 !! html
10126 <p>00
10127 </p>
10128 !! end
10129
10130 !! test
10131 Magic Word: {{CURRENTWEEK}} (T6594)
10132 !! wikitext
10133 {{CURRENTWEEK}}
10134 !! html
10135 <p>1
10136 </p>
10137 !! end
10138
10139 !! test
10140 Magic Word: {{CURRENTYEAR}}
10141 !! wikitext
10142 {{CURRENTYEAR}}
10143 !! html
10144 <p>1970
10145 </p>
10146 !! end
10147
10148 !! test
10149 Magic Word: {{CURRENTTIMESTAMP}}
10150 !! wikitext
10151 {{CURRENTTIMESTAMP}}
10152 !! html
10153 <p>19700101000203
10154 </p>
10155 !! end
10156
10157 !! test
10158 Magic Words LOCAL (UTC)
10159 !! wikitext
10160 *{{LOCALMONTH}}
10161 *{{LOCALMONTH1}}
10162 *{{LOCALMONTHNAME}}
10163 *{{LOCALMONTHNAMEGEN}}
10164 *{{LOCALMONTHABBREV}}
10165 *{{LOCALDAY}}
10166 *{{LOCALDAY2}}
10167 *{{LOCALDAYNAME}}
10168 *{{LOCALYEAR}}
10169 *{{LOCALTIME}}
10170 *{{LOCALHOUR}}
10171 *{{LOCALWEEK}}
10172 *{{LOCALDOW}}
10173 *{{LOCALTIMESTAMP}}
10174 !! html
10175 <ul><li>01</li>
10176 <li>1</li>
10177 <li>January</li>
10178 <li>January</li>
10179 <li>Jan</li>
10180 <li>1</li>
10181 <li>01</li>
10182 <li>Thursday</li>
10183 <li>1970</li>
10184 <li>00:02</li>
10185 <li>00</li>
10186 <li>1</li>
10187 <li>4</li>
10188 <li>19700101000203</li></ul>
10189
10190 !! end
10191
10192 !! test
10193 Magic Word: {{FULLPAGENAME}}
10194 !! options
10195 title=[[User:Ævar Arnfjörð Bjarmason]]
10196 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10197 !! wikitext
10198 {{FULLPAGENAME}}
10199 !! html/*
10200 <p>User:Ævar Arnfjörð Bjarmason
10201 </p>
10202 !! end
10203
10204 !! test
10205 Magic Word: {{FULLPAGENAMEE}}
10206 !! options
10207 title=[[User:Ævar Arnfjörð Bjarmason]]
10208 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10209 !! wikitext
10210 {{FULLPAGENAMEE}}
10211 !! html/*
10212 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10213 </p>
10214 !! end
10215
10216 !! test
10217 Magic Word: {{TALKSPACE}}
10218 !! options
10219 title=[[User:Ævar Arnfjörð Bjarmason]]
10220 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10221 !! wikitext
10222 {{TALKSPACE}}
10223 !! html/*
10224 <p>User talk
10225 </p>
10226 !! end
10227
10228 !! test
10229 Magic Word: {{TALKSPACE}}, same namespace
10230 !! options
10231 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10232 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10233 !! wikitext
10234 {{TALKSPACE}}
10235 !! html/*
10236 <p>User talk
10237 </p>
10238 !! end
10239
10240 !! test
10241 Magic Word: {{TALKSPACE}}, main namespace
10242 !! options
10243 title=[[Parser Test]]
10244 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10245 !! wikitext
10246 {{TALKSPACE}}
10247 !! html/*
10248 <p>Talk
10249 </p>
10250 !! end
10251
10252 !! test
10253 Magic Word: {{TALKSPACEE}}
10254 !! options
10255 title=[[User:Ævar Arnfjörð Bjarmason]]
10256 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10257 !! wikitext
10258 {{TALKSPACEE}}
10259 !! html/*
10260 <p>User_talk
10261 </p>
10262 !! end
10263
10264 !! test
10265 Magic Word: {{SUBJECTSPACE}}
10266 !! options
10267 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10268 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10269 !! wikitext
10270 {{SUBJECTSPACE}}
10271 !! html/*
10272 <p>User
10273 </p>
10274 !! end
10275
10276 !! test
10277 Magic Word: {{SUBJECTSPACE}}, same namespace
10278 !! options
10279 title=[[User:Ævar Arnfjörð Bjarmason]]
10280 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10281 !! wikitext
10282 {{SUBJECTSPACE}}
10283 !! html/*
10284 <p>User
10285 </p>
10286 !! end
10287
10288 !! test
10289 Magic Word: {{SUBJECTSPACE}}, main namespace
10290 !! options
10291 title=[[Parser Test]]
10292 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10293 !! wikitext
10294 {{SUBJECTSPACE}}
10295 !! html/*
10296
10297 !! end
10298
10299 !! test
10300 Magic Word: {{SUBJECTSPACEE}}
10301 !! options
10302 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10303 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10304 !! wikitext
10305 {{SUBJECTSPACEE}}
10306 !! html/*
10307 <p>User
10308 </p>
10309 !! end
10310
10311 !! test
10312 Magic Word: {{NAMESPACE}}
10313 !! options
10314 title=[[User:Ævar Arnfjörð Bjarmason]]
10315 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10316 !! wikitext
10317 {{NAMESPACE}}
10318 !! html/*
10319 <p>User
10320 </p>
10321 !! end
10322
10323 !! test
10324 Magic Word: {{NAMESPACEE}}
10325 !! options
10326 title=[[User:Ævar Arnfjörð Bjarmason]]
10327 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10328 !! wikitext
10329 {{NAMESPACEE}}
10330 !! html/*
10331 <p>User
10332 </p>
10333 !! end
10334
10335 !! test
10336 Magic Word: {{NAMESPACENUMBER}}
10337 !! options
10338 title=[[User:Ævar Arnfjörð Bjarmason]]
10339 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10340 !! wikitext
10341 {{NAMESPACENUMBER}}
10342 !! html/*
10343 <p>2
10344 </p>
10345 !! end
10346
10347 !! test
10348 Magic Word: {{SUBPAGENAME}}
10349 !! options
10350 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10351 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10352 !! wikitext
10353 {{SUBPAGENAME}}
10354 !! html/*
10355 <p>sub ö
10356 </p>
10357 !! end
10358
10359 !! test
10360 Magic Word: {{SUBPAGENAMEE}}
10361 !! options
10362 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10363 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10364 !! wikitext
10365 {{SUBPAGENAMEE}}
10366 !! html/*
10367 <p>sub_%C3%B6
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Word: {{ROOTPAGENAME}}
10373 !! options
10374 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10375 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10376 !! wikitext
10377 {{ROOTPAGENAME}}
10378 !! html/*
10379 <p>Ævar Arnfjörð Bjarmason
10380 </p>
10381 !! end
10382
10383 !! test
10384 Magic Word: {{ROOTPAGENAMEE}}
10385 !! options
10386 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10387 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10388 !! wikitext
10389 {{ROOTPAGENAMEE}}
10390 !! html/*
10391 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10392 </p>
10393 !! end
10394
10395 !! test
10396 Magic Word: {{BASEPAGENAME}}
10397 !! options
10398 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10399 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10400 !! wikitext
10401 {{BASEPAGENAME}}
10402 !! html/*
10403 <p>Ævar Arnfjörð Bjarmason
10404 </p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{BASEPAGENAMEE}}
10409 !! options
10410 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10411 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10412 !! wikitext
10413 {{BASEPAGENAMEE}}
10414 !! html/*
10415 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10416 </p>
10417 !! end
10418
10419 !! test
10420 Magic Word: {{TALKPAGENAME}}
10421 !! options
10422 title=[[User:Ævar Arnfjörð Bjarmason]]
10423 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10424 !! wikitext
10425 {{TALKPAGENAME}}
10426 !! html/*
10427 <p>User talk:Ævar Arnfjörð Bjarmason
10428 </p>
10429 !! end
10430
10431 !! test
10432 Magic Word: {{TALKPAGENAMEE}}
10433 !! options
10434 title=[[User:Ævar Arnfjörð Bjarmason]]
10435 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10436 !! wikitext
10437 {{TALKPAGENAMEE}}
10438 !! html/*
10439 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10440 </p>
10441 !! end
10442
10443 !! test
10444 Magic Word: {{SUBJECTPAGENAME}}
10445 !! options
10446 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{SUBJECTPAGENAME}}
10450 !! html/*
10451 <p>User:Ævar Arnfjörð Bjarmason
10452 </p>
10453 !! end
10454
10455 !! test
10456 Magic Word: {{SUBJECTPAGENAMEE}}
10457 !! options
10458 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{SUBJECTPAGENAMEE}}
10462 !! html/*
10463 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{NUMBEROFFILES}}
10469 !! options
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{NUMBEROFFILES}}
10473 !! html/*
10474 <p>7
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{PAGENAME}}
10480 !! options
10481 title=[[User:Ævar Arnfjörð Bjarmason]]
10482 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10483 !! wikitext
10484 {{PAGENAME}}
10485 !! html/*
10486 <p>Ævar Arnfjörð Bjarmason
10487 </p>
10488 !! end
10489
10490 !! test
10491 Magic Word: {{PAGENAME}} with metacharacters
10492 !! options
10493 title=[['foo & bar = baz']]
10494 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10495 !! wikitext
10496 ''{{PAGENAME}}''
10497 !! html+tidy
10498 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10499 </p>
10500 !! end
10501
10502 !! test
10503 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10504 !! options
10505 title=[[*RFC 1234 http://example.com/]]
10506 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10507 !! wikitext
10508 {{PAGENAME}}
10509 !! html+tidy
10510 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10511 </p>
10512 !! end
10513
10514 !! test
10515 Magic Word: {{PAGENAMEE}}
10516 !! options
10517 title=[[User:Ævar Arnfjörð Bjarmason]]
10518 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10519 !! wikitext
10520 {{PAGENAMEE}}
10521 !! html/*
10522 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10523 </p>
10524 !! end
10525
10526 !! test
10527 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10528 !! options
10529 title=[[*RFC 1234 http://example.com/]]
10530 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10531 !! wikitext
10532 {{PAGENAMEE}}
10533 !! html+tidy
10534 <p>&#42;RFC_1234_http&#58;//example.com/
10535 </p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{REVISIONID}}
10540 !! options
10541 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10542 showflags
10543 !! wikitext
10544 {{REVISIONID}}
10545 !! html/*
10546 <p>1337
10547 </p>
10548 flags=vary-revision-id
10549 !! end
10550
10551 !! test
10552 Magic Word: {{SCRIPTPATH}}
10553 !! options
10554 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10555 !! wikitext
10556 {{SCRIPTPATH}}
10557 !! html/*
10558
10559 !! end
10560
10561 !! test
10562 Magic Word: {{STYLEPATH}}
10563 !! options
10564 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10565 !! wikitext
10566 {{STYLEPATH}}
10567 !! html/*
10568 <p>/skins
10569 </p>
10570 !! end
10571
10572 !! test
10573 Magic Word: {{SERVER}}
10574 !! options
10575 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10576 !! wikitext
10577 {{SERVER}}
10578 !! html/*
10579 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10580 </p>
10581 !! end
10582
10583 !! test
10584 Magic Word: {{SERVERNAME}}
10585 !! options
10586 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10587 !! wikitext
10588 {{SERVERNAME}}
10589 !! html/*
10590 <p>example.org
10591 </p>
10592 !! end
10593
10594 !! test
10595 Magic Word: {{SITENAME}}
10596 !! options
10597 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10598 !! wikitext
10599 {{SITENAME}}
10600 !! html/*
10601 <p>MediaWiki
10602 </p>
10603 !! end
10604
10605 !! test
10606 Magic Word: {{PAGELANGUAGE}}
10607 !! options
10608 language=fr
10609 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10610 !! wikitext
10611 {{PAGELANGUAGE}}
10612 !! html/*
10613 <p>fr
10614 </p>
10615 !! end
10616
10617 !! test
10618 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10619 !! options
10620 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10621 !! wikitext
10622 {{PAGELANGUAGE}}
10623 !! html/*
10624 <p>en
10625 </p>
10626 !! end
10627
10628 !! test
10629 Case-sensitive magic words, when cased differently, should just be template transclusions
10630 !! wikitext
10631 {{CurrentMonth}}
10632 {{currentday}}
10633 {{cURreNTweEK}}
10634 {{currentHour}}
10635 !! html
10636 <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>
10637 <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>
10638 <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>
10639 <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>
10640 </p>
10641 !! end
10642
10643 !! test
10644 Case-insensitive magic words should still work with weird casing.
10645 !! wikitext
10646 {{sErVeRNaMe}}
10647 {{LCFirst:AOEU}}
10648 {{ucFIRST:aoeu}}
10649 {{SERver}}
10650 !! html
10651 <p>example.org
10652 aOEU
10653 Aoeu
10654 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10655 </p>
10656 !! end
10657
10658 # From plwiki:PLOS_ONE
10659 !! test
10660 Parsoid: Page property magic word with magic word contents
10661 !! wikitext
10662 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10663 !! html/parsoid
10664 <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>"}]]}'/>
10665 !! end
10666
10667 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10668 # But, this is a limitation of our representation and is documented in
10669 # TemplateHandler.js in processSpecialMagicWord
10670 !! test
10671 Parsoid: Template-generated DISPLAYTITLE
10672 !! wikitext
10673 {{{{echo|DISPLAYTITLE}}:Foo}}
10674 !! options
10675 showtitle
10676 !! config
10677 wgAllowDisplayTitle=true
10678 wgRestrictDisplayTitle=false
10679 !! html/php
10680 Foo
10681
10682 !! html/parsoid
10683 <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"}]]}'/>
10684 !! end
10685
10686 !! test
10687 Namespace 1 {{ns:1}}
10688 !! wikitext
10689 {{ns:1}}
10690 !! html
10691 <p>Talk
10692 </p>
10693 !! end
10694
10695 !! test
10696 Namespace 1 {{ns:01}}
10697 !! wikitext
10698 {{ns:01}}
10699 !! html
10700 <p>Talk
10701 </p>
10702 !! end
10703
10704 !! test
10705 Namespace 0 {{ns:0}} (T6783)
10706 !! wikitext
10707 {{ns:0}}
10708 !! html
10709
10710 !! end
10711
10712 !! test
10713 Namespace 0 {{ns:00}} (T6783)
10714 !! wikitext
10715 {{ns:00}}
10716 !! html
10717
10718 !! end
10719
10720 !! test
10721 Namespace -1 {{ns:-1}}
10722 !! wikitext
10723 {{ns:-1}}
10724 !! html
10725 <p>Special
10726 </p>
10727 !! end
10728
10729 !! test
10730 Namespace User {{ns:User}}
10731 !! wikitext
10732 {{ns:User}}
10733 !! html
10734 <p>User
10735 </p>
10736 !! end
10737
10738 !! test
10739 Namespace User talk {{ns:User_talk}}
10740 !! wikitext
10741 {{ns:User_talk}}
10742 !! html
10743 <p>User talk
10744 </p>
10745 !! end
10746
10747 !! test
10748 Namespace User talk {{ns:uSeR tAlK}}
10749 !! wikitext
10750 {{ns:uSeR tAlK}}
10751 !! html
10752 <p>User talk
10753 </p>
10754 !! end
10755
10756 !! test
10757 Namespace File {{ns:File}}
10758 !! wikitext
10759 {{ns:File}}
10760 !! html
10761 <p>File
10762 </p>
10763 !! end
10764
10765 !! test
10766 Namespace File {{ns:Image}}
10767 !! wikitext
10768 {{ns:Image}}
10769 !! html
10770 <p>File
10771 </p>
10772 !! end
10773
10774 !! test
10775 Namespace (lang=de) Benutzer {{ns:User}}
10776 !! options
10777 language=de
10778 !! wikitext
10779 {{ns:User}}
10780 !! html
10781 <p>Benutzer
10782 </p>
10783 !! end
10784
10785 !! test
10786 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10787 !! options
10788 language=de
10789 !! wikitext
10790 {{ns:3}}
10791 !! html
10792 <p>Benutzer Diskussion
10793 </p>
10794 !! end
10795
10796 !! test
10797 Urlencode
10798 !! wikitext
10799 {{urlencode:hi world?!}}
10800 {{urlencode:hi world?!|WIKI}}
10801 {{urlencode:hi world?!|PATH}}
10802 {{urlencode:hi world?!|QUERY}}
10803 !! html/php
10804 <p>hi+world%3F%21
10805 hi_world%3F!
10806 hi%20world%3F%21
10807 hi+world%3F%21
10808 </p>
10809 !! end
10810
10811 !! test
10812 Magic Word: prioritize type info over data-parsoid
10813 !! options
10814 parsoid=html2wt
10815 !! html/parsoid
10816 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10817 !! wikitext
10818 __FORCETOC__
10819 !! end
10820
10821 !! test
10822 Magic Word: serialize on separate line (parsoid)
10823 !! options
10824 parsoid=wt2wt,html2wt
10825 !! wikitext
10826 foo
10827 __NOTOC__
10828 bar
10829 !! html/parsoid
10830 foo<meta property="mw:PageProp/notoc"/>bar
10831 !! end
10832
10833 !! test
10834 Magic Word: rt non-english wikis
10835 !! options
10836 parsoid=wt2wt
10837 language=de
10838 !! wikitext
10839 __NOEDITSECTION__
10840 !! html/parsoid
10841 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10842 !! end
10843
10844 !!test
10845 __proto__ is treated as normal wikitext (T105997)
10846 !!wikitext
10847 __proto__
10848 !!html
10849 <p>__proto__
10850 </p>
10851 !!end
10852
10853 ###
10854 ### Magic links
10855 ###
10856 !! test
10857 Magic links: internal link to RFC (T2479)
10858 !! wikitext
10859 [[RFC 123]]
10860 !! html/php
10861 <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>
10862 </p>
10863 !! html/parsoid
10864 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10865 !! end
10866
10867 !! test
10868 Magic links: RFC (T2479)
10869 !! wikitext
10870 RFC 822
10871 !! html/php
10872 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10873 </p>
10874 !! html/parsoid
10875 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10876 !! end
10877
10878 !! test
10879 Magic links: RFC (T67278)
10880 !! wikitext
10881 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10882 !! html/php
10883 <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.
10884 </p>
10885 !! html/parsoid
10886 <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>
10887 !! end
10888
10889 !! test
10890 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10891 !! wikitext
10892 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10893 RFC
10894 822
10895 !! html/php
10896 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10897 RFC
10898 822
10899 </p>
10900 !! html/parsoid
10901 <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>
10902 RFC
10903 822</p>
10904 !! end
10905
10906 !! test
10907 Magic links: ISBN (T3937)
10908 !! wikitext
10909 ISBN 0-306-40615-2
10910 !! html/php
10911 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10912 </p>
10913 !! html/parsoid
10914 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10915 !! end
10916
10917 !! test
10918 Magic links: ISBN (T67278)
10919 !! wikitext
10920 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10921 !! html/php
10922 <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.
10923 </p>
10924 !! html/parsoid
10925 <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>
10926 !! end
10927
10928 !! test
10929 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10930 !! wikitext
10931 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10932 ISBN
10933 9780316098113
10934 ISBN 978
10935 0316098113
10936 !! html/php
10937 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10938 ISBN
10939 9780316098113
10940 ISBN 978
10941 0316098113
10942 </p>
10943 !! html/parsoid
10944 <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>
10945 ISBN
10946 9780316098113
10947 ISBN 978
10948 0316098113</p>
10949 !! end
10950
10951 !! test
10952 Magic links: PMID incorrectly converts space to underscore
10953 !! wikitext
10954 PMID 1234
10955 !! html/php
10956 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10957 </p>
10958 !! html/parsoid
10959 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10960 !! end
10961
10962 !! test
10963 Magic links: PMID (T67278)
10964 !! wikitext
10965 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10966 !! html/php
10967 <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.
10968 </p>
10969 !! html/parsoid
10970 <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>
10971 !! end
10972
10973 !! test
10974 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10975 !! wikitext
10976 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10977 PMID
10978 1234
10979 !! html/php
10980 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10981 PMID
10982 1234
10983 </p>
10984 !! html/parsoid
10985 <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>
10986 PMID
10987 1234</p>
10988 !! end
10989
10990 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10991 # since these are ExtLinkText, not MagicLinkText
10992 !! test
10993 Magic links: use appropriate serialization for "almost" magic links.
10994 !! wikitext
10995 X[[Special:BookSources/0978739256|foo]]
10996
10997 X[https://tools.ietf.org/html/rfc1234 foo]
10998 !! html/php
10999 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11000 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11001 </p>
11002 !! html/parsoid
11003 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11004 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11005 !! end
11006
11007 !! test
11008 Magic links: All disabled (T47942)
11009 !! options
11010 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11011 !! wikitext
11012 ISBN 0-306-40615-2
11013 PMID 1234
11014 RFC 4321
11015 !! html/php
11016 <p>ISBN 0-306-40615-2
11017 PMID 1234
11018 RFC 4321
11019 </p>
11020 !! end
11021
11022 ###
11023 ### Templates
11024 ####
11025
11026 !! test
11027 Nonexistent template
11028 !! wikitext
11029 {{thistemplatedoesnotexist}}
11030 !! html
11031 <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>
11032 </p>
11033 !! end
11034
11035 !! test
11036 Template with invalid target containing tags
11037 !! wikitext
11038 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11039 !! html
11040 <p>{{a<b>b</b>|foo|a=b|a = b}}
11041 </p>
11042 !! end
11043
11044 !! test
11045 Template with invalid target containing unclosed tag
11046 !! wikitext
11047 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11048 !! html
11049 <p>{{a<b>|foo|a=b|a = b}}</b>
11050 </p>
11051 !! end
11052
11053 !! test
11054 Template with invalid target containing wikilink
11055 !! wikitext
11056 {{[[Main Page]]}}
11057 !! html/php
11058 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11059 </p>
11060 !! html/parsoid
11061 <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>
11062 !! end
11063
11064 !! test
11065 Template with just whitespace in it, T70421
11066 !! wikitext
11067 {{echo|{{ }}}}
11068 !! html/parsoid
11069 <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>
11070 !! end
11071
11072 !! article
11073 Template:test
11074 !! text
11075 This is a test template
11076 !! endarticle
11077
11078 !! test
11079 Simple template
11080 !! wikitext
11081 {{test}}
11082 !! html
11083 <p>This is a test template
11084 </p>
11085 !! end
11086
11087 !! test
11088 Template with explicit namespace
11089 !! wikitext
11090 {{Template:test}}
11091 !! html
11092 <p>This is a test template
11093 </p>
11094 !! end
11095
11096
11097 !! article
11098 Template:paramtest
11099 !! text
11100 This is a test template with parameter {{{param}}}
11101 !! endarticle
11102
11103 !! test
11104 Template parameter
11105 !! wikitext
11106 {{paramtest|param=foo}}
11107 !! html
11108 <p>This is a test template with parameter foo
11109 </p>
11110 !! end
11111
11112 !! article
11113 Template:paramtestnum
11114 !! text
11115 [[{{{1}}}|{{{2}}}]]
11116 !! endarticle
11117
11118 !! test
11119 Template unnamed parameter
11120 !! wikitext
11121 {{paramtestnum|Main Page|the main page}}
11122 !! html
11123 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11124 </p>
11125 !! end
11126
11127 !! article
11128 Template:templatesimple
11129 !! text
11130 (test)
11131 !! endarticle
11132
11133 !! article
11134 Template:templateredirect
11135 !! text
11136 #redirect [[Template:templatesimple]]
11137 !! endarticle
11138
11139 !! article
11140 Template:templateasargtestnum
11141 !! text
11142 {{{{{1}}}}}
11143 !! endarticle
11144
11145 !! article
11146 Template:templateasargtest
11147 !! text
11148 {{template{{{templ}}}}}
11149 !! endarticle
11150
11151 !! article
11152 Template:templateasargtest2
11153 !! text
11154 {{{{{templ}}}}}
11155 !! endarticle
11156
11157 !! test
11158 Template with template name as unnamed argument
11159 !! wikitext
11160 {{templateasargtestnum|templatesimple}}
11161 !! html
11162 <p>(test)
11163 </p>
11164 !! end
11165
11166 !! test
11167 Template with template name as argument
11168 !! wikitext
11169 {{templateasargtest|templ=simple}}
11170 !! html
11171 <p>(test)
11172 </p>
11173 !! end
11174
11175 !! test
11176 Template with template name as argument (2)
11177 !! wikitext
11178 {{templateasargtest2|templ=templatesimple}}
11179 !! html
11180 <p>(test)
11181 </p>
11182 !! end
11183
11184 !! article
11185 Template:templateasargtestdefault
11186 !! text
11187 {{{{{templ|templatesimple}}}}}
11188 !! endarticle
11189
11190 !! article
11191 Template:templa
11192 !! text
11193 '''templ'''
11194 !! endarticle
11195
11196 !! test
11197 Template with default value
11198 !! wikitext
11199 {{templateasargtestdefault}}
11200 !! html
11201 <p>(test)
11202 </p>
11203 !! end
11204
11205 !! test
11206 Template with default value (value set)
11207 !! wikitext
11208 {{templateasargtestdefault|templ=templa}}
11209 !! html
11210 <p><b>templ</b>
11211 </p>
11212 !! end
11213
11214 !! test
11215 Template redirect
11216 !! wikitext
11217 {{templateredirect}}
11218 !! html/php
11219 <p>(test)
11220 </p>
11221 !! html/parsoid
11222 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11223 !! end
11224
11225 !! test
11226 Template with argument in separate line
11227 !! wikitext
11228 {{ templateasargtest |
11229 templ = simple }}
11230 !! html
11231 <p>(test)
11232 </p>
11233 !! end
11234
11235 !! test
11236 Template with complex template as argument
11237 !! wikitext
11238 {{paramtest|
11239 param ={{ templateasargtest |
11240 templ = simple }}}}
11241 !! html
11242 <p>This is a test template with parameter (test)
11243 </p>
11244 !! end
11245
11246 !! test
11247 Templates with templated name
11248 !! wikitext
11249 {{{{echo|echo}}|foo}}
11250 {{{{echo|inner list}} }}
11251 !! html
11252 <p>foo
11253 </p>
11254 <ul><li>item 1</li></ul>
11255
11256 !! html/parsoid
11257 <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>
11258 <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>
11259 !! end
11260
11261 ## Regression test; the output here isn't really that interesting.
11262 !! test
11263 Templates with templated name and top level template args
11264 !! wikitext
11265 {{1{{2{{{3}}}|4=5}}}}
11266 !! html/parsoid
11267 <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>
11268 !! end
11269
11270 # Parsoid markup is deliberate "broken". This is an edge case.
11271 # See long comment in TemplateHandler.js:convertAttribsToString.
11272 !! test
11273 Templates with invalid templated targets
11274 !! wikitext
11275 {{echo
11276 {{echo|foo}}
11277 }}
11278 !! html/php
11279 <p>{{echo
11280 foo
11281 }}
11282 </p>
11283 !! html/parsoid
11284 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11285 foo }}</p>
11286 !! end
11287
11288 !! test
11289 Template with thumb image (with link in description)
11290 !! wikitext
11291 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11292 !! html/php
11293 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>
11294
11295 !! html+tidy
11296 <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>
11297 !! html/parsoid
11298 <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>
11299 !! end
11300
11301 !! article
11302 Template:complextemplate
11303 !! text
11304 {{{1}}} {{paramtest|
11305 param ={{{param}}}}}
11306 !! endarticle
11307
11308 !! test
11309 Template with complex arguments
11310 !! wikitext
11311 {{complextemplate|
11312 param ={{ templateasargtest |
11313 templ = simple }}|[[Template:complextemplate|link]]}}
11314 !! html
11315 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11316 </p>
11317 !! end
11318
11319 !! test
11320 T2553: link with two variables in a piped link
11321 !! wikitext
11322 {|
11323 |[[{{{1}}}|{{{2}}}]]
11324 |}
11325 !! html/php
11326 <table>
11327 <tr>
11328 <td>[[{{{1}}}|{{{2}}}]]
11329 </td></tr></table>
11330
11331 !! html/parsoid
11332 <table>
11333 <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>
11334 </tbody></table>
11335 !! end
11336
11337 # See: T2553
11338 !! test
11339 Abort table cell attribute parsing on wikilink
11340 !! wikitext
11341 {|
11342 |testing [[one|two]] |three||four
11343 |testing one two |three||four
11344 |testing="[[one|two]]" |three||four
11345 |}
11346 !! html/php
11347 <table>
11348 <tr>
11349 <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>
11350 <td>four
11351 </td>
11352 <td>three</td>
11353 <td>four
11354 </td>
11355 <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>
11356 <td>four
11357 </td></tr></table>
11358
11359 !! html/parsoid
11360 <table>
11361 <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>
11362 <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>
11363 <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>
11364 </tbody></table>
11365 !! end
11366
11367 !! test
11368 Don't abort table cell attribute parsing if wikilink is found in template arg
11369 !! wikitext
11370 {|
11371 |Test {{#tag:ref|One two "[[three]]" four}}
11372 |}
11373 !! html/parsoid
11374 <table>
11375 <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>
11376 </tbody></table>
11377 !! end
11378
11379 !! test
11380 Magic variable as template parameter
11381 !! wikitext
11382 {{paramtest|param={{SITENAME}}}}
11383 !! html
11384 <p>This is a test template with parameter MediaWiki
11385 </p>
11386 !! end
11387
11388 !! article
11389 Template:linktest
11390 !! text
11391 [[{{{param}}}|link]]
11392 !! endarticle
11393
11394 !! test
11395 Template parameter as link source
11396 !! wikitext
11397 {{linktest|param=Main Page}}
11398 !! html
11399 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11400 </p>
11401 !! end
11402
11403 !!article
11404 Template:paramtest2
11405 !! text
11406 including another template, {{paramtest|param={{{arg}}}}}
11407 !! endarticle
11408
11409 !! test
11410 Template passing argument to another template
11411 !! wikitext
11412 {{paramtest2|arg='hmm'}}
11413 !! html
11414 <p>including another template, This is a test template with parameter 'hmm'
11415 </p>
11416 !! end
11417
11418 !! article
11419 Template:Linktest2
11420 !! text
11421 Main Page
11422 !! endarticle
11423
11424 !! test
11425 Template as link source
11426 !! wikitext
11427 [[{{linktest2}}]]
11428
11429 [[{{linktest2}}|Main Page]]
11430
11431 [[{{linktest2}}]]Page
11432 !! html
11433 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11434 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11435 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11436 </p>
11437 !! end
11438
11439
11440 !! article
11441 Template:loop1
11442 !! text
11443 {{loop2}}
11444 !! endarticle
11445
11446 !! article
11447 Template:loop2
11448 !! text
11449 {{loop1}}
11450 !! endarticle
11451
11452 !! test
11453 Template infinite loop
11454 !! wikitext
11455 {{loop1}}
11456 !! html
11457 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11458 </p>
11459 !! end
11460
11461 !! test
11462 Template from main namespace
11463 !! wikitext
11464 {{:Main Page}}
11465 !! html
11466 <p>blah blah
11467 </p>
11468 !! end
11469
11470 !! article
11471 Template:table
11472 !! text
11473 {|
11474 | 1 || 2
11475 |-
11476 | 3 || 4
11477 |}
11478 !! endarticle
11479
11480 !! test
11481 T2529: Template with table, not included at beginning of line
11482 !! wikitext
11483 foo {{table}}
11484 !! html
11485 <p>foo
11486 </p>
11487 <table>
11488 <tr>
11489 <td>1</td>
11490 <td>2
11491 </td></tr>
11492 <tr>
11493 <td>3</td>
11494 <td>4
11495 </td></tr></table>
11496
11497 !! end
11498
11499 !! test
11500 T2523: Template shouldn't eat newline (or add an extra one before table)
11501 !! wikitext
11502 foo
11503 {{table}}
11504 !! html
11505 <p>foo
11506 </p>
11507 <table>
11508 <tr>
11509 <td>1</td>
11510 <td>2
11511 </td></tr>
11512 <tr>
11513 <td>3</td>
11514 <td>4
11515 </td></tr></table>
11516
11517 !! end
11518
11519 !! test
11520 T2041: Template parameters shown as broken links
11521 !! wikitext
11522 {{{parameter}}}
11523 !! html
11524 <p>{{{parameter}}}
11525 </p>
11526 !! end
11527
11528 !! test
11529 Template with targets containing wikilinks
11530 !! options
11531 parsoid=wt2html
11532 !! wikitext
11533 {{[[foo]]}}
11534
11535 {{[[{{echo|foo}}]]}}
11536
11537 {{{{echo|[[foo}}]]}}
11538 !! html/php
11539 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11540 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11541 </p><p>{{[[foo}}]]
11542 </p>
11543 !! html/parsoid
11544 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11545 <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>
11546 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11547 !! end
11548
11549 !! article
11550 Template:''
11551 !! text
11552 bar
11553 !! endarticle
11554
11555 !! test
11556 Templates: Double quotes as template target
11557 !! wikitext
11558 foo {{''}} baz
11559 !! html/php
11560 <p>foo bar baz
11561 </p>
11562 !! html/parsoid
11563 <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
11564 </p>
11565 !! end
11566
11567 ## This test is about making sure Parsoid's data-mw is well formed in the
11568 ## face of multiple templates with intersecting and overlapping ranges. The
11569 ## wikitext itself is wretched.
11570 !! test
11571 Templates with intersecting and overlapping ranges
11572 !! wikitext
11573 {|{{echo|
11574 <p>ha</p>}}
11575 {|{{echo|
11576 <p>ho</p>}}
11577 {{echo|{{!}}hi}}
11578 |}
11579 !! html/php+tidy
11580 <p>ha</p><table>
11581
11582 </table><p>ho</p><table>
11583
11584 <tbody><tr>
11585 <td>hi
11586 </td></tr></tbody></table>
11587 !! html/parsoid
11588 <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":""}]]}'>
11589
11590 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11591
11592 <tbody><tr><td>hi</td></tr>
11593 </tbody></table>
11594 !! end
11595
11596 !! article
11597 Template:MSGNW test
11598 !! text
11599 ''None'' of '''this''' should be
11600 * interpreted
11601 but rather passed unmodified
11602 {{test}}
11603 <gallery>
11604 File:Foobar.jpg
11605 </gallery>
11606 <!-- comment -->
11607 !! endarticle
11608
11609 # hmm, fix this or just deprecate msgnw and document its behavior?
11610 !! test
11611 msgnw keyword
11612 !! wikitext
11613 {{msgnw:MSGNW test}}
11614 !! html/php
11615 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11616 &#42; interpreted
11617 &#32;but rather passed unmodified
11618 &#123;&#123;test&#125;&#125;
11619 &#60;gallery&#62;
11620 File:Foobar.jpg
11621 &#60;/gallery&#62;
11622 &#60;!-- comment --&#62;
11623 </p>
11624 !! end
11625
11626 !! test
11627 int keyword
11628 !! wikitext
11629 {{int:youhavenewmessages|lots of money|not!}}
11630 !! html
11631 <p>You have lots of money (not!).
11632 </p>
11633 !! end
11634
11635 !! test
11636 int keyword - non-existing message
11637 !! wikitext
11638 {{int:var}}
11639 !! html
11640 <p>⧼var⧽
11641 </p>
11642 !! end
11643
11644 !! article
11645 Template:Includes
11646 !! text
11647 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11648 !! endarticle
11649
11650 !! test
11651 <includeonly> and <noinclude> being included
11652 !! wikitext
11653 {{Includes}}
11654 !! html
11655 <p>Foobar
11656 </p>
11657 !! end
11658
11659 !! article
11660 Template:Includes2
11661 !! text
11662 <onlyinclude>Foo</onlyinclude>bar
11663 !! endarticle
11664
11665 !! test
11666 <onlyinclude> being included
11667 !! wikitext
11668 {{Includes2}}
11669 !! html
11670 <p>Foo
11671 </p>
11672 !! end
11673
11674
11675 !! article
11676 Template:Includes3
11677 !! text
11678 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11679 !! endarticle
11680
11681 !! test
11682 <onlyinclude> and <includeonly> being included
11683 !! wikitext
11684 {{Includes3}}
11685 !! html
11686 <p>Foo
11687 </p>
11688 !! end
11689
11690 !! test
11691 <includeonly> and <noinclude> on a page
11692 !! wikitext
11693 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11694 !! html
11695 <p>Foozar
11696 </p>
11697 !! end
11698
11699 !! test
11700 Un-closed <noinclude>
11701 !! wikitext
11702 <noinclude>
11703 !! html
11704 !! end
11705
11706 !! test
11707 <onlyinclude> on a page
11708 !! wikitext
11709 <onlyinclude>Foo</onlyinclude>bar
11710 !! html
11711 <p>Foobar
11712 </p>
11713 !! end
11714
11715 !! test
11716 Un-closed <onlyinclude>
11717 !! wikitext
11718 <onlyinclude>
11719 !! html
11720 !! end
11721
11722 !!test
11723 Self-closed noinclude, includeonly, onlyinclude tags
11724 !! wikitext
11725 <noinclude />
11726 <includeonly />
11727 <onlyinclude />
11728 !! html
11729 <p><br />
11730 </p>
11731 !!end
11732
11733 !!test
11734 Unbalanced includeonly and noinclude tags
11735 !! wikitext
11736 {|
11737 |a</noinclude>
11738 |b</noinclude></noinclude>
11739 |c</noinclude></includeonly>
11740 |d</includeonly></includeonly>
11741 |}
11742 !! html
11743 <table>
11744 <tr>
11745 <td>a
11746 </td>
11747 <td>b
11748 </td>
11749 <td>c&lt;/includeonly&gt;
11750 </td>
11751 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11752 </td></tr></table>
11753
11754 !!end
11755
11756 !! article
11757 Template:Includeonly section
11758 !! text
11759 <includeonly>
11760 ==Includeonly section==
11761 </includeonly>
11762 ==Section T-1==
11763 !!endarticle
11764
11765 !! test
11766 T8563: Edit link generation for section shown by <includeonly>
11767 !! wikitext
11768 {{includeonly section}}
11769 !! html
11770 <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>
11771 <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>
11772
11773 !! end
11774
11775 # Uses same input as the contents of [[Template:Includeonly section]]
11776 !! test
11777 T8563: Section extraction for section shown by <includeonly>
11778 !! options
11779 section=T-2
11780 !! wikitext
11781 <includeonly>
11782 ==Includeonly section==
11783 </includeonly>
11784 ==Section T-2==
11785 !! html
11786 ==Section T-2==
11787 !! end
11788
11789 !! test
11790 T8563: Edit link generation for section suppressed by <includeonly>
11791 !! wikitext
11792 <includeonly>
11793 ==Includeonly section==
11794 </includeonly>
11795 ==Section 1==
11796 !! html
11797 <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>
11798
11799 !! end
11800
11801 !! test
11802 T8563: Section extraction for section suppressed by <includeonly>
11803 !! options
11804 section=1
11805 !! wikitext
11806 <includeonly>
11807 ==Includeonly section==
11808 </includeonly>
11809 ==Section 1==
11810 !! html
11811 ==Section 1==
11812 !! end
11813
11814 !! test
11815 Un-closed <includeonly>
11816 !! wikitext
11817 <includeonly>
11818 !! html/php
11819 !! html/parsoid
11820 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11821 !! end
11822
11823 ## We used to, but no longer wt2wt this test since the default serializer
11824 ## will normalize the include directives to serialize on their own line.
11825 ## Selser will take care of preserving formatting in scenarios where they
11826 ## intermingled with other wikitext.
11827 !! test
11828 Includes and comments at SOL
11829 !! options
11830 parsoid=wt2html,html2html
11831 !! wikitext
11832 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11833
11834 <noinclude>
11835 some
11836 </noinclude>*stuff
11837 *here
11838
11839 <includeonly>can have stuff</includeonly>===here===
11840
11841 !! html/php
11842 <h2><span class="mw-headline" id="hu">hu</span></h2>
11843 <p>some
11844 </p>
11845 <ul><li>stuff</li>
11846 <li>here</li></ul>
11847 <h3><span class="mw-headline" id="here">here</span></h3>
11848
11849 !! html/parsoid
11850 <!-- 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>
11851
11852 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11853 <p>some</p>
11854 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11855 <li>here</li></ul>
11856
11857 <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>
11858
11859 !! end
11860
11861 # TODO: test with DOM fragment reuse!
11862 !! test
11863 Parsoid: DOM fragment reuse
11864 !! options
11865 parsoid=wt2wt,wt2html
11866 !! wikitext
11867 a{{echo|b<table></table>c}}d
11868
11869 a{{echo|b
11870 <table></table>
11871 c}}d
11872
11873 {{echo|a
11874
11875 <table></table>
11876
11877 b}}
11878 !! html
11879 <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>
11880
11881 <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">
11882 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11883 </span><p about="#mwt2">cd</p>
11884
11885 <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">
11886
11887 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11888
11889 </span><p about="#mwt3">b</p>
11890 !! end
11891
11892 !! test
11893 Parsoid: Merge double tds (T52603)
11894 !! options
11895 parsoid
11896 !! wikitext
11897 {|
11898 |{{echo|{{!}} foo}}
11899 |}
11900 !! html
11901 <table><tbody>
11902 <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>
11903 </tbody></table>
11904 !! end
11905
11906 !! test
11907 Parsoid: Merge double tds in nested transclusion content (T52603)
11908 !! options
11909 parsoid
11910 !! wikitext
11911 {{echo|<div>}}
11912 {|
11913 |{{echo|{{!}} foo}}
11914 |}
11915 {{echo|</div>}}
11916 !! html
11917 <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}}]}'>
11918 <table><tbody>
11919 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11920 </tbody></table>
11921 </div>
11922 !! end
11923
11924 ###
11925 ### <includeonly> and <noinclude> in attributes
11926 ###
11927 !!test
11928 0. includeonly around the entire attribute
11929 !! wikitext
11930 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11931 !! html
11932 <p><span id="v2">bar</span>
11933 </p>
11934 !!end
11935
11936 !!test
11937 1. includeonly in html attr key
11938 !! wikitext
11939 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11940 !! html
11941 <p><span id="foo">bar</span>
11942 </p>
11943 !!end
11944
11945 !!test
11946 2. includeonly in html attr value
11947 !! wikitext
11948 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11949 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11950 !! html
11951 <p><span id="v1">bar</span>
11952 <span id="v1">bar</span>
11953 </p>
11954 !!end
11955
11956 !!test
11957 3. includeonly in part of an attr value
11958 !! wikitext
11959 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11960 !! html
11961 <p><span style="color:red;">bar</span>
11962 </p>
11963 !!end
11964
11965 !!test
11966 4. includeonly in table attributes
11967 !! wikitext
11968 {|
11969 |- <noinclude>
11970 |-
11971 |a
11972 </noinclude>
11973 |- <includeonly>
11974 |-
11975 |b
11976 </includeonly>
11977 |}
11978 !! html
11979 <table>
11980
11981
11982 <tr>
11983 <td>a
11984 </td></tr>
11985 </table>
11986
11987 !!end
11988
11989 ###
11990 ### Preprocessor precedence tests
11991 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11992 ###
11993 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11994 !! test
11995 Preprocessor precedence 1: link is rightmost opening
11996 !! options
11997 parsoid=wt2html
11998 !! wikitext
11999 {{[[Foo|bar}}]]
12000
12001 But close-brace is not a valid character in a link title:
12002 {{[[Foo}}|bar]]
12003
12004 However, we can still tell this was handled as a link in the preprocessor:
12005 {{echo|[[Foo}}|bar]]|bat}}
12006 !! html/php
12007 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12008 </p><p>But close-brace is not a valid character in a link title:
12009 {{[[Foo}}|bar]]
12010 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12011 [[Foo}}|bar]]
12012 </p>
12013 !! html/parsoid
12014 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12015 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12016 <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>
12017 !! end
12018
12019 !! test
12020 Preprocessor precedence 2: template is rightmost opening
12021 !! options
12022 language=zh
12023 !! wikitext
12024 -{{echo|foo}-}}-
12025 !! html/php
12026 <p>-foo}--
12027 </p>
12028 !! html/parsoid
12029 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12030 !! end
12031
12032 !! test
12033 Preprocessor precedence 3: language converter is rightmost opening
12034 !! options
12035 language=zh
12036 parsoid=wt2html
12037 !! wikitext
12038 {{echo|hi}}
12039
12040 {{-{R|echo|hi}}}-
12041
12042 [[-{R|raw]]}-
12043 !! html/php
12044 <p>hi
12045 </p><p>{{echo|hi}}
12046 </p><p>[[raw]]
12047 </p>
12048 !! html/parsoid
12049 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12050 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12051 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12052 !! end
12053
12054 !! test
12055 Preprocessor precedence 4: left-most angle bracket
12056 !! options
12057 language=zh
12058 !! wikitext
12059 <!--{raw}-->
12060 !! html/php
12061 !! html/parsoid
12062 <!--{raw}-->
12063 !! end
12064
12065 !! article
12066 Template:Precedence5
12067 !! text
12068 {{{{{1}}}}}
12069 !! endarticle
12070
12071 !! test
12072 Preprocessor precedence 5: tplarg takes precedence over template
12073 !! wikitext
12074 {{Precedence5|Bullet}}
12075 !! html/php
12076 <ul><li>Bar</li></ul>
12077
12078 !! html/parsoid
12079 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12080 !! end
12081
12082 !! test
12083 Preprocessor precedence 6: broken link is rightmost opening
12084 !! options
12085 parsoid=wt2html
12086 !! wikitext
12087 {{echo|[[Foo}}
12088
12089 {{echo|[[Foo|bar|bat=baz}}
12090 !! html/php
12091 <p>{{echo|[[Foo}}
12092 </p><p>{{echo|[[Foo|bar|bat=baz}}
12093 </p>
12094 !! html/parsoid
12095 <p>{{echo|[[Foo}}</p>
12096 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12097 !! end
12098
12099 # This next test exposes a difference between PHP and Parsoid:
12100 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12101 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12102 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12103 # outer `[[Foo` extends until the `y]]`
12104 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12105 # intermediate result (after template expansion), and link processing
12106 # happens on this intermediate result, which moves the wikilink
12107 # boundary leftward to `[[Foo|Bar]]`
12108 # 2b) Parsoid works in a single step, so it's going to keep the
12109 # wikilink as extending to the `y]]`
12110 # 3a) Then PHP does linktrail processing which slurps up the trailing
12111 # `xy` inside the link.
12112 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12113 # `z` inside the link.
12114 # This is "correct" behavior. Parsoid's basic worldview is that the
12115 # `]]` inside the template shouldn't be allowed to leak out to affect
12116 # the surrounding wikilink. PHP may match Parsoid (in the future)
12117 # if you use {{#balance}} (T114445).
12118
12119 !! test
12120 Preprocessor precedence 7: broken template is rightmost opening
12121 !! options
12122 parsoid=wt2html
12123 !! wikitext
12124 [[Foo|{{echo|Bar]]
12125
12126 [[Foo|{{echo|Bar]]-x}}-y]]-z
12127
12128 Careful: linktrails can move the end of the wikilink:
12129 [[Foo|{{echo|y']]a}}l]]l
12130 !! html/php
12131 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12132 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12133 </p><p>Careful: linktrails can move the end of the wikilink:
12134 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12135 </p>
12136 !! html/parsoid
12137 <p>[[Foo|{{echo|Bar]]</p>
12138 <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>
12139 <p>Careful: linktrails can move the end of the wikilink:
12140 <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>
12141 !! end
12142
12143 !! test
12144 Preprocessor precedence 8: broken language converter is rightmost opening
12145 !! options
12146 language=zh
12147 !! wikitext
12148 [[Foo-{R|raw]]
12149 !! html
12150 <p>[[Foo-{R|raw]]
12151 </p>
12152 !! end
12153
12154 !! article
12155 Template:Preprocessor_precedence_9
12156 !! text
12157 ;4: {{{{1}}}}
12158 ;5: {{{{{2}}}}}
12159 ;6: {{{{{{3}}}}}}
12160 ;7: {{{{{{{4}}}}}}}
12161 !! endarticle
12162
12163 !! test
12164 Preprocessor precedence 9: groups of braces
12165 !! wikitext
12166 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12167 !! html/php
12168 <dl><dt>4</dt>
12169 <dd>{Four}</dd>
12170 <dt>5</dt>
12171 <dd></dd></dl>
12172 <ul><li>Bar</li></ul>
12173 <dl><dt>6</dt>
12174 <dd>Four</dd>
12175 <dt>7</dt>
12176 <dd>{Bullet}</dd></dl>
12177
12178 !! html/parsoid
12179 <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}}]}'>
12180 <dt>4</dt>
12181 <dd>{Four}</dd>
12182 <dt>5</dt>
12183 <dd></dd>
12184 </dl><ul about="#mwt1">
12185 <li>Bar</li>
12186 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12187 <dt>6</dt>
12188 <dd>Four</dd>
12189 <dt>7</dt>
12190 <dd>{Bullet}</dd>
12191 </dl>
12192 !! end
12193
12194 !! article
12195 Template:Preprocessor_precedence_10
12196 !! text
12197 ;1: -{R|raw}-
12198 ;2: -{{Bullet}}-
12199 ;3: -{{{1}}}-
12200 ;4: -{{{{2}}}}-
12201 ;5: -{{{{{3}}}}}-
12202 ;6: -{{{{{{4}}}}}}-
12203 ;7: -{{{{{{{5}}}}}}}-
12204 !! endarticle
12205
12206 !! test
12207 Preprocessor precedence 10: groups of braces with leading dash
12208 !! options
12209 language=zh
12210 !! wikitext
12211 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12212 !! html/php
12213 <dl><dt>1</dt>
12214 <dd>raw</dd>
12215 <dt>2</dt>
12216 <dd>-</dd></dl>
12217 <ul><li>Bar-</li></ul>
12218 <dl><dt>3</dt>
12219 <dd>-Three-</dd>
12220 <dt>4</dt>
12221 <dd>raw2</dd>
12222 <dt>5</dt>
12223 <dd>-</dd></dl>
12224 <ul><li>Bar-</li></ul>
12225 <dl><dt>6</dt>
12226 <dd>-Three-</dd>
12227 <dt>7</dt>
12228 <dd>raw2</dd></dl>
12229
12230 !! html/parsoid
12231 <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}}]}'>
12232 <dt>1</dt>
12233 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12234 <dt>2</dt>
12235 <dd>-</dd>
12236 </dl><ul about="#mwt1">
12237 <li>Bar-</li>
12238 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12239 <dt>3</dt>
12240 <dd>-Three-</dd>
12241 <dt>4</dt>
12242 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12243 <dt>5</dt>
12244 <dd>-</dd>
12245 </dl><ul about="#mwt1">
12246 <li>Bar-</li>
12247 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12248 <dt>6</dt>
12249 <dd>-Three-</dd>
12250 <dt>7</dt>
12251 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12252 </dl>
12253 !! end
12254
12255 !! test
12256 Preprocessor precedence 11: found during visual diff testing
12257 !! wikitext
12258 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12259
12260 {{echo|-{{echo|-{{echo|x}}}}}}
12261
12262 {{echo|-{{echo|x}}}}
12263 !! html/php
12264 <p><span>-<span>-x</span></span>
12265 </p><p>--x
12266 </p><p>-x
12267 </p>
12268 !! html/parsoid
12269 <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>
12270
12271 <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>
12272
12273 <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>
12274 !! end
12275
12276 !! test
12277 Preprocessor precedence 12: broken language converter closed by brace.
12278 !! options
12279 parsoid=wt2html
12280 !! wikitext
12281 This form breaks the template, which is unfortunate:
12282 *{{echo|foo-{bar}bat}}
12283
12284 But if the broken language converter markup is inside an extension
12285 tag, nothing bad happens:
12286 *<nowiki>foo-{bar}bat</nowiki>
12287 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12288 *<pre>foo-{bar}bat</pre>
12289 *{{echo|<pre>foo-{bar}bat</pre>}}
12290
12291 <tag>foo-{bar}bat</tag>
12292 {{echo|<tag>foo-{bar}bat</tag>}}
12293
12294 !! html/php+tidy
12295 <p>This form breaks the template, which is unfortunate:
12296 </p>
12297 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12298 <p>But if the broken language converter markup is inside an extension
12299 tag, nothing bad happens:
12300 </p>
12301 <ul><li>foo-&#123;bar}bat</li>
12302 <li>foo-&#123;bar}bat</li>
12303 <li><pre>foo-{bar}bat</pre></li>
12304 <li><pre>foo-{bar}bat</pre></li></ul>
12305 <pre>'foo-{bar}bat'
12306 array (
12307 )
12308 </pre>
12309 <pre>'foo-{bar}bat'
12310 array (
12311 )
12312 </pre>
12313 !! html/parsoid
12314 <p>This form breaks the template, which is unfortunate:</p>
12315 <ul>
12316 <li>{{echo|foo-{bar}bat}}</li>
12317 </ul>
12318 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12319 <ul>
12320 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12321 <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>
12322 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12323 <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>
12324 </ul>
12325 <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>
12326 !! end
12327
12328 !! test
12329 Preprocessor precedence 13: broken language converter in external link
12330 !! options
12331 parsoid=wt2html
12332 !! wikitext
12333 *[http://example.com/-{foo Example in URL]
12334 *[http://example.com Example in -{link} description]
12335 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12336 !! html/php+tidy
12337 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12338 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12339 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12340 !! html/parsoid
12341 <ul>
12342 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12343 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12344 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12345 </ul>
12346 !! end
12347
12348 !! test
12349 Preprocessor precedence 14: broken language converter in comment
12350 !! wikitext
12351 *<!--{{foo}}-->...should be ok
12352 *<!---{{foo}}-->...extra dashes
12353 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12354 !! html/php+tidy
12355 <ul><li>...should be ok</li>
12356 <li>...extra dashes</li>
12357 <li>foobat...should be ok</li></ul>
12358 !! html/parsoid
12359 <ul>
12360 <li><!--{{foo}}-->...should be ok</li>
12361 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12362 <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>
12363 </ul>
12364 !! end
12365
12366 !! test
12367 Preprocessor precedence 15: broken brace markup in headings
12368 !! config
12369 wgFragmentMode=[ 'html5', 'legacy' ]
12370 !! options
12371 parsoid=wt2html
12372 !! wikitext
12373 __NOTOC__ __NOEDITSECTION__
12374 ===1 foo[bar 1===
12375 1
12376 ===2 foo[[bar 2===
12377 2
12378 ===3 foo{bar 3===
12379 3
12380 ===4 foo{{bar 4===
12381 4
12382 ===5 foo{{{bar 5===
12383 5
12384 ===6 foo-{bar 6===
12385 6
12386 !! html/php+tidy
12387 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12388 <p>1
12389 </p>
12390 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12391 <p>2
12392 </p>
12393 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12394 <p>3
12395 </p>
12396 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12397 <p>4
12398 </p>
12399 <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>
12400 <p>5
12401 </p>
12402 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12403 <p>6
12404 </p>
12405 !! html/parsoid
12406 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12407 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12408 <p>1</p>
12409 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12410 <p>2</p>
12411 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12412 <p>3</p>
12413 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12414 <p>4</p>
12415 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12416 <p>5</p>
12417 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12418 <p>6</p>
12419 !! end
12420
12421 !! test
12422 Preprocessor precedence 16: matching closing braces to opening braces
12423 !! options
12424 language=zh
12425 parsoid=wt2html
12426 !! wikitext
12427 -{{{echo|foo}}bar}-
12428 !! html/php
12429 <p>foobar
12430 </p>
12431 !! html/parsoid
12432 <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>
12433 !! end
12434
12435 !! test
12436 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12437 !! options
12438 parsoid=wt2html
12439 !! wikitext
12440 {{echo|hi {{}}}}
12441 !! html/php
12442 <p>hi {{}}
12443 </p>
12444 !! html/parsoid
12445 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12446 !! end
12447
12448 ###
12449 ### Token Stream Patcher tests
12450 ###
12451 ### These tests won't always pass wt2wt and other modes because
12452 ### on serialization, the table will be output on a new line.
12453 ### For now, we are blacklisting them, and using this to test selser.
12454 ###
12455
12456 !!test
12457 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12458 !!options
12459 parsoid=wt2html,wt2wt
12460 !!wikitext
12461 {{echo|}}{| width = '100%'
12462 |foo
12463 |}
12464 !!html/parsoid
12465 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12466 <tbody><tr><td>foo</td></tr>
12467 </tbody></table>
12468 !!end
12469
12470 ## We used to, but no longer wt2wt this test since the default serializer
12471 ## will normalize the include directives to serialize on their own line.
12472 ## Selser will take care of preserving formatting in scenarios where they
12473 ## intermingled with other wikitext.
12474 !!test
12475 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12476 !!options
12477 parsoid=wt2html
12478 !!wikitext
12479 <includeonly>a</includeonly>{| {{{b}}}
12480 |c
12481 |}
12482 !!html/parsoid
12483 <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":""}]]}'>
12484 <tbody><tr><td>c</td></tr>
12485 </tbody></table>
12486 !!end
12487
12488 !! test
12489 Table wikitext syntax outside wiki-tables
12490 !! wikitext
12491 a
12492 |+ not a caption
12493 ! not a table heading
12494 |- not a table row
12495 | not a table cell
12496 | class="foo bar" | baz
12497 b
12498 |}
12499 |-
12500 c
12501 !! html
12502 <p>a
12503 |+ not a caption
12504 ! not a table heading
12505 |- not a table row
12506 | not a table cell
12507 | class="foo bar" | baz
12508 b
12509 |}
12510 |-
12511 c
12512 </p>
12513 !! end
12514
12515 ###
12516 ### Testing parsing of templates where a template arg
12517 ### has the same name as the template itself.
12518 ###
12519
12520 !! article
12521 Template:quote
12522 !! text
12523 {{{quote|{{{1}}}}}}
12524 !! endarticle
12525
12526 !!test
12527 Templates: Template Name/Arg clash: 1. Use of positional param
12528 !! wikitext
12529 {{quote|foo}}
12530 !! html
12531 <p>foo
12532 </p>
12533 !!end
12534
12535 !!test
12536 Templates: Template Name/Arg clash: 2. Use of named param
12537 !! wikitext
12538 {{quote|quote=foo}}
12539 !! html
12540 <p>foo
12541 </p>
12542 !!end
12543
12544 !!test
12545 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12546 !! wikitext
12547 {{quote|quote}}
12548 !! html
12549 <p>quote
12550 </p>
12551 !!end
12552
12553 ###
12554 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12555 ###
12556
12557 !!test
12558 Templates: 1. Simple use
12559 !! wikitext
12560 {{echo|Foo}}
12561 !! html
12562 <p>Foo
12563 </p>
12564 !!end
12565
12566 !!test
12567 Templates: 2. Inside a block tag
12568 !! wikitext
12569 <div>{{echo|Foo}}</div>
12570 <blockquote>{{echo|Foo}}</blockquote>
12571 !! html
12572 <div>Foo</div>
12573 <blockquote>Foo</blockquote>
12574
12575 !! html+tidy
12576 <div>Foo</div>
12577 <blockquote><p>Foo</p></blockquote>
12578 !!end
12579
12580 !!test
12581 Templates: P-wrapping: 1a. Templates on consecutive lines
12582 !! wikitext
12583 {{echo|Foo}}
12584 {{echo|bar}}
12585 !! html
12586 <p>Foo
12587 bar
12588 </p>
12589 !!end
12590
12591 !!test
12592 Templates: P-wrapping: 1b. Templates on consecutive lines
12593 !! wikitext
12594 Foo
12595
12596 {{echo|bar}}
12597 {{echo|baz}}
12598 !! html
12599 <p>Foo
12600 </p><p>bar
12601 baz
12602 </p>
12603 !!end
12604
12605 !!test
12606 Templates: P-wrapping: 1c. Templates on consecutive lines
12607 !! wikitext
12608 {{echo|Foo}}
12609 {{echo|bar}} <div>baz</div>
12610 !! html
12611 <p>Foo
12612 </p>
12613 bar <div>baz</div>
12614
12615 !! html+tidy
12616 <p>Foo
12617 </p><p>
12618 bar </p><div>baz</div>
12619 !! end
12620
12621 !!test
12622 Templates: P-wrapping: 1d. Template preceded by comment-only line
12623 !!options
12624 parsoid
12625 !! wikitext
12626 <!-- foo -->
12627 {{echo|Bar}}
12628 !! html
12629 <!-- foo -->
12630
12631 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12632 !!end
12633
12634 !!test
12635 Templates: Inline Text: 1. Multiple template uses
12636 !! wikitext
12637 {{echo|Foo}}bar{{echo|baz}}
12638 !! html
12639 <p>Foobarbaz
12640 </p>
12641 !!end
12642
12643 !!test
12644 Templates: Inline Text: 2. Back-to-back template uses
12645 !! wikitext
12646 {{echo|Foo}}{{echo|bar}}
12647 !! html
12648 <p>Foobar
12649 </p>
12650 !!end
12651
12652 !!test
12653 Templates: Block Tags: 1. Multiple template uses
12654 !! wikitext
12655 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12656 !! html
12657 <div>Foo</div><div>bar</div><div>baz</div>
12658
12659 !!end
12660
12661 !!test
12662 Templates: Block Tags: 2. Back-to-back template uses
12663 !! wikitext
12664 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12665 !! html
12666 <div>Foo</div><div>bar</div>
12667
12668 !!end
12669
12670 # This is an edge case relating to paragraph wrapping.
12671 !!test
12672 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12673 !! wikitext
12674 {{echo|a
12675 b</p>}}
12676 !! html/parsoid
12677 <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
12678 b</p>
12679 !!end
12680
12681 !!test
12682 Templates: Links: 1. Simple example
12683 !! wikitext
12684 {{echo|[[Foo|bar]]}}
12685 !! html
12686 <p><a href="/wiki/Foo" title="Foo">bar</a>
12687 </p>
12688 !!end
12689
12690 !!test
12691 Templates: Links: 2. Generation of link href
12692 !! wikitext
12693 [[{{echo|Foo}}|bar]]
12694 !! html
12695 <p><a href="/wiki/Foo" title="Foo">bar</a>
12696 </p>
12697 !!end
12698
12699 !!test
12700 Templates: Links: 3. Generation of part of a link href
12701 !! wikitext
12702 [[Fo{{echo|o}}|bar]]
12703
12704 [[Foo{{echo|bar}}]]
12705
12706 [[Foo{{echo|bar}}baz]]
12707
12708 [[Foo{{echo|bar}}|bar]]
12709
12710 [[:Foo{{echo|bar}}]]
12711
12712 [[:Foo{{echo|bar}}|bar]]
12713 !! html
12714 <p><a href="/wiki/Foo" title="Foo">bar</a>
12715 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12716 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12717 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12718 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12719 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12720 </p>
12721 !!end
12722
12723 !!test
12724 Templates: Links: 4. Multiple templates generating link href
12725 !! wikitext
12726 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12727 !! html
12728 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12729 </p>
12730 !!end
12731
12732 !!test
12733 Templates: Links: 5. Generation of link text
12734 !! wikitext
12735 [[Foo|{{echo|bar}}]]
12736 !! html
12737 <p><a href="/wiki/Foo" title="Foo">bar</a>
12738 </p>
12739 !!end
12740
12741 !!test
12742 Templates: Links: 5. Nested templates (only outermost template should be marked)
12743 !! wikitext
12744 {{echo|[[{{echo|Foo}}|bar]]}}
12745 !! html
12746 <p><a href="/wiki/Foo" title="Foo">bar</a>
12747 </p>
12748 !!end
12749
12750 !!test
12751 Templates: HTML Tag: 1. Generation of HTML attr. key
12752 !! wikitext
12753 <div {{echo|style}}="color:red;">foo</div>
12754 !! html
12755 <div style="color:red;">foo</div>
12756
12757 !!end
12758
12759 !!test
12760 Templates: HTML Tag: 2. Generation of HTML attr. value
12761 !! wikitext
12762 <div style={{echo|'color:red;'}}>foo</div>
12763 !! html
12764 <div style="color:red;">foo</div>
12765
12766 !!end
12767
12768 !!test
12769 Templates: HTML Tag: 3. Generation of HTML attr key and value
12770 !! wikitext
12771 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12772 !! html
12773 <div style="color:red;">foo</div>
12774
12775 !!end
12776
12777 !!test
12778 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12779 !! wikitext
12780 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12781 !! html
12782 <div title="This is a long title with just one piece templated">foo</div>
12783
12784 !!end
12785
12786 !!test
12787 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12788 !! wikitext
12789 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12790 !! html
12791 <div title="This is a long title with just one piece templated">foo</div>
12792
12793 !!end
12794
12795 !!test
12796 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12797 !! wikitext
12798 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12799 !! html
12800 <div title="This is a long title with just one piece templated">foo</div>
12801
12802 !!end
12803
12804 # SSS FIXME: While it is great we added support for all this,
12805 # do we want to make this part of the spec? Maybe we want to
12806 # deprecate this kind of usage in the future?
12807 !!test
12808 Templates: HTML Tag: 7. Generation of partial attribute key string
12809 !! wikitext
12810 <div st{{echo|yle}}="color:red;">foo</div>
12811 !! html
12812 <div style="color:red;">foo</div>
12813
12814 !!end
12815
12816 !! test
12817 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12818 !! wikitext
12819 <div {{echo|1=id="v1"}}>bar</div>
12820 !! html
12821 <div id="v1">bar</div>
12822
12823 !!end
12824
12825 !! test
12826 Templates: HTML Tag: 9. Multiple template-generated attributes
12827 !! wikitext
12828 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12829 !! html
12830 <div id="v1" title="foo">bar</div>
12831
12832 !!end
12833
12834 !! test
12835 Templates: Support for templates generating attributes and content
12836 !! wikitext
12837 {| {{mixed_attr_content_template}}
12838 |-
12839 |bar
12840 |}
12841 !! html/php
12842 <table style="color:red;" title="T48811">
12843
12844 <tr>
12845 <td>foo
12846 </td></tr>
12847 <tr>
12848 <td>bar
12849 </td></tr></table>
12850
12851 !! html/parsoid
12852 <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|}"]}'>
12853 <tbody><tr>
12854 <td>foo</td></tr>
12855 <tr>
12856 <td>bar</td></tr>
12857 </tbody></table>
12858 !!end
12859
12860 !! test
12861 1. Entities and nowikis inside templated attributes should be handled correctly
12862 !! wikitext
12863 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12864 !! html/php
12865 <div style="background:#f9f9f9;">foo</div>
12866
12867 !! html/parsoid
12868 <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>
12869 !! end
12870
12871 !! test
12872 2. Entities and nowikis inside templated attributes should be handled correctly
12873 !! wikitext
12874 {|
12875 |{{table_attribs_3}}
12876 |}
12877 !! html/php
12878 <table>
12879 <tr>
12880 <td style="background:#f9f9f9;">Foo
12881 </td></tr></table>
12882
12883 !! html/parsoid
12884 <table>
12885 <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>
12886 </tbody></table>
12887 !! end
12888
12889 !! test
12890 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12891 !! wikitext
12892 {{tbl-start}}
12893 |{{table_attribs_3}}
12894 {{tbl-end}}
12895 !! html/php
12896 <table>
12897 <tr>
12898 <td style="background:#f9f9f9;">Foo
12899 </td></tr></table>
12900
12901 !! html/parsoid
12902 <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}}]}'>
12903 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12904 </tbody></table>
12905 !! end
12906
12907 # T107622
12908 !! test
12909 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12910 !! wikitext
12911 {|
12912 |{{table_attribs_6}} hi
12913 |}
12914 !! html/php
12915 <table>
12916 <tr>
12917 <td style="background: red;">hi
12918 </td></tr></table>
12919
12920 !! html/parsoid
12921 <table>
12922 <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>
12923 </tbody></table>
12924 !! end
12925
12926 !!test
12927 Templates: HTML Tables: 1. Generating start of a HTML table
12928 !! wikitext
12929 {{echo|<table><tr><td>foo</td>}}</tr></table>
12930 !! html
12931 <table><tr><td>foo</td></tr></table>
12932
12933 !!end
12934
12935 !!test
12936 Templates: HTML Tables: 2a. Generating middle of a HTML table
12937 !! wikitext
12938 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12939 !! html
12940 <table><tr><td>foo</td></tr></table>
12941
12942 !!end
12943
12944 !!test
12945 Templates: HTML Tables: 2b. Generating middle of a HTML table
12946 !! wikitext
12947 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12948 !! html
12949 <table><tr><td>foo</td></tr></table>
12950
12951 !!end
12952
12953 !!test
12954 Templates: HTML Tables: 3. Generating end of a HTML table
12955 !! wikitext
12956 <table><tr>{{echo|<td>foo</td></tr></table>}}
12957 !! html
12958 <table><tr><td>foo</td></tr></table>
12959
12960 !!end
12961
12962 !!test
12963 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12964 !! wikitext
12965 {{echo|<table>}}<tr><td>foo</td></tr></table>
12966 !! html
12967 <table><tr><td>foo</td></tr></table>
12968
12969 !!end
12970
12971 !!test
12972 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12973 !! wikitext
12974 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12975 !! html
12976 <table><tr><td>foo</td></tr></table>
12977
12978 !!end
12979
12980 !!test
12981 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12982 !! wikitext
12983 <table><tr>{{echo|<td>}}foo</td></tr></table>
12984 !! html
12985 <table><tr><td>foo</td></tr></table>
12986
12987 !!end
12988
12989 !!test
12990 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12991 !! wikitext
12992 <table><tr><td>foo{{echo|</td>}}</tr></table>
12993 !! html
12994 <table><tr><td>foo</td></tr></table>
12995
12996 !!end
12997
12998 !!test
12999 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13000 !! wikitext
13001 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13002 !! html
13003 <table><tr><td>foo</td></tr></table>
13004
13005 !!end
13006
13007 !!test
13008 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13009 !! wikitext
13010 <table><tr><td>foo</td></tr>{{echo|</table>}}
13011 !! html
13012 <table><tr><td>foo</td></tr></table>
13013
13014 !!end
13015
13016 !!test
13017 Templates: HTML Tables: 5. Proper fostering of categories from inside
13018 !!options
13019 parsoid=wt2html,wt2wt
13020 !! wikitext
13021 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13022 <!--Two categories (T52330)-->
13023 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13024 !! html
13025 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13026 <!--Two categories (T52330)-->
13027 <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>
13028 !!end
13029
13030 !!test
13031 Templates: Wiki Tables: 1a. Fostering of entire template content
13032 !! wikitext
13033 {|
13034 {{echo|a}}
13035 |}
13036 !! html
13037 <table>
13038 a
13039 <tr><td></td></tr></table>
13040
13041 !! html+tidy
13042
13043 a
13044 <table><tbody><tr><td></td></tr></tbody></table>
13045 !! end
13046
13047 !!test
13048 Templates: Wiki Tables: 1b. Fostering of entire template content
13049 !! wikitext
13050 {|
13051 {{echo|<div>}}
13052 foo
13053 {{echo|</div>}}
13054 |}
13055 !! html
13056 <table>
13057 <div>
13058 <p>foo
13059 </p>
13060 </div>
13061 <tr><td></td></tr></table>
13062
13063 !! html/php+tidy
13064 <div>
13065 <p>foo
13066 </p>
13067 </div><table>
13068
13069 <tbody><tr><td></td></tr></tbody></table>
13070 !! html/parsoid
13071 <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|}"]}'>
13072 <p>foo</p>
13073 </div><table about="#mwt3">
13074
13075 </table>
13076 !! end
13077
13078 !!test
13079 Templates: Wiki Tables: 2. Fostering of partial template content
13080 !! wikitext
13081 {|
13082 {{echo|a
13083 <div>b</div>}}
13084 |}
13085 !! html
13086 <table>
13087 a
13088 <div>b</div>
13089 <tr><td></td></tr></table>
13090
13091 !! html/php+tidy
13092
13093 a
13094 <div>b</div><table>
13095 <tbody><tr><td></td></tr></tbody></table>
13096 !! html/parsoid
13097 <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">
13098
13099
13100 </table>
13101 !! end
13102
13103 !!test
13104 Templates: Wiki Tables: 3. td-content via multiple templates
13105 !! wikitext
13106 {|
13107 {{echo|{{pipe}}a}}{{echo|b}}
13108 |}
13109 !! html
13110 <table>
13111 <tr>
13112 <td>ab
13113 </td></tr></table>
13114
13115 !!end
13116
13117 !!test
13118 Templates: Wiki Tables: 4. Templated tags, no content
13119 !! wikitext
13120 {{tbl-start}}
13121 {{tbl-end}}
13122 !! html
13123 <table>
13124 <tr><td></td></tr></table>
13125
13126 !!end
13127
13128 !!test
13129 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13130 !! wikitext
13131 {{tbl-start}}
13132 |foo
13133 {{tbl-end}}
13134 !! html
13135 <table>
13136 <tr>
13137 <td>foo
13138 </td></tr></table>
13139
13140 !!end
13141
13142 !!test
13143 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13144 !! wikitext
13145 {{tbl-start}}
13146 {{!}}foo
13147 {{tbl-end}}
13148 !! html
13149 <table>
13150 <tr>
13151 <td>foo
13152 </td></tr></table>
13153
13154 !!end
13155
13156 ## This test case is very specific to Parsoid's internals
13157 ## and is hence only tested for Parsoid's code. Parsoid uses
13158 ## a <meta> marker tag for <ref> tags and they are expanded
13159 ## much later. We are verifying that this <meta> tag usage
13160 ## doesn't prevent foster parenting.
13161 !!test
13162 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13163 !!wikitext
13164 {{PartialTable}}<ref>foo</ref>
13165 |}
13166
13167 <references />
13168 !!html/parsoid
13169 <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">
13170 <tbody>
13171 </tbody></table>
13172
13173 <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>
13174 !!end
13175
13176 !! test
13177 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13178 !! wikitext
13179 {{echo|
13180 {{{!}}
13181 {{!}}-}}
13182 <onlyinclude>
13183 |foo
13184 </onlyinclude>
13185 {{!}}}
13186 !! html/parsoid
13187 <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{{!}}}"]}'>
13188 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13189 <tbody><tr>
13190
13191 <td>foo
13192 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13193 </tbody></table>
13194 !! end
13195
13196 !!test
13197 Templates: Lists: Multi-line list-items via templates
13198 !! wikitext
13199 *{{echo|a {{nonexistent|
13200 unused}}}}
13201 *{{echo|b {{nonexistent|
13202 unused}}}}
13203 !! html
13204 <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>
13205 <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>
13206
13207 !!end
13208
13209 !!test
13210 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13211 !! wikitext
13212 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13213 !! html
13214 <p><i>ab</i>c<i>d</i>e
13215 </p>
13216 !!end
13217
13218 !!test
13219 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13220 (PHP parser generates misnested html)
13221 !! wikitext
13222 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13223 !! html/parsoid
13224 <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>
13225 !!end
13226
13227 !!test
13228 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13229 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13230 !! options
13231 parsoid=wt2html,wt2wt
13232 !! wikitext
13233 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13234 !! html
13235 <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>
13236 <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>
13237 <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>
13238 !!end
13239
13240 !!test
13241 Templates: Ugly nesting: 4. Divs opened/closed across templates
13242 !! wikitext
13243 a<div>b{{echo|c</div>d}}e
13244 !! html
13245 a<div>bc</div>de
13246
13247 !! html+tidy
13248 <p>a</p><div>bc</div><p>de
13249 </p>
13250 !! end
13251
13252 !! test
13253 Templates: Ugly templates: 3. newline-only template parameter
13254 !! wikitext
13255 foo {{echo|
13256 }}
13257 !! html
13258 <p>foo
13259 </p>
13260 !! end
13261
13262 # This looks like a bug: a single newline triggers p/br for some reason.
13263 !! test
13264 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13265 !! wikitext
13266 {{echo|
13267 }}
13268 !! html
13269 <p><br />
13270 </p>
13271 !! end
13272
13273 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13274 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13275 !! test
13276 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13277 !! wikitext
13278 {{echo|<table>}}
13279 {{echo|<div>foo}}
13280 {{echo|</table>}}
13281 !! html/parsoid
13282 <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
13283 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13284 </table>
13285 !! end
13286
13287 # T66017 -- ugly wikitext with fostered content generates two template ranges
13288 # that are "identical" and generate nesting cycles in the algorithm
13289 !! test
13290 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13291 !! wikitext
13292 {{echo|<table><tr><td><table>}}
13293 {{echo|<div>}}
13294 {{echo|</div>}}
13295 !! html/parsoid
13296 <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"}'>
13297 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13298 </table></td></tr></tbody></table>
13299 !! end
13300
13301 !! test
13302 Templates: Parameters substituted at the top-level
13303 !! wikitext
13304 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13305
13306 {{{foo|bar|baz}}}
13307 !! html/php
13308 <p><i>who</i> me? <b>never!</b>
13309 </p><p>bar
13310 </p>
13311 !! html/parsoid
13312 <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>
13313
13314 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13315 !! end
13316
13317 !! test
13318 Templates: Param with empty arg in the final position
13319 !! wikitext
13320 {{{hi|}}}
13321 !! html/parsoid
13322 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13323 !! end
13324
13325 !!test
13326 Parser Functions: 1. Simple example
13327 !! wikitext
13328 {{uc:foo}}
13329 !! html
13330 <p>FOO
13331 </p>
13332 !!end
13333
13334 !!test
13335 Parser Functions: 2. Nested use (only outermost should be marked up)
13336 !! wikitext
13337 {{uc:{{lc:FOO}}}}
13338 !! html
13339 <p>FOO
13340 </p>
13341 !!end
13342
13343 ###
13344 ### Pre-save transform tests
13345 ###
13346 !! test
13347 pre-save transform: subst:
13348 !! options
13349 pst
13350 !! wikitext
13351 {{subst:test}}
13352 !! html/php
13353 This is a test template
13354 !! end
13355
13356 !! test
13357 pre-save transform: normal template
13358 !! options
13359 pst
13360 !! wikitext
13361 {{test}}
13362 !! html/php
13363 {{test}}
13364 !! end
13365
13366 !! test
13367 pre-save transform: nonexistent template
13368 !! options
13369 pst
13370 !! wikitext
13371 {{thistemplatedoesnotexist}}
13372 !! html/php
13373 {{thistemplatedoesnotexist}}
13374 !! end
13375
13376 !! test
13377 pre-save transform: subst magic variables
13378 !! options
13379 pst
13380 !! wikitext
13381 {{subst:SITENAME}}
13382 !! html/php
13383 MediaWiki
13384 !! end
13385
13386 # This is T2089, which I fixed. -- wtm
13387 !! test
13388 pre-save transform: subst: templates with parameters
13389 !! options
13390 pst
13391 !! wikitext
13392 {{subst:paramtest|param="something else"}}
13393 !! html/php
13394 This is a test template with parameter "something else"
13395 !! end
13396
13397 !! article
13398 Template:nowikitest
13399 !! text
13400 <nowiki>'''not wiki'''</nowiki>
13401 !! endarticle
13402
13403 !! test
13404 pre-save transform: nowiki in subst (T3188)
13405 !! options
13406 pst
13407 !! wikitext
13408 {{subst:nowikitest}}
13409 !! html/php
13410 <nowiki>'''not wiki'''</nowiki>
13411 !! end
13412
13413 !! article
13414 Template:commenttest
13415 !! text
13416 This template has <!-- a comment --> in it.
13417 !! endarticle
13418
13419 !! test
13420 pre-save transform: comment in subst (T3936)
13421 !! options
13422 pst
13423 !! wikitext
13424 {{subst:commenttest}}
13425 !! html/php
13426 This template has <!-- a comment --> in it.
13427 !! end
13428
13429 !! test
13430 pre-save transform: unclosed tag
13431 !! options
13432 pst
13433 !! wikitext
13434 <nowiki>'''not wiki'''
13435 !! html/php
13436 <nowiki>'''not wiki'''
13437 !! end
13438
13439 !! test
13440 pre-save transform: mixed tag case
13441 !! options
13442 pst
13443 !! wikitext
13444 <NOwiki>'''not wiki'''</noWIKI>
13445 !! html/php
13446 <NOwiki>'''not wiki'''</noWIKI>
13447 !! end
13448
13449 !! test
13450 pre-save transform: unclosed comment in <nowiki>
13451 !! options
13452 pst
13453 !! wikitext
13454 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13455 !! html/php
13456 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13457 !!end
13458
13459 # Leading @ in this template definition works around a limitation
13460 # in parsoid's parserTests which otherwise strips the <span> from the
13461 # result (confusing it for a template wrapper)
13462 !! article
13463 Template:dangerous
13464 !!text
13465 @<span onmouseover="alert('crap')">Oh no</span>
13466 !!endarticle
13467
13468 !!test
13469 (confirming safety of fix for subst T3936)
13470 !! wikitext
13471 {{Template:dangerous}}
13472 !! html
13473 <p>@<span>Oh no</span>
13474 </p>
13475 !! end
13476
13477 !! test
13478 pre-save transform: comment containing gallery (T7024)
13479 !! options
13480 pst
13481 !! wikitext
13482 <!-- <gallery>data</gallery> -->
13483 !! html/php
13484 <!-- <gallery>data</gallery> -->
13485 !!end
13486
13487 !! test
13488 pre-save transform: comment containing extension
13489 !! options
13490 pst
13491 !! wikitext
13492 <!-- <tag>data</tag> -->
13493 !! html/php
13494 <!-- <tag>data</tag> -->
13495 !!end
13496
13497 !! test
13498 pre-save transform: comment containing nowiki
13499 !! options
13500 pst
13501 !! wikitext
13502 <!-- <nowiki>data</nowiki> -->
13503 !! html/php
13504 <!-- <nowiki>data</nowiki> -->
13505 !!end
13506
13507 !! test
13508 pre-save transform: <noinclude> in subst (T5298)
13509 !! options
13510 pst
13511 !! wikitext
13512 {{subst:Includes}}
13513 !! html/php
13514 Foobar
13515 !! end
13516
13517 !! test
13518 pre-save transform: <onlyinclude> in subst (T5298)
13519 !! options
13520 pst
13521 !! wikitext
13522 {{subst:Includes2}}
13523 !! html/php
13524 Foo
13525 !! end
13526
13527 !! article
13528 Template:SubstTest
13529 !!text
13530 {{<includeonly>subst:</includeonly>Includes}}
13531 !! endarticle
13532
13533 !! article
13534 Template:SafeSubstTest
13535 !! text
13536 {{<includeonly>safesubst:</includeonly>Includes}}
13537 !! endarticle
13538
13539 !! test
13540 T24297: safesubst: works during PST
13541 !! options
13542 pst
13543 !! wikitext
13544 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13545 !! html/php
13546 FoobarFoobar
13547 !! end
13548
13549 !! test
13550 T24297: safesubst: works during normal parse
13551 !! wikitext
13552 {{SafeSubstTest}}
13553 !! html
13554 <p>Foobar
13555 </p>
13556 !! end
13557
13558 !! test
13559 subst: does not work during normal parse
13560 !! wikitext
13561 {{SubstTest}}
13562 !! html
13563 <p>{{subst:Includes}}
13564 </p>
13565 !! end
13566
13567 !! test
13568 pre-save transform: context links ("pipe trick")
13569 !! options
13570 pst
13571 !! wikitext
13572 [[Article (context)|]]
13573 [[Bar:Article|]]
13574 [[:Bar:Article|]]
13575 [[Bar:Article (context)|]]
13576 [[:Bar:Article (context)|]]
13577 [[|Article]]
13578 [[|Article (context)]]
13579 [[Bar:X (Y) Z|]]
13580 [[:Bar:X (Y) Z|]]
13581 !! html/php
13582 [[Article (context)|Article]]
13583 [[Bar:Article|Article]]
13584 [[:Bar:Article|Article]]
13585 [[Bar:Article (context)|Article]]
13586 [[:Bar:Article (context)|Article]]
13587 [[Article]]
13588 [[Article (context)]]
13589 [[Bar:X (Y) Z|X (Y) Z]]
13590 [[:Bar:X (Y) Z|X (Y) Z]]
13591 !! end
13592
13593 !! test
13594 pre-save transform: context links ("pipe trick") with interwiki prefix
13595 !! options
13596 pst
13597 !! wikitext
13598 [[interwiki:Article|]]
13599 [[:interwiki:Article|]]
13600 [[interwiki:Bar:Article|]]
13601 [[:interwiki:Bar:Article|]]
13602 !! html/php
13603 [[interwiki:Article|Article]]
13604 [[:interwiki:Article|Article]]
13605 [[interwiki:Bar:Article|Bar:Article]]
13606 [[:interwiki:Bar:Article|Bar:Article]]
13607 !! end
13608
13609 !! test
13610 pre-save transform: context links ("pipe trick") with parens in title
13611 !! options
13612 pst title=[[Somearticle (context)]]
13613 !! wikitext
13614 [[|Article]]
13615 !! html/php
13616 [[Article (context)|Article]]
13617 !! end
13618
13619 !! test
13620 pre-save transform: context links ("pipe trick") with comma in title
13621 !! options
13622 pst title=[[Someplace, Somewhere]]
13623 !! wikitext
13624 [[|Otherplace]]
13625 [[Otherplace, Elsewhere|]]
13626 [[Otherplace, Elsewhere, Anywhere|]]
13627 !! html/php
13628 [[Otherplace, Somewhere|Otherplace]]
13629 [[Otherplace, Elsewhere|Otherplace]]
13630 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13631 !! end
13632
13633 !! test
13634 pre-save transform: context links ("pipe trick") with parens and comma
13635 !! options
13636 pst title=[[Someplace (IGNORED), Somewhere]]
13637 !! wikitext
13638 [[|Otherplace]]
13639 [[Otherplace (place), Elsewhere|]]
13640 !! html/php
13641 [[Otherplace, Somewhere|Otherplace]]
13642 [[Otherplace (place), Elsewhere|Otherplace]]
13643 !! end
13644
13645 !! test
13646 pre-save transform: context links ("pipe trick") with comma and parens
13647 !! options
13648 pst title=[[Who, me? (context)]]
13649 !! wikitext
13650 [[|Yes, you.]]
13651 [[Me, Myself, and I (1937 song)|]]
13652 !! html/php
13653 [[Yes, you. (context)|Yes, you.]]
13654 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13655 !! end
13656
13657 !! test
13658 pre-save transform: context links ("pipe trick") with namespace
13659 !! options
13660 pst title=[[Ns:Somearticle]]
13661 !! wikitext
13662 [[|Article]]
13663 !! html/php
13664 [[Ns:Article|Article]]
13665 !! end
13666
13667 !! test
13668 pre-save transform: context links ("pipe trick") with namespace and parens
13669 !! options
13670 pst title=[[Ns:Somearticle (context)]]
13671 !! wikitext
13672 [[|Article]]
13673 !! html/php
13674 [[Ns:Article (context)|Article]]
13675 !! end
13676
13677 !! test
13678 pre-save transform: context links ("pipe trick") with namespace and comma
13679 !! options
13680 pst title=[[Ns:Somearticle, Context, Whatever]]
13681 !! wikitext
13682 [[|Article]]
13683 !! html/php
13684 [[Ns:Article, Context, Whatever|Article]]
13685 !! end
13686
13687 !! test
13688 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13689 !! options
13690 pst title=[[Ns:Somearticle, Context (context)]]
13691 !! wikitext
13692 [[|Article]]
13693 !! html/php
13694 [[Ns:Article (context)|Article]]
13695 !! end
13696
13697 !! test
13698 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13699 !! options
13700 pst title=[[Ns:Somearticle (IGNORED), Context]]
13701 !! wikitext
13702 [[|Article]]
13703 !! html/php
13704 [[Ns:Article, Context|Article]]
13705 !! end
13706
13707 !! test
13708 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13709 !! options
13710 pst
13711 !! wikitext
13712 [[Article(context)|]]
13713 [[Bar:Article(context)|]]
13714 [[:Bar:Article(context)|]]
13715 [[|Article(context)]]
13716 [[Bar:X(Y)Z|]]
13717 [[:Bar:X(Y)Z|]]
13718 !! html/php
13719 [[Article(context)|Article]]
13720 [[Bar:Article(context)|Article]]
13721 [[:Bar:Article(context)|Article]]
13722 [[Article(context)]]
13723 [[Bar:X(Y)Z|X(Y)Z]]
13724 [[:Bar:X(Y)Z|X(Y)Z]]
13725 !! end
13726
13727 !! test
13728 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13729 !! options
13730 pst
13731 !! wikitext
13732 [[Article (context)|]]
13733 [[Bar:Article (context)|]]
13734 [[:Bar:Article (context)|]]
13735 [[|Article (context)]]
13736 [[Bar:X (Y) Z|]]
13737 [[:Bar:X (Y) Z|]]
13738 !! html/php
13739 [[Article (context)|Article]]
13740 [[Bar:Article (context)|Article]]
13741 [[:Bar:Article (context)|Article]]
13742 [[Article (context)]]
13743 [[Bar:X (Y) Z|X (Y) Z]]
13744 [[:Bar:X (Y) Z|X (Y) Z]]
13745 !! end
13746
13747 !! test
13748 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13749 !! options
13750 pst
13751 !! wikitext
13752 [[Article(context)|]]
13753 [[Bar:Article(context)|]]
13754 [[:Bar:Article(context)|]]
13755 [[|Article(context)]]
13756 [[Bar:X(Y)Z|]]
13757 [[:Bar:X(Y)Z|]]
13758 !! html/php
13759 [[Article(context)|Article]]
13760 [[Bar:Article(context)|Article]]
13761 [[:Bar:Article(context)|Article]]
13762 [[Article(context)]]
13763 [[Bar:X(Y)Z|X(Y)Z]]
13764 [[:Bar:X(Y)Z|X(Y)Z]]
13765 !! end
13766
13767 !! test
13768 pre-save transform: context links ("pipe trick") with commas (T23660)
13769 !! options
13770 pst
13771 !! wikitext
13772 [[Article (context), context|]]
13773 [[Article (context),context|]]
13774 [[Bar:Article (context), context|]]
13775 [[Bar:Article (context),context|]]
13776 [[:Bar:Article (context), context|]]
13777 [[:Bar:Article (context),context|]]
13778 !! html/php
13779 [[Article (context), context|Article]]
13780 [[Article (context),context|Article]]
13781 [[Bar:Article (context), context|Article]]
13782 [[Bar:Article (context),context|Article]]
13783 [[:Bar:Article (context), context|Article]]
13784 [[:Bar:Article (context),context|Article]]
13785 !! end
13786
13787 !! test
13788 Parsoid: backwards pipe trick
13789 !! wikitext
13790 [[|'''bar''']]
13791 !! html/php
13792 <p>[[|<b>bar</b>]]
13793 </p>
13794 !! html/parsoid
13795 <p>[[|<b>bar</b>]]</p>
13796 !! end
13797
13798 !! test
13799 pre-save transform: trim trailing empty lines
13800 !! options
13801 pst
13802 !! wikitext
13803 Empty lines are trimmed
13804
13805
13806
13807
13808 !! html/php
13809 Empty lines are trimmed
13810 !! end
13811
13812 !! test
13813 pre-save transform: Signature expansion
13814 !! options
13815 pst
13816 !! wikitext
13817 * ~~~
13818 * ~~~~
13819 * ~~~~~
13820 * <noinclude>~~~</noinclude>
13821 * <includeonly>~~~</includeonly>
13822 * <onlyinclude>~~~</onlyinclude>
13823 !! html/php
13824 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13825 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13826 * 00:02, 1 January 1970 (UTC)
13827 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13828 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13829 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13830 !! end
13831
13832
13833 !! test
13834 ParserOutput flags from signature expansion (T84843)
13835 !! options
13836 pst
13837 showflags
13838 !! wikitext
13839 ~~~~
13840 !! html/php
13841 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13842 flags=user-signature
13843 !! end
13844
13845
13846 !! test
13847 pre-save transform: Signature expansion in nowiki tags (T2093)
13848 !! options
13849 pst disabled
13850 !! wikitext
13851 Shall not expand:
13852
13853 <nowiki>~~~~</nowiki>
13854
13855 <includeonly><nowiki>~~~~</nowiki></includeonly>
13856
13857 <noinclude><nowiki>~~~~</nowiki></noinclude>
13858
13859 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13860
13861 {{subst:Foo}} shall be converted to FOO
13862
13863 As well as inside noinclude/onlyinclude
13864 <noinclude>{{subst:Foo}}</noinclude>
13865 <onlyinclude>{{subst:Foo}}</onlyinclude>
13866
13867 But not inside includeonly
13868 <includeonly>{{subst:Foo}}</includeonly>
13869 !! html/php
13870 Shall not expand:
13871
13872 <nowiki>~~~~</nowiki>
13873
13874 <includeonly><nowiki>~~~~</nowiki></includeonly>
13875
13876 <noinclude><nowiki>~~~~</nowiki></noinclude>
13877
13878 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13879
13880 FOO shall be converted to FOO
13881
13882 As well as inside noinclude/onlyinclude
13883 <noinclude>FOO</noinclude>
13884 <onlyinclude>FOO</onlyinclude>
13885
13886 But not inside includeonly
13887 <includeonly>{{subst:Foo}}</includeonly>
13888 !! end
13889
13890 !! test
13891 Parsoid: Recognize nowiki with trailing space in tags
13892 !! options
13893 parsoid=wt2html
13894 !! wikitext
13895 <nowiki ><div>[[foo]]</nowiki >
13896
13897 a<nowiki / >b
13898
13899 c<nowiki />d
13900
13901 e<nowiki/ >f
13902 !! html
13903 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13904 <p>ab</p>
13905 <p>cd</p>
13906 <p>ef</p>
13907 !! end
13908
13909 !! test
13910 Parsoid: Recognize nowiki with odd capitalization
13911 !! options
13912 parsoid=wt2html
13913 !! wikitext
13914 <noWikI ><div>[[foo]]</Nowiki >
13915 !! html
13916 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13917 !! end
13918
13919
13920 !! test
13921 Parsoid: Escape nowiki with trailing space in tags
13922 !! options
13923 parsoid=html2wt
13924 !! html/parsoid
13925 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13926 <p>a&lt;nowiki /&gt;b</p>
13927 <p>c&lt;nowiki/ &gt;d</p>
13928 !! wikitext
13929 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13930
13931 a&lt;nowiki /&gt;b
13932
13933 c&lt;nowiki/ &gt;d
13934 !! end
13935
13936 !! test
13937 Parsoid: Escape weird noWikI capitalizations
13938 !! options
13939 parsoid=html2wt
13940 !! html/parsoid
13941 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13942 !! wikitext
13943 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13944 !! end
13945
13946 ###
13947 ### Message transform tests
13948 ###
13949 !! test
13950 message transform: magic variables
13951 !! options
13952 msg
13953 !! wikitext
13954 {{SITENAME}}
13955 !! html
13956 MediaWiki
13957 !! end
13958
13959 !! test
13960 message transform: should not transform wiki markup
13961 !! options
13962 msg
13963 !! wikitext
13964 ''test''
13965 !! html
13966 ''test''
13967 !! end
13968
13969 !! test
13970 message transform: <noinclude> in transcluded template (T6926)
13971 !! options
13972 msg
13973 !! wikitext
13974 {{Includes}}
13975 !! html
13976 Foobar
13977 !! end
13978
13979 !! test
13980 message transform: <onlyinclude> in transcluded template (T6926)
13981 !! options
13982 msg
13983 !! wikitext
13984 {{Includes2}}
13985 !! html
13986 Foo
13987 !! end
13988
13989 !! test
13990 {{#special:}} page name, known
13991 !! options
13992 msg
13993 !! wikitext
13994 {{#special:Recentchanges}}
13995 !! html
13996 Special:RecentChanges
13997 !! end
13998
13999 !! test
14000 {{#special:}} page name with subpage, known
14001 !! options
14002 msg
14003 !! wikitext
14004 {{#special:Recentchanges/param}}
14005 !! html
14006 Special:RecentChanges/param
14007 !! end
14008
14009 !! test
14010 {{#special:}} page name, unknown
14011 !! options
14012 msg
14013 !! wikitext
14014 {{#special:foobar nonexistent}}
14015 !! html
14016 Special:Foobar nonexistent
14017 !! end
14018
14019 !! test
14020 {{#speciale:}} page name, known
14021 !! options
14022 msg
14023 !! wikitext
14024 {{#speciale:Recentchanges}}
14025 !! html
14026 Special:RecentChanges
14027 !! end
14028
14029 !! test
14030 {{#speciale:}} page name with subpage, known
14031 !! options
14032 msg
14033 !! wikitext
14034 {{#speciale:Recentchanges/param}}
14035 !! html
14036 Special:RecentChanges/param
14037 !! end
14038
14039 !! test
14040 {{#speciale:}} page name, unknown
14041 !! options
14042 msg
14043 !! wikitext
14044 {{#speciale:foobar nonexistent}}
14045 !! html
14046 Special:Foobar_nonexistent
14047 !! end
14048
14049 ###
14050 ### Images
14051 ###
14052 ### For Parsoid-specific tests, see
14053 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14054
14055 !! test
14056 Simple image
14057 !! options
14058 parsoid=wt2html,wt2wt,html2html
14059 !! wikitext
14060 [[Image:foobar.jpg]]
14061 !! html/php
14062 <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>
14063 </p>
14064 !! html/parsoid
14065 <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>
14066 !! end
14067
14068 !! test
14069 Serialize simple image with span wrapper
14070 !! options
14071 parsoid=html2wt
14072 !! html/parsoid
14073 <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>
14074 !! wikitext
14075 [[File:Foobar.jpg]]
14076 !! end
14077
14078 !! test
14079 Simple image (using File: namespace, now canonical)
14080 !! wikitext
14081 [[File:Foobar.jpg]]
14082 !! html/php
14083 <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>
14084 </p>
14085 !! html/parsoid
14086 <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>
14087 !! end
14088
14089 !! test
14090 Right-aligned image
14091 !! wikitext
14092 [[File:Foobar.jpg|right]]
14093 !! html/php
14094 <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>
14095
14096 !! html/parsoid
14097 <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>
14098 !! end
14099
14100 !! test
14101 Image with caption
14102 !! wikitext
14103 [[File:Foobar.jpg|right|Caption text]]
14104 !! html/php
14105 <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>
14106
14107 !! html/parsoid
14108 <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>
14109 !! end
14110
14111 !! test
14112 Image with caption, T55312 #1
14113 !! wikitext
14114 [[File:Foobar.jpg|right|Caption page stuff]]
14115 !! html/php
14116 <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>
14117
14118 !! html/parsoid
14119 <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>
14120 !! end
14121
14122 !! test
14123 Image with caption, T55312 #2
14124 !! wikitext
14125 [[File:Foobar.jpg|right|Caption page=]]
14126 !! html/php
14127 <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>
14128
14129 !! html/parsoid
14130 <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>
14131 !! end
14132
14133 !! test
14134 Image with caption, T55312 #3
14135 !! wikitext
14136 [[File:Foobar.jpg|right|Caption page=stuff]]
14137 !! html/php
14138 <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>
14139
14140 !! html/parsoid
14141 <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>
14142 !! end
14143
14144 !! test
14145 Image caption with pipe entity
14146 !! wikitext
14147 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14148 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14149 !! html/php
14150 <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>
14151 <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>
14152
14153 !! html/parsoid
14154 <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>
14155 <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>
14156 !! end
14157
14158 !! test
14159 Allow empty links in image captions (T62753)
14160 !! options
14161 thumbsize=220
14162 !! wikitext
14163 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14164 [[]]
14165 [[Link2]]
14166 ]]
14167 !! html/php
14168 <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>
14169
14170 !! html/parsoid
14171 <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>
14172 [[]]
14173 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14174 </figcaption></figure>
14175 !! end
14176
14177 !! test
14178 Titles in unlinked images (T23454)
14179 !! wikitext
14180 [[File:Foobar.jpg|link=|stuff]]
14181 !! html/php
14182 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14183 </p>
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 !! test
14189 Link with empty target
14190 !! wikitext
14191 [[]]
14192 !! html
14193 <p>[[]]
14194 </p>
14195 !! end
14196
14197 !! test
14198 Image with link trail
14199 !! wikitext
14200 Linktrails should not work for images: [[File:Foobar.jpg]]s
14201 !! html/php
14202 <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
14203 </p>
14204 !! html/parsoid
14205 <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>
14206 !! end
14207
14208 !! test
14209 Image with empty attribute
14210 !! options
14211 parsoid=wt2html,wt2wt,html2html
14212 !! wikitext
14213 [[File:Foobar.jpg|right||Caption text]]
14214 !! html/php
14215 <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>
14216
14217 !! html/parsoid
14218 <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>
14219 !! end
14220
14221 !! test
14222 1. Block image with individual attributes from templates
14223 !! wikitext
14224 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14225 !! html/php
14226 <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>
14227
14228 !! html/parsoid
14229 <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>
14230 !! end
14231
14232 !! test
14233 2. Block Image with individual attributes from templates
14234 !! wikitext
14235 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14236 !! html/php
14237 <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>
14238
14239 !! html/parsoid
14240 <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>
14241 !! end
14242
14243 !! test
14244 3. Inline image with individual attributes from templates
14245 !! wikitext
14246 [[File:Foobar.jpg|{{echo|50px}}]]
14247 !! html/php
14248 <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>
14249 </p>
14250 !! html/parsoid
14251 <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>
14252 !! end
14253
14254 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14255 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14256 !! test
14257 Image with multiple attributes from the same template
14258 !! wikitext
14259 [[File:Foobar.jpg|{{image_attribs}}]]
14260 !! html/php
14261 <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>
14262
14263 !! html/parsoid
14264 <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>
14265 !! end
14266
14267 !! test
14268 Image with link tails
14269 !! options
14270 thumbsize=220
14271 !! wikitext
14272 123[[File:Foobar.jpg]]456
14273 123[[File:Foobar.jpg|right]]456
14274 123[[File:Foobar.jpg|thumb]]456
14275 !! html/php
14276 <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
14277 </p>
14278 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
14279 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
14280
14281 !! html/php+tidy
14282 <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
14283 </p><p>
14284 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
14285 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
14286 </p>
14287 !! html/parsoid
14288 <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>
14289 <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>
14290 <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>
14291 !! end
14292
14293 !! test
14294 Image with multiple captions -- only last one is accepted
14295 !! wikitext
14296 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14297 !! html/php
14298 <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>
14299
14300 !! html/parsoid
14301 <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>
14302 !! end
14303
14304 !! test
14305 Image with multiple widths -- use last
14306 !! wikitext
14307 [[File:Foobar.jpg|200px|300px|caption]]
14308 !! html/php
14309 <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>
14310 </p>
14311 !! html/parsoid
14312 <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>
14313 !! end
14314
14315 !! test
14316 Image with multiple alignments -- use first (T50664)
14317 !! options
14318 thumbsize=220
14319 !! wikitext
14320 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14321
14322 [[File:Foobar.jpg|middle|text-top|caption]]
14323 !! html/php
14324 <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>
14325 <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>
14326 </p>
14327 !! html/parsoid
14328 <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>
14329 <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>
14330 !! end
14331
14332 !! test
14333 Image with width attribute at different positions
14334 !! wikitext
14335 [[File:Foobar.jpg|200px|right|Caption]]
14336 [[File:Foobar.jpg|right|200px|Caption]]
14337 [[File:Foobar.jpg|right|Caption|200px]]
14338 !! html/php
14339 <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>
14340 <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>
14341 <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>
14342
14343 !! html/parsoid
14344 <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>
14345 <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>
14346 <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>
14347 !! end
14348
14349 # a sad bit of backward-compatibility
14350 !! test
14351 Image with size specified with pxpx (T15500, T53628)
14352 !! options
14353 parsoid=wt2html,wt2wt,html2html
14354 !! wikitext
14355 [[File:Foobar.jpg|20pxpx]]
14356 [[File:Foobar.jpg|200x20pxpx]]
14357 !! html/php
14358 <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>
14359 <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>
14360 </p>
14361 !! html/parsoid
14362 <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>
14363 !! end
14364
14365 !! test
14366 Image with link parameter, wiki target
14367 !! wikitext
14368 [[File:Foobar.jpg|link=Main Page]]
14369 !! html/php
14370 <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>
14371 </p>
14372 !! html/parsoid
14373 <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>
14374 !! end
14375
14376 # parsoid T51293 (part 1)
14377 !! test
14378 Image with link parameter, URL target
14379 !! wikitext
14380 [[File:Foobar.jpg|link=http://example.com/]]
14381 !! html/php
14382 <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>
14383 </p>
14384 !! html/parsoid
14385 <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>
14386 !! end
14387
14388 # parsoid T51293 (part 2)
14389 !! test
14390 Image with link parameter, protocol-less URL target
14391 !! wikitext
14392 [[File:Foobar.jpg|link=//example.com/]]
14393 !! html/php
14394 <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>
14395 </p>
14396 !! html/parsoid
14397 <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>
14398 !! end
14399
14400 !! test
14401 Escaping non-block captions (T107435)
14402 !! options
14403 parsoid={
14404 "modes": ["wt2wt"],
14405 "changes": [
14406 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14407 ]
14408 }
14409 !! wikitext
14410 [[Image:Foobar.jpg|caption]]
14411 !! wikitext/edited
14412 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14413 !! end
14414
14415 # wgExternalLinkTarget not supported by Parsoid
14416 !! test
14417 Image with link parameter, wgExternalLinkTarget
14418 !! wikitext
14419 [[Image:foobar.jpg|link=http://example.com/]]
14420 !! config
14421 wgExternalLinkTarget='foobar'
14422 !! html/php
14423 <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>
14424 </p>
14425 !! end
14426
14427 !! test
14428 Image with link parameter, wgNoFollowLinks set to false
14429 !! wikitext
14430 [[Image:foobar.jpg|link=http://example.com/]]
14431 !! config
14432 wgNoFollowLinks=false
14433 !! html/php
14434 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14435 </p>
14436 !! end
14437
14438 !! test
14439 Image with link parameter, wgNoFollowDomainExceptions
14440 !! wikitext
14441 [[Image:foobar.jpg|link=http://example.com/]]
14442 !! config
14443 wgNoFollowDomainExceptions='example.com'
14444 !! html/php
14445 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14446 </p>
14447 !! end
14448
14449 # wgExternalLinkTarget not supported by Parsoid
14450 !! test
14451 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14452 !! wikitext
14453 [[Image:foobar.jpg|link=http://example.com/|Title]]
14454 !! config
14455 wgExternalLinkTarget='foobar'
14456 !! html/php
14457 <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>
14458 </p>
14459 !! end
14460
14461 !! test
14462 Image with empty link parameter
14463 !! wikitext
14464 [[File:Foobar.jpg|link=]]
14465 !! html/php
14466 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14467 </p>
14468 !! html/parsoid
14469 <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>
14470 !! end
14471
14472 !! test
14473 Image with link parameter (wiki target) and unnamed parameter
14474 !! wikitext
14475 [[File:Foobar.jpg|link=Main_Page|Title]]
14476 !! html/php
14477 <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>
14478 </p>
14479 !! html/parsoid
14480 <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>
14481 !! end
14482
14483 !! test
14484 Image with link parameter (URL target) and unnamed parameter
14485 !! wikitext
14486 [[File:Foobar.jpg|link=http://example.com/|Title]]
14487 !! html/php
14488 <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>
14489 </p>
14490 !! html/parsoid
14491 <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>
14492 !! end
14493
14494 !! test
14495 Thumbnail image with link parameter
14496 !! options
14497 thumbsize=220
14498 parsoid=wt2html,wt2wt,html2html
14499 !! wikitext
14500 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14501 !! html/php
14502 <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>
14503
14504 !! html/parsoid
14505 <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>
14506 !! end
14507
14508 !! test
14509 Manually-specified thumbnail image
14510 !! options
14511 thumbsize=220
14512 !! wikitext
14513 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14514 !! html/php
14515 <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>
14516
14517 !! html/parsoid
14518 <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>
14519 !! end
14520
14521 !! test
14522 Manually-specified thumbnail image with explicit link to wiki page
14523 !! options
14524 thumbsize=220
14525 parsoid=wt2html,wt2wt,html2html
14526 !! wikitext
14527 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14528 !! html/php
14529 <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>
14530
14531 !! html/parsoid
14532 <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>
14533 !! end
14534
14535 !! test
14536 Manually-specified thumbnail image with explicit link to url
14537 !! options
14538 thumbsize=220
14539 parsoid=wt2html,wt2wt,html2html
14540 !! wikitext
14541 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14542 !! html/php
14543 <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>
14544
14545 !! html/parsoid
14546 <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>
14547 !! end
14548
14549 !! test
14550 Manually-specified thumbnail image with explicit no link
14551 !! options
14552 thumbsize=220
14553 parsoid=wt2html,wt2wt,html2html
14554 !! wikitext
14555 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14556 !! html/php
14557 <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>
14558
14559 !! html/parsoid
14560 <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>
14561 !! end
14562
14563 !! test
14564 Manually-specified thumbnail image with explicit link and alt text
14565 !! options
14566 thumbsize=220
14567 parsoid=wt2html,wt2wt,html2html
14568 !! wikitext
14569 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14570 !! html/php
14571 <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>
14572
14573 !! html/parsoid
14574 <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>
14575 !! end
14576
14577 !! test
14578 Image with frame and link
14579 !! options
14580 parsoid=wt2html,wt2wt,html2html
14581 !! wikitext
14582 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14583 !! html/php
14584 <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>
14585
14586 !! html/parsoid
14587 <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>
14588 !! end
14589
14590 !! test
14591 Image with frame and link and explicit alt
14592 !! options
14593 parsoid=wt2html,wt2wt,html2html
14594 !! wikitext
14595 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14596 !! html/php
14597 <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>
14598
14599 !! html/parsoid
14600 <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>
14601 !! end
14602
14603 !! test
14604 Image with wiki markup in implicit alt
14605 !! wikitext
14606 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14607
14608 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14609 !! html/php
14610 <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>
14611 </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>
14612 </p>
14613 !! html/parsoid
14614 <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>
14615
14616 <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>
14617 !! end
14618
14619 !! test
14620 Alt image option should handle most kinds of wikitext without barfing
14621 !! wikitext
14622 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14623 !! html/php
14624 <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>
14625
14626 !! html/parsoid
14627 <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>
14628 !! end
14629
14630 !! test
14631 Image with table with attributes in caption
14632 !! options
14633 parsoid=wt2html,html2html
14634 !! wikitext
14635 [[File:Foobar.jpg|thumb|
14636 {| class="123" |
14637 |- class="456" |
14638 | ha
14639 |}
14640 ]]
14641 !! html/parsoid
14642 <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>
14643 <table class="123">
14644 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14645 <td> ha</td></tr>
14646 </tbody></table>
14647 </figcaption></figure>
14648 !! end
14649
14650 !! test
14651 Image with table with rows from templates in caption
14652 !! wikitext
14653 [[File:Foobar.jpg|thumb|
14654 {|
14655 {{echo|{{!}} hi}}
14656 |}
14657 ]]
14658 !! html/parsoid
14659 <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>
14660 <table>
14661 <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>
14662 </tbody></table>
14663 </figcaption></figure>
14664 !! end
14665
14666 !! test
14667 Image with nested tables in caption
14668 !! wikitext
14669 [[File:Foobar.jpg|thumb|Foo<br />
14670 {|
14671 |
14672 {|
14673 |z
14674 |}
14675 |}
14676 ]]
14677 !! html/parsoid
14678 <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}'/>
14679 <table>
14680 <tbody><tr><td>
14681 <table>
14682 <tbody><tr><td>z</td></tr>
14683 </tbody></table></td></tr>
14684 </tbody></table>
14685 </figcaption></figure>
14686 !! end
14687
14688 ###################
14689 # Conflicting image format options.
14690 # First option specified should 'win'.
14691 # All three cases in each test should be identical.
14692
14693 !! test
14694 Image with 'frameless' first.
14695 !! options
14696 parsoid=wt2html,wt2wt,html2html
14697 !! wikitext
14698 [[File:Foobar.jpg|frameless|caption]]
14699
14700 [[File:Foobar.jpg|frameless|frame|caption]]
14701
14702 [[File:Foobar.jpg|frameless|thumb|caption]]
14703 !! html/php
14704 <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>
14705 </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>
14706 </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>
14707 </p>
14708 !! html/parsoid
14709 <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>
14710 <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>
14711 <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>
14712 !! end
14713
14714 !! test
14715 Image with 'frame' first.
14716 !! options
14717 parsoid=wt2html,wt2wt,html2html
14718 !! wikitext
14719 [[File:Foobar.jpg|frame|caption]]
14720 [[File:Foobar.jpg|frame|frameless|caption]]
14721 [[File:Foobar.jpg|frame|thumb|caption]]
14722 !! html/php
14723 <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>
14724 <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>
14725 <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>
14726
14727 !! html/parsoid
14728 <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>
14729 <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>
14730 <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>
14731 !! end
14732
14733 !! test
14734 Image with 'thumb' first.
14735 !! options
14736 parsoid=wt2html,wt2wt,html2html
14737 !! wikitext
14738 [[File:Foobar.jpg|thumb|caption]]
14739 [[File:Foobar.jpg|thumb|frameless|caption]]
14740 [[File:Foobar.jpg|thumb|frame|caption]]
14741 !! html/php
14742 <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>
14743 <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>
14744 <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>
14745
14746 !! html/parsoid
14747 <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>
14748 <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>
14749 <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>
14750 !! end
14751
14752 ###################
14753 # Image sizing.
14754 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14755 # and https://phabricator.wikimedia.org/T64258
14756 # Foobar has actual size of 1941x220
14757 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14758 # a scalable format.
14759 # 2. Framed images always ignore size options; always render at default size.
14760 # 3. "Unspecified format" and border are the only types which can be
14761 # enlarged.
14762
14763 !! test
14764 Image: unspecified format and border enlarge
14765 !! options
14766 parsoid=wt2html,wt2wt,html2html
14767 !! wikitext
14768 [[File:Foobar.jpg|2000px]]
14769
14770 [[File:Foobar.jpg|border|2000px]]
14771 !! html/php
14772 <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>
14773 </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>
14774 </p>
14775 !! html/parsoid
14776 <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>
14777 <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>
14778 !! end
14779
14780 !! test
14781 Image: "unspecified format" and border reduce
14782 !! options
14783 parsoid=wt2html,wt2wt,html2html
14784 !! wikitext
14785 [[File:Foobar.jpg|1000px]]
14786
14787 [[File:Foobar.jpg|border|1000px]]
14788 !! html/php
14789 <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>
14790 </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>
14791 </p>
14792 !! html/parsoid
14793 <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>
14794 <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>
14795 !! end
14796
14797 !! test
14798 Image: thumbs reduce
14799 !! options
14800 parsoid=wt2html,wt2wt,html2html
14801 !! wikitext
14802 [[File:Foobar.jpg|thumb|50px]]
14803 !! html/php
14804 <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>
14805
14806 !! html/parsoid
14807 <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>
14808 !! end
14809
14810 !! test
14811 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14812 !! options
14813 parsoid=wt2html,wt2wt,html2html
14814 !! wikitext
14815 [[File:Foobar.jpg|thumb|2000px]]
14816
14817 [[File:Foobar.svg|thumb|2000px]]
14818 !! html/php
14819 <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>
14820 <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>
14821
14822 !! html/parsoid
14823 <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>
14824 <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>
14825 !! end
14826
14827 !! test
14828 Image: frameless can reduce in size
14829 !! options
14830 parsoid=wt2html,wt2wt,html2html
14831 !! wikitext
14832 [[File:Foobar.jpg|frameless|50px]]
14833 !! html/php
14834 <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>
14835 </p>
14836 !! html/parsoid
14837 <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>
14838 !! end
14839
14840 !! test
14841 Image: bitmap frameless can't be enlarged past original size, but vector can
14842 !! options
14843 parsoid=wt2html,wt2wt,html2html
14844 !! wikitext
14845 [[File:Foobar.jpg|frameless|2000px]]
14846
14847 [[File:Foobar.svg|frameless|2000px]]
14848 !! html/php
14849 <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>
14850 </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>
14851 </p>
14852 !! html/parsoid
14853 <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>
14854 <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>
14855 !! end
14856
14857 !! test
14858 Image: framed images are always unscaled.
14859 !! options
14860 parsoid=wt2html,wt2wt,html2html
14861 !! wikitext
14862 [[File:Foobar.jpg|frame]]
14863
14864 [[File:Foobar.jpg|frame|50px]]
14865
14866 [[File:Foobar.jpg|frame|50x50px]]
14867
14868 [[File:Foobar.jpg|frame|2000px]]
14869 !! html/php
14870 <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>
14871 <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>
14872 <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>
14873 <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>
14874
14875 !! html/parsoid
14876 <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>
14877 <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>
14878 <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>
14879 <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>
14880 !! end
14881
14882 ###################
14883
14884 !! test
14885 Link to image page- image page normally doesn't exists, hence edit link
14886 Add test with existing image page
14887 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14888 !! wikitext
14889 [[:Image:test]]
14890 !! html
14891 <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>
14892 </p>
14893 !! end
14894
14895 !! test
14896 T20784 Link to non-existent image page with caption should use caption as link text
14897 !! wikitext
14898 [[:Image:test|caption]]
14899 !! html
14900 <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>
14901 </p>
14902 !! end
14903
14904 !! test
14905 Frameless image caption with a free URL
14906 !! wikitext
14907 [[File:Foobar.jpg|http://example.com]]
14908 !! html/php
14909 <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>
14910 </p>
14911 !! html/parsoid
14912 <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>
14913 !! end
14914
14915 !! test
14916 Thumbnail image caption with a free URL
14917 !! options
14918 thumbsize=220
14919 !! wikitext
14920 [[File:Foobar.jpg|thumb|http://example.com]]
14921 !! html/php
14922 <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>
14923
14924 !! html/parsoid
14925 <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>
14926 !! end
14927
14928 !! test
14929 Thumbnail image caption with a free URL and explicit alt
14930 !! options
14931 thumbsize=220
14932 parsoid=wt2html,wt2wt,html2html
14933 !! wikitext
14934 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14935 !! html/php
14936 <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>
14937
14938 !! html/parsoid
14939 <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>
14940 !! end
14941
14942 !! test
14943 SVG thumbnails with no language set
14944 !! options
14945 !! wikitext
14946 [[File:Foobar.svg|thumb|caption]]
14947 !! html/php
14948 <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>
14949
14950 !! html/parsoid
14951 <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>
14952 !! end
14953
14954 !! test
14955 SVG thumbnails with language de
14956 !! options
14957 parsoid=wt2html,wt2wt,html2html
14958 !! wikitext
14959 [[File:Foobar.svg|thumb|caption|lang=de]]
14960 !! html/php
14961 <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>
14962
14963 !! html/parsoid
14964 <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>
14965 !! end
14966
14967 !! test
14968 SVG thumbnails with invalid language code
14969 !! options
14970 parsoid=wt2html,wt2wt,html2html
14971 !! wikitext
14972 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
14973 !! html/php
14974 <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>
14975
14976 !! html/parsoid
14977 <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>
14978 !! end
14979
14980 !! test
14981 T3887: A ISBN with a thumbnail
14982 !! wikitext
14983 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14984 !! html/php
14985 <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>
14986
14987 !! html/parsoid
14988 <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>
14989 !! end
14990
14991 !! test
14992 T3887: A RFC with a thumbnail
14993 !! wikitext
14994 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14995 !! html/php
14996 <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>
14997
14998 !! html/parsoid
14999 <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>
15000 !! end
15001
15002 !! test
15003 T3887: A mailto link with a thumbnail
15004 !! wikitext
15005 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15006 !! html/php
15007 <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>
15008
15009 !! html/parsoid
15010 <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>
15011 !! end
15012
15013 # Pending resolution to T2368
15014 !! test
15015 T2648: Frameless image caption with a link
15016 !! wikitext
15017 [[File:Foobar.jpg|text with a [[link]] in it]]
15018 !! html/php
15019 <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>
15020 </p>
15021 !! html/parsoid
15022 <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>
15023 !! end
15024
15025 !! test
15026 T2648: Frameless image caption with a link (suffix)
15027 !! wikitext
15028 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15029 !! html/php
15030 <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>
15031 </p>
15032 !! html/parsoid
15033 <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>
15034 !! end
15035
15036 !! test
15037 T2648: Frameless image caption with an interwiki link
15038 !! wikitext
15039 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15040 !! html/php
15041 <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>
15042 </p>
15043 !! html/parsoid
15044 <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>
15045 !! end
15046
15047 !! test
15048 T2648: Frameless image caption with a piped interwiki link
15049 !! wikitext
15050 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15051 !! html/php
15052 <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>
15053 </p>
15054 !! html/parsoid
15055 <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>
15056 !! end
15057
15058 !! test
15059 T107474: Frameless image caption with <nowiki>
15060 !! wikitext
15061 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15062 !! html/parsoid
15063 <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>
15064 !! end
15065
15066 !! test
15067 Escape HTML special chars in image alt text
15068 !! wikitext
15069 [[File:Foobar.jpg|& < > "]]
15070 !! html/php
15071 <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>
15072 </p>
15073 !! html/parsoid
15074 <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>
15075 !! end
15076
15077 !! test
15078 Escape HTML special chars in image alt text with LanguageConverter
15079 !! options
15080 language=zh
15081 !! wikitext
15082 [[File:Foobar.jpg|& < > "]]
15083 !! html/php
15084 <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>
15085 </p>
15086 !! html/parsoid
15087 <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>
15088 !! end
15089
15090 !! test
15091 Entities in file name and attributes
15092 !! wikitext
15093 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15094 !! html/php
15095 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15096 </p>
15097 !! html/parsoid
15098 <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>
15099 !! end
15100
15101 !! test
15102 T2499: Alt text should have &#1234;, not &amp;1234;
15103 !! wikitext
15104 [[File:Foobar.jpg|&#9792;]]
15105 !! html/php
15106 <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>
15107 </p>
15108 !! html/parsoid
15109 <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>
15110 !! end
15111
15112 !! test
15113 Broken image caption with link
15114 !! options
15115 parsoid=wt2html,wt2wt,html2html
15116 !! wikitext
15117 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15118 !! html/php
15119 <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.
15120 </p>
15121 !! html/parsoid
15122 <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>
15123 !! end
15124
15125 !! test
15126 Image caption containing another image
15127 !! wikitext
15128 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15129 !! html/php
15130 <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>
15131
15132 !! html/parsoid
15133 <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>
15134 !! end
15135
15136 !! test
15137 Image: caption containing a newline
15138 !! wikitext
15139 [[File:Foobar.jpg|This
15140 *is some text]]
15141 !! html/php
15142 <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>
15143 </p>
15144 !! html/parsoid
15145 <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>
15146 !!end
15147
15148 !!test
15149 Image: caption containing leading space
15150 (The leading space should not trigger nowiki escaping in wt2wt mode)
15151 !! wikitext
15152 [[File:Foobar.jpg|thumb| bar]]
15153 !! html/php
15154 <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>
15155
15156 !! html/parsoid
15157 <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>
15158 !!end
15159
15160 # html/php output not have newlines after table, td, th, etc. because
15161 # Linker::makeThumbLink2() replaces the newlines with spaces since
15162 # the table is inside a caption.
15163 # FIXME: Verify if that circa 2004 fix is still required.
15164 !! test
15165 Image: caption containing a table
15166 !! options
15167 parsoid=wt2html,wt2wt,html2html
15168 !! wikitext
15169 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15170 {|
15171 !Foo!!Bar
15172 |-
15173 |Foo1||Bar1
15174 |}
15175 and some more text.]]
15176 !! html/php
15177 <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>
15178
15179 !! html/parsoid
15180 <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
15181 <table>
15182 <tbody>
15183 <tr><th>Foo</th><th>Bar</th></tr>
15184 <tr>
15185 <td>Foo1</td>
15186 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15187 !! end
15188
15189 !! test
15190 T5090: External links other than http: in image captions
15191 !! wikitext
15192 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15193 !! html/php
15194 <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>
15195
15196 !! html/parsoid
15197 <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>
15198 !! end
15199
15200 !! test
15201 Custom class
15202 !! options
15203 parsoid=wt2html,wt2wt,html2html
15204 !! wikitext
15205 [[Image:foobar.jpg|a|class=b]]
15206 !! html/php
15207 <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>
15208 </p>
15209 !! html/parsoid
15210 <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>
15211 !! end
15212
15213 !! test
15214 Localized image handling (1).
15215 !! options
15216 parsoid=wt2html,wt2wt,html2html
15217 language=es
15218 !! wikitext
15219 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15220 !! html/php
15221 <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>
15222
15223 !! html/parsoid
15224 <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>
15225 !! end
15226
15227 !! test
15228 Localized image handling (2).
15229 !! options
15230 thumbsize=220
15231 parsoid=wt2html,wt2wt,html2html
15232 language=es
15233 !! wikitext
15234 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15235 !! html/php
15236 <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>
15237
15238 !! html/parsoid
15239 <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>
15240 !! end
15241
15242 !! test
15243 Localized image handling (3).
15244 !! options
15245 language=fa
15246 parsoid=html2wt
15247 !! html/parsoid
15248 <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>
15249 !! wikitext
15250 [[File:Foobar.jpg|بندانگشتی]]
15251 !! end
15252
15253 !! test
15254 "border", "frameless" and "class" attributes on an image.
15255 !! options
15256 thumbsize=220
15257 parsoid=wt2html,wt2wt,html2html
15258 !! wikitext
15259 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15260 !! html/php
15261 <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>
15262 </p>
15263 !! html/parsoid
15264 <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>
15265 !! end
15266
15267 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15268 !! test
15269 Invalid image attributes (T64500)
15270 !! options
15271 thumbsize=220
15272 parsoid=wt2html,wt2wt,html2html
15273 !! wikitext
15274 [[File:Foobar.jpg|thumb|float|left|caption]]
15275
15276 [[File:Foobar.jpg|thumb|righ|caption]]
15277
15278 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15279 !! html/php
15280 <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>
15281 <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>
15282 <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>
15283
15284 !! html/parsoid
15285 <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>
15286 <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>
15287 <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>
15288 !! end
15289
15290 !! article
15291 File:Barfoo.jpg
15292 !! text
15293 #REDIRECT [[File:Barfoo.jpg]]
15294 !! endarticle
15295
15296 # FIXME: Parsoid should run this test -- but we'd need to teach the
15297 # mockAPI about the redirected Barfoo.jpg image.
15298 !! test
15299 Redirected image
15300 !! wikitext
15301 [[Image:Barfoo.jpg]]
15302 !! html/php
15303 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15304 </p>
15305 !! end
15306
15307 !! test
15308 Missing image with uploads disabled
15309 !! options
15310 wgEnableUploads=0
15311 !! wikitext
15312 [[File:Foobaz.jpg]]
15313 !! html/php
15314 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15315 </p>
15316 !! html/parsoid
15317 <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>
15318 !! end
15319
15320 # Parsoid-specific testing for images
15321 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15322 # Currently imperfect due to a flaw in the Parsoid testrunner
15323 # Work in progress
15324 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15325 # image tests.
15326
15327 !! test
15328 Parsoid-specific image handling - simple image with size and middle alignment
15329 !! wikitext
15330 [[File:Foobar.jpg|middle|50px]]
15331 !! html/parsoid
15332 <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>
15333 !! end
15334
15335 !! test
15336 Parsoid-specific image handling - simple image with size, middle alignment,
15337 non-standard namespace alias
15338 !! options
15339 parsoid=wt2wt,wt2html,html2html
15340 !! wikitext
15341 [[Image:Foobar.jpg|middle|50px]]
15342 !! html/parsoid
15343 <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>
15344 !! end
15345
15346 !! test
15347 Parsoid-specific image handling - simple image with size and middle alignment
15348 (existing content)
15349 !! wikitext
15350 [[File:Foobar.jpg|50px|middle]]
15351 !! html/parsoid
15352 <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>
15353 !! end
15354
15355 !! test
15356 Parsoid-specific image handling - simple image with size and middle alignment
15357 and non-standard namespace name
15358 !! options
15359 parsoid=wt2html,wt2wt,html2html
15360 !! wikitext
15361 [[Image:Foobar.jpg|50px|middle]]
15362 !! html/parsoid
15363 <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>
15364 !! end
15365
15366 !! test
15367 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15368 !! wikitext
15369 [[File:Foobar.jpg|500x10px|baseline|caption]]
15370 !! html/parsoid
15371 <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>
15372 !! end
15373
15374 !! test
15375 Parsoid-specific image handling - simple image with border and size spec
15376 !! wikitext
15377 [[File:Foobar.jpg|50px|border|caption]]
15378 !! html/parsoid
15379 <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>
15380 !! end
15381
15382 !! test
15383 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15384 !! wikitext
15385 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15386 !! html/parsoid
15387 <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>
15388 !! end
15389
15390 !! test
15391 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15392 (existing content)
15393 !! wikitext
15394 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15395 !! html/parsoid
15396 <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>
15397 !! end
15398
15399 !! test
15400 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15401 !! wikitext
15402 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15403 !! html/parsoid
15404 <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>
15405 !! end
15406
15407 !! test
15408 Parsoid-specific image handling - thumbnail with specific size, halign,
15409 valign, and caption (existing content)
15410 !! wikitext
15411 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15412 !! html/parsoid
15413 <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>
15414 !! end
15415
15416 !! test
15417 Parsoid-specific image handling - framed image with specific size and caption
15418 (size is ignored)
15419 !! options
15420 parsoid=wt2html,wt2wt,html2html
15421 !! wikitext
15422 [[File:Foobar.jpg|frame|500x50px|caption]]
15423 !! html/parsoid
15424 <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>
15425 !! end
15426
15427 !! test
15428 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15429 (size is ignored)
15430 !! options
15431 parsoid=wt2html,wt2wt,html2html
15432 !! wikitext
15433 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15434 !! html/parsoid
15435 <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>
15436 !! end
15437
15438 !! test
15439 Parsoid-specific image handling - frameless image with specific size, border, and caption
15440 !! wikitext
15441 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15442 !! html/parsoid
15443 <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>
15444 !! end
15445
15446 !! test
15447 Parsoid-specific image handling - simple image with a formatted caption
15448 !! wikitext
15449 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15450 !! html/parsoid
15451 <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>
15452 !! end
15453
15454 !! test
15455 Parsoid-specific image handling - caption with a template in it
15456 !! wikitext
15457 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15458 !! html/parsoid
15459 <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>
15460 !! end
15461
15462 !! test
15463 Parsoid-specific image handling - caption with unbalanced tags in it
15464 !! options
15465 parsoid=wt2html,wt2wt,html2html
15466 !! wikitext
15467 foo
15468 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15469 bar
15470 !! html/parsoid
15471 <p>foo</p>
15472 <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>
15473 <p>bar</p>
15474 !! end
15475
15476 !! test
15477 Parsoid-specific image handling - empty caption (1)
15478 !! options
15479 parsoid=wt2html,wt2wt
15480 !! wikitext
15481 [[File:Foobar.jpg|thumb|]]
15482 !! html/parsoid
15483 <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>
15484 !! end
15485
15486 # empty captions don't get serialized unless we're in the "round trip" case
15487 !! test
15488 Parsoid-specific image handling - empty caption (2)
15489 !! options
15490 parsoid=html2wt
15491 !! html/parsoid
15492 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15493 <a href="./File:Foobar.jpg">
15494 <img resource="./File:Foobar.jpg"
15495 src="//example.com/images/3/3a/Foobar.jpg"
15496 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15497 height="25" width="220"/>
15498 </a>
15499 <figcaption></figcaption>
15500 </figure>
15501 !! wikitext
15502 [[File:Foobar.jpg|thumb]]
15503 !! end
15504
15505 !! test
15506 Parsoid-specific image handling - whitespace caption
15507 !! wikitext
15508 [[File:Foobar.jpg|thumb| ]]
15509 !! html/parsoid
15510 <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>
15511 !! end
15512
15513 !! test
15514 Parsoid-specific image handling - lang option
15515 !! wikitext
15516 foo
15517 [[File:Foobar.svg|lang=de|caption]]
15518 bar
15519 !! html/parsoid
15520 <p>foo
15521 <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>
15522 bar</p>
15523 !! end
15524
15525 ## Edge case bugs in Parsoid from T93580
15526 !! test
15527 T93580: 1. Templated <ref> inside block images
15528 !! wikitext
15529 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15530
15531 <references />
15532 !! html/parsoid
15533 <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>
15534
15535 <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>
15536 !! end
15537
15538 !! test
15539 T93580: 2. <ref> inside inline images
15540 !! wikitext
15541 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15542
15543 <references />
15544 !! html/parsoid
15545 <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>
15546
15547 <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>
15548 !! end
15549
15550 !! test
15551 T93580: 3. Templated <ref> inside inline images
15552 !! wikitext
15553 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15554
15555 <references />
15556 !! html/parsoid
15557 <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>
15558
15559 <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>
15560 !! end
15561
15562 ###
15563 ### Subpages
15564 ###
15565 !! article
15566 Subpage test/subpage
15567 !! text
15568 foo
15569 !! endarticle
15570
15571 !! test
15572 Subpage link
15573 !! options
15574 subpage title=[[Subpage test]]
15575 !! wikitext
15576 [[/subpage]]
15577 !! html
15578 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15579 </p>
15580 !! end
15581
15582 !! test
15583 Subpage noslash link
15584 !! options
15585 subpage title=[[Subpage test]]
15586 !! wikitext
15587 [[/subpage/]]
15588 !! html
15589 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15590 </p>
15591 !! end
15592
15593 !! article
15594 Subpage test/1/2/subpage
15595 !! text
15596 blah
15597 !! endarticle
15598
15599 !! test
15600 Relative subpage noslash link
15601 !! options
15602 parsoid=wt2wt,wt2html,html2html
15603 subpage title=[[Subpage test/1/2/3/4]]
15604 !! wikitext
15605 [[../../subpage/]]
15606
15607 [[../../subpage]]
15608 !! html/php
15609 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15610 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15611 </p>
15612 !! html/parsoid
15613 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15614 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15615 !! end
15616
15617 !! test
15618 Parsoid: dot-slash prefixed wikilinks
15619 !! wikitext
15620 [[./foo]]
15621
15622 [[././bar]]
15623
15624 [[././baz/]]
15625 !! html/php
15626 <p>[[./foo]]
15627 </p><p>[[././bar]]
15628 </p><p>[[././baz/]]
15629 </p>
15630 !! html/parsoid
15631 <p>[[./foo]]
15632 </p><p>[[././bar]]
15633 </p><p>[[././baz/]]
15634 </p>
15635 !! end
15636
15637 !! test
15638 Render invalid page names as plain text (T53090)
15639 !! wikitext
15640 [[./../foo|bar]]
15641 [[foo�|bar]]
15642 [[foo/.|bar]]
15643 [[foo/..|bar]]
15644 [[foo~~~bar]]
15645 [[foo>bar]]
15646 [[foo[bar]]
15647 [[.]]
15648 [[..]]
15649 [[foo././bar]]
15650 [[foo[http://example.com]xyz]]
15651
15652 [[{{echo|./../foo}}|bar]]
15653 [[{{echo|foo/.}}|bar]]
15654 [[{{echo|foo/..}}|bar]]
15655 [[{{echo|foo~~~~bar}}]]
15656 [[{{echo|foo>bar}}]]
15657 [[{{echo|foo././bar}}]]
15658 [[{{echo|foo{bar}}]]
15659 [[{{echo|foo}bar}}]]
15660 [[{{echo|foo[bar}}]]
15661 [[{{echo|foo]bar}}]]
15662 [[{{echo|foo<bar}}]]
15663 !!html/php
15664 <p>[[./../foo|bar]]
15665 [[foo�|bar]]
15666 [[foo/.|bar]]
15667 [[foo/..|bar]]
15668 [[foo~~~bar]]
15669 [[foo&gt;bar]]
15670 [[foo[bar]]
15671 [[.]]
15672 [[..]]
15673 [[foo././bar]]
15674 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15675 </p><p>[[./../foo|bar]]
15676 [[foo/.|bar]]
15677 [[foo/..|bar]]
15678 [[foo~~~~bar]]
15679 [[foo&gt;bar]]
15680 [[foo././bar]]
15681 [[foo{bar]]
15682 [[foo}bar]]
15683 [[foo[bar]]
15684 [[foo]bar]]
15685 [[foo&lt;bar]]
15686 </p>
15687 !!html/parsoid
15688 <p>[[./../foo|bar]]
15689 [[foo�|bar]]
15690 [[foo/.|bar]]
15691 [[foo/..|bar]]
15692 [[foo~~~bar]]
15693 [[foo>bar]]
15694 [[foo[bar]]
15695 [[.]]
15696 [[..]]
15697 [[foo././bar]]
15698 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15699
15700 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15701 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15702 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15703 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15704 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15705 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15706 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15707 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15708 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15709 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15710 [[<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>
15711 !!end
15712
15713 !! test
15714 Disabled subpages
15715 !! wikitext
15716 [[/subpage]]
15717 !! html
15718 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15719 </p>
15720 !! end
15721
15722 !! test
15723 T2561: {{/Subpage}}
15724 !! options
15725 subpage title=[[Page]]
15726 !! wikitext
15727 {{/Subpage}}
15728 !! html
15729 <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>
15730 </p>
15731 !! end
15732
15733 ###
15734 ### Categories
15735 ###
15736 !! article
15737 Category:MediaWiki User's Guide
15738 !! text
15739 blah
15740 !! endarticle
15741
15742 !! test
15743 Link to category
15744 !! wikitext
15745 [[:Category:MediaWiki User's Guide]]
15746 !! html
15747 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15748 </p>
15749 !! end
15750
15751 !! test
15752 Simple category
15753 !! options
15754 cat
15755 !! wikitext
15756 [[Category:MediaWiki User's Guide]]
15757 !! html/php
15758 cat=MediaWiki_User's_Guide sort=
15759 !! html/parsoid
15760 <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"}}'/>
15761 !! end
15762
15763 !! test
15764 PAGESINCATEGORY invalid title fatal (r33546 fix)
15765 !! wikitext
15766 {{PAGESINCATEGORY:<bogus>}}
15767 !! html
15768 <p>0
15769 </p>
15770 !! end
15771
15772 !! test
15773 Category with different sort key
15774 !! options
15775 cat
15776 !! wikitext
15777 [[Category:MediaWiki User's Guide|Foo]]
15778 !! html/php
15779 cat=MediaWiki_User's_Guide sort=Foo
15780 !! html/parsoid
15781 <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"}}'/>
15782 !! end
15783
15784 !! test
15785 Category with identical sort key
15786 !! options
15787 cat
15788 !! wikitext
15789 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15790 !! html/php
15791 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15792 !! html/parsoid
15793 <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"}}'/>
15794 !! end
15795
15796 !! test
15797 Category with empty sort key
15798 !! options
15799 cat
15800 pst
15801 !! wikitext
15802 [[Category:MediaWiki User's Guide|]]
15803 !! html/php
15804 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15805 !! end
15806
15807 !! test
15808 Category with empty sort key and parentheses
15809 !! options
15810 cat
15811 pst
15812 !! wikitext
15813 [[Category:Foo (bar)|]]
15814 !! html/php
15815 [[Category:Foo (bar)|Foo]]
15816 !! end
15817
15818 !! test
15819 Category with link tail
15820 !! options
15821 cat
15822 pst
15823 !! wikitext
15824 123[[Category:Foo]]456
15825 !! html/php
15826 123[[Category:Foo]]456
15827 !! end
15828
15829 !! test
15830 Category with template
15831 !! options
15832 cat
15833 pst
15834 !! wikitext
15835 [[Category:{{echo|Foo}}]]
15836 !! html/php
15837 [[Category:{{echo|Foo}}]]
15838 !! end
15839
15840 !! test
15841 Category with template in sort key
15842 !! options
15843 cat
15844 pst
15845 !! wikitext
15846 [[Category:Foo|{{echo|Bar}}]]
15847 !! html/php
15848 [[Category:Foo|{{echo|Bar}}]]
15849 !! end
15850
15851 !! test
15852 Category with template in sort key and title
15853 !! options
15854 cat
15855 pst
15856 !! wikitext
15857 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15858 !! html/php
15859 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15860 !! end
15861
15862 ## We used to, but no longer wt2wt this test since the default serializer
15863 ## will normalize all categories to serialize on their own line.
15864 ## This wikitext usage is going to be fairly uncommon in production and
15865 ## selser will take care of preserving formatting in those scenarios.
15866 !! test
15867 Category / paragraph interactions
15868 !! options
15869 parsoid=wt2html
15870 !! wikitext
15871 Foo [[Category:Baz]] Bar
15872
15873 Foo [[Category:Baz]]
15874 Bar
15875
15876 Foo
15877 [[Category:Baz]]
15878 Bar
15879
15880 Foo
15881 [[Category:Baz]] Bar
15882
15883 Foo
15884 [[Category:Baz]]
15885 [[Category:Baz]]
15886 [[Category:Baz]]
15887 Bar
15888
15889 [[Category:Baz]]
15890 [[Category:Baz]]
15891 [[Category:Baz]]
15892
15893 [[Category:Baz]]
15894 {{echo|[[Category:Baz]]}}
15895 [[Category:Baz]]
15896 !! html/php
15897 <p>Foo Bar
15898 </p><p>Foo
15899 Bar
15900 </p><p>Foo
15901 Bar
15902 </p><p>Foo Bar
15903 </p><p>Foo
15904 Bar
15905 </p>
15906 !! html/parsoid
15907 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15908 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15909 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15910 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15911 <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>
15912 <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}}]}'/>
15913 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15914 !! end
15915
15916 ## We used to, but no longer wt2wt this test since the default serializer
15917 ## will normalize all categories to serialize on their own line.
15918 ## This wikitext usage is going to be fairly uncommon in production and
15919 ## selser will take care of preserving formatting in those scenarios.
15920 ##
15921 ## The whitespace on the empty line is part of the test. Please do not delete
15922 !! test
15923 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15924 !! options
15925 parsoid=wt2html
15926 !! wikitext
15927 This
15928
15929 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15930
15931 {{echo|[[Category:Foo]] and so should this!}}
15932 !! html/php
15933 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15934 </p>
15935 !! html/parsoid
15936 <p>This
15937
15938 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15939
15940 <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>
15941 !! end
15942
15943 ## Parsoid will not try to wt2wt this while preserving newlines because
15944 ## it suppresses excess newlines within list items -- and we don't want to
15945 ## introduce a special case just for categories, which is, in reality somewhat
15946 ## odd behavior -- categories are unlikely to be used in list items like this
15947 ## in top-level pages and are only likely to show up in template-generated
15948 ## list items where this RT-ing is a non-issue.
15949 ##
15950 ## The whitespace on the empty line is part of the test. Please do not delete
15951 !! test
15952 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15953 !! options
15954 parsoid=wt2html
15955 !! wikitext
15956 * This
15957
15958 [[Category:Foo]] and this should be part of the same list item
15959 * So should this
15960
15961 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15962 !! html
15963 <ul><li>This and this should be part of the same list item</li>
15964 <li>So should this and this should be part of the same list item</li></ul>
15965 !! html/parsoid
15966 <ul>
15967 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15968 <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>
15969 </ul>
15970 !! end
15971
15972 ## Newlines and categories that follow the last item of a list
15973 ## are treated differently because this (list followed by categories)
15974 ## is an extremely common pattern on wikis.
15975 !! test
15976 3. Categories and newlines: newline suppression for last list item should RT properly
15977 !! wikitext
15978 * a
15979 * b
15980
15981 [[Category:Foo]]
15982
15983 [[Category:Bar]]
15984 [[Category:Baz]]
15985 !! html/parsoid
15986 <ul><li> a</li>
15987 <li> b</li></ul>
15988
15989 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15990
15991 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15992 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15993 !! end
15994
15995 !! test
15996 4. Categories and newlines: newline suppression for last list item should RT properly
15997 !! wikitext
15998 * a
15999 **** b
16000
16001 [[Category:Foo]]
16002 !! html/parsoid
16003 <ul><li> a
16004 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16005
16006 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16007 !! end
16008
16009 ## only wt2html for this to make sure the algo only applies to the rightmost path
16010 !! test
16011 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16012 !! options
16013 parsoid=wt2html
16014 !! wikitext
16015 * a
16016 ** b
16017 [[Category:Foo]]
16018 * c
16019 ** d
16020 [[Category:Foo]]
16021 !! html/parsoid
16022 <ul><li> a
16023 <ul><li> b
16024 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16025 <li> c
16026 <ul><li> d</li></ul></li></ul>
16027 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16028 !! end
16029
16030 ## We used to, but no longer wt2wt this test since the default serializer
16031 ## will normalize all categories to serialize on their own line.
16032 ## This wikitext usage is going to be fairly uncommon in production and
16033 ## selser will take care of preserving formatting in those scenarios.
16034 !! test
16035 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16036 !! options
16037 parsoid=wt2html
16038 !! wikitext
16039 * a [[Category:Foo]]
16040 !! html/parsoid
16041 <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>
16042 !! end
16043
16044 # This test also demonstrates because of newline+category tunneling
16045 # through the list hander, template wrapping doesn't expand to the
16046 # containing list when the list item swallows the category.
16047 !! test
16048 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16049 !! wikitext
16050 * {{echo|a
16051 [[Category:Foo]]}}
16052 !! html/parsoid
16053 <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
16054 </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>
16055 !! end
16056
16057 !! test
16058 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16059 !! wikitext
16060 * a
16061
16062 {{echo|[[Category:Foo]]
16063 [[Category:Bar]]}}
16064 [[Category:Baz]]
16065 !! html/parsoid
16066 <ul><li> a</li></ul>
16067
16068 <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">
16069 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16070 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16071 !! end
16072
16073 !! test
16074 9. Categories and newlines: should behave properly with linkprefix (T87753)
16075 !! options
16076 language=ar
16077 !! wikitext
16078 foo bar
16079 foo bar
16080 [[تصنيف:Foo]]
16081 [[تصنيف:Bar]]
16082 !! html/php
16083 <p>foo bar
16084 foo bar
16085 </p>
16086 !! html/parsoid
16087 <p>foo bar
16088 foo bar</p>
16089 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16090 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16091 !! end
16092
16093 !! test
16094 10. No regressions on internal links following category (T174639)
16095 !! options
16096 parsoid=wt2html,html2html
16097 !! wikitext
16098 [[Category:Foo]]<div>a
16099
16100 [[Foo]]</div>
16101 !! html/php
16102 <div>a
16103 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16104
16105 !! html/parsoid
16106 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16107
16108 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16109 !! end
16110
16111 # Note that Parsoid differs slightly from PHP due to T175421
16112 !! test
16113 11. Special case where only newlines separate links (T175416)
16114 !! options
16115 parsoid=wt2html,html2html
16116 !! wikitext
16117 [[Category:Foo]]
16118
16119 [[Foo]][[es:Alimento]]
16120
16121 [[Foo]]
16122 !! html/php
16123 <p><br />
16124 <a href="/wiki/Foo" title="Foo">Foo</a>
16125 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16126 </p>
16127 !! html/parsoid
16128 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16129
16130 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16131
16132 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16133 !! end
16134
16135 !! test
16136 Category links with multiple namespaces
16137 !! wikitext
16138 [[Category:Project:Foo]]
16139 !! html/parsoid
16140 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16141 !! end
16142
16143 !! test
16144 Parsoid: Serialize link to category page with colon escape
16145 !! options
16146 parsoid
16147 !! wikitext
16148
16149 [[:Category:Foo]]
16150 [[:Category:Foo|Bar]]
16151 !! html
16152 <p>
16153 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16154 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16155 </p>
16156 !! end
16157
16158 # We used to, but no longer wt2wt this test since the default serializer
16159 # will normalize all categories to serialize on their own line.
16160 # This wikitext usage is going to be fairly uncommon in production and
16161 # selser will take care of preventing whitespace insertion if this
16162 # occurs in an article.
16163 #
16164 # html2html disabled for the same reason (whitespace insertion between
16165 # x and y).
16166 #
16167 # html2wt disabled because it localizes the "Category" namespace.
16168 !! test
16169 Link prefix/suffixes aren't applied to category links
16170 !! options
16171 parsoid=wt2html
16172 language=is
16173 !! wikitext
16174 x[[Category:Foo]]y
16175 !! html/php
16176 <p>xy
16177 </p>
16178 !! html/parsoid
16179 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16180 !! end
16181
16182 !! test
16183 Link prefix/suffixes aren't applied to language links
16184 !! options
16185 parsoid=wt2html
16186 language=is
16187 !! wikitext
16188 x[[es:Foo]]y
16189 !! html/php
16190 <p>xy
16191 </p>
16192 !! html/parsoid
16193 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16194 !! end
16195
16196 !! test
16197 Parsoid: Serialize link to file page with colon escape
16198 !! options
16199 parsoid
16200 !! wikitext
16201
16202 [[:File:Foo.png]]
16203 [[:File:Foo.png|Bar]]
16204 !! html
16205 <p>
16206 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16207 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16208 </p>
16209 !! end
16210
16211 !! test
16212 Parsoid: Serialize a genuine category link without colon escape
16213 !! options
16214 parsoid
16215 !! wikitext
16216 [[Category:Foo]]
16217 [[Category:Foo|Bar]]
16218 !! html
16219 <link rel="mw:PageProp/Category" href="./Category:Foo">
16220 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16221 !! end
16222
16223 !! test
16224 Normalize hrefs properly before testing for invalid link targets (T72894)
16225 !! options
16226 parsoid=html2wt
16227 !! html/parsoid
16228 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16229 !! wikitext
16230 [[Category:Toxine bactérienne]]
16231 !! end
16232
16233 !! test
16234 Parsoid: Defaultsort
16235 !! wikitext
16236 {{DEFAULTSORT:Foo}}
16237 !! html/parsoid
16238 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16239 !! end
16240
16241 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16242 # But, this is a limitation of our representation and is documented in
16243 # TemplateHandler.js in processSpecialMagicWord
16244 !! test
16245 Parsoid: Defaultsort (template-generated)
16246 !! wikitext
16247 {{{{echo|DEFAULTSORT}}:Foo}}
16248 !! html/parsoid
16249 <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"}]]}'/>
16250 !! end
16251
16252 ###
16253 ### Inter-language links
16254 ###
16255 !! test
16256 Interlanguage links
16257 !! options
16258 ill
16259 !! wikitext
16260 [[es:Alimento]]
16261 [[fr:Nourriture]]
16262 [[zh:食品]]
16263 !! html/php
16264 es:Alimento fr:Nourriture zh:食品
16265 !! html/parsoid
16266 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16267 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16268 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16269 !! end
16270
16271 !! test
16272 Duplicate interlanguage links (T26502)
16273 !! options
16274 ill
16275 !! wikitext
16276 [[es:1]]
16277 [[es:2]]
16278 [[fr:1]]
16279 [[fr:2]]
16280 !! html/php
16281 es:1 fr:1
16282 !! html/parsoid
16283 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16284 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16285 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16286 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16287 !! end
16288
16289 ###
16290 ### Sections
16291 ###
16292 !! test
16293 Basic section headings
16294 !! wikitext
16295 ==Headline 1==
16296 Some text
16297
16298 ==Headline 2==
16299 More
16300 ===Smaller headline===
16301 Blah blah
16302 !! html
16303 <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>
16304 <p>Some text
16305 </p>
16306 <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>
16307 <p>More
16308 </p>
16309 <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>
16310 <p>Blah blah
16311 </p>
16312 !! end
16313
16314 !! test
16315 Section headings with TOC
16316 !! wikitext
16317 ==Headline 1==
16318 ===Subheadline 1===
16319 =====Skipping a level=====
16320 ======Skipping a level======
16321
16322 ==Headline 2==
16323 Some text
16324 ===Another headline===
16325 !! html
16326 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16327 <ul>
16328 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16329 <ul>
16330 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16331 <ul>
16332 <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>
16333 <ul>
16334 <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>
16335 </ul>
16336 </li>
16337 </ul>
16338 </li>
16339 </ul>
16340 </li>
16341 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16342 <ul>
16343 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16344 </ul>
16345 </li>
16346 </ul>
16347 </div>
16348
16349 <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>
16350 <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>
16351 <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>
16352 <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>
16353 <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>
16354 <p>Some text
16355 </p>
16356 <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>
16357
16358 !! end
16359
16360 !! test
16361 TOC anchors don't collide
16362 !! wikitext
16363 __FORCETOC__
16364 ==Headline 2==
16365 ==Headline==
16366 ==Headline 2==
16367 ==Headline==
16368 !! html/php
16369 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16370 <ul>
16371 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16372 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16373 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16374 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16375 </ul>
16376 </div>
16377
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=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16379 <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>
16380 <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>
16381 <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>
16382
16383 !! end
16384
16385 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16386 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16387 !! test
16388 Handling of sections up to level 6 and beyond
16389 !! options
16390 parsoid=wt2html
16391 !! wikitext
16392 =Level 1 Heading=
16393 ==Level 2 Heading==
16394 ===Level 3 Heading===
16395 ====Level 4 Heading====
16396 =====Level 5 Heading=====
16397 ======Level 6 Heading======
16398 =======Level 7 Heading=======
16399 ========Level 8 Heading========
16400 =========Level 9 Heading=========
16401 ==========Level 10 Heading==========
16402 !! html/php
16403 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16404 <ul>
16405 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16406 <ul>
16407 <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>
16408 <ul>
16409 <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>
16410 <ul>
16411 <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>
16412 <ul>
16413 <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>
16414 <ul>
16415 <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>
16416 <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>
16417 <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>
16418 <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>
16419 <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>
16420 </ul>
16421 </li>
16422 </ul>
16423 </li>
16424 </ul>
16425 </li>
16426 </ul>
16427 </li>
16428 </ul>
16429 </li>
16430 </ul>
16431 </div>
16432
16433 <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>
16434 <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>
16435 <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>
16436 <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>
16437 <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>
16438 <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>
16439 <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>
16440 <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>
16441 <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>
16442 <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>
16443
16444 !! html/parsoid
16445 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16446 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16447 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16448 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16449 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16450 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16451 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16452 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16453 <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3D_Level_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
16454 <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
16455 !! end
16456
16457 !! test
16458 TOC regression (T11764)
16459 !! wikitext
16460 ==title 1==
16461 ===title 1.1===
16462 ====title 1.1.1====
16463 ===title 1.2===
16464 ==title 2==
16465 ===title 2.1===
16466 !! html
16467 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16468 <ul>
16469 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16470 <ul>
16471 <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>
16472 <ul>
16473 <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>
16474 </ul>
16475 </li>
16476 <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>
16477 </ul>
16478 </li>
16479 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16480 <ul>
16481 <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>
16482 </ul>
16483 </li>
16484 </ul>
16485 </div>
16486
16487 <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>
16488 <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>
16489 <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>
16490 <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>
16491 <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>
16492 <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>
16493
16494 !! end
16495
16496 !! test
16497 TOC for heading containing <span id="..."></span> (T96153)
16498 !! wikitext
16499 __FORCETOC__
16500 ==<span id="old-anchor"></span>New title==
16501 !! html/php
16502 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16503 <ul>
16504 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16505 </ul>
16506 </div>
16507
16508 <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>
16509
16510 !! end
16511
16512 !! test
16513 TOC with wgMaxTocLevel=3 (T8204)
16514 !! options
16515 wgMaxTocLevel=3
16516 !! wikitext
16517 ==title 1==
16518 ===title 1.1===
16519 ====title 1.1.1====
16520 ===title 1.2===
16521 ==title 2==
16522 ===title 2.1===
16523 !! html
16524 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16525 <ul>
16526 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16527 <ul>
16528 <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>
16529 <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>
16530 </ul>
16531 </li>
16532 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16533 <ul>
16534 <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>
16535 </ul>
16536 </li>
16537 </ul>
16538 </div>
16539
16540 <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>
16541 <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>
16542 <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>
16543 <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>
16544 <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>
16545 <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>
16546
16547 !! end
16548
16549 !! test
16550 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16551 !! options
16552 wgMaxTocLevel=3
16553 !! wikitext
16554 ==Section 1==
16555 ===Section 1.1===
16556 ====Section 1.1.1====
16557 ====Section 1.1.1.1====
16558 ==Section 2==
16559 !! html
16560 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16561 <ul>
16562 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16563 <ul>
16564 <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>
16565 </ul>
16566 </li>
16567 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16568 </ul>
16569 </div>
16570
16571 <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>
16572 <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>
16573 <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>
16574 <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>
16575 <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>
16576
16577 !! end
16578
16579
16580 !! test
16581 Resolving duplicate section names
16582 !! wikitext
16583 ==Foo bar==
16584 ==Foo bar==
16585 !! html
16586 <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>
16587 <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>
16588
16589 !! end
16590
16591 !! test
16592 Resolving duplicate section names with differing case (T12721)
16593 !! wikitext
16594 ==Foo bar==
16595 ==Foo Bar==
16596 !! html
16597 <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>
16598 <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>
16599
16600 !! end
16601
16602 !! article
16603 Template:sections
16604 !! text
16605 ===Section 1===
16606 ==Section 2==
16607 !! endarticle
16608
16609 !! test
16610 Template with sections, __NOTOC__
16611 !! wikitext
16612 __NOTOC__
16613 ==Section 0==
16614 {{sections}}
16615 ==Section 4==
16616 !! html
16617 <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>
16618 <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>
16619 <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>
16620 <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>
16621
16622 !! end
16623
16624 !! test
16625 __NOEDITSECTION__ keyword
16626 !! wikitext
16627 __NOEDITSECTION__
16628 ==Section 1==
16629 ==Section 2==
16630 !! html
16631 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16632 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16633
16634 !! end
16635
16636 !! test
16637 Link inside a section heading
16638 !! wikitext
16639 ==Section with a [[Main Page|link]] in it==
16640 !! html
16641 <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>
16642
16643 !! end
16644
16645 !! test
16646 TOC regression (T14077)
16647 !! wikitext
16648 __TOC__
16649 ==title 1==
16650 ===title 1.1===
16651 ==title 2==
16652 !! html
16653 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16654 <ul>
16655 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16656 <ul>
16657 <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>
16658 </ul>
16659 </li>
16660 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16661 </ul>
16662 </div>
16663
16664 <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>
16665 <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>
16666 <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>
16667
16668 !! end
16669
16670 !! test
16671 T3219 URL next to image (good)
16672 !! wikitext
16673 http://example.com [[File:Foobar.jpg]]
16674 !! html/php
16675 <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>
16676 </p>
16677 !! html/parsoid
16678 <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>
16679 !!end
16680
16681 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16682 !! test
16683 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16684 !! options
16685 parsoid=wt2html,html2html
16686 !! wikitext
16687 ===
16688 The line above must have a trailing space!
16689 === <!--
16690 --> <!-- -->
16691 But just in case it doesn't...
16692 !! html/php
16693 <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>
16694 <p>The line above must have a trailing space!
16695 </p>
16696 <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>
16697 <p>But just in case it doesn't...
16698 </p>
16699 !! html/parsoid
16700 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16701 <p>The line above must have a trailing space!</p>
16702 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16703 --> <!-- -->
16704 <p>But just in case it doesn't...</p>
16705 !! end
16706
16707 !! test
16708 Header with special characters (T27462)
16709 !! wikitext
16710 The tooltips shall not show entities to the user (ie. be double escaped)
16711
16712 ==text > text==
16713 section 1
16714
16715 ==text < text==
16716 section 2
16717
16718 ==text & text==
16719 section 3
16720
16721 ==text ' text==
16722 section 4
16723
16724 ==text " text==
16725 section 5
16726 !! html/php
16727 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16728 </p>
16729 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16730 <ul>
16731 <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>
16732 <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>
16733 <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>
16734 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16735 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16736 </ul>
16737 </div>
16738
16739 <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>
16740 <p>section 1
16741 </p>
16742 <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>
16743 <p>section 2
16744 </p>
16745 <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>
16746 <p>section 3
16747 </p>
16748 <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>
16749 <p>section 4
16750 </p>
16751 <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>
16752 <p>section 5
16753 </p>
16754 !! html/parsoid
16755 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16756
16757 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16758 <p>section 1</p>
16759
16760 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16761 <p>section 2</p>
16762
16763 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16764 <p>section 3</p>
16765
16766 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16767 <p>section 4</p>
16768
16769 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16770 <p>section 5</p>
16771 !! end
16772
16773 !! test
16774 Header with space, plus and underscore as entity
16775 !! wikitext
16776 Id should not contain + for spaces
16777
16778 ==Space between Text==
16779 section 1
16780
16781 ==Space-Entity&#32;between&#32;Text==
16782 section 2
16783
16784 ==Plus+between+Text==
16785 section 3
16786
16787 ==Plus-Entity&#43;between&#43;Text==
16788 section 4
16789
16790 ==Underscore_between_Text==
16791 section 5
16792
16793 ==Underscore-Entity&#95;between&#95;Text==
16794 section 6
16795
16796 [[#Space between Text]]
16797 [[#Space-Entity&#32;between&#32;Text]]
16798 [[#Plus+between+Text]]
16799 [[#Plus-Entity&#43;between&#43;Text]]
16800 [[#Underscore_between_Text]]
16801 [[#Underscore-Entity&#95;between&#95;Text]]
16802 !! html/php
16803 <p>Id should not contain + for spaces
16804 </p>
16805 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16806 <ul>
16807 <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>
16808 <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>
16809 <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>
16810 <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>
16811 <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>
16812 <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>
16813 </ul>
16814 </div>
16815
16816 <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>
16817 <p>section 1
16818 </p>
16819 <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>
16820 <p>section 2
16821 </p>
16822 <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>
16823 <p>section 3
16824 </p>
16825 <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>
16826 <p>section 4
16827 </p>
16828 <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>
16829 <p>section 5
16830 </p>
16831 <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>
16832 <p>section 6
16833 </p><p><a href="#Space_between_Text">#Space between Text</a>
16834 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16835 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16836 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16837 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16838 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16839 </p>
16840 !! html/parsoid
16841 <p>Id should not contain + for spaces</p>
16842
16843 <h2 id="Space_between_Text">Space between Text</h2>
16844 <p>section 1</p>
16845
16846 <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>
16847 <p>section 2</p>
16848
16849 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16850 <p>section 3</p>
16851
16852 <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>
16853 <p>section 4</p>
16854
16855 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16856 <p>section 5</p>
16857
16858 <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>
16859 <p>section 6</p>
16860
16861 <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>
16862 <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>
16863 <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>
16864 <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>
16865 <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>
16866 <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>
16867 !! end
16868
16869 # Parsoid html2wt disabled because it adds padding spaces around =
16870 !! test
16871 Headers with excess '=' characters
16872 (Are similar tests necessary beyond the 1st level?)
16873 !! options
16874 parsoid=wt2html,wt2wt,html2html
16875 !! wikitext
16876 =foo==
16877 ==foo=
16878 =''italic'' heading==
16879 ==''italic'' heading=
16880 !! html/php
16881 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16882 <ul>
16883 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16884 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16885 <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>
16886 <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>
16887 </ul>
16888 </div>
16889
16890 <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>
16891 <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>
16892 <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>
16893 <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>
16894
16895 !! html/parsoid
16896 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16897 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16898 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16899 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16900 !! end
16901
16902 !! test
16903 HTML headers vs TOC (T25393)
16904 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16905 !! wikitext
16906 <h1>Header 1</h1>
16907 ==Header 1.1==
16908 ==Header 1.2==
16909
16910 <h1>Header 2
16911 </h1>
16912 ==Header 2.1==
16913 ==Header 2.2==
16914 __NOEDITSECTION__
16915 !! html/php
16916 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16917 <ul>
16918 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16919 <ul>
16920 <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>
16921 <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>
16922 </ul>
16923 </li>
16924 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16925 <ul>
16926 <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>
16927 <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>
16928 </ul>
16929 </li>
16930 </ul>
16931 </div>
16932
16933 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16934 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16935 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16936 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16937 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16938 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16939
16940 !! html/parsoid
16941 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16942 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
16943 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
16944
16945 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16946 </h1>
16947 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
16948 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
16949 <meta property="mw:PageProp/noeditsection"/>
16950 !! end
16951
16952 !! test
16953 Single-line or multiline-comments can follow headings
16954 !! options
16955 parsoid=wt2html,wt2wt
16956 !! wikitext
16957 ==foo==<!---->
16958 ==bar==<!--c1-->
16959 ==baz==<!--
16960 c2
16961 c3-->
16962 !! html/php
16963 <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>
16964 <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>
16965 <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>
16966
16967 !! html/parsoid
16968 <h2 id="foo">foo</h2><!---->
16969 <h2 id="bar">bar</h2><!--c1-->
16970 <h2 id="baz">baz</h2><!--
16971 c2
16972 c3-->
16973 !! end
16974
16975 !! test
16976 T3219 URL next to image (broken)
16977 !! wikitext
16978 http://example.com[[File:Foobar.jpg]]
16979 !! html/php
16980 <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>
16981 </p>
16982 !! html/parsoid
16983 <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>
16984 !!end
16985
16986 !! test
16987 T3186 news: in the middle of text
16988 !! wikitext
16989 http://en.wikinews.org/wiki/Wikinews:Workplace
16990 !! html
16991 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16992 </p>
16993 !!end
16994
16995
16996 !! test
16997 Namespaced link must have a title
16998 !! wikitext
16999 [[Project:]]
17000 !! html
17001 <p>[[Project:]]
17002 </p>
17003 !!end
17004
17005 !! test
17006 Namespaced link must have a title (bad fragment version)
17007 !! wikitext
17008 [[Project:#fragment]]
17009 !! html
17010 <p>[[Project:#fragment]]
17011 </p>
17012 !!end
17013
17014
17015 ###
17016 ### HTML tags and HTML attributes
17017 ###
17018
17019 !! test
17020 div with no attributes
17021 !! wikitext
17022 <div>HTML rocks</div>
17023 !! html
17024 <div>HTML rocks</div>
17025
17026 !! end
17027
17028 !! test
17029 div with double-quoted attribute
17030 !! wikitext
17031 <div id="rock">HTML rocks</div>
17032 !! html
17033 <div id="rock">HTML rocks</div>
17034
17035 !! end
17036
17037 !! test
17038 div with single-quoted attribute
17039 !! wikitext
17040 <div id='rock'>HTML rocks</div>
17041 !! html
17042 <div id="rock">HTML rocks</div>
17043
17044 !! end
17045
17046 !! test
17047 div with unquoted attribute
17048 !! wikitext
17049 <div id=rock>HTML rocks</div>
17050 !! html
17051 <div id="rock">HTML rocks</div>
17052
17053 !! end
17054
17055 !! test
17056 div with illegal double attributes
17057 !! wikitext
17058 <div id="a" id="b">HTML rocks</div>
17059 !! html
17060 <div id="b">HTML rocks</div>
17061
17062 !!end
17063
17064 !! test
17065 div with empty attribute value, space before equals
17066 !! options
17067 parsoid=wt2html,html2html
17068 !! wikitext
17069 <div class =>HTML rocks</div>
17070 !! html/php
17071 <div class="">HTML rocks</div>
17072
17073 !! html/parsoid
17074 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17075 !! end
17076
17077 !! test
17078 div with multiple empty attribute values
17079 !! config
17080 wgFragmentMode=[ 'html5', 'legacy' ]
17081 !! options
17082 parsoid=wt2html,html2html
17083 !! wikitext
17084 <div id= title=>HTML rocks</div>
17085 !! html/php
17086 <div id="title=">HTML rocks</div>
17087
17088 !! html/parsoid
17089 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17090 !! end
17091
17092 # FIXME Parsoid doesn't actually match PHP here.
17093 # Probably we should use the synthetic <foo /> or <indicator>
17094 # extensions for this test, which are enabled when running parser tests.
17095 !! test
17096 Extension tag in attribute value
17097 !! wikitext
17098 <span title="<translate>123</translate>">ok</span>
17099 !! html/php+disabled
17100 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17101 </p>
17102 !! html/parsoid
17103 <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>
17104 !! end
17105
17106 !! test
17107 table with multiple empty attribute values
17108 !! options
17109 parsoid=wt2html,html2html
17110 !! wikitext
17111 {| title= id=
17112 |hi
17113 |}
17114 !! html/php
17115 <table title="id=">
17116 <tr>
17117 <td>hi
17118 </td></tr></table>
17119
17120 !! html/parsoid
17121 <table title="id=">
17122 <tbody><tr><td>hi</td></tr>
17123 </tbody></table>
17124 !! end
17125
17126 !! test
17127 div with braces in attribute value
17128 !! wikitext
17129 <div title="{}">Foo</div>
17130 !! html/php
17131 <div title="&#123;&#125;">Foo</div>
17132
17133 !! html/parsoid
17134 <div title="{}">Foo</div>
17135 !! end
17136
17137 !! test
17138 div with empty attribute value, no 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="">HTML rocks</div>
17148 !! end
17149
17150 !! test
17151 HTML multiple attributes correction
17152 !! wikitext
17153 <p class="error" class="awesome">Awesome!</p>
17154 !! html
17155 <p class="awesome">Awesome!</p>
17156
17157 !!end
17158
17159 !! test
17160 Table multiple attributes correction
17161 !! wikitext
17162 {|
17163 !+ class="error" class="awesome"|status
17164 |}
17165 !! html
17166 <table>
17167 <tr>
17168 <th class="awesome">status
17169 </th></tr></table>
17170
17171 !!end
17172
17173 !! test
17174 DIV IN UPPERCASE
17175 !! wikitext
17176 <DIV ID="x">HTML ROCKS</DIV>
17177 !! html
17178 <div id="x">HTML ROCKS</div>
17179
17180 !!end
17181
17182 !! test
17183 Non-ASCII pseudo-tags are rendered as text
17184 !! wikitext
17185 <khyô>
17186 !! html
17187 <p>&lt;khyô&gt;
17188 </p>
17189 !! end
17190
17191 !! test
17192 Pseudo-tag with URL 'name' renders as url link
17193 !! wikitext
17194 <http://example.com/>
17195 !! html
17196 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17197 </p>
17198 !! end
17199
17200 !! test
17201 text with amp in the middle of nowhere
17202 !! wikitext
17203 Remember AT&T?
17204 !! html
17205 <p>Remember AT&amp;T?
17206 </p>
17207 !! end
17208
17209 !! test
17210 text with character entity: eacute
17211 !! wikitext
17212 I always thought &eacute; was a cute letter.
17213 !! html+tidy
17214 <p>I always thought &#233; was a cute letter.
17215 </p>
17216 !! end
17217
17218 !! test
17219 text with entity-escaped character entity-like string: eacute
17220 !! wikitext
17221 I always thought &amp;eacute; was a cute letter.
17222 !! html
17223 <p>I always thought &amp;eacute; was a cute letter.
17224 </p>
17225 !! end
17226
17227 !! test
17228 text with undefined character entity: xacute
17229 !! wikitext
17230 I always thought &xacute; was a cute letter.
17231 !! html
17232 <p>I always thought &amp;xacute; was a cute letter.
17233 </p>
17234 !! end
17235
17236 !! test
17237 HTML5 tags
17238 !! wikitext
17239 <data value="5">five</data>
17240 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17241 <mark>This highlighted text</mark>
17242 !! html
17243 <p><data value="5">five</data>
17244 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17245 <mark>This highlighted text</mark>
17246 </p>
17247 !! end
17248
17249 !! test
17250 HTML tag with leading space is parsed as text
17251 !! wikitext
17252 < div>foo< /div>
17253 !! html
17254 <p>&lt; div&gt;foo&lt; /div&gt;
17255 </p>
17256 !! end
17257
17258 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17259 ## the HTML5 parsing spec.
17260 !! test
17261 Element with broken attribute syntax
17262 !! options
17263 parsoid=wt2html
17264 !! wikitext
17265 <div style=" style="123">hi</div>
17266 <div =>ho</div>
17267 !! html/php
17268 <div style="123">hi</div>
17269 <div>ho</div>
17270
17271 !! html/parsoid
17272 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17273 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17274 !! end
17275
17276 ###
17277 ### Nesting tests (see T43545, T52604, T53081)
17278 ###
17279
17280 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17281 # Note that html2wt is considerably more difficult if we use <b> in
17282 # the test case, instead of <small>
17283 !! test
17284 Ensure that HTML adoption agency algorithm is properly implemented.
17285 !! wikitext
17286 <small>X<small>Y</small>Z</small>
17287 !! html
17288 <p><small>X<small>Y</small>Z</small>
17289 </p>
17290 !! end
17291
17292 # This was T43545 in the PHP parser.
17293 !! test
17294 Nesting of <kbd>
17295 !! wikitext
17296 <kbd>X<kbd>Y</kbd>Z</kbd>
17297 !! html+tidy
17298 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17299 </p>
17300 !! end
17301
17302 # The following cases were T53081 in the PHP parser.
17303 # Note that there are some other nestable tags (b, i, etc) which are
17304 # not covered; see T53081 for discussion.
17305
17306 !! test
17307 Nesting of <em>
17308 !! wikitext
17309 <em>X<em>Y</em>Z</em>
17310 !! html+tidy
17311 <p><em>X<em>Y</em>Z</em>
17312 </p>
17313 !! end
17314
17315 !! test
17316 Nesting of <strong>
17317 !! wikitext
17318 <strong>X<strong>Y</strong>Z</strong>
17319 !! html+tidy
17320 <p><strong>X<strong>Y</strong>Z</strong>
17321 </p>
17322 !! end
17323
17324 !! test
17325 Nesting of <q>
17326 !! wikitext
17327 <q>X<q>Y</q>Z</q>
17328 !! html+tidy
17329 <p><q>X<q>Y</q>Z</q>
17330 </p>
17331 !! end
17332
17333 !! test
17334 Nesting of <ruby>
17335 !! wikitext
17336 <ruby>X<ruby>Y</ruby>Z</ruby>
17337 !! html
17338 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17339 </p>
17340 !! end
17341
17342 !! test
17343 Nesting of <bdo>
17344 !! wikitext
17345 <bdo>X<bdo>Y</bdo>Z</bdo>
17346 !! html
17347 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17348 </p>
17349 !! end
17350
17351
17352 ###
17353 ### Media links
17354 ###
17355
17356 !! test
17357 Media link
17358 !! wikitext
17359 [[Media:Foobar.jpg]]
17360 [[Media:Video.ogv]]
17361 [[:Media:Video.ogv]]
17362 !! html/php
17363 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17364 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17365 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17366 </p>
17367 !! html/parsoid
17368 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17369 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17370 <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>
17371 !! end
17372
17373 !! test
17374 Media link with text
17375 !! wikitext
17376 [[Media:Foobar.jpg|A neat file to look at]]
17377 !! html/php
17378 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17379 </p>
17380 !! html/parsoid
17381 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17382 !! end
17383
17384 # FIXME: this is still bad HTML tag nesting
17385 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17386 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17387 !! test
17388 Media link with nasty text
17389 !! wikitext
17390 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17391 !! html/php
17392 <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>
17393
17394 !! html+php/tidy
17395 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17396 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17397 !! html/parsoid
17398 <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>
17399
17400 !! end
17401
17402 !! test
17403 Media link to nonexistent file (T3702)
17404 !! wikitext
17405 [[Media:No such.jpg]]
17406 [[Media:No_such file.jpg]]
17407 !! html/php
17408 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17409 <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>
17410 </p>
17411 !! html/parsoid
17412 <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>
17413 <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>
17414 !! end
17415
17416 !! test
17417 Image link to nonexistent file (T3850 - good)
17418 !! wikitext
17419 [[File:No_such.jpg]]
17420 !! html/php
17421 <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>
17422 </p>
17423 !! html/parsoid
17424 <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>
17425 !! end
17426
17427 !! test
17428 :Image link to nonexistent file (T3850 - bad)
17429 !! wikitext
17430 [[:Image:No such.jpg]]
17431 !! html/php
17432 <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>
17433 </p>
17434 !! html/parsoid
17435 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17436 !! end
17437
17438 !! test
17439 Character reference normalization in link text (T3938)
17440 !! wikitext
17441 [[Main Page|this&that]]
17442 !! html
17443 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17444 </p>
17445 !!end
17446
17447 !! article
17448 אַ
17449 !! text
17450 Test for unicode normalization
17451
17452 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17453 !! endarticle
17454
17455 !! test
17456 (T21451) Links should refer to the normalized form.
17457 !! wikitext
17458 [[&#xFB2E;]]
17459 [[&#x5d0;&#x5b7;]]
17460 [[&#x5d0;ַ]]
17461 [[א&#x5b7;]]
17462 [[אַ]]
17463 !! html
17464 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17465 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17466 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17467 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17468 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17469 </p>
17470 !! end
17471
17472 !! test
17473 Empty attribute crash test (T4067)
17474 !! wikitext
17475 <font color="">foo</font>
17476 !! html
17477 <p><font color="">foo</font>
17478 </p>
17479 !! end
17480
17481 !! test
17482 Empty attribute crash test single-quotes (T4067)
17483 !! wikitext
17484 <font color=''>foo</font>
17485 !! html
17486 <p><font color="">foo</font>
17487 </p>
17488 !! end
17489
17490 !! test
17491 Attribute test: equals, then nothing
17492 !! options
17493 parsoid=wt2html,html2html
17494 !! wikitext
17495 <font color=>foo</font>
17496 !! html/php
17497 <p><font color="">foo</font>
17498 </p>
17499 !! html/parsoid
17500 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17501 !! end
17502
17503 !! test
17504 Attribute test: unquoted value
17505 !! options
17506 parsoid=wt2html,html2html
17507 !! wikitext
17508 <font color=x>foo</font>
17509 !! html/php
17510 <p><font color="x">foo</font>
17511 </p>
17512 !! html/parsoid
17513 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17514 !! end
17515
17516 !! test
17517 Attribute test: unquoted but illegal value (hash)
17518 !! wikitext
17519 <font color=#x>foo</font>
17520 !! html
17521 <p><font color="#x">foo</font>
17522 </p>
17523 !! end
17524
17525 # Parsoid does not serialize to empty attribute syntax,
17526 # so wt2wt and html2wt cases are skipped
17527 !! test
17528 Attribute test: no value (T54330)
17529 !! options
17530 parsoid=wt2html,html2html
17531 !! wikitext
17532 <font color>foo</font>
17533 !! html/php
17534 <p><font color="">foo</font>
17535 </p>
17536 !! html/parsoid
17537 <p><font color="">foo</font></p>
17538 !! end
17539
17540 !! test
17541 T4095: link with three closing brackets
17542 !! wikitext
17543 [[Main Page]]]
17544 !! html/php
17545 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17546 </p>
17547 !! html/parsoid
17548 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17549 !! end
17550
17551 !! test
17552 T4095: link with pipe and three closing brackets
17553 !! wikitext
17554 [[Main Page|link]]]
17555 !! html/php
17556 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17557 </p>
17558 !! html/parsoid
17559 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17560 !! end
17561
17562 !! test
17563 T4095: link with pipe and three closing brackets, version 2
17564 !! wikitext
17565 [[Main Page|[http://example.com/]]]
17566 !! html/php
17567 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17568 </p>
17569 !! html/parsoid
17570 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17571 !! end
17572
17573
17574 ###
17575 ### Safety
17576 ###
17577
17578 !! article
17579 Template:Dangerous attribute
17580 !! text
17581 " onmouseover="alert(document.cookie)
17582 !! endarticle
17583
17584 !! article
17585 Template:Dangerous style attribute
17586 !! text
17587 border-size: expression(alert(document.cookie))
17588 !! endarticle
17589
17590 !! article
17591 Template:Div style
17592 !! text
17593 <div style="float: right; {{{1}}}">Magic div</div>
17594 !! endarticle
17595
17596 !! test
17597 T4304: HTML attribute safety (safe template; regression T4309)
17598 !! wikitext
17599 <div title="{{test}}"></div>
17600 !! html/php
17601 <div title="This is a test template"></div>
17602
17603 !! html/parsoid
17604 <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>
17605 !! end
17606
17607 # Parsoid has enough context to handle this case
17608 !! test
17609 T4304: HTML attribute safety (dangerous template; 2309)
17610 !! wikitext
17611 <div title="{{dangerous attribute}}"></div>
17612 !! html/php
17613 <div title=""></div>
17614
17615 !! html/parsoid
17616 <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>
17617 !! end
17618
17619 !! test
17620 T4304: HTML attribute safety (dangerous style template; 2309)
17621 !! wikitext
17622 <div style="{{dangerous style attribute}}"></div>
17623 !! html/php
17624 <div style="/* insecure input */"></div>
17625
17626 !! html/parsoid
17627 <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>
17628 !! end
17629
17630 !! test
17631 T4304: HTML attribute safety (safe parameter; 2309)
17632 !! wikitext
17633 {{div style|width: 200px}}
17634 !! html/php
17635 <div style="float: right; width: 200px">Magic div</div>
17636
17637 !! html/parsoid
17638 <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>
17639 !! end
17640
17641 !! test
17642 T4304: HTML attribute safety (unsafe parameter; 2309)
17643 !! wikitext
17644 {{div style|width: expression(alert(document.cookie))}}
17645 !! html/php
17646 <div style="/* insecure input */">Magic div</div>
17647
17648 !! html/parsoid
17649 <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>
17650 !! end
17651
17652 ## Parsoid output here differs; needs investigation.
17653 !! test
17654 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17655 !! wikitext
17656 {{div style|"><script>alert(document.cookie)</script>}}
17657 !! html
17658 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17659
17660 !! end
17661
17662 ## Parsoid output here differs; needs investigation.
17663 !! test
17664 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17665 !! wikitext
17666 {{div style|" ><script>alert(document.cookie)</script>}}
17667 !! html
17668 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17669
17670 !! end
17671
17672 !! test
17673 T4304: HTML attribute safety (link)
17674 !! wikitext
17675 <div title="[[Main Page]]"></div>
17676 !! html/php
17677 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17678
17679 !! html/parsoid
17680 <div title="[[Main Page]]"></div>
17681 !! end
17682
17683 !! test
17684 T4304: HTML attribute safety (italics)
17685 !! wikitext
17686 <div title="''foobar''"></div>
17687 !! html
17688 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17689
17690 !! end
17691
17692 !! test
17693 T4304: HTML attribute safety (bold)
17694 !! wikitext
17695 <div title="'''foobar'''"></div>
17696 !! html
17697 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17698
17699 !! end
17700
17701 !! test
17702 T4304: HTML attribute safety (ISBN)
17703 !! wikitext
17704 <div title="ISBN 1234567890"></div>
17705 !! html
17706 <div title="&#73;SBN 1234567890"></div>
17707
17708 !! end
17709
17710 !! test
17711 T4304: HTML attribute safety (RFC)
17712 !! wikitext
17713 <div title="RFC 1234"></div>
17714 !! html
17715 <div title="&#82;FC 1234"></div>
17716
17717 !! end
17718
17719 !! test
17720 T4304: HTML attribute safety (PMID)
17721 !! wikitext
17722 <div title="PMID 1234567890"></div>
17723 !! html
17724 <div title="&#80;MID 1234567890"></div>
17725
17726 !! end
17727
17728 !! test
17729 T4304: HTML attribute safety (web link)
17730 !! wikitext
17731 <div title="http://example.com/"></div>
17732 !! html
17733 <div title="http&#58;//example.com/"></div>
17734
17735 !! end
17736
17737 !! test
17738 T4304: HTML attribute safety (named web link)
17739 !! wikitext
17740 <div title="[http://example.com/ link]"></div>
17741 !! html/php
17742 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17743
17744 !! html/parsoid
17745 <div title="[http://example.com/ link]"></div>
17746 !! end
17747
17748 !! test
17749 T5244: HTML attribute safety (extension; safe)
17750 !! wikitext
17751 <div style="<nowiki>background:blue</nowiki>"></div>
17752 !! html/php
17753 <div style="background:blue"></div>
17754
17755 !! html/parsoid
17756 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17757 !! end
17758
17759 !! test
17760 T5244: HTML attribute safety (extension; unsafe)
17761 !! wikitext
17762 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17763 !! html/php
17764 <div style="/* insecure input */"></div>
17765
17766 !! html/parsoid
17767 <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>
17768 !! end
17769
17770 # More MSIE fun discovered by Tom Gilder
17771
17772 !! test
17773 MSIE CSS safety test: spurious slash
17774 !! wikitext
17775 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17776 !! html/php
17777 <div style="/* insecure input */">evil</div>
17778
17779 !! html/parsoid
17780 <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>
17781 !! end
17782
17783 !! test
17784 MSIE CSS safety test: hex code
17785 !! wikitext
17786 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17787 !! html/php
17788 <div style="/* insecure input */">evil</div>
17789
17790 !! html/parsoid
17791 <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>
17792 !! end
17793
17794 !! test
17795 MSIE CSS safety test: comment in url
17796 !! wikitext
17797 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17798 !! html/php
17799 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17800
17801 !! html/parsoid
17802 <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>
17803 !! end
17804
17805 !! test
17806 MSIE CSS safety test: comment in expression
17807 !! wikitext
17808 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17809 !! html/php
17810 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17811
17812 !! html/parsoid
17813 <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>
17814 !! end
17815
17816 !! test
17817 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17818 !! wikitext
17819 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17820 !! html/php
17821 <p style="/* invalid control char */">A</p>
17822
17823 !! html/parsoid
17824 <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>
17825 !! end
17826
17827 !! test
17828 MSIE 6 CSS safety test: Fullwidth (T57332)
17829 !! wikitext
17830 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17831 <div style="top:EXPRESSION(alert())">B</div>
17832 !! html/php
17833 <p style="/* insecure input */">A</p>
17834 <div style="/* insecure input */">B</div>
17835
17836 !! html/parsoid
17837 <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>
17838 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17839 !! end
17840
17841 !! test
17842 MSIE 6 CSS safety test: IPA extensions (T57332)
17843 !! wikitext
17844 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17845 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17846 !! html/php
17847 <div style="/* insecure input */">A</div>
17848 <p style="/* insecure input */">B</p>
17849
17850 !! html/parsoid
17851 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17852 <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>
17853 !! end
17854
17855 !! test
17856 MSIE 6 CSS safety test: sup/sub script (T57332)
17857 !! wikitext
17858 <div style="background-image:url⁽javascript:alert())">A</div>
17859 <div style="background-image:url₍javascript:alert())">B</div>
17860 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17861 !! html/php
17862 <div style="/* insecure input */">A</div>
17863 <div style="/* insecure input */">B</div>
17864 <p style="/* insecure input */">C</p>
17865
17866 !! html/parsoid
17867 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17868 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17869 <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>
17870 !! end
17871
17872 !! test
17873 Opera -o-link CSS
17874 !! options
17875 parsoid=wt2html,html2html
17876 !! wikitext
17877 <div
17878 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;"
17879 style="-o-link:attr(title);-o-link-source:current">X</div>
17880 !! html/php
17881 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17882
17883 !! html/parsoid
17884 <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>
17885 !! end
17886
17887 !! test
17888 MSIE 6 CSS safety test: Repetition markers (T57332)
17889 !! wikitext
17890 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17891 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17892 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17893 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17894 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17895 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17896 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17897 !! html/php
17898 <p style="/* insecure input */">A</p>
17899 <p style="/* insecure input */">B</p>
17900 <p style="/* insecure input */">C</p>
17901 <p style="/* insecure input */">D</p>
17902 <p style="/* insecure input */">E</p>
17903 <p style="/* insecure input */">F</p>
17904 <p style="/* insecure input */">G</p>
17905
17906 !! html/parsoid
17907 <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>
17908 <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>
17909 <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>
17910 <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>
17911 <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>
17912 <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>
17913 <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>
17914 !! end
17915
17916 !! test
17917 Table attribute legitimate extension
17918 !! wikitext
17919 {|
17920 !+ style="<nowiki>color:blue</nowiki>"|status
17921 |}
17922 !! html
17923 <table>
17924 <tr>
17925 <th style="color:blue">status
17926 </th></tr></table>
17927
17928 !!end
17929
17930 !! test
17931 Table attribute safety
17932 !! wikitext
17933 {|
17934 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
17935 |}
17936 !! html
17937 <table>
17938 <tr>
17939 <th style="/* insecure input */">status
17940 </th></tr></table>
17941
17942 !! end
17943
17944 !! test
17945 CSS line continuation 1
17946 !! wikitext
17947 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17948 !! html
17949 <div style="/* insecure input */"></div>
17950
17951 !! end
17952
17953 !! test
17954 CSS line continuation 2
17955 !! wikitext
17956 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17957 !! html
17958 <div style="/* invalid control char */"></div>
17959
17960 !! end
17961
17962 !! article
17963 Template:Identity
17964 !! text
17965 {{{1}}}
17966 !! endarticle
17967
17968 !! test
17969 Expansion of multi-line templates in attribute values (T8255)
17970 !! wikitext
17971 <div style="background: {{identity|#00FF00}}">-</div>
17972 !! html
17973 <div style="background: #00FF00">-</div>
17974
17975 !! end
17976
17977 !! test
17978 Expansion of multi-line templates in attribute values (T8255 sanity check)
17979 !! wikitext
17980 <div style="background:
17981 #00FF00">-</div>
17982 !! html/php
17983 <div style="background: #00FF00">-</div>
17984
17985 !! html/parsoid
17986 <div style="background:
17987 #00FF00">-</div>
17988 !! end
17989
17990 !! test
17991 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17992 !! wikitext
17993 <div style="background: &#10;#00FF00">-</div>
17994 !! html
17995 <div style="background: &#10;#00FF00">-</div>
17996
17997 !! end
17998
17999 !! test
18000 Tags which are hidden from tidiers cannot pass through the Sanitizer
18001 !! wikitext
18002 <mw:toc><script>alert();</script></mw:toc>
18003 !! html+tidy
18004 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18005 </p>
18006 !! end
18007
18008 ###
18009 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18010 ###
18011
18012 !! test
18013 Parser hook: empty input
18014 !! wikitext
18015 <tag></tag>
18016 !! html/php
18017 <pre>
18018 ''
18019 array (
18020 )
18021 </pre>
18022
18023 !! html/parsoid
18024 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18025 !! end
18026
18027 ## Don't expect parsoid to rt this form.
18028 !! test
18029 Parser hook: empty input using terminated empty elements
18030 !! options
18031 parsoid=wt2html,html2html
18032 !! wikitext
18033 <tag/>
18034 !! html/php
18035 <pre>
18036 NULL
18037 array (
18038 )
18039 </pre>
18040
18041 !! html/parsoid
18042 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18043 !! end
18044
18045 !! test
18046 Parser hook: empty input using terminated empty elements (space before)
18047 !! wikitext
18048 <tag />
18049 !! html/php
18050 <pre>
18051 NULL
18052 array (
18053 )
18054 </pre>
18055
18056 !! html/parsoid
18057 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18058 !! end
18059
18060 !! test
18061 Parser hook: basic input
18062 !! wikitext
18063 <tag>input</tag>
18064 !! html/php
18065 <pre>
18066 'input'
18067 array (
18068 )
18069 </pre>
18070
18071 !! html/parsoid
18072 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18073 !! end
18074
18075 ## Don't expect parsoid to rt this form.
18076 !! test
18077 Parser hook: case insensitive
18078 !! options
18079 parsoid=wt2html,html2html
18080 !! wikitext
18081 <TAG>input</TAG>
18082 !! html/php
18083 <pre>
18084 'input'
18085 array (
18086 )
18087 </pre>
18088
18089 !! html/parsoid
18090 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18091 !! end
18092
18093 ## Don't expect parsoid to rt this form.
18094 !! test
18095 Parser hook: case insensitive, redux
18096 !! options
18097 parsoid=wt2html,html2html
18098 !! wikitext
18099 <TaG>input</TAg>
18100 !! html/php
18101 <pre>
18102 'input'
18103 array (
18104 )
18105 </pre>
18106
18107 !! html/parsoid
18108 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18109 !! end
18110
18111 !! test
18112 Parser hook: nested tags
18113 !! wikitext
18114 <tag><tag></tag></tag>
18115 !! html/php
18116 <pre>
18117 '<tag>'
18118 array (
18119 )
18120 </pre>&lt;/tag&gt;
18121
18122 !! html/parsoid
18123 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18124 !! end
18125
18126 !! test
18127 Parser hook: basic arguments
18128 !! wikitext
18129 <tag width="200" height="100" depth="50" square=""></tag>
18130 !! html/php
18131 <pre>
18132 ''
18133 array (
18134 'width' => '200',
18135 'height' => '100',
18136 'depth' => '50',
18137 'square' => '',
18138 )
18139 </pre>
18140
18141 !! html/parsoid
18142 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18143 !! end
18144
18145 ## Don't expect parsoid to rt this form.
18146 !! test
18147 Parser hook: basic arguments, variations
18148 !! options
18149 parsoid=wt2html,html2html
18150 !! wikitext
18151 <tag width=200 height = "100" depth = '50' square></tag>
18152 !! html/php
18153 <pre>
18154 ''
18155 array (
18156 'width' => '200',
18157 'height' => '100',
18158 'depth' => '50',
18159 'square' => '',
18160 )
18161 </pre>
18162
18163 !! html/parsoid
18164 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18165 !! end
18166
18167 !! test
18168 Parser hook: argument containing a forward slash (T7344)
18169 !! wikitext
18170 <tag filename="/tmp/bla"></tag>
18171 !! html/php
18172 <pre>
18173 ''
18174 array (
18175 'filename' => '/tmp/bla',
18176 )
18177 </pre>
18178
18179 !! html/parsoid
18180 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18181 !! end
18182
18183 ## Don't expect parsoid to rt this form.
18184 !! test
18185 Parser hook: empty input using terminated empty elements (T4374)
18186 !! options
18187 parsoid=wt2html,html2html
18188 !! wikitext
18189 <tag foo=bar/>text
18190 !! html/php
18191 <pre>
18192 NULL
18193 array (
18194 'foo' => 'bar',
18195 )
18196 </pre>text
18197
18198 !! html/parsoid
18199 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18200 !! end
18201
18202 ## </tag> should be output literally since there is no matching tag that begins it
18203 ## Don't expect parsoid to rt this form.
18204 !! test
18205 Parser hook: basic arguments using terminated empty elements (T4374)
18206 !! options
18207 parsoid=wt2html
18208 !! wikitext
18209 <tag width=200 height = "100" depth = '50' square/>
18210 other stuff
18211 </tag>
18212 !! html/php
18213 <pre>
18214 NULL
18215 array (
18216 'width' => '200',
18217 'height' => '100',
18218 'depth' => '50',
18219 'square' => '',
18220 )
18221 </pre>
18222 <p>other stuff
18223 &lt;/tag&gt;
18224 </p>
18225 !! html/parsoid
18226 <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
18227 &lt;/tag></p>
18228 !! end
18229
18230 ## Don't expect parsoid to rt this form.
18231 !! test
18232 Parser hook: Don't allow unclosed extension tags
18233 !! options
18234 parsoid=wt2html
18235 !! wikitext
18236 test <tag>123
18237
18238 this is a '''test'''
18239 !! html/php
18240 <p>test &lt;tag&gt;123
18241 </p><p>this is a <b>test</b>
18242 </p>
18243 !! html/parsoid
18244 <p>test &lt;tag>123</p>
18245
18246 <p>this is a <b>test</b></p>
18247 !! end
18248
18249 ###
18250 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18251 ###
18252
18253 !! test
18254 Parser hook: static parser hook not inside a comment
18255 !! wikitext
18256 <statictag>hello, world</statictag>
18257
18258 <statictag action="flush" />
18259 !! html/php
18260 <p><br />
18261 hello, world
18262 </p>
18263 !! html/parsoid
18264 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18265 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18266 !! end
18267
18268 !! test
18269 Parser hook: static parser hook inside a comment
18270 !! wikitext
18271 <!-- <statictag>hello, world</statictag> -->
18272 <statictag action="flush" />
18273 !! html/php
18274 <p><br />
18275 </p>
18276 !! html/parsoid
18277 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18278 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18279 !! end
18280
18281 # Nested template calls; this case was broken by Parser.php rev 1.506,
18282 # since reverted.
18283
18284 !! article
18285 Template:One-parameter
18286 !! text
18287 (My parameter is: {{{1}}})
18288 !! endarticle
18289
18290 !! article
18291 Template:Map-one-parameter
18292 !! text
18293 {{{{{1}}}|{{{2}}}}}
18294 !! endarticle
18295
18296 !! test
18297 Nested template calls
18298 !! wikitext
18299 {{Map-one-parameter|One-parameter|param}}
18300 !! html
18301 <p>(My parameter is: param)
18302 </p>
18303 !! end
18304
18305
18306 ###
18307 ### Sanitizer
18308 ###
18309
18310 # Remex wraps empty tag runs with p-tags.
18311 # Parsoid strips them out during p-wrapping.
18312 !! test
18313 Sanitizer: Closing of open tags
18314 !! wikitext
18315 <s></s><table></table>
18316 !! html/php+tidy
18317 <p><s></s></p><table></table>
18318 !! html/parsoid
18319 <s></s><table></table>
18320 !! end
18321
18322 !! test
18323 Sanitizer: Closing of open but not closed tags
18324 !! wikitext
18325 <s>foo
18326 !! html
18327 <p><s>foo</s>
18328 </p>
18329 !! end
18330
18331 !! test
18332 Sanitizer: Closing of closed but not open tags
18333 !! options
18334 parsoid=wt2html
18335 !! wikitext
18336 </s>
18337 !! html/php+tidy
18338 <p class="mw-empty-elt">
18339 </p>
18340 !! html/parsoid
18341 !! end
18342
18343 !! test
18344 Sanitizer: Closing of closed but not open table tags
18345 !! options
18346 parsoid=wt2html
18347 !! wikitext
18348 Table not started</td></tr></table>
18349 !! html+tidy
18350 <p>Table not started
18351 </p>
18352 !! end
18353
18354 !! test
18355 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18356 !! config
18357 wgFragmentMode=[ 'html5', 'legacy' ]
18358 !! wikitext
18359 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18360 !! html/php
18361 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18362 </p>
18363 !! html/parsoid
18364 <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>
18365 !! end
18366
18367 !! test
18368 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18369 !! config
18370 wgFragmentMode=[ 'legacy' ]
18371 !! wikitext
18372 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18373 !! html/php
18374 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18375 </p>
18376 !! end
18377
18378 # In HTML5, the restrictions are that id must contain at least one character,
18379 # and must not contain any space characters.
18380 !! test
18381 Sanitizer: Validating the contents of the id attribute (T6515)
18382 !! options
18383 disabled
18384 !! wikitext
18385 <br id="" /><br id="a space" />
18386 !! html
18387 Something ...
18388 !! end
18389
18390 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18391 !! test
18392 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18393 !! options
18394 disabled
18395 !! wikitext
18396 <br id="foo" /><br id="foo" />
18397 !! html
18398 Something need to be done. foo-2 ?
18399 !! end
18400
18401 !! test
18402 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18403 !! wikitext
18404 <div itemscope>
18405 <meta itemprop="hello" content="world">
18406 <meta http-equiv="refresh" content="5">
18407 <meta itemprop="hello" http-equiv="refresh" content="5">
18408 <link itemprop="hello" href="{{SERVER}}">
18409 <link rel="stylesheet" href="{{SERVER}}">
18410 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18411 </div>
18412 !! html
18413 <div itemscope="">
18414 <p> <meta itemprop="hello" content="world" />
18415 &lt;meta http-equiv="refresh" content="5"&gt;
18416 <meta itemprop="hello" content="5" />
18417 <link itemprop="hello" href="http&#58;//example.org" />
18418 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18419 <link itemprop="hello" href="http&#58;//example.org" />
18420 </p>
18421 </div>
18422
18423 !! end
18424
18425 !! test
18426 Sanitizer: Strip comments from CSS attributes
18427 !! options
18428 parsoid=wt2html,wt2wt
18429 !! wikitext
18430 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18431 !! html/php
18432 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18433 </p>
18434 !! html/parsoid
18435 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18436 !! end
18437
18438 !! test
18439 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18440 !! wikitext
18441 [[meatball:Soft"Security]]
18442 !! html/php
18443 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18444 </p>
18445 !! html/parsoid
18446 <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>
18447 !! end
18448
18449 !! test
18450 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18451 !! wikitext
18452 [[meatball:Foo<Bar]]
18453 [[meatball:Foo>Bar]]
18454 [[meatball:Foo&lt;bar]]
18455 [[meatball:Foo&gt;bar]]
18456 !! html/php
18457 <p>[[meatball:Foo&lt;Bar]]
18458 [[meatball:Foo&gt;Bar]]
18459 [[meatball:Foo&lt;bar]]
18460 [[meatball:Foo&gt;bar]]
18461 </p>
18462 !! html/parsoid
18463 <p>[[meatball:Foo&lt;Bar]]
18464 [[meatball:Foo>Bar]]
18465 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18466 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18467 !! end
18468
18469 !! test
18470 Language converter: output gets cut off unexpectedly (T7757)
18471 !! options
18472 language=zh
18473 !! wikitext
18474 this bit is safe: }-
18475
18476 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18477
18478 then we get cut off here: }-
18479
18480 all additional text is vanished
18481 !! html/php
18482 <p>this bit is safe: }-
18483 </p><p>but if we add a conversion instance: xxx
18484 </p><p>then we get cut off here: }-
18485 </p><p>all additional text is vanished
18486 </p>
18487 !! html/parsoid
18488 <p>this bit is safe: }-</p>
18489 <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>
18490 <p>then we get cut off here: }-</p>
18491 <p>all additional text is vanished</p>
18492 !! end
18493
18494 !! test
18495 Language converter glossary rules inside attributes (T119158)
18496 !! options
18497 language=sr variant=sr-el
18498 !! wikitext
18499 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18500
18501 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18502 !! html/php
18503 <p>
18504 </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>
18505 </p>
18506 !! html/parsoid
18507 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18508
18509 <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>
18510 !! end
18511
18512 !! test
18513 Self closed html pairs (T7487)
18514 !! wikitext
18515 <center><font id="bug" />Centered text</center>
18516 <div><font id="bug2" />In div text</div>
18517 !! html+tidy
18518 <center><font id="bug"></font>Centered text</center>
18519 <div><font id="bug2"></font>In div text</div>
18520 !! end
18521
18522 !! test
18523 Punctuation: nbsp before exclamation
18524 !! wikitext
18525 C'est grave !
18526 !! html
18527 <p>C'est grave&#160;!
18528 </p>
18529 !! end
18530
18531 !! test
18532 Punctuation: CSS !important (T13874)
18533 !! wikitext
18534 <div style="width:50% !important">important</div>
18535 !! html
18536 <div style="width:50% !important">important</div>
18537
18538 !!end
18539
18540 !! test
18541 Punctuation: CSS ! important (T13874; with space after)
18542 !! wikitext
18543 <div style="width:50% ! important">important</div>
18544 !! html
18545 <div style="width:50% ! important">important</div>
18546
18547 !!end
18548
18549 !! test
18550 HTML bullet list, closed tags (T7497)
18551 !! wikitext
18552 <ul>
18553 <li>One</li>
18554 <li>Two</li>
18555 </ul>
18556 !! html/php
18557 <ul>
18558 <li>One</li>
18559 <li>Two</li>
18560 </ul>
18561
18562 !! html/parsoid
18563 <ul data-parsoid='{"stx":"html"}'>
18564 <li data-parsoid='{"stx":"html"}'>One</li>
18565 <li data-parsoid='{"stx":"html"}'>Two</li>
18566 </ul>
18567
18568 !! end
18569
18570 !! test
18571 HTML bullet list, unclosed tags (T7497)
18572 !! wikitext
18573 <ul>
18574 <li>One
18575 <li>Two
18576 </ul>
18577 !! html/php+tidy
18578 <ul>
18579 <li>One
18580 </li><li>Two
18581 </li></ul>
18582 !! html/parsoid
18583 <ul data-parsoid='{"stx":"html"}'>
18584 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18585 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18586 </ul>
18587
18588 !! end
18589
18590 !! test
18591 HTML ordered list, closed tags (T7497)
18592 !! wikitext
18593 <ol>
18594 <li>One</li>
18595 <li>Two</li>
18596 </ol>
18597 !! html/php
18598 <ol>
18599 <li>One</li>
18600 <li>Two</li>
18601 </ol>
18602
18603 !! html/parsoid
18604 <ol data-parsoid='{"stx":"html"}'>
18605 <li data-parsoid='{"stx":"html"}'>One</li>
18606 <li data-parsoid='{"stx":"html"}'>Two</li>
18607 </ol>
18608
18609 !! end
18610
18611 !! test
18612 HTML ordered list, unclosed tags (T7497)
18613 !! options
18614 !! wikitext
18615 <ol>
18616 <li>One
18617 <li>Two
18618 </ol>
18619 !! html/php+tidy
18620 <ol>
18621 <li>One
18622 </li><li>Two
18623 </li></ol>
18624 !! html/parsoid
18625 <ol data-parsoid='{"stx":"html"}'>
18626 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18627 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18628 </ol>
18629
18630 !! end
18631
18632 !! test
18633 HTML nested bullet list, closed tags (T7497)
18634 !! wikitext
18635 <ul>
18636 <li>One</li>
18637 <li>Two:
18638 <ul>
18639 <li>Sub-one</li>
18640 <li>Sub-two</li>
18641 </ul>
18642 </li>
18643 </ul>
18644 !! html/php
18645 <ul>
18646 <li>One</li>
18647 <li>Two:
18648 <ul>
18649 <li>Sub-one</li>
18650 <li>Sub-two</li>
18651 </ul>
18652 </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:
18659 <ul data-parsoid='{"stx":"html"}'>
18660 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18661 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18662 </ul>
18663 </li>
18664 </ul>
18665 !! end
18666
18667 !! test
18668 HTML nested bullet list, open tags (T7497)
18669 !! wikitext
18670 <ul>
18671 <li>One
18672 <li>Two:
18673 <ul>
18674 <li>Sub-one
18675 <li>Sub-two
18676 </ul>
18677 </ul>
18678 !! html+tidy
18679 <ul>
18680 <li>One
18681 </li><li>Two:
18682 <ul>
18683 <li>Sub-one
18684 </li><li>Sub-two
18685 </li></ul>
18686 </li></ul>
18687 !! end
18688
18689 !! test
18690 HTML nested ordered list, closed tags (T7497)
18691 !! wikitext
18692 <ol>
18693 <li>One</li>
18694 <li>Two:
18695 <ol>
18696 <li>Sub-one</li>
18697 <li>Sub-two</li>
18698 </ol>
18699 </li>
18700 </ol>
18701 !! html
18702 <ol>
18703 <li>One</li>
18704 <li>Two:
18705 <ol>
18706 <li>Sub-one</li>
18707 <li>Sub-two</li>
18708 </ol>
18709 </li>
18710 </ol>
18711
18712 !! end
18713
18714 !! test
18715 HTML nested ordered list, open tags (T7497)
18716 !! wikitext
18717 <ol>
18718 <li>One
18719 <li>Two:
18720 <ol>
18721 <li>Sub-one
18722 <li>Sub-two
18723 </ol>
18724 </ol>
18725 !! html/php
18726 <ol>
18727 <li>One
18728 <li>Two:
18729 <ol>
18730 <li>Sub-one
18731 <li>Sub-two
18732 </ol>
18733 </ol>
18734
18735 !! html/parsoid
18736 <ol>
18737 <li>One
18738 </li>
18739 <li>Two:
18740 <ol>
18741 <li>Sub-one
18742 </li>
18743 <li>Sub-two
18744 </li>
18745 </ol>
18746 </li>
18747 </ol>
18748
18749 !! end
18750
18751 !! test
18752 HTML ordered list item with parameters oddity
18753 !! wikitext
18754 <ol><li id="fragment">One</li>
18755 </ol>
18756 !! html
18757 <ol><li id="fragment">One</li>
18758 </ol>
18759
18760 !! end
18761
18762 # parsoid doesn't explicitly mark autonumbered links, see T55505
18763 !!test
18764 T7918: autonumbering
18765 !! wikitext
18766 [http://first/] [http://second] [ftp://ftp]
18767
18768 ftp://inlineftp
18769
18770 [mailto:enclosed@mail.tld With target]
18771
18772 [mailto:enclosed@mail.tld]
18773
18774 mailto:inline@mail.tld
18775 !! html/php
18776 <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>
18777 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18778 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18779 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18780 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18781 </p>
18782 !! html/parsoid
18783 <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>
18784 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18785 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18786 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18787 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18788 !! end
18789
18790
18791 #
18792 # Security and HTML correctness
18793 # From Nick Jenkins' fuzz testing
18794 #
18795
18796 !! test
18797 Fuzz testing: Parser13
18798 !! wikitext
18799 {|
18800 | http://a|
18801 !! html
18802 <table>
18803 <tr>
18804 <td>
18805 </td>
18806 </tr>
18807 </table>
18808
18809 !! end
18810
18811 # Note that Parsoid output differs from the PHP parser here: the PHP
18812 # parser breaks the URL for the magic word, while in Parsoid the URL
18813 # production takes precedence.
18814 !! test
18815 Fuzz testing: Parser14
18816 !! wikitext
18817 ==onmouseover===
18818 http://__TOC__
18819 !! html/php
18820 <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>
18821 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18822 <ul>
18823 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18824 </ul>
18825 </div>
18826
18827
18828 !! html/php+tidy
18829 <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>
18830 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18831 <ul>
18832 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18833 </ul>
18834 </div>
18835 !! html/parsoid
18836 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18837 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18838 !! end
18839
18840 !! test
18841 Fuzz testing: Parser14-table
18842 !! options
18843 parsoid=wt2html,html2html
18844 !! wikitext
18845 ==a==
18846 {| STYLE=__TOC__
18847 !! html
18848 <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>
18849 <table style="&#95;_TOC&#95;_">
18850 <tr><td></td></tr>
18851 </table>
18852
18853 !! html+tidy
18854 <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>
18855 <table style="__TOC__">
18856 <tr>
18857 <td></td>
18858 </tr>
18859 </table>
18860 !! html/parsoid
18861 <h2 id="a">a</h2>
18862 <table style="__TOC__"></table>
18863 !! end
18864
18865 # Known to produce bogus xml (extra </td>)
18866 # Don't add the html/php section since it generates broken HTML
18867 !! test
18868 Fuzz testing: Parser16
18869 !! wikitext
18870 {|
18871 !https://||||||
18872 !! html+tidy
18873 <table>
18874 <tbody><tr>
18875 <th>https://</th>
18876 <th></th>
18877 <th></th>
18878 <th>
18879
18880 </th></tr>
18881 </tbody></table>
18882 !! end
18883
18884 !! test
18885 Fuzz testing: Parser21
18886 !! wikitext
18887 {|
18888 !irc://{{ftp://a" onmouseover="alert('hello world');"
18889 |
18890 !! html
18891 <table>
18892 <tr>
18893 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18894 </th>
18895 <td>
18896 </td>
18897 </tr>
18898 </table>
18899
18900 !! end
18901
18902 !! test
18903 Fuzz testing: Parser22
18904 !! wikitext
18905 http://===r:::https://b
18906
18907 {|
18908 !! html
18909 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18910 </p>
18911 <table>
18912 <tr><td></td></tr>
18913 </table>
18914
18915 !! end
18916
18917 # Known to produce bad XML for now
18918 !! test
18919 Fuzz testing: Parser24
18920 !! options
18921 parsoid=wt2html
18922 !! wikitext
18923 {|
18924 {{{|
18925 <u CLASS=
18926 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18927 <br style="onmouseover='alert(document.cookie);' " />
18928
18929 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18930 |
18931 !! html/php
18932 <table>
18933 {{{|
18934 <u class="&#124;">}}}} &gt;
18935 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18936
18937 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18938 <tr>
18939 <td></u>
18940 </td>
18941 </tr>
18942 </table>
18943
18944 !! html/parsoid
18945 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18946 <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>"}'/>}}}} >
18947 <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}'>
18948
18949
18950
18951 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18952 !! end
18953
18954 # Note: the current result listed for this is not what the original one was,
18955 # but the original bug was JavaScript injection, which is fixed in any case.
18956 # It's not clear that the original result listed was any more correct than the
18957 # current one. Original result:
18958 # <p>{{{|
18959 # </p>
18960 # <li class="&#124;&#124;">
18961 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18962 !!test
18963 Fuzz testing: Parser25 (T8055)
18964 !! wikitext
18965 {{{
18966 |
18967 <LI CLASS=||
18968 >
18969 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18970 !! html/php
18971 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18972 </p>
18973 !! html/parsoid
18974 <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"]}'>
18975 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18976 !! end
18977
18978 !!test
18979 Fuzz testing: URL adjacent extension (with space, clean)
18980 !! wikitext
18981 http://example.com <nowiki>junk</nowiki>
18982 !! html/php
18983 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18984 </p>
18985 !! html/parsoid
18986 <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>
18987 !! end
18988
18989 !!test
18990 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18991 !! wikitext
18992 http://example.com<nowiki>junk</nowiki>
18993 !! html/php
18994 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18995 </p>
18996 !! html/parsoid
18997 <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>
18998 !! end
18999
19000 !! test
19001 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19002 !! wikitext
19003 http://example.com<pre>junk</pre>
19004 !! html/php
19005 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19006
19007 !! html/php+tidy
19008 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19009 !! html/parsoid
19010 <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>
19011 !! end
19012
19013 !! test
19014 Fuzz testing: image with bogus manual thumbnail
19015 !! wikitext
19016 [[Image:foobar.jpg|thumbnail= ]]
19017 !! html/php
19018 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19019
19020 !! html/parsoid
19021 <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>
19022 !! end
19023
19024 # Parsoid will emit the newline literally in wt2wt; see next test case.
19025 !! test
19026 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19027 !! options
19028 parsoid=wt2html
19029 !! wikitext
19030 <pre dir="&#10;"></pre>
19031 !! html/php
19032 <pre dir="&#10;"></pre>
19033
19034 !! html/parsoid
19035 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19036 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19037 !! end
19038
19039 !! test
19040 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19041 !! options
19042 parsoid=html2wt
19043 !! html/parsoid
19044 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19045 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19046 !! wikitext
19047 <pre dir="
19048 "></pre>
19049 !! html/php
19050 <pre dir=""></pre>
19051
19052 !! end
19053
19054 !! test
19055 Templates in extension attributes are not expanded
19056 !! wikitext
19057 <pre dir="{{echo|ltr}}"></pre>
19058 !! html/php
19059 <pre dir="{{echo|ltr}}"></pre>
19060
19061 !! html/parsoid
19062 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19063 !! end
19064
19065 !! test
19066 Parsing optional HTML elements (T8171)
19067 !! options
19068 !! wikitext
19069 <table>
19070 <tr>
19071 <td> Some tabular data</td>
19072 <td> More tabular data ...
19073 <td> And yet som tabular data</td>
19074 </tr>
19075 </table>
19076 !! html
19077 <table>
19078 <tr>
19079 <td> Some tabular data</td>
19080 <td> More tabular data ...
19081 </td><td> And yet som tabular data</td>
19082 </tr>
19083 </table>
19084
19085 !! end
19086
19087 !! test
19088 Correct handling of <td>, <tr> (T8171)
19089 !! options
19090 !! wikitext
19091 <table>
19092 <tr>
19093 <td> Some tabular data</td>
19094 <td> More tabular data ...</td>
19095 <td> And yet som tabular data</td>
19096 </tr>
19097 </table>
19098 !! html
19099 <table>
19100 <tr>
19101 <td> Some tabular data</td>
19102 <td> More tabular data ...</td>
19103 <td> And yet som tabular data</td>
19104 </tr>
19105 </table>
19106
19107 !! end
19108
19109
19110 !! test
19111 Parsing crashing regression (fr:JavaScript)
19112 !! wikitext
19113 </body></x>
19114 !! html
19115 <p>&lt;/body&gt;&lt;/x&gt;
19116 </p>
19117 !! end
19118
19119 !! test
19120 Inline wiki vs wiki block nesting
19121 !! wikitext
19122 '''Bold paragraph
19123
19124 New wiki paragraph
19125 !! html
19126 <p><b>Bold paragraph</b>
19127 </p><p>New wiki paragraph
19128 </p>
19129 !! end
19130
19131 # FIXME: The current php output is documented
19132 # and desired output is the parsoid target.
19133 !! test
19134 Inline HTML vs wiki block nesting
19135 !! wikitext
19136 <b>Bold paragraph
19137
19138 New wiki paragraph
19139 !! html/php
19140 <p><b>Bold paragraph
19141 </p><p>New wiki paragraph</b>
19142 </p>
19143 !! html/parsoid
19144 <p><b>Bold paragraph</b>
19145 </p><p>New wiki paragraph
19146 </p>
19147 !! end
19148
19149 # Original result was this:
19150 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19151 # </p>
19152 # While that might be marginally more intuitive, maybe, the six-apostrophe
19153 # construct is clearly pathological and the result stated here (which is what
19154 # the parser actually does) is about as reasonable as anything.
19155 !!test
19156 Mixing markup for italics and bold
19157 !! options
19158 !! wikitext
19159 '''bold''''''bold''bolditalics'''''
19160 !! html
19161 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19162 </p>
19163 !! end
19164
19165
19166 !! article
19167 Xyzzyx
19168 !! text
19169 Article for special page transclusion test
19170 !! endarticle
19171
19172 !! test
19173 Special page transclusion
19174 !! options
19175 !! wikitext
19176 {{Special:Prefixindex/Xyzzyx}}
19177 !! html
19178 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19179 </ul>
19180
19181 !! end
19182
19183 !! test
19184 Special page transclusion twice (T7021)
19185 !! options
19186 !! wikitext
19187 {{Special:Prefixindex/Xyzzyx}}
19188 {{Special:Prefixindex/Xyzzyx}}
19189 !! html
19190 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19191 </ul>
19192 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19193 </ul>
19194
19195 !! end
19196
19197 !! test
19198 Transclusion of default MediaWiki message
19199 !! wikitext
19200 {{MediaWiki:Mainpage}}
19201 !! html
19202 <p>Main Page
19203 </p>
19204 !! end
19205
19206 !! test
19207 Transclusion of nonexistent MediaWiki message
19208 !! wikitext
19209 {{MediaWiki:Mainpagexxx}}
19210 !! html
19211 <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>
19212 </p>
19213 !! end
19214
19215 !! test
19216 Transclusion of MediaWiki message with underscore
19217 !! wikitext
19218 {{MediaWiki:history_short}}
19219 !! html
19220 <p>History
19221 </p>
19222 !! end
19223
19224 !! test
19225 Transclusion of MediaWiki message with space
19226 !! wikitext
19227 {{MediaWiki:history short}}
19228 !! html
19229 <p>History
19230 </p>
19231 !! end
19232
19233 !! test
19234 Invalid header with following text
19235 !! wikitext
19236 = x = y
19237 !! html
19238 <p>= x = y
19239 </p>
19240 !! end
19241
19242
19243 !! test
19244 Section extraction test (section 0)
19245 !! options
19246 section=0
19247 !! wikitext
19248 start
19249 ==a==
19250 ===aa===
19251 ====aaa====
19252 ==b==
19253 ===ba===
19254 ===bb===
19255 ====bba====
19256 ===bc===
19257 ==c==
19258 ===ca===
19259 !! html/php
19260 start
19261 !! end
19262
19263 !! test
19264 Section extraction test (section 1)
19265 !! options
19266 section=1
19267 !! wikitext
19268 start
19269 ==a==
19270 ===aa===
19271 ====aaa====
19272 ==b==
19273 ===ba===
19274 ===bb===
19275 ====bba====
19276 ===bc===
19277 ==c==
19278 ===ca===
19279 !! html/php
19280 ==a==
19281 ===aa===
19282 ====aaa====
19283 !! end
19284
19285 !! test
19286 Section extraction test (section 2)
19287 !! options
19288 section=2
19289 !! wikitext
19290 start
19291 ==a==
19292 ===aa===
19293 ====aaa====
19294 ==b==
19295 ===ba===
19296 ===bb===
19297 ====bba====
19298 ===bc===
19299 ==c==
19300 ===ca===
19301 !! html/php
19302 ===aa===
19303 ====aaa====
19304 !! end
19305
19306 !! test
19307 Section extraction test (section 3)
19308 !! options
19309 section=3
19310 !! wikitext
19311 start
19312 ==a==
19313 ===aa===
19314 ====aaa====
19315 ==b==
19316 ===ba===
19317 ===bb===
19318 ====bba====
19319 ===bc===
19320 ==c==
19321 ===ca===
19322 !! html/php
19323 ====aaa====
19324 !! end
19325
19326 !! test
19327 Section extraction test (section 4)
19328 !! options
19329 section=4
19330 !! wikitext
19331 start
19332 ==a==
19333 ===aa===
19334 ====aaa====
19335 ==b==
19336 ===ba===
19337 ===bb===
19338 ====bba====
19339 ===bc===
19340 ==c==
19341 ===ca===
19342 !! html/php
19343 ==b==
19344 ===ba===
19345 ===bb===
19346 ====bba====
19347 ===bc===
19348 !! end
19349
19350 !! test
19351 Section extraction test (section 5)
19352 !! options
19353 section=5
19354 !! wikitext
19355 start
19356 ==a==
19357 ===aa===
19358 ====aaa====
19359 ==b==
19360 ===ba===
19361 ===bb===
19362 ====bba====
19363 ===bc===
19364 ==c==
19365 ===ca===
19366 !! html/php
19367 ===ba===
19368 !! end
19369
19370 !! test
19371 Section extraction test (section 6)
19372 !! options
19373 section=6
19374 !! wikitext
19375 start
19376 ==a==
19377 ===aa===
19378 ====aaa====
19379 ==b==
19380 ===ba===
19381 ===bb===
19382 ====bba====
19383 ===bc===
19384 ==c==
19385 ===ca===
19386 !! html/php
19387 ===bb===
19388 ====bba====
19389 !! end
19390
19391 !! test
19392 Section extraction test (section 7)
19393 !! options
19394 section=7
19395 !! wikitext
19396 start
19397 ==a==
19398 ===aa===
19399 ====aaa====
19400 ==b==
19401 ===ba===
19402 ===bb===
19403 ====bba====
19404 ===bc===
19405 ==c==
19406 ===ca===
19407 !! html/php
19408 ====bba====
19409 !! end
19410
19411 !! test
19412 Section extraction test (section 8)
19413 !! options
19414 section=8
19415 !! wikitext
19416 start
19417 ==a==
19418 ===aa===
19419 ====aaa====
19420 ==b==
19421 ===ba===
19422 ===bb===
19423 ====bba====
19424 ===bc===
19425 ==c==
19426 ===ca===
19427 !! html/php
19428 ===bc===
19429 !! end
19430
19431 !! test
19432 Section extraction test (section 9)
19433 !! options
19434 section=9
19435 !! wikitext
19436 start
19437 ==a==
19438 ===aa===
19439 ====aaa====
19440 ==b==
19441 ===ba===
19442 ===bb===
19443 ====bba====
19444 ===bc===
19445 ==c==
19446 ===ca===
19447 !! html/php
19448 ==c==
19449 ===ca===
19450 !! end
19451
19452 !! test
19453 Section extraction test (section 10)
19454 !! options
19455 section=10
19456 !! wikitext
19457 start
19458 ==a==
19459 ===aa===
19460 ====aaa====
19461 ==b==
19462 ===ba===
19463 ===bb===
19464 ====bba====
19465 ===bc===
19466 ==c==
19467 ===ca===
19468 !! html/php
19469 ===ca===
19470 !! end
19471
19472 !! test
19473 Section extraction test (nonexistent section 11)
19474 !! options
19475 section=11
19476 !! wikitext
19477 start
19478 ==a==
19479 ===aa===
19480 ====aaa====
19481 ==b==
19482 ===ba===
19483 ===bb===
19484 ====bba====
19485 ===bc===
19486 ==c==
19487 ===ca===
19488 !! html/php
19489 !! end
19490
19491 !! test
19492 Section extraction test with bogus heading (section 1)
19493 !! options
19494 section=1
19495 !! wikitext
19496 ==a==
19497 ==bogus== not a legal section
19498 ==b==
19499 !! html/php
19500 ==a==
19501 ==bogus== not a legal section
19502 !! end
19503
19504 !! test
19505 Section extraction test with bogus heading (section 2)
19506 !! options
19507 section=2
19508 !! wikitext
19509 ==a==
19510 ==bogus== not a legal section
19511 ==b==
19512 !! html/php
19513 ==b==
19514 !! end
19515
19516 !! test
19517 Section extraction test with comment after heading (section 1)
19518 !! options
19519 section=1
19520 !! wikitext
19521 ==a==
19522 ==b== <!-- -->
19523 ==c==
19524 !! html/php
19525 ==a==
19526 !! end
19527
19528 !! test
19529 Section extraction test with comment after heading (section 2)
19530 !! options
19531 section=2
19532 !! wikitext
19533 ==a==
19534 ==b== <!-- -->
19535 ==c==
19536 !! html/php
19537 ==b== <!-- -->
19538 !! end
19539
19540 !! test
19541 Section extraction test with bogus <nowiki> heading (section 1)
19542 !! options
19543 section=1
19544 !! wikitext
19545 ==a==
19546 ==bogus== <nowiki>not a legal section</nowiki>
19547 ==b==
19548 !! html/php
19549 ==a==
19550 ==bogus== <nowiki>not a legal section</nowiki>
19551 !! end
19552
19553 !! test
19554 Section extraction test with bogus <nowiki> heading (section 2)
19555 !! options
19556 section=2
19557 !! wikitext
19558 ==a==
19559 ==bogus== <nowiki>not a legal section</nowiki>
19560 ==b==
19561 !! html/php
19562 ==b==
19563 !! end
19564
19565 # Formerly testing for T4587, now resolved by the use of unmarked sections
19566 # instead of respecting commented sections
19567 !! test
19568 Section extraction prefixed by comment (section 1)
19569 !! options
19570 section=1
19571 !! wikitext
19572 <!-- -->==sec1==
19573 ==sec2==
19574 !! html/php
19575 ==sec2==
19576 !!end
19577
19578 !! test
19579 Section extraction prefixed by comment (section 2)
19580 !! options
19581 section=2
19582 !! wikitext
19583 <!-- -->==sec1==
19584 ==sec2==
19585 !! html/php
19586
19587 !!end
19588
19589 # Formerly testing for T4607, now resolved by the use of unmarked sections
19590 # instead of respecting HTML-style headings
19591 !! test
19592 Section extraction, mixed wiki and html (section 1)
19593 !! options
19594 section=1
19595 !! wikitext
19596 <h2>unmarked</h2>
19597 unmarked
19598 ==1==
19599 one
19600 ==2==
19601 two
19602 !! html/php
19603 ==1==
19604 one
19605 !! end
19606
19607 !! test
19608 Section extraction, mixed wiki and html (section 2)
19609 !! options
19610 section=2
19611 !! wikitext
19612 <h2>unmarked</h2>
19613 unmarked
19614 ==1==
19615 one
19616 ==2==
19617 two
19618 !! html/php
19619 ==2==
19620 two
19621 !! end
19622
19623
19624 # Formerly testing for T5342
19625 !! test
19626 Section extraction, heading surrounded by <noinclude>
19627 !! options
19628 section=1
19629 !! wikitext
19630 <noinclude>==unmarked==</noinclude>
19631 ==marked==
19632 !! html/php
19633 ==marked==
19634 !!end
19635
19636 # Test behavior of T21910
19637 !! test
19638 Sectiion with all-equals
19639 !! options
19640 section=2
19641 !! wikitext
19642 ===
19643 The line above must have a trailing space
19644 === <!--
19645 --> <!-- -->
19646 But just in case it doesn't...
19647 !! html/php
19648 === <!--
19649 --> <!-- -->
19650 But just in case it doesn't...
19651 !! end
19652
19653 !! test
19654 Section replacement test (section 0)
19655 !! options
19656 replace=0,"xxx"
19657 !! wikitext
19658 start
19659 ==a==
19660 ===aa===
19661 ====aaa====
19662 ==b==
19663 ===ba===
19664 ===bb===
19665 ====bba====
19666 ===bc===
19667 ==c==
19668 ===ca===
19669 !! html/php
19670 xxx
19671
19672 ==a==
19673 ===aa===
19674 ====aaa====
19675 ==b==
19676 ===ba===
19677 ===bb===
19678 ====bba====
19679 ===bc===
19680 ==c==
19681 ===ca===
19682 !! end
19683
19684 !! test
19685 Section replacement test (section 1)
19686 !! options
19687 replace=1,"xxx"
19688 !! wikitext
19689 start
19690 ==a==
19691 ===aa===
19692 ====aaa====
19693 ==b==
19694 ===ba===
19695 ===bb===
19696 ====bba====
19697 ===bc===
19698 ==c==
19699 ===ca===
19700 !! html/php
19701 start
19702 xxx
19703
19704 ==b==
19705 ===ba===
19706 ===bb===
19707 ====bba====
19708 ===bc===
19709 ==c==
19710 ===ca===
19711 !! end
19712
19713 !! test
19714 Section replacement test (section 2)
19715 !! options
19716 replace=2,"xxx"
19717 !! wikitext
19718 start
19719 ==a==
19720 ===aa===
19721 ====aaa====
19722 ==b==
19723 ===ba===
19724 ===bb===
19725 ====bba====
19726 ===bc===
19727 ==c==
19728 ===ca===
19729 !! html/php
19730 start
19731 ==a==
19732 xxx
19733
19734 ==b==
19735 ===ba===
19736 ===bb===
19737 ====bba====
19738 ===bc===
19739 ==c==
19740 ===ca===
19741 !! end
19742
19743 !! test
19744 Section replacement test (section 3)
19745 !! options
19746 replace=3,"xxx"
19747 !! wikitext
19748 start
19749 ==a==
19750 ===aa===
19751 ====aaa====
19752 ==b==
19753 ===ba===
19754 ===bb===
19755 ====bba====
19756 ===bc===
19757 ==c==
19758 ===ca===
19759 !! html/php
19760 start
19761 ==a==
19762 ===aa===
19763 xxx
19764
19765 ==b==
19766 ===ba===
19767 ===bb===
19768 ====bba====
19769 ===bc===
19770 ==c==
19771 ===ca===
19772 !! end
19773
19774 !! test
19775 Section replacement test (section 4)
19776 !! options
19777 replace=4,"xxx"
19778 !! wikitext
19779 start
19780 ==a==
19781 ===aa===
19782 ====aaa====
19783 ==b==
19784 ===ba===
19785 ===bb===
19786 ====bba====
19787 ===bc===
19788 ==c==
19789 ===ca===
19790 !! html/php
19791 start
19792 ==a==
19793 ===aa===
19794 ====aaa====
19795 xxx
19796
19797 ==c==
19798 ===ca===
19799 !! end
19800
19801 !! test
19802 Section replacement test (section 5)
19803 !! options
19804 replace=5,"xxx"
19805 !! wikitext
19806 start
19807 ==a==
19808 ===aa===
19809 ====aaa====
19810 ==b==
19811 ===ba===
19812 ===bb===
19813 ====bba====
19814 ===bc===
19815 ==c==
19816 ===ca===
19817 !! html/php
19818 start
19819 ==a==
19820 ===aa===
19821 ====aaa====
19822 ==b==
19823 xxx
19824
19825 ===bb===
19826 ====bba====
19827 ===bc===
19828 ==c==
19829 ===ca===
19830 !! end
19831
19832 !! test
19833 Section replacement test (section 6)
19834 !! options
19835 replace=6,"xxx"
19836 !! wikitext
19837 start
19838 ==a==
19839 ===aa===
19840 ====aaa====
19841 ==b==
19842 ===ba===
19843 ===bb===
19844 ====bba====
19845 ===bc===
19846 ==c==
19847 ===ca===
19848 !! html/php
19849 start
19850 ==a==
19851 ===aa===
19852 ====aaa====
19853 ==b==
19854 ===ba===
19855 xxx
19856
19857 ===bc===
19858 ==c==
19859 ===ca===
19860 !! end
19861
19862 !! test
19863 Section replacement test (section 7)
19864 !! options
19865 replace=7,"xxx"
19866 !! wikitext
19867 start
19868 ==a==
19869 ===aa===
19870 ====aaa====
19871 ==b==
19872 ===ba===
19873 ===bb===
19874 ====bba====
19875 ===bc===
19876 ==c==
19877 ===ca===
19878 !! html/php
19879 start
19880 ==a==
19881 ===aa===
19882 ====aaa====
19883 ==b==
19884 ===ba===
19885 ===bb===
19886 xxx
19887
19888 ===bc===
19889 ==c==
19890 ===ca===
19891 !! end
19892
19893 !! test
19894 Section replacement test (section 8)
19895 !! options
19896 replace=8,"xxx"
19897 !! wikitext
19898 start
19899 ==a==
19900 ===aa===
19901 ====aaa====
19902 ==b==
19903 ===ba===
19904 ===bb===
19905 ====bba====
19906 ===bc===
19907 ==c==
19908 ===ca===
19909 !! html/php
19910 start
19911 ==a==
19912 ===aa===
19913 ====aaa====
19914 ==b==
19915 ===ba===
19916 ===bb===
19917 ====bba====
19918 xxx
19919
19920 ==c==
19921 ===ca===
19922 !!end
19923
19924 !! test
19925 Section replacement test (section 9)
19926 !! options
19927 replace=9,"xxx"
19928 !! wikitext
19929 start
19930 ==a==
19931 ===aa===
19932 ====aaa====
19933 ==b==
19934 ===ba===
19935 ===bb===
19936 ====bba====
19937 ===bc===
19938 ==c==
19939 ===ca===
19940 !! html/php
19941 start
19942 ==a==
19943 ===aa===
19944 ====aaa====
19945 ==b==
19946 ===ba===
19947 ===bb===
19948 ====bba====
19949 ===bc===
19950 xxx
19951 !! end
19952
19953 !! test
19954 Section replacement test (section 10)
19955 !! options
19956 replace=10,"xxx"
19957 !! wikitext
19958 start
19959 ==a==
19960 ===aa===
19961 ====aaa====
19962 ==b==
19963 ===ba===
19964 ===bb===
19965 ====bba====
19966 ===bc===
19967 ==c==
19968 ===ca===
19969 !! html/php
19970 start
19971 ==a==
19972 ===aa===
19973 ====aaa====
19974 ==b==
19975 ===ba===
19976 ===bb===
19977 ====bba====
19978 ===bc===
19979 ==c==
19980 xxx
19981 !! end
19982
19983 !! test
19984 Section replacement test with initial whitespace (T15728)
19985 !! options
19986 replace=2,"xxx"
19987 !! wikitext
19988 Preformatted initial line
19989 ==a==
19990 ===a===
19991 !! html/php
19992 Preformatted initial line
19993 ==a==
19994 xxx
19995 !! end
19996
19997
19998 !! test
19999 Section extraction, heading followed by pre with 20 spaces (T8398)
20000 !! options
20001 section=1
20002 !! wikitext
20003 ==a==
20004 a
20005 !! html/php
20006 ==a==
20007 a
20008 !! end
20009
20010 !! test
20011 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20012 !! options
20013 section=1
20014 !! wikitext
20015 ==a==
20016 a
20017 !! html/php
20018 ==a==
20019 a
20020 !! end
20021
20022
20023 !! test
20024 Section extraction, <pre> around bogus header (T12309)
20025 !! options
20026 section=2
20027 !! wikitext
20028 == Section One ==
20029 <pre>
20030 =======
20031 </pre>
20032
20033 == Section Two ==
20034 stuff
20035 !! html/php
20036 == Section Two ==
20037 stuff
20038 !! end
20039
20040 !! test
20041 Section replacement, <pre> around bogus header (T12309)
20042 !! options
20043 replace=2,"xxx"
20044 !! wikitext
20045 == Section One ==
20046 <pre>
20047 =======
20048 </pre>
20049
20050 == Section Two ==
20051 stuff
20052 !! html/php
20053 == Section One ==
20054 <pre>
20055 =======
20056 </pre>
20057
20058 xxx
20059 !! end
20060
20061 !! test
20062 Handling of &#x0A; in URLs
20063 !! wikitext
20064 *irc://&#x0A;a
20065 !! html/php
20066 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20067
20068 !! html/parsoid
20069 <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>
20070 !! end
20071
20072 !! test
20073 Handling of %0A in URLs
20074 !! wikitext
20075 *irc://%0Aa
20076 !! html/php
20077 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20078
20079 !! html/parsoid
20080 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20081 !! end
20082
20083 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20084 !! test
20085 5 quotes, code coverage +1 line
20086 !! options
20087 parsoid=wt2html
20088 !! wikitext
20089 '''''
20090 !! html/php
20091 !! html/parsoid
20092 <b><i></i></b>
20093 !! end
20094
20095 # same html as previous, but wikitext adjusted to match parsoid html2wt
20096 # note that wt2html and html2html will put the <i> before the <b>
20097 !! test
20098 5 quotes, code coverage +1 line w/ nowiki (1)
20099 !! options
20100 parsoid=wt2wt,html2wt
20101 !! wikitext
20102 '''''<nowiki/>'''''
20103 !! html/php
20104 <p><i></i>
20105 </p>
20106 !! html/parsoid
20107 <p><b><i></i></b></p>
20108 !! end
20109
20110 # same as previous, just swapping the <i> and <b>
20111 !! test
20112 5 quotes, code coverage +1 line w/ nowiki (2)
20113 !! wikitext
20114 '''''<nowiki/>'''''
20115 !! html/php
20116 <p><i></i>
20117 </p>
20118 !! html/parsoid
20119 <p><i><b></b></i></p>
20120 !! end
20121
20122 !! test
20123 Special:Search page linking.
20124 !! wikitext
20125 {{Special:search}}
20126 !! html
20127 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20128 </p>
20129 !! end
20130
20131 !! test
20132 {{!}} is a magic word
20133 !! wikitext
20134 {{!}} is a magic word there and {{!}} is still a magic word here
20135 | is not a magic word here but {{!}} is still a magic word here
20136 !! html/php
20137 <p>| is a magic word there and | is still a magic word here
20138 | is not a magic word here but | is still a magic word here
20139 </p>
20140 !! html/parsoid
20141 <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
20142 | 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>
20143 !! end
20144
20145 !! test
20146 Say the magic word
20147 !! options
20148 title=[[Parser test]]
20149 !! wikitext
20150 *{{PAGENAME}}
20151 *{{PAGENAMEE}}
20152 *{{FULLPAGENAME}}
20153 *{{FULLPAGENAMEE}}
20154 *{{BASEPAGENAME}}
20155 *{{BASEPAGENAMEE}}
20156 *{{SUBPAGENAME}}
20157 *{{SUBPAGENAMEE}}
20158 *{{ROOTPAGENAME}}
20159 *{{ROOTPAGENAMEE}}
20160 *{{TALKPAGENAME}}
20161 *{{TALKPAGENAMEE}}
20162 *{{SUBJECTPAGENAME}}
20163 *{{SUBJECTPAGENAMEE}}
20164 *{{NAMESPACEE}}
20165 *{{NAMESPACE}}
20166 *{{NAMESPACENUMBER}}
20167 *{{TALKSPACE}}
20168 *{{TALKSPACEE}}
20169 *{{SUBJECTSPACE}}
20170 *{{SUBJECTSPACEE}}
20171 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20172 !! html
20173 <ul><li>Parser test</li>
20174 <li>Parser_test</li>
20175 <li>Parser test</li>
20176 <li>Parser_test</li>
20177 <li>Parser test</li>
20178 <li>Parser_test</li>
20179 <li>Parser test</li>
20180 <li>Parser_test</li>
20181 <li>Parser test</li>
20182 <li>Parser_test</li>
20183 <li>Talk:Parser test</li>
20184 <li>Talk:Parser_test</li>
20185 <li>Parser test</li>
20186 <li>Parser_test</li>
20187 <li></li>
20188 <li></li>
20189 <li>0</li>
20190 <li>Talk</li>
20191 <li>Talk</li>
20192 <li></li>
20193 <li></li>
20194 <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>
20195
20196 !! end
20197 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20198
20199 !! test
20200 Gallery with valid attributes
20201 !! wikitext
20202 <gallery type="123" summary="345">
20203 File:File:Foobar.jpg
20204 </gallery>
20205 !! html/php
20206 <ul class="gallery mw-gallery-traditional" type="123">
20207 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20208 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20209 <div class="gallerytext">
20210 </div>
20211 </div></li>
20212 </ul>
20213
20214 !! html/parsoid
20215 <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"}}'>
20216 <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>
20217 </ul>
20218 !! end
20219
20220 ## Parsoid thinks the "centre" here is a property, not a caption.
20221 !! test
20222 Gallery
20223 !! options
20224 parsoid={
20225 "modes": ["wt2html"],
20226 "nativeGallery": true
20227 }
20228 !! wikitext
20229 <gallery>
20230 image1.png |
20231 image2.gif|||||
20232
20233 image3|
20234 image4 |300px| centre
20235 image5.svg| http://///////
20236 [[x|xx]]]]
20237 * image6
20238 </gallery>
20239 !! html/php
20240 <ul class="gallery mw-gallery-traditional">
20241 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20242 <div class="thumb" style="height: 150px;">Image1.png</div>
20243 <div class="gallerytext">
20244 </div>
20245 </div></li>
20246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20247 <div class="thumb" style="height: 150px;">Image2.gif</div>
20248 <div class="gallerytext">
20249 </div>
20250 </div></li>
20251 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20252 <div class="thumb" style="height: 150px;">Image3</div>
20253 <div class="gallerytext">
20254 </div>
20255 </div></li>
20256 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20257 <div class="thumb" style="height: 150px;">Image4</div>
20258 <div class="gallerytext">
20259 <pre>centre
20260 </pre>
20261 </div>
20262 </div></li>
20263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20264 <div class="thumb" style="height: 150px;">Image5.svg</div>
20265 <div class="gallerytext">
20266 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20267 </p>
20268 </div>
20269 </div></li>
20270 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20271 <div class="thumb" style="height: 150px;">* image6</div>
20272 <div class="gallerytext">
20273 </div>
20274 </div></li>
20275 </ul>
20276
20277 !! html/parsoid
20278 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20279 <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>
20280 <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>
20281 <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>
20282 <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>
20283 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20284 <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>
20285 </ul>
20286 !! end
20287
20288 !! test
20289 Gallery (with options, html)
20290 !! options
20291 parsoid={
20292 "modes": ["wt2html", "html2html"],
20293 "nativeGallery": true
20294 }
20295 !! wikitext
20296 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20297 File:Nonexistent.jpg|caption
20298 File:Nonexistent.jpg
20299 image:foobar.jpg|some '''caption''' [[Main Page]]
20300 image:foobar.jpg
20301 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20302 </gallery>
20303 !! html/php
20304 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20305 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20306 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20307 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20308 <div class="gallerytext">
20309 <p>caption
20310 </p>
20311 </div>
20312 </div></li>
20313 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20314 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20315 <div class="gallerytext">
20316 </div>
20317 </div></li>
20318 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20319 <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>
20320 <div class="gallerytext">
20321 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20322 </p>
20323 </div>
20324 </div></li>
20325 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20326 <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>
20327 <div class="gallerytext">
20328 </div>
20329 </div></li>
20330 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20331 <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>
20332 <div class="gallerytext">
20333 <p>blabla.
20334 </p>
20335 </div>
20336 </div></li>
20337 </ul>
20338
20339 !! html/parsoid
20340 <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":{}}'>
20341 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20342 <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>
20343 <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>
20344 <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>
20345 <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>
20346 <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>
20347 </ul>
20348 !! end
20349
20350 !! test
20351 Gallery (with options, extsrc)
20352 !! options
20353 parsoid={
20354 "nativeGallery": false
20355 }
20356 !! wikitext
20357 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20358 File:Nonexistent.jpg|caption
20359 File:Nonexistent.jpg
20360 image:foobar.jpg|some '''caption''' [[Main Page]]
20361 image:foobar.jpg
20362 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20363 </gallery>
20364 !! html/php
20365 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20366 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20367 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20368 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20369 <div class="gallerytext">
20370 <p>caption
20371 </p>
20372 </div>
20373 </div></li>
20374 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20375 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20376 <div class="gallerytext">
20377 </div>
20378 </div></li>
20379 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20380 <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>
20381 <div class="gallerytext">
20382 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20383 </p>
20384 </div>
20385 </div></li>
20386 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20387 <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>
20388 <div class="gallerytext">
20389 </div>
20390 </div></li>
20391 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20392 <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>
20393 <div class="gallerytext">
20394 <p>blabla.
20395 </p>
20396 </div>
20397 </div></li>
20398 </ul>
20399
20400 !! html/parsoid
20401 <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"}}'>
20402 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20403 <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>
20404 <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>
20405 <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>
20406 <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>
20407 <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>
20408 </ul>
20409 !! end
20410
20411 !! test
20412 Gallery (without px units)
20413 !! wikitext
20414 <gallery widths="70" heights="40">
20415 File:Foobar.jpg
20416 </gallery>
20417 !! html/php
20418 <ul class="gallery mw-gallery-traditional">
20419 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20420 <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>
20421 <div class="gallerytext">
20422 </div>
20423 </div></li>
20424 </ul>
20425
20426 !! html/parsoid
20427 <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"}}'>
20428 <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>
20429 </ul>
20430 !! end
20431
20432 !! test
20433 Gallery (with invalid units)
20434 !! wikitext
20435 <gallery widths="70em" heights="40em">
20436 File:Foobar.jpg
20437 </gallery>
20438 !! html/php
20439 <ul class="gallery mw-gallery-traditional">
20440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20441 <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>
20442 <div class="gallerytext">
20443 </div>
20444 </div></li>
20445 </ul>
20446
20447 !! html/parsoid
20448 <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"}}'>
20449 <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>
20450 </ul>
20451 !! end
20452
20453 !! test
20454 Gallery with link that has fragment
20455 !! options
20456 parsoid={
20457 "modes": ["wt2html", "html2html"],
20458 "nativeGallery": true
20459 }
20460 !! wikitext
20461 <gallery>
20462 image:foobar.jpg|link=Main_Page
20463 image:foobar.jpg|link=Main_Page#section
20464 image:foobar.jpg|link=Main Page#section|caption
20465 </gallery>
20466 !! html/php
20467 <ul class="gallery mw-gallery-traditional">
20468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20469 <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>
20470 <div class="gallerytext">
20471 </div>
20472 </div></li>
20473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20474 <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>
20475 <div class="gallerytext">
20476 </div>
20477 </div></li>
20478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20479 <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>
20480 <div class="gallerytext">
20481 <p>caption
20482 </p>
20483 </div>
20484 </div></li>
20485 </ul>
20486
20487 !! html/parsoid
20488 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20489 <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>
20490 <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>
20491 <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>
20492 </ul>
20493 !! end
20494
20495 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20496 !! test
20497 Gallery with template inside caption
20498 !! options
20499 parsoid={
20500 "nativeGallery": true
20501 }
20502 !! wikitext
20503 <gallery caption="{{echo|hi}}">
20504 File:Foobar.jpg|{{echo|ho}}
20505 </gallery>
20506 !! html/php
20507 <ul class="gallery mw-gallery-traditional">
20508 <li class='gallerycaption'>{{echo|hi}}</li>
20509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20510 <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>
20511 <div class="gallerytext">
20512 <p>ho
20513 </p>
20514 </div>
20515 </div></li>
20516 </ul>
20517
20518 !! html/parsoid
20519 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20520 <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>
20521 <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>
20522 </ul>
20523 !! end
20524
20525 !! test
20526 Gallery with wikitext inside caption
20527 !! options
20528 parsoid={
20529 "nativeGallery": true
20530 }
20531 !! wikitext
20532 <gallery>
20533 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20534 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20535 </gallery>
20536 !! html/php
20537 <ul class="gallery mw-gallery-traditional">
20538 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20539 <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>
20540 <div class="gallerytext">
20541 <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>
20542 </p>
20543 </div>
20544 </div></li>
20545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20546 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
20547 <div class="gallerytext">
20548 <p>This is a test template
20549 </p>
20550 </div>
20551 </div></li>
20552 </ul>
20553
20554 !! html/parsoid
20555 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20556 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./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>
20557 <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>
20558 </ul>
20559 !! end
20560
20561 !! test
20562 Gallery (with showfilename option)
20563 !! options
20564 parsoid={
20565 "nativeGallery": true
20566 }
20567 !! wikitext
20568 <gallery showfilename="">
20569 File:Nonexistent.jpg|caption
20570 File:Nonexistent.jpg
20571 File:Foobar.jpg|some '''caption''' [[Main Page]]
20572 File:Foobar.jpg
20573 </gallery>
20574 !! html/php
20575 <ul class="gallery mw-gallery-traditional">
20576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20577 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20578 <div class="gallerytext">
20579 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20580 caption
20581 </p>
20582 </div>
20583 </div></li>
20584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20585 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20586 <div class="gallerytext">
20587 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20588 </p>
20589 </div>
20590 </div></li>
20591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20592 <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>
20593 <div class="gallerytext">
20594 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20595 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20596 </p>
20597 </div>
20598 </div></li>
20599 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20600 <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>
20601 <div class="gallerytext">
20602 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20603 </p>
20604 </div>
20605 </div></li>
20606 </ul>
20607
20608 !! html/parsoid
20609 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20610 <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>
20611 <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>
20612 <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>
20613 <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>
20614 </ul>
20615 !! end
20616
20617 ## Should Parsoid be preserving these variations? See T151367
20618 !! test
20619 Gallery (with namespace-less filenames)
20620 !! options
20621 parsoid={
20622 "modes": ["wt2html", "html2html"],
20623 "nativeGallery": true
20624 }
20625 !! wikitext
20626 <gallery>
20627 File:Nonexistent.jpg
20628 Nonexistent.jpg
20629 image:foobar.jpg
20630 foobar.jpg
20631 </gallery>
20632 !! html/php
20633 <ul class="gallery mw-gallery-traditional">
20634 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20635 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20636 <div class="gallerytext">
20637 </div>
20638 </div></li>
20639 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20640 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20641 <div class="gallerytext">
20642 </div>
20643 </div></li>
20644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20645 <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>
20646 <div class="gallerytext">
20647 </div>
20648 </div></li>
20649 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20650 <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>
20651 <div class="gallerytext">
20652 </div>
20653 </div></li>
20654 </ul>
20655
20656 !! html/parsoid
20657 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20658 <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>
20659 <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>
20660 <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>
20661 <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>
20662 </ul>
20663 !! end
20664
20665 !! test
20666 Gallery override link with wikilink (T36852)
20667 !! options
20668 parsoid={
20669 "nativeGallery": true
20670 }
20671 !! wikitext
20672 <gallery>
20673 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20674 </gallery>
20675 !! html/php
20676 <ul class="gallery mw-gallery-traditional">
20677 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20678 <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>
20679 <div class="gallerytext">
20680 </div>
20681 </div></li>
20682 </ul>
20683
20684 !! html/parsoid
20685 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20686 <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>
20687 </ul>
20688 !! end
20689
20690 !! test
20691 Gallery override link with absolute external link (T36852)
20692 !! options
20693 parsoid={
20694 "nativeGallery": true
20695 }
20696 !! wikitext
20697 <gallery>
20698 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20699 </gallery>
20700 !! html/php
20701 <ul class="gallery mw-gallery-traditional">
20702 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20703 <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>
20704 <div class="gallerytext">
20705 </div>
20706 </div></li>
20707 </ul>
20708
20709 !! html/parsoid
20710 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20711 <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>
20712 </ul>
20713 !! end
20714
20715 !! test
20716 Gallery override link with absolute external link with LanguageConverter
20717 !! options
20718 language=zh
20719 !! wikitext
20720 <gallery>
20721 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20722 </gallery>
20723 !! html/php
20724 <ul class="gallery mw-gallery-traditional">
20725 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20726 <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>
20727 <div class="gallerytext">
20728 <p>caption
20729 </p>
20730 </div>
20731 </div></li>
20732 </ul>
20733
20734 !! html/parsoid
20735 <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"}}'>
20736 <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>
20737 </ul>
20738 !! end
20739
20740 !! test
20741 Gallery override link with malicious javascript (T36852)
20742 !! options
20743 parsoid={
20744 "modes": ["wt2html", "html2html"],
20745 "nativeGallery": true
20746 }
20747 !! wikitext
20748 <gallery>
20749 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20750 </gallery>
20751 !! html/php
20752 <ul class="gallery mw-gallery-traditional">
20753 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20754 <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>
20755 <div class="gallerytext">
20756 </div>
20757 </div></li>
20758 </ul>
20759
20760 !! html/parsoid
20761 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20762 <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>
20763 </ul>
20764 !! end
20765
20766 # Note that parsoid uses the invalid link as a caption, PHP does not.
20767 !! test
20768 Gallery with invalid title as link (T45964)
20769 !! options
20770 parsoid={
20771 "modes": ["wt2html", "html2html"],
20772 "nativeGallery": true
20773 }
20774 !! wikitext
20775 <gallery>
20776 File:Foobar.jpg|link=<
20777 </gallery>
20778 !! html/php
20779 <ul class="gallery mw-gallery-traditional">
20780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20781 <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>
20782 <div class="gallerytext">
20783 </div>
20784 </div></li>
20785 </ul>
20786
20787 !! html/parsoid
20788 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20789 <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>
20790 </ul>
20791 !! end
20792
20793 !! test
20794 Serialize gallery without attrs in data-mw
20795 !! options
20796 parsoid={
20797 "modes": ["html2wt"],
20798 "nativeGallery": true
20799 }
20800 !! html/parsoid
20801 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20802 <li class="gallerycaption">123</li>
20803 <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>
20804 </ul>
20805 !! wikitext
20806 <gallery caption="123">
20807 File:Test.png
20808 </gallery>
20809 !! end
20810
20811 !! test
20812 Gallery with class and style attributes
20813 !! options
20814 parsoid={
20815 "nativeGallery": true
20816 }
20817 !! wikitext
20818 <gallery class="center" style="text-align: center;">
20819 File:Foobar.jpg
20820 </gallery>
20821 !! html/php
20822 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20824 <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>
20825 <div class="gallerytext">
20826 </div>
20827 </div></li>
20828 </ul>
20829
20830 !! html/parsoid
20831 <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":{}}'>
20832 <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>
20833 </ul>
20834 !! end
20835
20836 !! test
20837 Gallery in slideshow mode
20838 !! options
20839 parsoid={
20840 "nativeGallery": true
20841 }
20842 !! wikitext
20843 <gallery mode="slideshow" showthumbnails="">
20844 File:Foobar.jpg
20845 </gallery>
20846 !! html/php
20847 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20849 <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>
20850 <div class="gallerytext">
20851 </div>
20852 </div></li>
20853 </ul>
20854
20855 !! html/parsoid
20856 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20857 <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>
20858 </ul>
20859 !! end
20860
20861 !! test
20862 HTML Hex character encoding (spells the word "JavaScript")
20863 !! options
20864 parsoid=wt2html,wt2wt,html2html
20865 !! wikitext
20866 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20867 !! html/php
20868 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20869 </p>
20870 !! html/parsoid
20871 <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>
20872 !! end
20873
20874 !! test
20875 HTML Hex character encoding bogus encoding (T28437 regression check)
20876 !! wikitext
20877 &#xsee;&#XSEE;
20878 !! html
20879 <p>&amp;#xsee;&amp;#XSEE;
20880 </p>
20881 !! end
20882
20883 !! test
20884 HTML Hex character encoding mixed case
20885 !! options
20886 parsoid=wt2html,wt2wt,html2html
20887 !! wikitext
20888 &#xEE;&#Xee;
20889 !! html/php
20890 <p>&#xee;&#xee;
20891 </p>
20892 !! html/parsoid
20893 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20894 !! end
20895
20896 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20897 # Note that U+000C (form feed) is not a valid XML character, so
20898 # it is banned even though allowed in HTML5.
20899 !! test
20900 Illegal character references (T106578)
20901 !! wikitext
20902 ; Null: &#00;
20903 ; FF: &#xC;
20904 ; CR: &#xD;
20905 ; Control (low): &#8;
20906 ; Control (high): &#x7F; &#x9F;
20907 ; Surrogate: &#xD83D;&#xDCA9;
20908 ; This is an okay astral character: &#x1F4A9;
20909 !! html+tidy
20910 <dl><dt>Null</dt>
20911 <dd>&amp;#00;</dd>
20912 <dt>FF</dt>
20913 <dd>&amp;#xC;</dd>
20914 <dt>CR</dt>
20915 <dd>&amp;#xD;</dd>
20916 <dt>Control (low)</dt>
20917 <dd>&amp;#8;</dd>
20918 <dt>Control (high)</dt>
20919 <dd>&amp;#x7F; &amp;#x9F;</dd>
20920 <dt>Surrogate</dt>
20921 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20922 <dt>This is an okay astral character</dt>
20923 <dd>&#x1f4a9;</dd></dl>
20924 !! end
20925
20926 !! test
20927 __FORCETOC__ override
20928 !! wikitext
20929 __NEWSECTIONLINK__
20930 __FORCETOC__
20931 !! html/php
20932 <p><br />
20933 </p>
20934 !! end
20935
20936 !! test
20937 ISBN code coverage
20938 !! wikitext
20939 ISBN 978-0-1234-56&#x20;789
20940 !! html/php
20941 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20942 </p>
20943 !! html/parsoid
20944 <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>
20945 !! end
20946
20947 !! test
20948 ISBN followed by 5 spaces
20949 !! wikitext
20950 ISBN
20951 !! html
20952 <p>ISBN
20953 </p>
20954 !! end
20955
20956 !! test
20957 Double ISBN
20958 !! wikitext
20959 ISBN ISBN 1234567890
20960 !! html/php
20961 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20962 </p>
20963 !! html/parsoid
20964 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20965 !! end
20966
20967 # Uppercase X and lowercase x as well
20968 !! test
20969 ISBN with an X
20970 !! wikitext
20971 ISBN 3-462-04561-X
20972 ISBN 3-462-04561-x
20973 ISBN 080442957X
20974 ISBN 080442957x
20975 ISBN 978080442957X
20976 ISBN 978080442957x
20977 !! html/php
20978 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20979 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20980 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20981 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20982 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20983 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20984 </p>
20985 !! html/parsoid
20986 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20987 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20988 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20989 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20990 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20991 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20992 !! end
20993
20994 !! test
20995 ISBN with empty prefix (parsoid test)
20996 !! wikitext
20997 ISBN 1234567890
20998 !! html/php
20999 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21000 </p>
21001 !! html/parsoid
21002 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21003 !! end
21004
21005 !! test
21006 T24905: <abbr> followed by ISBN followed by </a>
21007 !! wikitext
21008 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21009 !! html/php
21010 <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>
21011 </p>
21012 !! html/parsoid
21013 <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>
21014 !! end
21015
21016 !! test
21017 Double RFC
21018 !! wikitext
21019 RFC RFC 1234
21020 !! html
21021 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21022 </p>
21023 !! end
21024
21025 !! test
21026 Double RFC with a wiki link
21027 !! wikitext
21028 RFC [[RFC 1234]]
21029 !! html
21030 <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>
21031 </p>
21032 !! end
21033
21034 !! test
21035 RFC code coverage
21036 !! wikitext
21037 RFC 983&#x20;987
21038 !! html/php
21039 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21040 </p>
21041 !! html/parsoid
21042 <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>
21043 !! end
21044
21045 !! test
21046 Centre-aligned image
21047 !! wikitext
21048 [[Image:foobar.jpg|centre]]
21049 !! html/php
21050 <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>
21051
21052 !! html/parsoid
21053 <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>
21054 !! end
21055
21056 !! test
21057 None-aligned image
21058 !! wikitext
21059 [[Image:foobar.jpg|none]]
21060 !! html/php
21061 <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>
21062
21063 !! html/parsoid
21064 <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>
21065 !! end
21066
21067 !! test
21068 Width + Height sized image (using px) (height is ignored)
21069 !! wikitext
21070 [[Image:foobar.jpg|640x480px]]
21071 !! html/php
21072 <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>
21073 </p>
21074 !! html/parsoid
21075 <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>
21076 !! end
21077
21078 !! test
21079 Width-sized image (using px, no following whitespace)
21080 !! wikitext
21081 [[Image:foobar.jpg|640px]]
21082 !! html/php
21083 <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>
21084 </p>
21085 !! html/parsoid
21086 <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>
21087 !! end
21088
21089 !! test
21090 Width-sized image (using px, with following whitespace - test regression from r39467)
21091 !! wikitext
21092 [[Image:foobar.jpg|640px ]]
21093 !! html/php
21094 <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>
21095 </p>
21096 !! html/parsoid
21097 <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>
21098 !!end
21099
21100 !! test
21101 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21102 !! wikitext
21103 [[Image:foobar.jpg| 640px]]
21104 !! html/php
21105 <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>
21106 </p>
21107 !! html/parsoid
21108 <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>
21109 !! end
21110
21111 !! test
21112 Image with page parameter
21113 !! options
21114 djvu
21115 !! wikitext
21116 [[File:LoremIpsum.djvu|page=2]]
21117 !! html/php
21118 <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>
21119 </p>
21120 !! html/parsoid
21121 <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>
21122 !! end
21123
21124 !! test
21125 Another italics / bold test
21126 !! wikitext
21127 ''' ''x'
21128 !! html
21129 <pre>'<i> </i>x'
21130 </pre>
21131 !!end
21132
21133 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21134 !! test
21135 dt/dd/dl test
21136 !! wikitext
21137 :;;;::
21138 !! html/php
21139 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21140
21141 !! html/parsoid
21142 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21143
21144 !!end
21145
21146 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21147 !! test
21148 Images with the "|" character in the comment
21149 !! wikitext
21150 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21151 !! html/php
21152 <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>
21153
21154 !! html/parsoid
21155 <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>
21156 !! end
21157
21158 !! test
21159 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21160 !! wikitext
21161 <html><script>alert(1);</script></html>
21162 !! html
21163 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21164 </p>
21165 !! end
21166
21167 !! test
21168 HTML with raw HTML ($wgRawHtml==true)
21169 !! options
21170 wgRawHtml=1
21171 !! wikitext
21172 <html><script>alert(1);</script></html>
21173 !! html/php
21174 <p><script>alert(1);</script>
21175 </p>
21176 !! end
21177
21178 !! test
21179 Parents of subpages, one level up
21180 !! options
21181 subpage title=[[Subpage test/L1/L2/L3]]
21182 !! wikitext
21183 [[../|L2]]
21184 !! html
21185 <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>
21186 </p>
21187 !! end
21188
21189
21190 !! test
21191 Parents of subpages, one level up, not named
21192 !! options
21193 subpage title=[[Subpage test/L1/L2/L3]]
21194 !! wikitext
21195 [[../]]
21196 !! html
21197 <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>
21198 </p>
21199 !! end
21200
21201
21202
21203 !! test
21204 Parents of subpages, two levels up
21205 !! options
21206 subpage title=[[Subpage test/L1/L2/L3]]
21207 !! wikitext
21208 [[../../|L1]]2
21209
21210 [[../../|L1]]l
21211 !! html
21212 <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
21213 </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>
21214 </p>
21215 !! end
21216
21217 !! test
21218 Parents of subpages, two levels up, without trailing slash or name.
21219 !! options
21220 subpage title=[[Subpage test/L1/L2/L3]]
21221 !! wikitext
21222 [[../..]]
21223 !! html
21224 <p>[[../..]]
21225 </p>
21226 !! end
21227
21228 !! test
21229 Parents of subpages, two levels up, with lots of extra trailing slashes.
21230 !! options
21231 subpage title=[[Subpage test/L1/L2/L3]]
21232 !! wikitext
21233 [[../../////]]
21234 !! html
21235 <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>
21236 </p>
21237 !! end
21238
21239 !! article
21240 Subpage test/L1/L2/L3Sibling
21241 !! text
21242 Sibling article
21243 !! endarticle
21244
21245 !! test
21246 Transclusion of a sibling page (one level up)
21247 !! options
21248 subpage title=[[Subpage test/L1/L2/L3]]
21249 !! wikitext
21250 {{../L3Sibling}}
21251 !! html
21252 <p>Sibling article
21253 </p>
21254 !! end
21255
21256 !! test
21257 Transclusion of a child page
21258 !! options
21259 subpage title=[[Subpage test/L1/L2]]
21260 !! wikitext
21261 {{/L3Sibling}}
21262 !! html
21263 <p>Sibling article
21264 </p>
21265 !! end
21266
21267 # This is wt2html only in Parsoid because we add <nowiki>
21268 # because of {{..}} and we don't expect to fix that to
21269 # eliminate the nowikis selective for {{..}} markup.
21270 !! test
21271 Non-transclusion because of too many up levels
21272 !! options
21273 subpage title=[[Subpage test/L1/L2/L3]]
21274 parsoid=wt2html
21275 !! wikitext
21276 {{../../../../More than parent}}
21277 !! html/php
21278 <p>{{../../../../More than parent}}
21279 </p>
21280 !! html/parsoid
21281 <p>{{../../../../More than parent}}</p>
21282 !! end
21283
21284 !! test
21285 Definition list code coverage
21286 !! wikitext
21287 ;title : def
21288 ;title : def
21289 ;title: def
21290 !! html/php
21291 <dl><dt>title &#160;</dt>
21292 <dd>def</dd>
21293 <dt>title&#160;</dt>
21294 <dd>def</dd>
21295 <dt>title</dt>
21296 <dd>def</dd></dl>
21297
21298 !! html/parsoid
21299 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21300 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21301 <dt>title</dt><dd> def</dd></dl>
21302 !! end
21303
21304 !! test
21305 Don't fall for the self-closing div
21306 !! wikitext
21307 <div>hello world</div/>
21308 !! html
21309 <div>hello world</div>
21310
21311 !! end
21312
21313 !! test
21314 MSGNW magic word
21315 !! wikitext
21316 {{MSGNW:msg}}
21317 !! html/php
21318 <p>&#91;&#91;:Template:Msg&#93;&#93;
21319 </p>
21320 !! end
21321
21322 !! test
21323 RAW magic word
21324 !! wikitext
21325 {{RAW:QUERTY}}
21326 !! html
21327 <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>
21328 </p>
21329 !! end
21330
21331 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21332 !! test
21333 Always escape literal '>' in output, not just after '<'
21334 !! wikitext
21335 ><>
21336 !! html
21337 <p>&gt;&lt;&gt;
21338 </p>
21339 !! end
21340
21341 !! test
21342 Template caching
21343 !! wikitext
21344 {{Test}}
21345 {{Test}}
21346 !! html
21347 <p>This is a test template
21348 This is a test template
21349 </p>
21350 !! end
21351
21352
21353 !! article
21354 MediaWiki:Fake
21355 !! text
21356 ==header==
21357 !! endarticle
21358
21359 !! test
21360 Inclusion of !userCanEdit() content
21361 !! wikitext
21362 {{MediaWiki:Fake}}
21363 !! html
21364 <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>
21365
21366 !! end
21367
21368
21369 !! test
21370 Out-of-order TOC heading levels
21371 !! wikitext
21372 ==2==
21373 ======6======
21374 ===3===
21375 =1=
21376 =====5=====
21377 ==2==
21378 !! html
21379 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21380 <ul>
21381 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21382 <ul>
21383 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21384 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21385 </ul>
21386 </li>
21387 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21388 <ul>
21389 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21390 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21391 </ul>
21392 </li>
21393 </ul>
21394 </div>
21395
21396 <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>
21397 <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>
21398 <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>
21399 <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>
21400 <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>
21401 <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>
21402
21403 !! end
21404
21405
21406 !! test
21407 ISBN with a dummy number
21408 !! wikitext
21409 ISBN ---
21410 !! html
21411 <p>ISBN ---
21412 </p>
21413 !! end
21414
21415
21416 !! test
21417 ISBN with space-delimited number
21418 !! wikitext
21419 ISBN 92 9017 032 8
21420 !! html/php
21421 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21422 </p>
21423 !! html/parsoid
21424 <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>
21425 !! end
21426
21427
21428 !! test
21429 ISBN with multiple spaces, no number
21430 !! wikitext
21431 ISBN foo
21432 !! html
21433 <p>ISBN foo
21434 </p>
21435 !! end
21436
21437
21438 !! test
21439 ISBN length
21440 !! wikitext
21441 ISBN 123456789
21442
21443 ISBN 1234567890
21444
21445 ISBN 12345678901
21446 !! html/php
21447 <p>ISBN 123456789
21448 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21449 </p><p>ISBN 12345678901
21450 </p>
21451 !! html/parsoid
21452 <p>ISBN 123456789</p>
21453
21454 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21455
21456 <p>ISBN 12345678901</p>
21457 !! end
21458
21459
21460 !! test
21461 ISBN with trailing year (T9110)
21462 !! wikitext
21463 ISBN 1-234-56789-0 - 2006
21464
21465 ISBN 1 234 56789 0 - 2006
21466 !! html/php
21467 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21468 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21469 </p>
21470 !! html/parsoid
21471 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21472
21473 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21474 !! end
21475
21476
21477 !! test
21478 anchorencode
21479 !! config
21480 wgFragmentMode=[ 'html5', 'legacy' ]
21481 !! wikitext
21482 {{anchorencode:foo bar©#%n}}
21483 !! html/php
21484 <p>foo_bar©#%n
21485 </p>
21486 !! html/parsoid
21487 <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>
21488 !! end
21489
21490 !! test
21491 anchorencode (legacy)
21492 !! config
21493 wgFragmentMode=[ 'legacy' ]
21494 !! wikitext
21495 {{anchorencode:foo bar©#%n}}
21496 !! html/php
21497 <p>foo_bar.C2.A9.23.25n
21498 </p>
21499 !! end
21500
21501 !! test
21502 anchorencode trims spaces
21503 !! config
21504 wgFragmentMode=[ 'html5', 'legacy' ]
21505 !! wikitext
21506 {{anchorencode: __pretty__please__}}
21507 !! html/php
21508 <p>pretty_please
21509 </p>
21510 !! html/parsoid
21511 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21512 !! end
21513
21514 !! test
21515 anchorencode deals with links
21516 !! config
21517 wgFragmentMode=[ 'html5', 'legacy' ]
21518 !! wikitext
21519 {{anchorencode: [[hello|world]] [[hi]]}}
21520 !! html/php
21521 <p>world_hi
21522 </p>
21523 !! html/parsoid
21524 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21525 !! end
21526
21527 !! test
21528 anchorencode deals with templates
21529 !! config
21530 wgFragmentMode=[ 'html5', 'legacy' ]
21531 !! wikitext
21532 {{anchorencode: {{Foo}} x}}
21533 !! html/php
21534 <p>FOO_x
21535 </p>
21536 !! html/parsoid
21537 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21538 !! end
21539
21540 !! test
21541 anchorencode encodes like the TOC generator: (T20431)
21542 !! config
21543 wgFragmentMode=[ 'html5', 'legacy' ]
21544 !! wikitext
21545 ===_ +:.3A%3A _ &&amp;]] x===
21546 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21547 __NOEDITSECTION__
21548 !! html/php
21549 <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>
21550 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21551 </p>
21552 !! html/parsoid
21553 <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>
21554 <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>
21555 <meta property="mw:PageProp/noeditsection"/>
21556 !! end
21557
21558 !! test
21559 anchorencode encodes like the TOC generator: (T20431) (legacy)
21560 !! config
21561 wgFragmentMode=[ 'legacy' ]
21562 !! wikitext
21563 ===_ +:.3A%3A&&amp;]]===
21564 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21565 __NOEDITSECTION__
21566 !! html/php
21567 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21568 <p>.2B:.3A.253A.26.26.5D.5D
21569 </p>
21570 !! end
21571
21572 !! test
21573 T8200: blockquotes and paragraph formatting
21574 !! wikitext
21575 <blockquote>
21576 foo
21577 </blockquote>
21578
21579 bar
21580
21581 baz
21582 !! html
21583 <blockquote>
21584 <p>foo
21585 </p>
21586 </blockquote>
21587 <p>bar
21588 </p>
21589 <pre>baz
21590 </pre>
21591 !! end
21592
21593 !! test
21594 T10293: Use of center tag ruins paragraph formatting
21595 !! wikitext
21596 <center>
21597 foo
21598 </center>
21599
21600 bar
21601
21602 baz
21603 !! html
21604 <center>
21605 <p>foo
21606 </p>
21607 </center>
21608 <p>bar
21609 </p>
21610 <pre>baz
21611 </pre>
21612 !! end
21613
21614 !!test
21615 Parsing of overlapping (improperly nested) inline html tags
21616 !! wikitext
21617 <span><s>x</span></s>
21618 !! html/php
21619 <p><span><s>x&lt;/span&gt;</s></span>
21620 </p>
21621 !! html/parsoid
21622 <p><span><s>x</s></span>
21623 </p>
21624 !!end
21625
21626 ###
21627 ### Language variants related tests
21628 ###
21629
21630 # Parsoid does not mark self-links.
21631 # Parsoid does not convert links; PHP will do any necessary redirects.
21632
21633 !! test
21634 Self-link in language variants
21635 !! options
21636 title=[[Dunav]] language=sr
21637 !! wikitext
21638 Both [[Dunav]] and [[Дунав]] are names for this river.
21639 !! html/php
21640 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21641 </p>
21642 !! html/parsoid
21643 <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>
21644 !! end
21645
21646 !! article
21647 Дуна
21648 !! text
21649 content
21650 !! endarticle
21651
21652 !! test
21653 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21654 !! options
21655 title=[[Duna]] language=sr
21656 !! wikitext
21657 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21658 !! html/php
21659 <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.
21660 </p>
21661 !! html/parsoid
21662 <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>
21663 !! end
21664
21665 !! test
21666 Link to a section of a variant of this title shouldn't be parsed as self-link
21667 !! options
21668 title=[[Duna]] language=sr
21669 !! wikitext
21670 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21671 !! html/php
21672 <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.
21673 </p>
21674 !! html/parsoid
21675 <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>
21676 !! end
21677
21678 !! test
21679 Link to pages in language variants
21680 !! options
21681 language=sr
21682 !! wikitext
21683 Main Page can be written as [[Маин Паге]]
21684 !! html/php
21685 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21686 </p>
21687 !! html/parsoid
21688 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21689 !! end
21690
21691
21692 !! test
21693 Multiple links to pages in language variants
21694 !! options
21695 language=sr
21696 !! wikitext
21697 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21698 !! html/php
21699 <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>.
21700 </p>
21701 !! html/parsoid
21702 <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>
21703 !! end
21704
21705
21706 !! test
21707 Simple template in language variants
21708 !! options
21709 language=sr
21710 !! wikitext
21711 {{тест}}
21712 !! html/php
21713 <p>This is a test template
21714 </p>
21715 !! end
21716
21717
21718 !! test
21719 Template with explicit namespace in language variants
21720 !! options
21721 language=sr
21722 !! wikitext
21723 {{Template:тест}}
21724 !! html/php
21725 <p>This is a test template
21726 </p>
21727 !! end
21728
21729
21730 !! test
21731 Basic test for template parameter in language variants
21732 !! options
21733 language=sr
21734 !! wikitext
21735 {{парамтест|param=foo}}
21736 !! html/php
21737 <p>This is a test template with parameter foo
21738 </p>
21739 !! end
21740
21741 !! test
21742 Simple category in language variants
21743 !! options
21744 language=sr cat
21745 !! wikitext
21746 [[Category:МедиаWики Усер'с Гуиде]]
21747 !! html/php
21748 cat=МедиаWики_Усер'с_Гуиде sort=
21749 !! html/parsoid
21750 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21751 !! end
21752
21753 !! article
21754 Category:分类
21755 !! text
21756 blah
21757 !! endarticle
21758
21759 !! article
21760 Category:分類
21761 !! text
21762 blah
21763 !! endarticle
21764
21765 ## We used to, but no longer wt2wt this test since the default serializer
21766 ## will normalize all categories to serialize on their own line.
21767 ## This wikitext usage is going to be fairly uncommon in production and
21768 ## selser will take care of preserving formatting in those scenarios.
21769 !! test
21770 Don't convert blue categorylinks to another variant (T35210)
21771 !! options
21772 cat
21773 language=zh
21774 parsoid=wt2html
21775 !! wikitext
21776 [[A]][[Category:分类]]
21777 !! html/php
21778 cat=分类 sort=
21779 !! html/parsoid
21780 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21781 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21782 !! end
21783
21784 !! test
21785 Stripping -{}- tags (language variants)
21786 !! options
21787 language=sr
21788 !! wikitext
21789 Latin proverb: -{Ne nuntium necare}-
21790 !! html/php
21791 <p>Latin proverb: Ne nuntium necare
21792 </p>
21793 !! html/parsoid
21794 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21795 !! end
21796
21797
21798 !! test
21799 Prevent conversion with -{}- tags (language variants)
21800 !! options
21801 language=sr variant=sr-ec
21802 !! wikitext
21803 Latinski: -{Ne nuntium necare}-
21804 !! html/php
21805 <p>Латински: Ne nuntium necare
21806 </p>
21807 !! html/parsoid
21808 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21809 !! end
21810
21811
21812 !! test
21813 Prevent conversion of text with -{}- tags (language variants)
21814 !! options
21815 language=sr variant=sr-ec
21816 !! wikitext
21817 Latinski: -{Ne nuntium necare}-
21818 !! html/php
21819 <p>Латински: Ne nuntium necare
21820 </p>
21821 !! html/parsoid
21822 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21823 !! end
21824
21825
21826 !! test
21827 Prevent conversion of links with -{}- tags (language variants)
21828 !! options
21829 language=sr variant=sr-ec
21830 !! wikitext
21831 -{[[Main Page]]}-
21832 !! html/php
21833 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21834 </p>
21835 !! html/parsoid
21836 <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>
21837 !! end
21838
21839
21840 !! test
21841 -{}- tags within headlines (within html for parserConvert())
21842 !! config
21843 wgFragmentMode=[ 'html5', 'legacy' ]
21844 !! options
21845 language=sr variant=sr-ec
21846 !! wikitext
21847 ==-{Naslov}-==
21848
21849 Note that even an unprotected headline ID is not affected by language
21850 conversion:
21851
21852 ==Latinski==
21853 !! html/php
21854 <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>
21855 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21856 цонверсион:
21857 </p>
21858 <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>
21859
21860 !! html/parsoid
21861 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21862
21863 <p>Note that even an unprotected headline ID is not affected by language
21864 conversion:</p>
21865
21866 <h2 id="Latinski">Latinski</h2>
21867 !! end
21868
21869 !! test
21870 Explicit definition of language variant alternatives
21871 !! options
21872 language=zh variant=zh-tw
21873 !! wikitext
21874 -{zh:China;zh-tw:Taiwan}-, not China
21875 !! html/php
21876 <p>Taiwan, not China
21877 </p>
21878 !! html/parsoid
21879 <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>
21880 !! end
21881
21882 !! test
21883 Filter syntax for language variants
21884 !! options
21885 language=zh variant=zh-tw
21886 !! wikitext
21887 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21888 !! html/php
21889 <p>fooblog, WEBJOURNAL, WEBLOGquux
21890 </p>
21891 !! html/parsoid
21892 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21893 !! end
21894
21895 # Note that Parsoid post-processing for language variants needs to
21896 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21897 !! test
21898 Conversion around HTML tags
21899 !! options
21900 language=sr variant=sr-ec
21901 !! wikitext
21902 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21903 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21904 !! html/php
21905 <p>
21906 <span title="ЛаCтин">ски</span>
21907 </p>
21908 !! html/parsoid
21909 <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"}]}'/>
21910 <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>
21911 !! end
21912
21913 !! test
21914 Explicit session-wise two-way language variant mapping (A flag and - flag)
21915 !! options
21916 language=zh variant=zh-tw
21917 !! wikitext
21918 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21919
21920 Taiwan is not China.
21921
21922 But -{A|zh:China; zh-tw:Taiwan}- is China,
21923
21924 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21925
21926 and -{China}- is China.
21927 !! html/php
21928 <p>This is Taiwan, but we'll forget that now.
21929 </p><p>Taiwan is not China.
21930 </p><p>But Taiwan is Taiwan,
21931 </p><p>(This should be stripped!)
21932 </p><p>and China is China.
21933 </p>
21934 !! html/parsoid
21935 <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>
21936 <p>Taiwan is not China.</p>
21937 <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>
21938 <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>
21939 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21940 !! end
21941
21942 !! test
21943 Explicit session-wise one-way language variant mapping (A flag and - flag)
21944 !! options
21945 language=zh variant=zh-tw
21946 !! wikitext
21947 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21948
21949 COUNTRY is China or Taiwan.
21950
21951 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21952
21953 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21954
21955 and -{COUNTRY}- is COUNTRY.
21956 !! html/php
21957 <p>This is Taiwan, but we'll forget that now.
21958 </p><p>COUNTRY is China or Taiwan.
21959 </p><p>But Taiwan is Taiwan,
21960 </p><p>(This should be stripped!)
21961 </p><p>and COUNTRY is COUNTRY.
21962 </p>
21963 !! html/parsoid
21964 <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>
21965 <p>COUNTRY is China or Taiwan.</p>
21966 <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>
21967 <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>
21968 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21969 !! end
21970
21971 !! test
21972 Explicit session-wise two-way language variant mapping (H flag for hide)
21973 !! options
21974 language=zh variant=zh-tw
21975 !! wikitext
21976 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21977
21978 Taiwan is China.
21979 !! html/php
21980 <p>(This should be stripped!)
21981 </p><p>Taiwan is Taiwan.
21982 </p>
21983 !! html/parsoid
21984 <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>
21985 <p>Taiwan is China.</p>
21986 !! end
21987
21988 !! test
21989 Explicit session-wise one-way language variant mapping (H flag for hide)
21990 !! options
21991 language=zh variant=zh-tw
21992 !! wikitext
21993 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21994
21995 COUNTRY is Taiwan or China.
21996 !! html/php
21997 <p>(This should be stripped!)
21998 </p><p>Taiwan is Taiwan or China.
21999 </p>
22000 !! html/parsoid
22001 <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>
22002 <p>COUNTRY is Taiwan or China.</p>
22003 !! end
22004
22005 ## Note that parsoid test runner does not support 'showtitle' option.
22006 !! test
22007 Adding explicit conversion rule for title (T flag)
22008 !! options
22009 language=zh variant=zh-tw showtitle
22010 !! wikitext
22011 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22012
22013 Taiwan is China.
22014 !! html/php
22015 Taiwan
22016 <p>Should be stripped!
22017 </p><p>Taiwan is China.
22018 </p>
22019 !! html/parsoid
22020 <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>
22021 <p>Taiwan is China.</p>
22022 !! end
22023
22024 !! test
22025 Code coverage: T combined with H flag
22026 !! options
22027 language=zh variant=zh-tw showtitle
22028 !! wikitext
22029 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22030
22031 Taiwan is China.
22032 !! html/php
22033 Taiwan
22034 <p>Should be stripped!
22035 </p><p>Taiwan is Taiwan.
22036 </p>
22037 !! html/parsoid
22038 <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>
22039 <p>Taiwan is China.</p>
22040 !! end
22041
22042 !! test
22043 Code coverage: T with no variants
22044 !! options
22045 language=zh variant=zh-tw showtitle
22046 !! wikitext
22047 -{H|zh:China; zh-tw:Taiwan}-
22048 Taiwan is China.-{T|Taiwan is China}-
22049 !! html/php
22050 Taiwan is China
22051 <p>
22052 Taiwan is Taiwan.
22053 </p>
22054 !! html/parsoid
22055 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22056 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22057 !! end
22058
22059 !! test
22060 Code coverage: rules with no variants
22061 !! options
22062 language=zh variant=zh-tw
22063 !! wikitext
22064 -{H|zh:China; zh-tw:Taiwan}-
22065 Taiwan is China.
22066 -{H|China}-
22067 Taiwan is China.
22068 !! html/php
22069 <p>
22070 Taiwan is Taiwan.
22071
22072 Taiwan is China.
22073 </p>
22074 !! html/parsoid
22075 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22076 Taiwan is China.
22077 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22078 Taiwan is China.</p>
22079 !! end
22080
22081
22082 !! test
22083 Code coverage: D flag for conversion rule
22084 !! options
22085 language=zh variant=zh-tw
22086 !! wikitext
22087 -{D|zh-cn:XA; zh-tw:YA}-
22088 -{A;D|zh-cn:XB; zh-tw:YB}-
22089 -{D;H|zh-cn:XC; zh-tw:YC}-
22090
22091 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22092
22093 -{D|0=>zh-tw:1}-
22094 -{A;D|2=>zh-tw:3}-
22095 -{D;H|4=>zh-tw:5}-
22096
22097 XA XB XC YA YB YC FOO BAR BAT 012345
22098 !! html/php
22099 <p>大陆:XA;台灣:YA;
22100
22101 大陆:XC;台灣:YC;
22102 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22103 </p><p>0⇒台灣:1;
22104
22105 4⇒台灣:5;
22106 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22107 </p>
22108 !! html/parsoid
22109 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22110 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22111 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22112 <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>
22113 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22114 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22115 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22116 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22117 !! end
22118
22119 !! test
22120 Code coverage: N flag for conversion rule
22121 !! options
22122 language=zh variant=zh-cn
22123 !! wikitext
22124 -{N|zh-cn}-
22125
22126 -{N|zh-tw}-
22127
22128 -{N|sr-ec}-
22129 !! html/php
22130 <p>大陆
22131 </p><p>台灣
22132 </p><p>српски (ћирилица)‎
22133 </p>
22134 !! html/parsoid
22135 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22136 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22137 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22138 !! end
22139
22140 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22141 !! test
22142 Code coverage: N flag for conversion rule (wt2html only)
22143 !! options
22144 language=zh variant=zh-cn
22145 parsoid=wt2html,html2html
22146 !! wikitext
22147 -{D;N|en}-
22148 !! html/php
22149 <p>English
22150 </p>
22151 !! html/parsoid
22152 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22153 !! end
22154
22155 !! test
22156 Testing that changing the language variant here in the tests actually works
22157 !! options
22158 language=zh variant=zh showtitle
22159 !! wikitext
22160 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22161 !! html/php
22162 China
22163 <p>Should be stripped!
22164 </p>
22165 !! html/parsoid
22166 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22167 !! end
22168
22169 !! test
22170 Recursive conversion of alt and title attrs shouldn't clear converter state
22171 !! options
22172 language=zh variant=zh-cn
22173 showtitle
22174 !! wikitext
22175 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22176 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22177 !! html/php
22178 China
22179 <p>
22180 Should be stripped<span title="Exclamation">!</span>
22181 </p>
22182 !! html/parsoid
22183 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22184 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>
22185 !! end
22186
22187 !! test
22188 T26072: more test on conversion rule for title
22189 !! options
22190 language=zh variant=zh-tw showtitle
22191 !! wikitext
22192 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22193
22194 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22195 !! html/php
22196 Taiwan
22197 <p>This should be stripped!
22198 </p><p>This won't take interferes with the title rule.
22199 </p>
22200 !! html/parsoid
22201 <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>
22202 <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>
22203 !! end
22204
22205 !! test
22206 Partly disable title conversion if variant == main language code
22207 !! options
22208 language=zh variant=zh title=[[ZH]] showtitle
22209 !! wikitext
22210 -{T|zh-cn:CN;zh-tw:TW}-
22211 !! html/php
22212 ZH
22213 <p>
22214 </p>
22215 !! html/parsoid
22216 <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>
22217 !! end
22218
22219 !! test
22220 Partly disable title conversion if variant == main language code, more
22221 !! options
22222 language=zh variant=zh title=[[ZH]] showtitle
22223 !! wikitext
22224 -{T|TW}-
22225 !! html/php
22226 ZH
22227 <p>
22228 </p>
22229 !! html/parsoid
22230 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22231 !! end
22232
22233 !! test
22234 Raw output of variant escape tags (R flag)
22235 !! options
22236 language=zh variant=zh-tw
22237 !! wikitext
22238 Raw: -{R|zh:China;zh-tw:Taiwan}-
22239 !! html/php
22240 <p>Raw: zh:China;zh-tw:Taiwan
22241 </p>
22242 !! html/parsoid
22243 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22244 !! end
22245
22246 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22247 !! test
22248 Raw output of variant escape tags (R flag) (wt2html only)
22249 !! options
22250 language=zh variant=zh-tw
22251 parsoid=wt2html,html2html
22252 !! wikitext
22253 -{Variant}- -{D|syntax}- -{D;R|options}-
22254 !! html/php
22255 <p>Variant syntax options
22256 </p>
22257 !! html/parsoid
22258 <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>
22259 !! end
22260
22261 !! test
22262 Nested markup inside raw output of variant escape tags (R flag)
22263 !! options
22264 language=zh variant=zh-tw
22265 !! wikitext
22266 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22267 !! html/php
22268 <p>Nested raw: nested Taiwan nested
22269 </p>
22270 !! html/parsoid
22271 <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>
22272 !! end
22273
22274 !! test
22275 Nested markup and spaces inside raw output of variant escape tags (R flag)
22276 !! options
22277 language=zh variant=zh-tw
22278 !! wikitext
22279 X-{ outer -{ inner }- outer }-X
22280 !! html/php
22281 <p>X outer inner outer X
22282 </p>
22283 !! html/parsoid
22284 <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>
22285 !! end
22286
22287 !! test
22288 Templates inside raw output of variant escape tags (R flag)
22289 !! options
22290 language=zh variant=zh-tw
22291 !! wikitext
22292 Nested raw: -{R|nested {{echo|hi}} templates}-
22293 !! html/php
22294 <p>Nested raw: nested hi templates
22295 </p>
22296 !! html/parsoid
22297 <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>
22298 !! end
22299
22300 !! test
22301 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22302 !! options
22303 language=zh variant=zh-cn
22304 !! wikitext
22305 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22306 !! html/php
22307 <p>0
22308 </p>
22309 !! html/parsoid
22310 <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>
22311 !! end
22312
22313 !! test
22314 Conversion rules from [numeric-only string] to [something else] (T48634)
22315 !! options
22316 language=zh variant=zh-cn
22317 !! wikitext
22318 -{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
22319 !! html/php
22320 <p>D12345EE12345
22321 </p>
22322 !! html/parsoid
22323 <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>
22324 !! end
22325
22326 !! test
22327 Two-way converter rule entries with an empty value should be ignored (T53551)
22328 !! options
22329 language=zh variant=zh-cn
22330 !! wikitext
22331 -{H|zh-cn:foo;zh-tw:;}-foobar
22332 !! html/php
22333 <p>foobar
22334 </p>
22335 !! html/parsoid
22336 <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>
22337 !! end
22338
22339 !! test
22340 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22341 !! options
22342 language=zh variant=zh-cn
22343 !! wikitext
22344 -{H|=>zh-cn:foo;}-foobar
22345 !! html/php
22346 <p>foobar
22347 </p>
22348 !! html/parsoid
22349 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22350 !! end
22351
22352 !! test
22353 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22354 !! options
22355 language=zh variant=zh-cn
22356 !! wikitext
22357 -{H|}-foobar
22358 !! html/php
22359 <p>foobar
22360 </p>
22361 !! html/parsoid
22362 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22363 !! end
22364
22365 !! test
22366 Nested using of manual convert syntax
22367 !! options
22368 language=zh variant=zh-hk
22369 !! wikitext
22370 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22371 !! html/php
22372 <p>Nested: Hello Hong Kong!
22373 </p>
22374 !! html/parsoid
22375 <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>
22376 !! end
22377
22378 !! test
22379 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22380 !! options
22381 language=zh variant=zh-cn
22382 !! wikitext
22383 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22384 !! html/php
22385 <p><span title="X">A</span>
22386 </p>
22387 !! html/parsoid
22388 <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>
22389 !! end
22390
22391 !! test
22392 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22393 !! options
22394 language=zh variant=zh-cn
22395 !! wikitext
22396 -{<span title="-{X}-">A</span>}-
22397 !! html/php+disabled
22398 <p><span title="X">A</span>
22399 </p>
22400 !! html/parsoid
22401 <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>
22402 !! end
22403
22404 # Parsoid and PHP disagree on how to parse this example: Parsoid
22405 # insists that the content of a language converter element be a valid
22406 # DOM fragment or attribute string
22407 !! test
22408 Language converter markup with block content
22409 !! options
22410 language=zh variant=zh-cn
22411 !! wikitext
22412 <span>a-{b<div>c}-d
22413
22414 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22415
22416 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22417 !! html/php+tidy
22418 <span>ab<div>cd
22419 <span>ab<div>cd
22420 <span>ad
22421 </span></div></span></div></span>
22422 !! html/parsoid
22423 <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>
22424
22425 <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>
22426
22427 <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>
22428 !! end
22429
22430 !! test
22431 LanguageConverter selser (1)
22432 !! options
22433 language=zh variant=zh-cn
22434 parsoid={
22435 "modes": ["wt2wt", "selser"],
22436 "changes": [
22437 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22438 ]
22439 }
22440 !! wikitext
22441 -{raw}-
22442 !! wikitext/edited
22443 -{edited}-
22444 !! end
22445
22446 !! test
22447 LanguageConverter selser (2)
22448 !! options
22449 language=zh variant=zh-cn
22450 parsoid={
22451 "modes": ["wt2wt", "selser"],
22452 "changes": [
22453 ["span[class='x']", "contents", "text", "-{foo}-"],
22454 ["a", "contents", "text", "-{"],
22455 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22456 ]
22457 }
22458 !! wikitext
22459 <span class="x">TEXT1</span>
22460 [http://example.com TEXT2]
22461 [[Foo|TEXT3]]
22462 {{echo|TEXT4}}
22463 !! wikitext/edited
22464 <span class="x"><nowiki>-{foo}-</nowiki></span>
22465 [http://example.com -{]
22466 [[Foo|<nowiki>-{</nowiki>]]
22467 {{1x|<nowiki>-{</nowiki>}}
22468 !! end
22469
22470 # Tests LanguageVariantText in ConstrainedText
22471 !! test
22472 LanguageConverter selser (3)
22473 !! options
22474 language=zh variant=zh-cn
22475 parsoid={
22476 "modes": ["wt2wt", "selser"],
22477 "changes": [
22478 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22479 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22480 ]
22481 }
22482 !! wikitext
22483 {|
22484 |-
22485 |<span>Foo</span>
22486 |}
22487 !! wikitext/edited
22488 {|
22489 |-
22490 |<nowiki/>-{edited}-
22491 |}
22492 !! end
22493
22494 # Tests LanguageVariantText._fromSelSer
22495 !! test
22496 LanguageConverter selser (4)
22497 !! options
22498 language=zh variant=zh-cn
22499 parsoid={
22500 "modes": ["wt2wt", "selser"],
22501 "changes": [
22502 ["td > span.x", "remove"]
22503 ]
22504 }
22505 !! wikitext
22506 {|
22507 |-
22508 |<span class="x">Foo</span>-{Bar}-
22509 ||<span class="x">Foo</span>-{Bar}-
22510 |}
22511 !! wikitext/edited
22512 {|
22513 |-
22514 |<nowiki/>-{Bar}-
22515 ||-{Bar}-
22516 |}
22517 !! end
22518
22519 # Since Parsoid is starting to emit canonical wikitext for links,
22520 # [http://example.com http://example.com] will not RT back to that
22521 # form anymore.
22522 # Parsoid does not language-convert links (it is done in a
22523 # post-processing step)
22524 !! test
22525 Proper conversion of text in external links
22526 !! options
22527 language=sr variant=sr-ec
22528 parsoid=wt2html
22529 !! wikitext
22530 http://www.google.com
22531 gopher://www.google.com
22532 [http://www.google.com http://www.google.com]
22533 [gopher://www.google.com gopher://www.google.com]
22534 [https://www.google.com irc://www.google.com]
22535 [ftp://www.google.com www.google.com/ftp://dir]
22536 [//www.google.com www.google.com]
22537 !! html/php
22538 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22539 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22540 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22541 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22542 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22543 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22544 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22545 </p>
22546 !! html/parsoid
22547 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22548 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22549 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22550 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22551 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22552 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22553 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22554 !! end
22555
22556 !! test
22557 Do not convert roman numbers to language variants
22558 !! options
22559 language=sr variant=sr-ec
22560 !! wikitext
22561 Fridrih IV je car.
22562 !! html/php
22563 <p>Фридрих IV је цар.
22564 </p>
22565 !! html/parsoid
22566 <p>Fridrih IV je car.</p>
22567 !! end
22568
22569 !! test
22570 Unclosed language converter markup "-{"
22571 !! options
22572 language=sr
22573 !! wikitext
22574 -{T|hello
22575 !! html
22576 <p>-{T|hello
22577 </p>
22578 !! end
22579
22580 !! test
22581 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22582 !! options
22583 language=sr
22584 !! wikitext
22585 -{R|=&gt;}-
22586 !! html/php
22587 <p>=&gt;
22588 </p>
22589 !! html/parsoid
22590 <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>
22591 !!end
22592
22593 !! test
22594 Don't break link parsing if language converter markup is in the caption.
22595 !! options
22596 language=sr variant=sr-ec
22597 !! wikitext
22598 [[Main Page|-{R|main page}-]]
22599 !! html/php
22600 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22601 </p>
22602 !! html/parsoid
22603 <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>
22604 !! end
22605
22606 !! test
22607 T146304: Don't break template parsing if language converter markup is in the parameter.
22608 !! options
22609 language=sr variant=sr-ec
22610 !! wikitext
22611 {{echo|-{R|foo}-}}
22612 !! html/php
22613 <p>foo
22614 </p>
22615 !! html/parsoid
22616 <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>
22617 !! end
22618
22619 !! test
22620 T146305: Don't break image parsing if language converter markup is in the caption.
22621 !! options
22622 language=sr
22623 !! wikitext
22624 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22625 !! html/php
22626 <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>
22627
22628 !! html/parsoid
22629 <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>
22630 !! end
22631
22632 !! test
22633 T146305: Don't break image parsing if nested language converter markup is in the caption.
22634 !! options
22635 language=zh variant=zh-cn
22636 !! wikitext
22637 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22638 !! html/php
22639 <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>
22640
22641 !! html/parsoid
22642 <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>
22643 !! end
22644
22645 # XXX html2wt disabled because rich markup in alt is not preserved.
22646 !! test
22647 Don't break gallery if language converter markup is inside.
22648 !! options
22649 language=zh
22650 !! wikitext
22651 <gallery>
22652 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22653 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22654 </gallery>
22655 !! html/php
22656 <ul class="gallery mw-gallery-traditional">
22657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22658 <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>
22659 <div class="gallerytext">
22660 <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>
22661 </p>
22662 </div>
22663 </div></li>
22664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22665 <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>
22666 <div class="gallerytext">
22667 <p>This is a test template
22668 </p>
22669 </div>
22670 </div></li>
22671 </ul>
22672
22673 !! html/parsoid
22674 <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"}}'>
22675 <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>
22676 <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>
22677 </ul>
22678 !! end
22679
22680 !! test
22681 T153135: Don't break list handling if language converter markup is in the item.
22682 !! options
22683 language=zh variant=zh-cn
22684 !! wikitext
22685 ;-{zh-cn:AAA;zh-tw:BBB}-
22686 ;-{R|foo:bar}-
22687 !! html/php
22688 <dl><dt>AAA</dt>
22689 <dt>foo:bar</dt></dl>
22690
22691 !! html/parsoid
22692 <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>
22693 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22694 </dl>
22695 !! end
22696
22697 // Note that parsoid does not protect colons unless language converter
22698 // markup is properly nested, because it is a backtracking parser.
22699 !! test
22700 T153135: Unclosed markup in definition list (code coverage)
22701 !! options
22702 language=zh variant=zh-cn
22703 !! wikitext
22704 ;<b>foo:bar
22705 ;-{zh-cn:AAA
22706 !! html/php+tidy
22707 <dl><dt><b>foo:bar</b></dt><b>
22708 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22709 </b></p>
22710 !! html/parsoid
22711 <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}'>
22712 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22713 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22714 </b></dl>
22715 !! end
22716
22717 !! test
22718 T153135: Nested language converter markup in definition list (code coverage)
22719 !! options
22720 language=zh variant=zh-cn
22721 !! wikitext
22722 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22723 !! html/php
22724 <dl><dt>AAA foo:bar bat:baz</dt>
22725 <dd>def</dd></dl>
22726
22727 !! html/parsoid
22728 <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>
22729 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22730 </dl>
22731 !! end
22732
22733 # html2wt mode disabled due to <nowiki> insertion.
22734 !! test
22735 T153140: Don't break table handling if language converter markup is in the cell.
22736 !! options
22737 language=sr variant=sr-ec
22738 parsoid=wt2html,wt2wt,html2html
22739 !! wikitext
22740 {|
22741 |-
22742 | -{R|B}-
22743 |}
22744 !! html/php
22745 <table>
22746
22747 <tr>
22748 <td>B
22749 </td></tr></table>
22750
22751 !! html/parsoid
22752 <table>
22753 <tbody>
22754 <tr>
22755 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22756 </tr>
22757 </tbody>
22758 </table>
22759 !! end
22760
22761 !! test
22762 Language converter tricky html2wt cases (1)
22763 !! options
22764 language=sr
22765 parsoid=html2wt,wt2wt
22766 !! html/parsoid
22767 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22768 !! wikitext
22769 -{<nowiki>}-</nowiki>}-
22770 !! html/php
22771 <p>&#125;-
22772 </p>
22773 !! end
22774
22775 !! test
22776 Language converter tricky html2wt cases (2)
22777 !! options
22778 language=sr
22779 parsoid=html2wt,wt2wt
22780 !! html/parsoid
22781 <p>-{foo}-</p>
22782 !! wikitext
22783 <nowiki>-{foo}-</nowiki>
22784 !! html/php
22785 <p>-&#123;foo&#125;-
22786 </p>
22787 !! end
22788
22789 !! test
22790 Language converter tricky html2wt cases (3)
22791 !! options
22792 language=sr
22793 parsoid=html2wt,wt2wt
22794 !! html/parsoid
22795 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22796 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22797 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22798 !! wikitext
22799 -{R||}-
22800
22801 -{R|R|raw}-
22802
22803 -{<nowiki>-{foo}-</nowiki>}-
22804 !! html/php
22805 <p>|
22806 </p><p>R|raw
22807 </p><p>-&#123;foo&#125;-
22808 </p>
22809 !! end
22810
22811 !! test
22812 Language converter tricky html2wt cases (4)
22813 !! options
22814 language=sr
22815 parsoid=html2wt,wt2wt
22816 !! html/parsoid
22817 <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>
22818 !! wikitext
22819 -{R|{{echo|hey}}}-
22820 !! html/php
22821 <p>hey
22822 </p>
22823 !! end
22824
22825 # Note that the <nowiki> escaping added by parsoid for source text,
22826 # destination text, and language names only works on the PHP side
22827 # for *destination text*. (HTML entity escaping wouldn't work
22828 # any better.) This is probably a bug, at least for source texts.
22829 # (For language names PHP uses a precise regexp based on the languages
22830 # it currently knows have variants, which is fragile since this set
22831 # can grow/shrink over time.)
22832 !! test
22833 Language converter tricky html2wt cases (5)
22834 !! options
22835 language=zh variant=zh-cn
22836 !! html/parsoid
22837 <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>
22838 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22839 <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>
22840 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22841 <p>a:b=>c xyz</p>
22842 !! wikitext
22843 -{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
22844
22845 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22846
22847 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22848
22849 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22850
22851 a:b=>c xyz
22852 !! html/php+disabled
22853 <p>foobat;xyz=&gt;zh-cn:abc
22854 </p><p>A
22855 </p><p>0;zh-tw:bar
22856 </p><p>abc
22857 </p><p>a:b=&gt;c 0;zh-tw:bar
22858 </p>
22859 !! end
22860
22861 !! test
22862 T179579: Nowiki and lc interaction
22863 !! options
22864 parsoid=wt2html
22865 language=sr
22866 !! wikitext
22867 -{</nowiki>123}-
22868
22869 -{123<nowiki>|</nowiki>456}-
22870 !! html/parsoid
22871 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22872
22873 <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>
22874 !! end
22875
22876 !! test
22877 T2529: Uncovered bullet
22878 !! wikitext
22879 *Foo {{bullet}}
22880 !! html
22881 <ul><li>Foo</li>
22882 <li>Bar</li></ul>
22883
22884 !! end
22885
22886 !! test
22887 T2529: Uncovered bullet in a deeply nested list
22888 !! wikitext
22889 *******Foo {{bullet}}
22890 !! html
22891 <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>
22892 <li>Bar</li></ul>
22893
22894 !! end
22895
22896 !! test
22897 T2529: Uncovered table already at line-start
22898 !! wikitext
22899 x
22900
22901 {{table}}
22902 y
22903 !! html
22904 <p>x
22905 </p>
22906 <table>
22907 <tr>
22908 <td>1</td>
22909 <td>2
22910 </td></tr>
22911 <tr>
22912 <td>3</td>
22913 <td>4
22914 </td></tr></table>
22915 <p>y
22916 </p>
22917 !! end
22918
22919 !! test
22920 T2529: Uncovered bullet in parser function result
22921 !! wikitext
22922 *Foo {{lc:{{bullet}} }}
22923 !! html
22924 <ul><li>Foo</li>
22925 <li>bar</li></ul>
22926
22927 !! end
22928
22929 !! test
22930 T7678: Double-parsed template argument
22931 !! wikitext
22932 {{lc:{{{1}}}|hello}}
22933 !! html
22934 <p>{{{1}}}
22935 </p>
22936 !! end
22937
22938 !! test
22939 T7678: Double-parsed template invocation
22940 !! wikitext
22941 {{lc:{{paramtest {{!}} param = hello }} }}
22942 !! html
22943 <p>{{paramtest | param = hello }}
22944 </p>
22945 !! end
22946
22947 !! test
22948 Case insensitivity of parser functions for non-ASCII characters (T10143)
22949 !! options
22950 language=cs
22951 title=[[Main Page]]
22952 !! wikitext
22953 {{PRVNÍVELKÉ:ěščř}}
22954 {{prvnívelké:ěščř}}
22955 {{PRVNÍMALÉ:ěščř}}
22956 {{prvnímalé:ěščř}}
22957 {{MALÁ:ěščř}}
22958 {{malá:ěščř}}
22959 {{VELKÁ:ěščř}}
22960 {{velká:ěščř}}
22961 !! html
22962 <p>Ěščř
22963 Ěščř
22964 ěščř
22965 ěščř
22966 ěščř
22967 ěščř
22968 ĚŠČŘ
22969 ĚŠČŘ
22970 </p>
22971 !! end
22972
22973 !! test
22974 Morwen/13: Unclosed link followed by heading
22975 !! wikitext
22976 [[link
22977 ==heading==
22978 !! html
22979 <p>[[link
22980 </p>
22981 <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>
22982
22983 !! end
22984
22985 !! test
22986 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22987 !! wikitext
22988 {{foo|
22989 =heading=
22990 !! html
22991 <p>{{foo|
22992 </p>
22993 <h1><span class="mw-headline" id="heading">heading</span></h1>
22994
22995 !! end
22996
22997 !! test
22998 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22999 !! wikitext
23000 {{foo|
23001 ==heading==
23002 !! html
23003 <p>{{foo|
23004 </p>
23005 <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>
23006
23007 !! end
23008
23009 !! test
23010 Tildes in comments
23011 !! options
23012 pst
23013 !! wikitext
23014 <!-- ~~~~ -->
23015 !! html/php
23016 <!-- ~~~~ -->
23017 !! end
23018
23019 !! test
23020 Paragraphs inside divs (no extra line breaks)
23021 !! wikitext
23022 <div>Line one
23023
23024 Line two</div>
23025 !! html
23026 <div>Line one
23027 Line two</div>
23028
23029 !! end
23030
23031 !! test
23032 Paragraphs inside divs (extra line break on open)
23033 !! wikitext
23034 <div>
23035 Line one
23036
23037 Line two</div>
23038 !! html
23039 <div>
23040 <p>Line one
23041 </p>
23042 Line two</div>
23043
23044 !! end
23045
23046 !! test
23047 Paragraphs inside divs (extra line break on close)
23048 !! wikitext
23049 <div>Line one
23050
23051 Line two
23052 </div>
23053 !! html
23054 <div>Line one
23055 <p>Line two
23056 </p>
23057 </div>
23058
23059 !! end
23060
23061 !! test
23062 Paragraphs inside divs (extra line break on open and close)
23063 !! wikitext
23064 <div>
23065 Line one
23066
23067 Line two
23068 </div>
23069 !! html
23070 <div>
23071 <p>Line one
23072 </p><p>Line two
23073 </p>
23074 </div>
23075
23076 !! end
23077
23078 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23079 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23080 !! test
23081 Nesting tags, paragraphs on lines which begin with <div>
23082 !! wikitext
23083 <div></div><strong>A
23084 B</strong>
23085 !! html/php+tidy
23086 <div></div><p><strong>A
23087 </strong></p><strong></strong><p><strong>B</strong>
23088 </p>
23089 !! html/parsoid
23090 <div></div>
23091 <p><strong>A
23092 B</strong>
23093 </p>
23094 !! end
23095
23096 # T8200: <blockquote> should behave like <div> with respect to line breaks
23097 !! test
23098 T8200: paragraphs inside blockquotes (no extra line breaks)
23099 !! wikitext
23100 <blockquote>Line one
23101
23102 Line two</blockquote>
23103 !! html
23104 <blockquote>Line one
23105 Line two</blockquote>
23106
23107 !! html+tidy
23108 <blockquote><p>Line one
23109 Line two</p></blockquote>
23110 !! end
23111
23112 !! test
23113 T8200: paragraphs inside blockquotes (extra line break on open)
23114 !! wikitext
23115 <blockquote>
23116 Line one
23117
23118 Line two</blockquote>
23119 !! html
23120 <blockquote>
23121 <p>Line one
23122 </p>
23123 Line two</blockquote>
23124
23125 !! html+tidy
23126 <blockquote>
23127 <p>Line one
23128 </p><p>
23129 Line two</p></blockquote>
23130 !! end
23131
23132 !! test
23133 T8200: paragraphs inside blockquotes (extra line break on close)
23134 !! wikitext
23135 <blockquote>Line one
23136
23137 Line two
23138 </blockquote>
23139 !! html
23140 <blockquote>Line one
23141 <p>Line two
23142 </p>
23143 </blockquote>
23144
23145 !! html+tidy
23146 <blockquote><p>Line one
23147 </p><p>Line two
23148 </p>
23149 </blockquote>
23150 !! end
23151
23152 !! test
23153 T8200: paragraphs inside blockquotes (extra line break on open and close)
23154 !! wikitext
23155 <blockquote>
23156 Line one
23157
23158 Line two
23159 </blockquote>
23160 !! html
23161 <blockquote>
23162 <p>Line one
23163 </p><p>Line two
23164 </p>
23165 </blockquote>
23166
23167 !! end
23168
23169 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23170 !! test
23171 Paragraphs inside blockquotes/divs (no extra line breaks)
23172 !! wikitext
23173 <blockquote><div>Line one
23174
23175 Line two</div></blockquote>
23176 !! html
23177 <blockquote><div>Line one
23178 Line two</div></blockquote>
23179
23180 !! end
23181
23182 !! test
23183 Paragraphs inside blockquotes/divs (extra line break on open)
23184 !! wikitext
23185 <blockquote><div>
23186 Line one
23187
23188 Line two</div></blockquote>
23189 !! html
23190 <blockquote><div>
23191 <p>Line one
23192 </p>
23193 Line two</div></blockquote>
23194
23195 !! end
23196
23197 !! test
23198 Paragraphs inside blockquotes/divs (extra line break on close)
23199 !! wikitext
23200 <blockquote><div>Line one
23201
23202 Line two
23203 </div></blockquote>
23204 !! html
23205 <blockquote><div>Line one
23206 <p>Line two
23207 </p>
23208 </div></blockquote>
23209
23210 !! end
23211
23212 !! test
23213 Paragraphs inside blockquotes/divs (extra line break on open and close)
23214 !! wikitext
23215 <blockquote><div>
23216 Line one
23217
23218 Line two
23219 </div></blockquote>
23220 !! html
23221 <blockquote><div>
23222 <p>Line one
23223 </p><p>Line two
23224 </p>
23225 </div></blockquote>
23226
23227 !! end
23228
23229 !! test
23230 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23231 !! options
23232 wgLinkHolderBatchSize=0
23233 !! wikitext
23234 [[meatball:1]]
23235 [[meatball:2]]
23236 [[meatball:3]]
23237 !! html
23238 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23239 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23240 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23241 </p>
23242 !! end
23243
23244 !! test
23245 Free external link invading image caption
23246 !! wikitext
23247 [[Image:Foobar.jpg|thumb|http://x|hello]]
23248 !! html/php
23249 <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>
23250
23251 !! html/parsoid
23252 <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>
23253 !! end
23254
23255 !! test
23256 T17196: localised external link numbers
23257 !! options
23258 language=fa
23259 !! wikitext
23260 [http://en.wikipedia.org/]
23261 !! html/php
23262 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23263 </p>
23264 !! html/parsoid
23265 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23266 !! end
23267
23268 !! test
23269 Multibyte character in padleft
23270 !! wikitext
23271 {{padleft:-Hello|7|Æ}}
23272 !! html/php
23273 <p>Æ-Hello
23274 </p>
23275 !! html/parsoid
23276 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23277 !! end
23278
23279 !! test
23280 Multibyte character in padright
23281 !! wikitext
23282 {{padright:Hello-|7|Æ}}
23283 !! html/php
23284 <p>Hello-Æ
23285 </p>
23286 !! html/parsoid
23287 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23288 !! end
23289
23290 !!test
23291 formatdate parser function
23292 !! wikitext
23293 {{#formatdate:2009-03-24}}
23294 !! html
23295 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23296 </p>
23297 !! end
23298
23299 !!test
23300 formatdate parser function, with default format
23301 !! wikitext
23302 {{#formatdate:2009-03-24|mdy}}
23303 !! html
23304 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23305 </p>
23306 !! end
23307
23308 !! test
23309 Spacing of numbers in formatted dates
23310 !! wikitext
23311 {{#formatdate:January 15}}
23312 !! html
23313 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23314 </p>
23315 !! end
23316
23317 !! test
23318 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
23319 !! options
23320 language=nl title=[[MediaWiki:Common.css]]
23321 !! wikitext
23322 {{#formatdate:2009-03-24|dmy}}
23323 !! html
23324 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23325 </p>
23326 !! end
23327
23328 #
23329 #
23330 #
23331
23332 #
23333 # Edit comments
23334 #
23335
23336 !! test
23337 Edit comment with link
23338 !! options
23339 comment
23340 !! wikitext
23341 I like the [[Main Page]] a lot
23342 !! html/php
23343 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23344 !!end
23345
23346 !! test
23347 Edit comment with link and link text
23348 !! options
23349 comment
23350 !! wikitext
23351 I like the [[Main Page|best pages]] a lot
23352 !! html/php
23353 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23354 !!end
23355
23356 !! test
23357 Edit comment with link and link text with suffix
23358 !! options
23359 comment
23360 !! wikitext
23361 I like the [[Main Page|best page]]s a lot
23362 !! html/php
23363 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23364 !!end
23365
23366 !! test
23367 Edit comment with section link (non-local, eg in history list)
23368 !! options
23369 comment title=[[Main Page]]
23370 !! wikitext
23371 /* External links */ removed bogus entries
23372 !! html/php
23373 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23374 !!end
23375
23376 !! test
23377 Edit comment with section link and text before it (non-local, eg in history list)
23378 !! options
23379 comment title=[[Main Page]]
23380 !! wikitext
23381 pre-comment text /* External links */ removed bogus entries
23382 !! html/php
23383 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>
23384 !!end
23385
23386 !! test
23387 Edit comment with section link (local, eg in diff view)
23388 !! options
23389 comment local title=[[Main Page]]
23390 !! wikitext
23391 /* External links */ removed bogus entries
23392 !! html/php
23393 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23394 !!end
23395
23396 !! test
23397 Edit comment with subpage link (T16080)
23398 !! options
23399 comment
23400 subpage
23401 title=[[Subpage test]]
23402 !! wikitext
23403 Poked at a [[/subpage]] here...
23404 !! html/php
23405 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23406 !!end
23407
23408 !! test
23409 Edit comment with subpage link and link text (T16080)
23410 !! options
23411 comment
23412 subpage
23413 title=[[Subpage test]]
23414 !! wikitext
23415 Poked at a [[/subpage|neat little page]] here...
23416 !! html/php
23417 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23418 !!end
23419
23420 !! test
23421 Edit comment with bogus subpage link in non-subpage NS (T16080)
23422 !! options
23423 comment
23424 title=[[Subpage test]]
23425 !! wikitext
23426 Poked at a [[/subpage]] here...
23427 !! html/php
23428 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...
23429 !!end
23430
23431 !! test
23432 Edit comment with bare anchor link (local, as on diff)
23433 !! options
23434 comment
23435 local
23436 title=[[Main Page]]
23437 !! wikitext
23438 [[#section]]
23439 !! html/php
23440 <a href="#section">#section</a>
23441 !! end
23442
23443 !! test
23444 Edit comment with bare anchor link (non-local, as on history)
23445 !! options
23446 comment
23447 title=[[Main Page]]
23448 !! wikitext
23449 [[#section]]
23450 !! html/php
23451 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23452 !! end
23453
23454 !! test
23455 Anchor starting with underscore
23456 !! options
23457 title=[[Foo]]
23458 !! wikitext
23459 [[#_ref|One]]
23460 !! html/php
23461 <p><a href="#_ref">One</a>
23462 </p>
23463 !! html/parsoid
23464 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23465 !! end
23466
23467 !! test
23468 Id starting with underscore
23469 !! wikitext
23470 <div id="_ref"></div>
23471 !! html/*
23472 <div id="_ref"></div>
23473
23474 !! end
23475
23476 !! test
23477 Edit comment with link with more than one pipe (T99346)
23478 !! options
23479 comment
23480 !! wikitext
23481 [[Main Page|Many|pipes]]
23482 !! html/php
23483 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23484 !! end
23485
23486 !! test
23487 Complex edit comment with link with more than one pipe (T99346)
23488 !! options
23489 comment
23490 !! wikitext
23491 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23492 !! html/php
23493 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;
23494 !! end
23495
23496 !! test
23497 Space normalisation on autocomment (T24784)
23498 !! options
23499 comment
23500 title=[[Main Page]]
23501 !! wikitext
23502 /* __hello__world__ */
23503 !! html/php
23504 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23505 !! end
23506
23507 !! test
23508 percent-encoding and + signs in comments (T28410)
23509 !! options
23510 comment
23511 !! wikitext
23512 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23513 !! html/php
23514 <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>
23515 !! end
23516
23517 # Parsoid doesn't support this yet: see T75581
23518 # but it *should* omit the 'src' attribute if the image is bad.
23519 # PHP side of tests was disabled in
23520 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23521 # because of issues in the PHP parserTests infrastructure
23522 # (but the output below is indeed what the PHP side emits)
23523 !! test
23524 Bad images - basic functionality
23525 !! wikitext
23526 [[File:Bad.jpg]]
23527 !! DISABLED/html/php
23528 !! html/parsoid
23529 <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>
23530 !! end
23531
23532 !! test
23533 Bad images - T18039: text after bad image disappears
23534 !! wikitext
23535 Foo bar
23536 [[File:Bad.jpg]]
23537 Bar foo
23538 !! DISABLED/html/php
23539 <p>Foo bar
23540 </p><p>Bar foo
23541 </p>
23542 !! html/parsoid
23543 <p>Foo bar
23544 <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>
23545 Bar foo</p>
23546 !! end
23547
23548 !! test
23549 Verify that displaytitle works (T24501) no displaytitle
23550 !! options
23551 showtitle
23552 !! config
23553 wgAllowDisplayTitle=true
23554 wgRestrictDisplayTitle=false
23555 !! wikitext
23556 this is not the the title
23557 !! html/php
23558 Parser test
23559 <p>this is not the the title
23560 </p>
23561 !! end
23562
23563 !! test
23564 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23565 !! options
23566 showtitle
23567 title=[[Screen]]
23568 !! config
23569 wgAllowDisplayTitle=true
23570 wgRestrictDisplayTitle=false
23571 !! wikitext
23572 this is not the the title
23573 {{DISPLAYTITLE:whatever}}
23574 !! html/php
23575 whatever
23576 <p>this is not the the title
23577 </p>
23578 !! end
23579
23580 !! test
23581 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23582 !! options
23583 showtitle
23584 title=[[Screen]]
23585 !! config
23586 wgAllowDisplayTitle=true
23587 wgRestrictDisplayTitle=true
23588 !! wikitext
23589 this is not the the title
23590 {{DISPLAYTITLE:whatever}}
23591 !! html/php
23592 Screen
23593 <p>this is not the the title
23594 </p>
23595 !! end
23596
23597 !! test
23598 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23599 !! options
23600 showtitle
23601 title=[[Screen]]
23602 !! config
23603 wgAllowDisplayTitle=true
23604 wgRestrictDisplayTitle=true
23605 !! wikitext
23606 this is not the the title
23607 {{DISPLAYTITLE:screen}}
23608 !! html/php
23609 screen
23610 <p>this is not the the title
23611 </p>
23612 !! end
23613
23614 !! test
23615 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23616 !! options
23617 showtitle
23618 title=[[Screen]]
23619 !! config
23620 wgAllowDisplayTitle=false
23621 !! wikitext
23622 this is not the the title
23623 {{DISPLAYTITLE:screen}}
23624 !! html/php
23625 Screen
23626 <p>this is not the the title
23627 <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>
23628 </p>
23629 !! end
23630
23631 !! test
23632 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23633 !! options
23634 showtitle
23635 title=[[Screen]]
23636 !! config
23637 wgAllowDisplayTitle=false
23638 !! wikitext
23639 this is not the the title
23640 !! html/php
23641 Screen
23642 <p>this is not the the title
23643 </p>
23644 !! end
23645
23646 !! test
23647 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23648 !! options
23649 showtitle
23650 title=[[Screen]]
23651 !! config
23652 wgAllowDisplayTitle=true
23653 wgRestrictDisplayTitle=true
23654 !! wikitext
23655 this is not the the title
23656 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23657 !! html/php
23658 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23659 <p>this is not the the title
23660 </p>
23661 !! end
23662
23663 !! test
23664 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23665 !! options
23666 showtitle
23667 title=[[Screen]]
23668 !! config
23669 wgAllowDisplayTitle=true
23670 wgRestrictDisplayTitle=true
23671 !! wikitext
23672 this is not the the title
23673 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23674 !! html/php
23675 <span style="color: red;">s</span>creen
23676 <p>this is not the the title
23677 </p>
23678 !! end
23679
23680 !! test
23681 Page status indicators: Empty name is invalid
23682 !! options
23683 showindicators
23684 !! wikitext
23685 <indicator name=" "></indicator>
23686 <indicator></indicator>
23687 !! html/php
23688 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23689 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23690 </p>
23691 !! end
23692
23693 !! test
23694 Page status indicators: Weird syntaxes that are okay
23695 !! options
23696 showindicators
23697 !! wikitext
23698 <indicator name="empty" />
23699 <indicator name="name"></indicator>
23700 !! html/php
23701 empty=
23702 name=
23703 <p><br />
23704 </p>
23705 !! end
23706
23707 !! test
23708 Page status indicators: Torture test
23709 !! options
23710 showindicators
23711 !! wikitext
23712 <indicator name="01">hello world</indicator>
23713 <indicator name="02">[[Main Page]]</indicator>
23714 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23715 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23716 <indicator name="05">*foo
23717 *bar</indicator>
23718 <indicator name="06"><nowiki>foo</nowiki></indicator>
23719 <indicator name="07"> Preformatted</indicator>
23720 <indicator name="08"><div>Broken tag</indicator>
23721 <indicator name="09">{| class=wikitable
23722 |cell
23723 |}</indicator>
23724 <indicator name="10">Two
23725
23726 paragraphs</indicator>
23727 !! html/php
23728 01=hello world
23729 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23730 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" />
23731 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>
23732 05=<ul><li>foo</li>
23733 <li>bar</li></ul>
23734
23735 06=foo
23736 07=<pre>Preformatted
23737 </pre>
23738 08=<div>Broken tag</div>
23739
23740 09=<table class="wikitable">
23741 <tr>
23742 <td>cell
23743 </td></tr></table>
23744
23745 10=<p>Two
23746 </p><p>paragraphs
23747 </p>
23748 <p><br />
23749 </p><p><br />
23750 </p><p><br />
23751 </p><p><br />
23752 </p><p><br />
23753 </p>
23754 !! end
23755
23756 !! test
23757 preload: check <noinclude> and <includeonly>
23758 !! options
23759 preload
23760 !! wikitext
23761 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23762 !! html/php
23763 Hello kind world.
23764 !! end
23765
23766 !! test
23767 preload: check <onlyinclude>
23768 !! options
23769 preload
23770 !! wikitext
23771 Goodbye <onlyinclude>Hello world</onlyinclude>
23772 !! html/php
23773 Hello world
23774 !! end
23775
23776 !! test
23777 preload: can pass tags through if we want to
23778 !! options
23779 preload
23780 !! wikitext
23781 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23782 !! html/php
23783 <includeonly>Hello world</includeonly>
23784 !! end
23785
23786 !! test
23787 preload: check that it doesn't try to do tricks
23788 !! options
23789 preload
23790 !! wikitext
23791 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23792 !! html/php
23793 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23794 !! end
23795
23796 !! test
23797 Play a bit with r67090 and T5158
23798 !! wikitext
23799 <div style="width:50% !important">&nbsp;</div>
23800 <div style="width:50%&nbsp;!important">&nbsp;</div>
23801 <div style="width:50%&#160;!important">&nbsp;</div>
23802 <div style="border : solid;">&nbsp;</div>
23803 !! html/php
23804 <div style="width:50% !important">&#160;</div>
23805 <div style="width:50% !important">&#160;</div>
23806 <div style="width:50% !important">&#160;</div>
23807 <div style="border&#160;: solid;">&#160;</div>
23808
23809 !! html/parsoid
23810 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23811 <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>
23812 <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>
23813 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23814
23815 !! end
23816
23817 !! test
23818 HTML5 data attributes
23819 !! wikitext
23820 <span data-foo="bar">Baz</span>
23821 <p data-abc-def_hij="">Quuz</p>
23822 !! html/php
23823 <p><span data-foo="bar">Baz</span>
23824 </p>
23825 <p data-abc-def_hij="">Quuz</p>
23826
23827 !! html/parsoid
23828 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23829 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23830 !! end
23831
23832 !! test
23833 Strip reserved data attributes
23834 !! wikitext
23835 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23836 !! html/php
23837 <div data-ok="fred">d</div>
23838
23839 !! html/parsoid
23840 <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>
23841 !! end
23842
23843 !! test
23844 percent-encoding and + signs in internal links (T28410)
23845 !! wikitext
23846 [[User:+%]] [[Page+title%]]
23847 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23848 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23849 [[%33%45]] [[%33%45+]]
23850 !! html/php
23851 <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>
23852 <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>
23853 <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>
23854 <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>
23855 </p>
23856 !! html/parsoid
23857 <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>
23858 <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>
23859 <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>
23860 <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>
23861 !! end
23862
23863 !! test
23864 Special characters in embedded file links (T29679)
23865 !! wikitext
23866 [[File:Contains & ampersand.jpg]]
23867 [[File:Does not exist.jpg|Title with & ampersand]]
23868 !! html/php
23869 <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>
23870 <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>
23871 </p>
23872 !! html/parsoid
23873 <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>
23874 <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>
23875 !! end
23876
23877 !! test
23878 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23879 !! wikitext
23880 Text&apos;s been normalized?
23881 !! html
23882 <p>Text&#39;s been normalized?
23883 </p>
23884 !! end
23885
23886 !! test
23887 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23888 !! wikitext
23889 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23890 !! html
23891 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23892 </p>
23893 !! end
23894
23895 !! test
23896 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23897 !! wikitext
23898 [http://www.example.org/ ideograms]
23899 !! html
23900 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23901 </p>
23902 !! end
23903
23904 !! test
23905 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23906 !! wikitext
23907 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23908 !! html
23909 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23910 </p>
23911 !! end
23912
23913 !! article
23914 Mediawiki:loop1
23915 !! text
23916 {{Identical|A}}
23917 !! endarticle
23918
23919 !! article
23920 Mediawiki:loop2
23921 !! text
23922 {{Identical|B}}
23923 !! endarticle
23924
23925 !! article
23926 Template:Identical
23927 !! text
23928 {{int:loop1}}
23929 {{int:loop2}}
23930 !! endarticle
23931
23932 !! test
23933 T33098 Template which includes system messages which includes the template
23934 !! wikitext
23935 {{Identical}}
23936 !! html
23937 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23938 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23939 </p>
23940 !! end
23941
23942 !! test
23943 T33490 Turkish: ucfirst 'blah'
23944 !! options
23945 language=tr
23946 !! wikitext
23947 {{ucfirst:blah}}
23948 !! html
23949 <p>Blah
23950 </p>
23951 !! end
23952
23953 !! test
23954 T33490 Turkish: ucfirst 'ix'
23955 !! options
23956 language=tr
23957 !! wikitext
23958 {{ucfirst:ix}}
23959 !! html
23960 <p>İx
23961 </p>
23962 !! end
23963
23964 !! test
23965 T33490 Turkish: lcfirst 'BLAH'
23966 !! options
23967 language=tr
23968 !! wikitext
23969 {{lcfirst:BLAH}}
23970 !! html
23971 <p>bLAH
23972 </p>
23973 !! end
23974
23975 !! test
23976 T33490 Turkish: ucfırst (with a dotless i)
23977 !! options
23978 language=tr
23979 !! wikitext
23980 {{ucfırst:blah}}
23981 !! html
23982 <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>
23983 </p>
23984 !! end
23985
23986 !! test
23987 T33490 ucfırst (with a dotless i) with English language
23988 !! options
23989 language=en
23990 !! wikitext
23991 {{ucfırst:blah}}
23992 !! html
23993 <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>
23994 </p>
23995 !! end
23996
23997 # Note that Parsoid doesn't emit an explicit TOC.
23998 # Note also that the html2wt direction tends to emit an extra newline
23999 # between the __TOC__ magicword and the first heading unless *both*
24000 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24001 # it's "{}").
24002
24003 !! test
24004 T28375: TOC with italics
24005 !! options
24006 title=[[Main Page]]
24007 !! wikitext
24008 __TOC__
24009 ==''Lost'' episodes==
24010 !! html/php
24011 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24012 <ul>
24013 <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>
24014 </ul>
24015 </div>
24016
24017 <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>
24018
24019 !! html/parsoid
24020 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24021 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24022 !! end
24023
24024 !! test
24025 T28375: TOC with bold
24026 !! options
24027 title=[[Main Page]]
24028 !! wikitext
24029 __TOC__
24030 =='''should be bold''' then normal text==
24031 !! html/php
24032 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24033 <ul>
24034 <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>
24035 </ul>
24036 </div>
24037
24038 <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>
24039
24040 !! html/parsoid
24041 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24042 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24043 !! end
24044
24045 !! test
24046 T35845: Headings become cursive in TOC when they contain an image
24047 !! options
24048 title=[[Main Page]]
24049 !! wikitext
24050 __TOC__
24051 ==Image [[Image:foobar.jpg]]==
24052 !! html/php
24053 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24054 <ul>
24055 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24056 </ul>
24057 </div>
24058
24059 <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>
24060
24061 !! html/parsoid
24062 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24063 <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>
24064 !! end
24065
24066 !! test
24067 T35845 (2): Headings become bold in TOC when they contain a blockquote
24068 !! options
24069 title=[[Main Page]]
24070 !! wikitext
24071 __TOC__
24072 ==<blockquote>Quote</blockquote>==
24073 !! html/php
24074 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24075 <ul>
24076 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24077 </ul>
24078 </div>
24079
24080 <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>
24081
24082 !! html/php+tidy
24083 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24084 <ul>
24085 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24086 </ul>
24087 </div>
24088
24089 <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>
24090 !! html/parsoid
24091 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24092 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24093 !! end
24094
24095 !! test
24096 Unclosed tags in TOC
24097 !! config
24098 wgFragmentMode=[ 'html5', 'legacy' ]
24099 !! options
24100 title=[[Main Page]]
24101 !! wikitext
24102 __TOC__
24103 ==Proof: 2 < 3==
24104 <small>Hanc marginis exiguitas non caperet.</small>
24105 QED
24106 !! html/php
24107 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24108 <ul>
24109 <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>
24110 </ul>
24111 </div>
24112
24113 <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>
24114 <p><small>Hanc marginis exiguitas non caperet.</small>
24115 QED
24116 </p>
24117 !! html/parsoid
24118 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24119 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24120 <p><small>Hanc marginis exiguitas non caperet.</small>
24121 QED</p>
24122 !! end
24123
24124 !! test
24125 Multiple tags in TOC
24126 !! wikitext
24127 __TOC__
24128 ==<i>Foo</i> <b>Bar</b>==
24129
24130 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24131 !! html/php
24132 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24133 <ul>
24134 <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>
24135 <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>
24136 </ul>
24137 </div>
24138
24139 <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>
24140 <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>
24141
24142 !! html/php+tidy
24143 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24144 <ul>
24145 <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>
24146 <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>
24147 </ul>
24148 </div>
24149
24150 <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>
24151 <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>
24152 !! html/parsoid
24153 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24154 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24155
24156 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24157 !! end
24158
24159 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24160 # html5 tag parsing.
24161 !! test
24162 Tags with parameters in TOC
24163 !! options
24164 parsoid=wt2html
24165 !! wikitext
24166 __TOC__
24167 ==<sup class="in-h2">Hello</sup>==
24168
24169 ==<sup class="a > b">Evilbye</sup>==
24170 !! html/php
24171 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24172 <ul>
24173 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24174 <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>
24175 </ul>
24176 </div>
24177
24178 <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>
24179 <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>
24180
24181 !! html/parsoid
24182 <meta property="mw:PageProp/toc" />
24183 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24184
24185 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24186 !! end
24187
24188 !! test
24189 span tags with directionality in TOC
24190 !! wikitext
24191 __TOC__
24192 ==<span dir="ltr">C++</span>==
24193
24194 ==<span dir="rtl">זבנג!</span>==
24195
24196 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24197
24198 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24199
24200 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24201 !! html/php
24202 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24203 <ul>
24204 <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>
24205 <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>
24206 <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>
24207 <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>
24208 <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>
24209 </ul>
24210 </div>
24211
24212 <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>
24213 <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>
24214 <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>
24215 <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>
24216 <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>
24217
24218 !! html/parsoid
24219 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24220 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24221 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24222 <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>
24223 <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>
24224 <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>
24225 !! end
24226
24227 !! test
24228 T74884: bdi element in ToC
24229 !! wikitext
24230 __TOC__
24231 ==<bdi>test</bdi>==
24232 !! html/php
24233 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24234 <ul>
24235 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24236 </ul>
24237 </div>
24238
24239 <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>
24240
24241 !! html/parsoid
24242 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24243 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24244 !! end
24245
24246 !! test
24247 T35715: s/strike element in ToC
24248 !! wikitext
24249 __TOC__
24250 ==<s>test</s> test <strike>test</strike>==
24251 !! html/php
24252 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24253 <ul>
24254 <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>
24255 </ul>
24256 </div>
24257
24258 <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>
24259
24260 !! html/parsoid
24261 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24262 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24263 !! end
24264
24265 !! test
24266 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24267 !! wikitext
24268 __TOC__
24269 ==x==
24270 !! html/php
24271 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24272 <ul>
24273 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24274 </ul>
24275 </div>
24276
24277 <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>
24278
24279 !! html/parsoid
24280 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24281 <h2 id="x" data-parsoid='{}'>x</h2>
24282 !! end
24283
24284 !! article
24285 MediaWiki:T34057
24286 !! text
24287 == {{int:headline_sample}} ==
24288 !! endarticle
24289
24290 !! test
24291 T34057: Title needed when expanding <h> nodes.
24292 !! options
24293 title=[[Main Page]]
24294 !! wikitext
24295 {{int:T34057}}
24296 !! html
24297 <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>
24298
24299 !! end
24300
24301 !! test
24302 Strip marker in urlencode
24303 !! wikitext
24304 {{urlencode:x<nowiki/>y}}
24305 {{urlencode:x<nowiki/>y|wiki}}
24306 {{urlencode:x<nowiki/>y|path}}
24307 {{urlencode:x<pre id="one">two</pre>y}}
24308 !! html/php
24309 <p>xy
24310 xy
24311 xy
24312 xy
24313 </p>
24314 !! end
24315
24316 !! test
24317 Strip marker in lc
24318 !! wikitext
24319 {{lc:x<nowiki/>y}}
24320 !! html
24321 <p>xy
24322 </p>
24323 !! end
24324
24325 !! test
24326 Strip marker in uc
24327 !! wikitext
24328 {{uc:x<nowiki/>y}}
24329 !! html
24330 <p>XY
24331 </p>
24332 !! end
24333
24334 !! test
24335 Strip marker in formatNum
24336 !! wikitext
24337 {{formatnum:1<nowiki/>2}}
24338 {{formatnum:1<nowiki/>2|R}}
24339 !! html
24340 <p>12
24341 12
24342 </p>
24343 !! end
24344
24345 !! test
24346 Check noCommafy in formatNum
24347 !! options
24348 language=be-tarask
24349 !! wikitext
24350 {{formatnum:123456.78}}
24351 {{formatnum:123456.78|NOSEP}}
24352 !! html
24353 <p>123 456,78
24354 123456.78
24355 </p>
24356 !! end
24357
24358 !! test
24359 Wrong option for formatNum (T58199)
24360 !! wikitext
24361 {{formatnum:1,234.56|Random}}
24362 {{formatnum:1,234.56|EVERYTHING}}
24363 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24364 !! html
24365 <p>1,234.56
24366 1,234.56
24367 1,234.56
24368 </p>
24369 !! end
24370
24371 !! test
24372 Strip marker in grammar
24373 !! options
24374 language=fi
24375 !! wikitext
24376 {{grammar:elative|foo<nowiki/>bar}}
24377 !! html
24378 <p>foobarista
24379 </p>
24380 !! end
24381
24382 !! test
24383 Strip marker in padleft
24384 !! wikitext
24385 {{padleft:|2|x<nowiki/>y}}
24386 !! html
24387 <p>xy
24388 </p>
24389 !! end
24390
24391 !! test
24392 Strip marker in padright
24393 !! wikitext
24394 {{padright:|2|x<nowiki/>y}}
24395 !! html
24396 <p>xy
24397 </p>
24398 !! end
24399
24400 !! test
24401 Strip marker in anchorencode
24402 !! wikitext
24403 {{anchorencode:x<nowiki/>y}}
24404 !! html/php
24405 <p>xy
24406 </p>
24407 !! html/parsoid
24408 <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>
24409 !! end
24410
24411 !! test
24412 nowiki inside link inside heading (T20295)
24413 !! wikitext
24414 ==[[foo|x<nowiki>y</nowiki>z]]==
24415 !! html
24416 <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>
24417
24418 !! end
24419
24420 !! test
24421 new support for bdi element (T33817)
24422 !! wikitext
24423 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24424 !! html
24425 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24426
24427 !!end
24428
24429 !! test
24430 Ignore pipe between table row attributes
24431 !! wikitext
24432 {|
24433 |quux
24434 |- id=foo | style='color: red'
24435 |bar
24436 |}
24437 !! html
24438 <table>
24439 <tr>
24440 <td>quux
24441 </td></tr>
24442 <tr id="foo" style="color: red">
24443 <td>bar
24444 </td></tr></table>
24445
24446 !! end
24447
24448 !!test
24449 Language parser function
24450 !! wikitext
24451 {{#language:ar}}
24452 !! html
24453 <p>العربية
24454 </p>
24455 !! end
24456
24457 !!test
24458 Padleft and padright (default 0-padding)
24459 !! wikitext
24460 {{padleft:xyz|5}}
24461 {{padright:xyz|5}}
24462 !! html/php
24463 <p>00xyz
24464 xyz00
24465 </p>
24466 !! html/parsoid
24467 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24468 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24469 !! end
24470
24471 !!test
24472 Padleft and padright (partial fill)
24473 !! wikitext
24474 {{padleft:xyz|6|ab}}
24475 {{padright:xyz|6|ab}}
24476 !! html/php
24477 <p>abaxyz
24478 xyzaba
24479 </p>
24480 !! html/parsoid
24481 <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>
24482 <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>
24483 !! end
24484
24485 !!test
24486 Padleft and padright as substr
24487 !! wikitext
24488 {{padleft:|3|abcde}}
24489 {{padright:|3|abcde}}
24490 !! html/php
24491 <p>abc
24492 abc
24493 </p>
24494 !! html/parsoid
24495 <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>
24496 <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>
24497 !! end
24498
24499 !!test
24500 Special parser function
24501 !! wikitext
24502 {{#special:RandomPage}}
24503 {{#special:BaDtItLe}}
24504 {{#special:Foobar}}
24505 !! html
24506 <p>Special:Random
24507 Special:Badtitle
24508 Special:Foobar
24509 </p>
24510 !! end
24511
24512 !!test
24513 T36939 - Case insensitive link parsing ([HttP://])
24514 !! wikitext
24515 [HttP://MediaWiki.Org/]
24516 !! html/php
24517 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24518 </p>
24519 !! html/parsoid
24520 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24521 !! end
24522
24523 !!test
24524 T36939 - Case insensitive link parsing ([HttP:// title])
24525 !! wikitext
24526 [HttP://MediaWiki.Org/ MediaWiki]
24527 !! html
24528 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24529 </p>
24530 !! end
24531
24532 !!test
24533 T36939 - Case insensitive link parsing (HttP://)
24534 !! wikitext
24535 HttP://MediaWiki.Org/
24536 !! html/php
24537 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24538 </p>
24539 !! html/parsoid
24540 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24541 !! end
24542
24543 !!test
24544 Disable TOC
24545 !! options
24546 notoc
24547 !! wikitext
24548 Lead
24549 ==Section 1==
24550 ==Section 2==
24551 ==Section 3==
24552 ==Section 4==
24553 ==Section 5==
24554 !! html
24555 <p>Lead
24556 </p>
24557
24558 <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>
24559 <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>
24560 <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>
24561 <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>
24562 <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>
24563
24564 !! end
24565
24566
24567 ###
24568 ### Parsoid-specific tests
24569 ### Parsoid-PHP parser incompatibilities
24570 ###
24571 !!test
24572 1. SOL-sensitive wikitext tokens as template-args
24573 !!options
24574 parsoid=wt2html,wt2wt
24575 !! wikitext
24576 {{echo|*a}}
24577 {{echo|#a}}
24578 {{echo|:a}}
24579 !! html
24580 <span about="#mwt1" typeof="mw:Transclusion">
24581 </span><ul about="#mwt1"><li>a</li>
24582 </ul>
24583 <span about="#mwt2" typeof="mw:Transclusion">
24584 </span><ol about="#mwt2"><li>a</li>
24585 </ol>
24586 <span about="#mwt3" typeof="mw:Transclusion">
24587 </span><dl about="#mwt3"><dd>a</dd>
24588 </dl>
24589 !!end
24590
24591 #### -----------------------------------------------------------------
24592 #### Parsoid-specific functionality tests
24593 #### -----------------------------------------------------------------
24594
24595 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24596 # We know wt2wt will fail, but we expect selser to pass.
24597 # Due to the nature of our testing, wt2wt and selser tests will enter the
24598 # blacklist and we'll catch selser regressions based on changes to the
24599 # blacklist entries for selser tests.
24600 !! test
24601 1. Bad treebuilder fixup of formatting elt is cleaned up
24602 !! options
24603 parsoid=wt2html,wt2wt
24604 !! wikitext
24605 {|
24606 |
24607 <small>
24608 [[Image:Foobar.jpg|right|Test]]
24609 </small>
24610 |}
24611 !! html/parsoid
24612 <table>
24613 <tbody><tr><td>
24614 <small>
24615 <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>
24616 </small>
24617 </td></tr>
24618 </tbody></table>
24619 !! end
24620
24621 !! test
24622 2. Bad treebuilder fixup of formatting elt is cleaned up
24623 !! options
24624 parsoid=wt2html,wt2wt
24625 !! wikitext
24626 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24627
24628 <small>[[Image:Foobar.jpg|right|300px]]</small>
24629 !! html/parsoid
24630
24631 <p><b>foo</b></p>
24632 <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>
24633 <p><b>bar</b></p>
24634 <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>
24635 !! end
24636
24637 !! test
24638 3. Bad treebuilder fixup of formatting elt is cleaned up
24639 !! options
24640 parsoid=wt2html,wt2wt
24641 !! wikitext
24642 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24643 !! html/parsoid
24644 <p><small><b>foo</b></small></p>
24645 <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>
24646 <p><small><b>bar</b></small></p>
24647 !! end
24648
24649 !! test
24650 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24651 !! options
24652 parsoid=wt2html,wt2wt
24653 !! wikitext
24654 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24655 !! html/parsoid
24656 <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>
24657 !! end
24658
24659 #### ----------------------------------------------------------------
24660 #### Parsoid-only testing of Parsoid's impl of LST
24661 #### Not implemented yet, see
24662 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24663 #### ----------------------------------------------------------------
24664
24665 ## We still need to support serializing the older format while content is stored.
24666 !! test
24667 LST Sections: Backwards compatibility
24668 !! options
24669 parsoid={
24670 "suppressErrors": true,
24671 "modes": ["html2wt"]
24672 }
24673 !! wikitext
24674 <section begin="2011-05-16" />
24675 <section end="2014-04-10 (MW 1.23wmf22)" />
24676 !! html/parsoid
24677 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24678 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24679 !! end
24680
24681 !! test
24682 LST Sections: Newfangled approach
24683 !! wikitext
24684 <section begin="2011-05-16" />
24685 <section end="2014-04-10 (MW 1.23wmf22)" />
24686 !! html/parsoid
24687 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24688 </span>
24689 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24690 </span></p>
24691 !! end
24692
24693 #--------- Test stripping of empty nodes in template content ----------
24694
24695 !! test
24696 Empty LI and TR nodes should be stripped from template content
24697 !! wikitext
24698 {{EmptyLITest}}
24699 {{EmptyTRTest}}
24700 !! html/parsoid
24701 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24702 <li>a</li>
24703 <li>b</li>
24704 </ul>
24705 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24706 <tbody>
24707 <tr>
24708 <td>foo</td>
24709 </tr>
24710 <tr>
24711 <td>bar</td>
24712 </tr>
24713 </tbody>
24714 </table>
24715 !! end
24716
24717 !! test
24718 Empty LI and TR nodes should not be stripped from top-level content
24719 !! wikitext
24720 * a
24721 *
24722 * b
24723 {|
24724 |-
24725 |-
24726 |foo
24727 |}
24728 !! html/parsoid
24729 <ul>
24730 <li> a</li>
24731 <li class='mw-empty-elt'></li>
24732 <li> b</li>
24733 </ul>
24734 <table>
24735 <tbody>
24736 <tr class='mw-empty-elt'></tr>
24737 <tr>
24738 <td>foo</td>
24739 </tr>
24740 </tbody>
24741 </table>
24742 !! end
24743
24744 !! test
24745 Empty TR nodes should not be stripped if they have any attributes set
24746 !! wikitext
24747 {{EmptyTRWithHTMLAttrTest}}
24748 !! html/parsoid
24749 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24750 <tr align='center'></tr>
24751 <tr><td>foo</td></tr>
24752 <tr align='center'></tr>
24753 <tr><td>bar</td></tr>
24754 </table>
24755 !! end
24756
24757 #### ----------------------------------------------------------------
24758 #### The following section of tests are primarily to test
24759 #### wikitext escaping capabilities of Parsoid. Given that
24760 #### escaping can be done any number of ways, the wikitext (input)
24761 #### is always adjusted to reflect how Parsoid adds nowiki
24762 #### escape tags.
24763 ####
24764 #### We are marking several tests as parsoid-only since the
24765 #### HTML in the result section is different from what the
24766 #### PHP parser generates for it.
24767 #### ----------------------------------------------------------------
24768
24769
24770 #### --------------- Headings ---------------
24771 #### 0. Unnested
24772 #### 1. Nested inside html <h1>=foo=</h1>
24773 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24774 #### 3. Nested inside html with wikitext split by html tags
24775 #### 4. No escape needed
24776 #### 5. Empty headings <h1></h1>
24777 #### 6. Heading chars in SOL context
24778 #### ----------------------------------------
24779 !! test
24780 Headings: 0. Unnested
24781 !! options
24782 parsoid=html2wt
24783 !! html/parsoid
24784 <p>=foo=</p>
24785
24786 <p> =foo=
24787 <!--cmt-->
24788 =foo=</p>
24789
24790 <p>=foo<i>a</i>=</p>
24791 !! wikitext
24792 <nowiki>=foo=</nowiki>
24793
24794 <nowiki> </nowiki>=foo=
24795 <!--cmt-->
24796 <nowiki>=foo=</nowiki>
24797
24798 =foo''a''<nowiki>=</nowiki>
24799 !!end
24800
24801 # New headings and existing headings are handled differently
24802 !! test
24803 Headings: 1. Nested inside html
24804 !! options
24805 parsoid=html2wt
24806 !! html/parsoid
24807 <h1>=foo=</h1>
24808 <h2>=foo=</h2>
24809 <h3>=foo=</h3>
24810
24811 <h1 data-parsoid=''>=foo=</h1>
24812 <h2 data-parsoid=''>=foo=</h2>
24813 <h3 data-parsoid=''>=foo=</h3>
24814 <h4 data-parsoid=''>=foo=</h4>
24815 <h5 data-parsoid=''>=foo=</h5>
24816 <h6 data-parsoid=''>=foo=</h6>
24817 !! wikitext
24818 = =foo= =
24819
24820 == =foo= ==
24821
24822 === =foo= ===
24823
24824 =<nowiki>=foo=</nowiki>=
24825 ==<nowiki>=foo=</nowiki>==
24826 ===<nowiki>=foo=</nowiki>===
24827 ====<nowiki>=foo=</nowiki>====
24828 =====<nowiki>=foo=</nowiki>=====
24829 ======<nowiki>=foo=</nowiki>======
24830
24831 !!end
24832
24833 !! test
24834 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24835 !! options
24836 parsoid=html2wt
24837 !! html/parsoid
24838 <h1>foo</h1>*bar
24839 <h1>foo</h1>=bar
24840 <h1>foo</h1>=bar=
24841 !! wikitext
24842 = foo =
24843 <nowiki>*</nowiki>bar
24844
24845 = foo =
24846 =bar
24847
24848 = foo =
24849 <nowiki>=bar=</nowiki>
24850 !!end
24851
24852 !! test
24853 Headings: 3. Nested inside html with wikitext split by html tags
24854 !! options
24855 parsoid=html2wt
24856 !! html/parsoid
24857 <h1>=<b>bold</b>foo=</h1>
24858 !! wikitext
24859 = ='''bold'''foo= =
24860 !!end
24861
24862 !! test
24863 Headings: 4a. No escaping needed (testing just h1 and h2)
24864 !! options
24865 parsoid=html2wt
24866 !! html/parsoid
24867 <h1>=foo</h1>
24868 <h1>foo=</h1>
24869 <h1> =foo= </h1>
24870 <h1>=foo= bar</h1>
24871 <h2>=foo</h2>
24872 <h2>foo=</h2>
24873 <h1>=</h1>
24874 <h1><i>=</i>foo=</h1>
24875 !! wikitext
24876 = =foo =
24877
24878 = foo= =
24879
24880 = =foo= =
24881
24882 = =foo= bar =
24883
24884 == =foo ==
24885
24886 == foo= ==
24887
24888 = = =
24889
24890 = ''=''foo= =
24891 !!end
24892
24893 !! test
24894 Headings: 4b. No escaping needed (inside p-tags)
24895 !! options
24896 parsoid=html2wt
24897 !! html/parsoid
24898 <p>=foo= x
24899 =foo= <s></s>
24900 </p>
24901 !! wikitext
24902 =foo= x
24903 =foo= <s></s>
24904 !! html/php
24905 <p>=foo= x
24906 =foo= <s></s>
24907 </p>
24908 !!end
24909
24910 !! test
24911 Headings: 4c. Short headings (1)
24912 !! options
24913 parsoid=html2wt
24914 !! html/parsoid
24915 <p>===
24916 </p>
24917 !! wikitext
24918 <nowiki>===</nowiki>
24919 !! html/php
24920 <p>===
24921 </p>
24922 !! end
24923
24924 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24925 !! test
24926 Headings: 4d. Short headings (2)
24927 !! options
24928 parsoid=wt2html,html2html
24929 !! wikitext
24930 =
24931 ==
24932 ===
24933 ====
24934 =====
24935 !! html/php
24936 <p>=
24937 ==
24938 </p>
24939 <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>
24940 <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>
24941 <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>
24942
24943 !! html/parsoid
24944 <p>=
24945 ==</p>
24946 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24947 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24948 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24949 !! end
24950
24951 !! test
24952 Headings: 5. Empty headings
24953 !! options
24954 parsoid=html2wt
24955 !! html/parsoid
24956 <h1 data-parsoid='{}'></h1>
24957
24958 <h2 data-parsoid='{}'></h2>
24959
24960 <h3 data-parsoid='{}'></h3>
24961
24962 <h4 data-parsoid='{}'></h4>
24963
24964 <h5 data-parsoid='{}'></h5>
24965
24966 <h6 data-parsoid='{}'></h6>
24967 !! wikitext
24968 =<nowiki/>=
24969
24970 ==<nowiki/>==
24971
24972 ===<nowiki/>===
24973
24974 ====<nowiki/>====
24975
24976 =====<nowiki/>=====
24977
24978 ======<nowiki/>======
24979 !!end
24980
24981 !! test
24982 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24983 !! options
24984 parsoid=html2wt
24985 !! html/parsoid
24986 <p>=a=</p>
24987
24988 <p>=a=</p>
24989
24990 <p>=a=</p>
24991 !! wikitext
24992 <nowiki>=a=</nowiki>
24993
24994 <nowiki>=a=</nowiki>
24995
24996 <nowiki>=a=</nowiki>
24997 !!end
24998
24999 !! test
25000 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25001 !! options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <p>=a=
25005 b</p>
25006
25007 <p>=a=
25008 b</p>
25009
25010 <p>=a=
25011 b</p>
25012 !! wikitext
25013 <nowiki>=a=</nowiki>
25014 b
25015
25016 <nowiki>=a=</nowiki>
25017 b
25018
25019 <nowiki>=a=</nowiki>
25020 b
25021 !!end
25022
25023 !! test
25024 Headings: 6c. Heading chars in SOL context (leading newline break)
25025 !! options
25026 parsoid=html2wt
25027 !! html/parsoid
25028 <p>a
25029 =b=</p>
25030 !! wikitext
25031 a
25032 <nowiki>=b=</nowiki>
25033 !!end
25034
25035 !! test
25036 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25037 !! options
25038 parsoid=html2wt
25039 !! html/parsoid
25040 <!--c0--><p>=a=</p>
25041
25042 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25043 !! wikitext
25044 <!--c0--><nowiki>=a=</nowiki>
25045
25046 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25047 !!end
25048
25049 !! test
25050 Headings: 6d. Heading chars in SOL context (No escaping needed)
25051 !! options
25052 parsoid=html2wt
25053 !! html/parsoid
25054 =a=<div>b</div>
25055 !! wikitext
25056 =a=<div>b</div>
25057 !!end
25058
25059 !! test
25060 Headings: 7. Insert a newline between new content and headings
25061 !! options
25062 parsoid=html2wt
25063 !! html/parsoid
25064 <h2>NEW</h2>
25065 <p>new</p>
25066 <h2 data-parsoid='{}'>A</h2>
25067 <p data-parsoid='{}'>a</p>
25068 !! wikitext
25069 == NEW ==
25070 new
25071
25072 ==A==
25073 a
25074
25075 !! end
25076
25077 !! test
25078 Headings: Used as horizontal rule
25079 !! config
25080 wgFragmentMode=[ 'html5', 'legacy' ]
25081 !! options
25082 parsoid=wt2html
25083 !! wikitext
25084 ===============
25085 !! html/php
25086 <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>
25087
25088 !! html/parsoid
25089 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25090 !! end
25091
25092 #### --------------- Lists ---------------
25093 #### 0. Outside nests (*foo, etc.)
25094 #### 1. Nested inside html <ul><li>*foo</li></ul>
25095 #### 2. Inside definition lists
25096 #### 3. Only bullets at start should be escaped
25097 #### 4. No escapes needed
25098 #### 5. No unnecessary escapes
25099 #### 6. Escape bullets in SOL position
25100 #### 7. Escape bullets in a multi-line context
25101 #### ----------------------------------------
25102
25103 !! test
25104 Lists: 0. Outside nests
25105 !! options
25106 parsoid=html2wt
25107 !! html/parsoid
25108 <p>*foo</p>
25109
25110 <p>#foo</p>
25111
25112 <p>;Foo:bar</p>
25113 !! wikitext
25114 <nowiki>*</nowiki>foo
25115
25116 <nowiki>#</nowiki>foo
25117
25118 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25119 !!end
25120
25121 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25122 ## to test wikitext escaping, and insignificant whitespace diffs
25123 ## cause PHP parser tests to barf
25124 !! test
25125 Lists: 1. Nested inside html (No unnecessary escapes)
25126 !! options
25127 parsoid=html2wt
25128 !! html/parsoid
25129 <ul>
25130 <li>*foo</li>
25131 <li>#foo</li>
25132 <li>:foo</li>
25133 <li>;foo</li>
25134 <li data-parsoid='{}'>*foo</li>
25135 <li data-parsoid='{}'>#foo</li>
25136 <li data-parsoid='{}'>:foo</li>
25137 <li data-parsoid='{}'>;foo</li>
25138 </ul>
25139
25140 <ol>
25141 <li>*foo</li>
25142 <li>#foo</li>
25143 <li>:foo</li>
25144 <li>;foo</li>
25145 <li data-parsoid='{}'>*foo</li>
25146 <li data-parsoid='{}'>#foo</li>
25147 <li data-parsoid='{}'>:foo</li>
25148 <li data-parsoid='{}'>;foo</li>
25149 </ol>
25150 !! wikitext
25151 * *foo
25152 * #foo
25153 * :foo
25154 * ;foo
25155 *<nowiki>*foo</nowiki>
25156 *<nowiki>#foo</nowiki>
25157 *<nowiki>:foo</nowiki>
25158 *<nowiki>;foo</nowiki>
25159
25160 # *foo
25161 # #foo
25162 # :foo
25163 # ;foo
25164 #<nowiki>*foo</nowiki>
25165 #<nowiki>#foo</nowiki>
25166 #<nowiki>:foo</nowiki>
25167 #<nowiki>;foo</nowiki>
25168 !!end
25169
25170 !! test
25171 Lists: 2. Inside definition lists
25172 !! options
25173 parsoid=html2wt
25174 !! html/parsoid
25175 <dl><dt>;foo</dt></dl>
25176 <dl><dt>:foo</dt></dl>
25177 <dl><dt>:foo</dt>
25178 <dd>bar</dd></dl>
25179 <dl><dd>:foo</dd></dl>
25180 !! wikitext
25181 ; ;foo
25182
25183 ; <nowiki>:foo</nowiki>
25184
25185 ; <nowiki>:foo</nowiki>
25186 : bar
25187
25188 : :foo
25189 !!end
25190
25191 !! test
25192 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25193 !! options
25194 parsoid=html2wt
25195 !! html/parsoid
25196 <ul>
25197 <li>*foo*bar</li>
25198 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25199 </ul>
25200 !! wikitext
25201 * *foo*bar
25202 *<nowiki>*foo</nowiki>''it''*bar
25203 !!end
25204
25205 !! test
25206 Lists: 4. No escapes needed
25207 !! options
25208 parsoid=html2wt
25209 !! html/parsoid
25210 <ul>
25211 <li>foo*bar
25212 </li>
25213 </ul>
25214 <ul>
25215 <li><i>foo</i>*bar
25216 </li>
25217 </ul>
25218 <ul>
25219 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25220 </li>
25221 </ul>
25222 <ul>
25223 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25224 </li>
25225 </ul>
25226 !! wikitext
25227 *foo*bar
25228
25229 *''foo''*bar
25230
25231 *[[Foo]]: bar
25232
25233 *[[Foo]]*bar
25234 !!end
25235
25236 !! test
25237 Lists: 5. No unnecessary escapes
25238 !! options
25239 parsoid=html2wt
25240 !! html/parsoid
25241 <ul><li> bar <span>[[foo]]</span></li></ul>
25242 <ul><li> =bar <span>[[foo]]</span></li></ul>
25243 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25244 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25245 <ul><li> =bar <span>foo]]</span>=</li></ul>
25246 <ul><li> <s></s>: a</li></ul>
25247 <ul><li> <i>* foo</i></li></ul>
25248
25249 !! wikitext
25250 * bar <span><nowiki>[[foo]]</nowiki></span>
25251
25252 * =bar <span><nowiki>[[foo]]</nowiki></span>
25253
25254 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25255
25256 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25257
25258 * =bar <span>foo]]</span>=
25259
25260 * <s></s>: a
25261
25262 * ''* foo''
25263 !!end
25264
25265 !! test
25266 Lists: 6. Escape bullets in SOL position
25267 !! options
25268 parsoid=html2wt
25269 !! html/parsoid
25270 <p><!--cmt-->*foo</p>
25271 !! wikitext
25272 <!--cmt--><nowiki>*</nowiki>foo
25273 !!end
25274
25275 !! test
25276 Lists: 7. Escape bullets in a multi-line context
25277 !! options
25278 parsoid=html2wt
25279 !! html/parsoid
25280 <p>a
25281 *b
25282 </p>
25283 !! wikitext
25284 a
25285 <nowiki>*</nowiki>b
25286 !!end
25287
25288 !! test
25289 Lists: 8. Escape colons only if not present in tags
25290 !! options
25291 parsoid=html2wt
25292 !! html/parsoid
25293 <dl><dt>a:b<i>c:d</i></dt></dl>
25294 !! wikitext
25295 ; <nowiki>a:b</nowiki>''c:d''
25296 !! end
25297
25298 #### --------------- HRs ---------------
25299 #### 1. Single line
25300 #### -----------------------------------
25301
25302 !! test
25303 HRs: 1. Single line
25304 !! options
25305 parsoid=html2wt
25306 !! html/parsoid
25307 <hr />----
25308 <hr />=foo=
25309 <hr />*foo
25310 !! wikitext
25311 ----<nowiki>----</nowiki>
25312 ----=foo=
25313 ----*foo
25314 !! end
25315
25316 #### --------------- Tables ---------------
25317 #### 1a. Simple example
25318 #### 1b. No escaping needed (!foo)
25319 #### 1c. No escaping needed (|foo)
25320 #### 1d. No escaping needed (|}foo)
25321 ####
25322 #### 2a. Nested in td (<td>foo|bar</td>)
25323 #### 2b. Nested in td (<td>foo||bar</td>)
25324 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25325 ####
25326 #### 3a. Nested in th (<th>foo!bar</th>)
25327 #### 3b. Nested in th (<th>foo!!bar</th>)
25328 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25329 ####
25330 #### 4a. Escape -
25331 #### 4b. Escape +
25332 #### 4c. No escaping needed
25333 #### --------------------------------------
25334
25335 !! test
25336 Tables: 1a. Simple example
25337 !! options
25338 parsoid=html2wt
25339 !! html/parsoid
25340 <p>{|
25341 |}
25342 </p>
25343 !! wikitext
25344 <nowiki>{|</nowiki>
25345 |}
25346 !! end
25347
25348 !! test
25349 Tables: 1b. No escaping needed
25350 !! options
25351 parsoid=html2wt
25352 !! html/parsoid
25353 <p>!foo
25354 </p>
25355 !! wikitext
25356 !foo
25357 !! end
25358
25359 !! test
25360 Tables: 1c. No escaping needed
25361 !! options
25362 parsoid=html2wt
25363 !! html/parsoid
25364 <p>|foo
25365 </p>
25366 !! wikitext
25367 |foo
25368 !! end
25369
25370 !! test
25371 Tables: 1d. No escaping needed
25372 !! options
25373 parsoid=html2wt
25374 !! html/parsoid
25375 <p>|}foo
25376 </p>
25377 !! wikitext
25378 |}foo
25379 !! end
25380
25381 !! test
25382 Tables: 2a. Nested in td
25383 !! options
25384 parsoid=html2wt
25385 !! html/parsoid
25386 <table><tbody><tr>
25387 <td>foo|bar</td></tr>
25388 <tr><td>x<div>a|b</div></td>
25389 </tbody></table>
25390 !! wikitext
25391 {|
25392 |<nowiki>foo|bar</nowiki>
25393 |-
25394 |x<div><nowiki>a|b</nowiki></div>
25395 |}
25396 !! html/php+tidy
25397 <table>
25398 <tbody><tr>
25399 <td>foo|bar
25400 </td></tr>
25401 <tr>
25402 <td>x<div>a|b</div>
25403 </td></tr></tbody></table>
25404 !! end
25405
25406 !! test
25407 Tables: 2b. Nested in td
25408 !! options
25409 parsoid=html2wt
25410 !! html/parsoid
25411 <table><tbody><tr>
25412 <td>foo||bar</td>
25413 <td>a<i>b||c</i></td>
25414 <td>a<i><div>b||c</div></i></td>
25415 </tr></tbody></table>
25416 !! wikitext
25417 {|
25418 |<nowiki>foo||bar</nowiki>
25419 |a''<nowiki>b||c</nowiki>''
25420 |a''<div><nowiki>b||c</nowiki></div>''
25421 |}
25422 !! html/php
25423 <table>
25424 <tr>
25425 <td>foo||bar
25426 </td>
25427 <td>a<i>b||c</i>
25428 </td>
25429 <td>a<i><div>b||c</div></i>
25430 </td></tr></table>
25431
25432 !! end
25433
25434 !! test
25435 Tables: 2c. Nested in td -- no escaping needed
25436 !! options
25437 parsoid=html2wt
25438 !! html/*
25439 <table>
25440 <tr>
25441 <td>foo!!bar
25442 </td></tr></table>
25443
25444 !! wikitext
25445 {|
25446 |foo!!bar
25447 |}
25448 !! end
25449
25450 !! test
25451 Tables: 3a. Nested in th
25452 !! options
25453 parsoid=html2wt
25454 !! html/*
25455 <table>
25456 <tr>
25457 <th>foo!bar
25458 </th></tr></table>
25459
25460 !! wikitext
25461 {|
25462 !foo!bar
25463 |}
25464 !! end
25465
25466 !! test
25467 Tables: 3b. Nested in th
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <table><tbody>
25472 <tr><th>foo!!bar</th>
25473 <th><i>foo|bar</i></th>
25474 <th><i>foo!!bar</i></th>
25475 <th><i><span>foo!!bar</span></i></th>
25476 </tr></tbody></table>
25477 !! wikitext
25478 {|
25479 !<nowiki>foo!!bar</nowiki>
25480 !''<nowiki>foo|bar</nowiki>''
25481 !''<nowiki>foo!!bar</nowiki>''
25482 !''<span><nowiki>foo!!bar</nowiki></span>''
25483 |}
25484 !! html/php
25485 <table>
25486 <tr>
25487 <th>foo!!bar
25488 </th>
25489 <th><i>foo|bar</i>
25490 </th>
25491 <th><i>foo!!bar</i>
25492 </th>
25493 <th><i><span>foo!!bar</span></i>
25494 </th></tr></table>
25495
25496 !! end
25497
25498 !! test
25499 Tables: 3c. Nested in th
25500 !! options
25501 parsoid=html2wt
25502 !! html/parsoid
25503 <table><tbody>
25504 <tr><th>foo||bar</th>
25505 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25506 </tr></tbody></table>
25507 !! wikitext
25508 {|
25509 !<nowiki>foo||bar</nowiki>
25510 !<nowiki>foo||bar</nowiki>
25511 |}
25512 !! html/php
25513 <table>
25514 <tr>
25515 <th>foo||bar
25516 </th>
25517 <th>foo||bar
25518 </th></tr></table>
25519
25520 !! end
25521
25522 !! test
25523 Tables: 4a. Escape -
25524 !! options
25525 parsoid=html2wt
25526 !! html/*
25527 <table>
25528 <tr>
25529 <th>-bar
25530 </th></tr>
25531 <tr>
25532 <td>-bar
25533 </td></tr></table>
25534
25535 !! wikitext
25536 {|
25537 !-bar
25538 |-
25539 |<nowiki>-bar</nowiki>
25540 |}
25541 !! end
25542
25543 !! test
25544 Tables: 4b. Escape +
25545 !! options
25546 parsoid=html2wt
25547 !! html/*
25548 <table>
25549 <tr>
25550 <th>+bar
25551 </th></tr>
25552 <tr>
25553 <td>+bar
25554 </td></tr></table>
25555
25556 !! wikitext
25557 {|
25558 !+bar
25559 |-
25560 |<nowiki>+bar</nowiki>
25561 |}
25562 !! end
25563
25564 !! test
25565 Tables: 4c. No escaping needed
25566 !! options
25567 parsoid=html2wt
25568 !! html/parsoid
25569 <table><tbody>
25570 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25571 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25572 <tr><td>foo
25573 <p>bar|baz
25574 +bar
25575 -bar</p></td></tr>
25576 <tr><td>x
25577 <div>a|b</div></td>
25578 </tbody></table>
25579 !! wikitext
25580 {|
25581 |foo-bar
25582 |foo+bar
25583 |-
25584 |''foo''-bar
25585 |''foo''+bar
25586 |-
25587 |foo
25588 bar|baz
25589 +bar
25590 -bar
25591 |-
25592 |x
25593 <div>a|b</div>
25594 |}
25595 !! html/php
25596 <table>
25597 <tr>
25598 <td>foo-bar
25599 </td>
25600 <td>foo+bar
25601 </td></tr>
25602 <tr>
25603 <td><i>foo</i>-bar
25604 </td>
25605 <td><i>foo</i>+bar
25606 </td></tr>
25607 <tr>
25608 <td>foo
25609 <p>bar|baz
25610 +bar
25611 -bar
25612 </p>
25613 </td></tr>
25614 <tr>
25615 <td>x
25616 <div>a|b</div>
25617 </td></tr></table>
25618
25619 !! end
25620
25621 !! test
25622 Tables: 4d. No escaping needed
25623 !! options
25624 parsoid=html2wt
25625 !! html/parsoid
25626 <table>
25627 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25628 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25629 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25630 </tbody></table>
25631 !! wikitext
25632 {|
25633 |[[Foo]]-bar
25634 ||+1
25635 ||-2
25636 |}
25637 !! html/php
25638 <table>
25639 <tr>
25640 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25641 </td>
25642 <td>+1
25643 </td>
25644 <td>-2
25645 </td></tr></table>
25646
25647 !! end
25648
25649 !! test
25650 T97430: Don't emit empty nowiki pairs around marker meta tags
25651 !! options
25652 parsoid=html2wt
25653 !! html/parsoid
25654 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25655 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25656 !! wikitext
25657 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25658 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25659 !! end
25660
25661 !! test
25662 Unclosed xmlish element in table line shouldn't eat end delimiters
25663 !! options
25664 parsoid=html2wt
25665 !! html/parsoid
25666 <table>
25667 <tbody><tr><td> &lt;foo</td>
25668 <td> bar></td></tr>
25669 </tbody></table>
25670 !! wikitext
25671 {|
25672 | <foo
25673 | bar>
25674 |}
25675 !! html/php
25676 <table>
25677 <tr>
25678 <td>&lt;foo
25679 </td>
25680 <td>bar&gt;
25681 </td></tr></table>
25682
25683 !! end
25684
25685 #### --------------- Links ----------------
25686 #### 1. Quote marks in link text
25687 #### 2. Wikilinks: Escapes needed
25688 #### 3. Wikilinks: No escapes needed
25689 #### 4. Extlinks: Escapes needed
25690 #### 5. Extlinks: No escapes needed
25691 #### --------------------------------------
25692 !! test
25693 Links 1. WikiLinks: No escapes needed
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25698 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25699 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25700 !! wikitext
25701 [[Foo|Foo''boo'']]
25702 [[Foo|[Foobar]]]
25703 [[Foo|x [Foobar] x]]
25704 !! html/php
25705 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25706 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25707 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25708 </p>
25709 !! end
25710
25711 !! test
25712 Links 2. WikiLinks: Escapes needed
25713 !! options
25714 parsoid=html2wt
25715 !! html/parsoid
25716 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25717 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25718 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25719 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25720 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25721 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25722 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25723 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25724 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25725 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25726 !! wikitext
25727 [[Foo|<nowiki>Foobar]</nowiki>]]
25728 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25729 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25730 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25731 [[Foo|<nowiki>|Bar</nowiki>]]
25732 [[Foo|<nowiki>]]bar</nowiki>]]
25733 [[Foo|<nowiki>[[bar</nowiki>]]
25734 [[Foo|<nowiki>x [[ y</nowiki>]]
25735 [[Foo|<nowiki>x ]] y</nowiki>]]
25736 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25737 !! html/php
25738 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25739 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25740 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25741 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25742 <a href="/wiki/Foo" title="Foo">|Bar</a>
25743 <a href="/wiki/Foo" title="Foo">]]bar</a>
25744 <a href="/wiki/Foo" title="Foo">[[bar</a>
25745 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25746 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25747 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25748 </p>
25749 !! end
25750
25751 !! test
25752 Links 3. WikiLinks: No escapes needed
25753 !! options
25754 parsoid=html2wt
25755 !! html/parsoid
25756 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25757 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25758 !! wikitext
25759 [[Foo|[Foobar]]
25760 [[Foo|foo|bar]]
25761 !! html/php
25762 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25763 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25764 </p>
25765 !! end
25766
25767 !! test
25768 Links 4. ExtLinks: Escapes needed
25769 !! options
25770 parsoid=html2wt
25771 !! html/parsoid
25772 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25773 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25774 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25775 <p>[http://google.com]</p>
25776 <p>[http://google.com google]</p>
25777 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25778 <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>
25779 !! wikitext
25780 [http://google.com <nowiki>[google]</nowiki>]
25781 [http://google.com <nowiki>google]</nowiki>]
25782 [http://google.com <nowiki>goog] le</nowiki>]
25783
25784 <nowiki>[http://google.com]</nowiki>
25785
25786 <nowiki>[http://google.com google]</nowiki>
25787
25788 [http://google.com<nowiki>]</nowiki>
25789
25790 [{{echo|http://google.com}}<nowiki>]</nowiki>
25791 !! html/php
25792 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25793 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25794 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25795 </p><p>[http://google.com]
25796 </p><p>[http://google.com google]
25797 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25798 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25799 </p>
25800 !! end
25801
25802 !! test
25803 Links 5. ExtLinks: No escapes needed
25804 !! options
25805 parsoid=html2wt
25806 !! html/parsoid
25807 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25808 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25809 !! wikitext
25810 [http://google.com [google]
25811
25812 [[http://google.com]]
25813 !! html/php
25814 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25815 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25816 </p>
25817 !! end
25818
25819 !! test
25820 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25821 !! options
25822 parsoid=html2wt
25823 !! html/parsoid
25824 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25826 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25827 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25828 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25830 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25831 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25832 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25833 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25834 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25835 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25836 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25837 </p>
25838 !! wikitext
25839 x<nowiki/>http://example.com<nowiki/>y
25840 http://example.com<nowiki/>?x
25841 http://example.com<nowiki/>&x
25842 http://example.com<nowiki/>'x
25843 http://example.com<nowiki/>,x
25844 http://example.com<nowiki/>.x
25845 http://example.com<nowiki/>;x
25846 http://example.com<nowiki/>:x
25847 http://example.com<nowiki/>;x
25848 http://example.com<nowiki/>!x
25849 http://example.com<nowiki/>=x
25850 http://example.com<nowiki/>(x)
25851 http://example.com(x<nowiki/>)
25852 !! end
25853
25854 !! test
25855 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25856 !! options
25857 parsoid=html2wt
25858 !! html/parsoid
25859 <p>x
25860 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25861 y
25862 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25863 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25864 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25865 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25866 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25867 </p>
25868 !! wikitext
25869 x
25870 http://example.com
25871 y
25872 "http://example.com"
25873 (http://example.com)
25874 (http://example.com) foo
25875 http://example.com,
25876 http://example.com, foo
25877 !! html/php
25878 <p>x
25879 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25880 y
25881 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25882 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25883 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25884 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25885 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25886 </p>
25887 !! end
25888
25889 !! test
25890 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25891 !! options
25892 parsoid=html2wt
25893 !! html/parsoid
25894 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25895 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25896 !! wikitext
25897 http://example.com.,;:!?\
25898 -http://example.com:
25899 !! html/php
25900 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25901 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25902 </p>
25903 !! end
25904
25905 !! test
25906 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25907 !! options
25908 parsoid=html2wt
25909 !! html/parsoid
25910 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25911 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25912 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25913 !! wikitext
25914 RFC 123<nowiki/>4
25915 RFC 123<nowiki/>y
25916 X<nowiki/>RFC 123<nowiki/>y
25917 !! end
25918
25919 !! test
25920 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25925 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25926 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25927 </p>
25928 !! wikitext
25929 RFC 123?foo
25930 RFC 123&foo
25931 -RFC 123-
25932 !! html/php
25933 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25934 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25935 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25936 </p>
25937 !! end
25938
25939 !! test
25940 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25941 !! options
25942 parsoid=html2wt
25943 !! html/parsoid
25944 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25945 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25946 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25947 !! wikitext
25948 PMID 123<nowiki/>4
25949 PMID 123<nowiki/>y
25950 X<nowiki/>PMID 123<nowiki/>y
25951 !! end
25952
25953 !! test
25954 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25955 !! options
25956 parsoid=html2wt
25957 !! html/parsoid
25958 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25959 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25960 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25961 </p>
25962 !! wikitext
25963 PMID 123?foo
25964 PMID 123&foo
25965 -PMID 123-
25966 !! html/php
25967 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25968 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25969 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25970 </p>
25971 !! end
25972
25973 !! test
25974 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25975 !! options
25976 parsoid=html2wt
25977 !! html/parsoid
25978 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25979 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25980 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25981 </p>
25982 !! wikitext
25983 ISBN 1234567890<nowiki/>1
25984 ISBN 1234567890<nowiki/>x
25985 a<nowiki/>ISBN 1234567890<nowiki/>b
25986 !! end
25987
25988 !! test
25989 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25990 !! options
25991 parsoid=html2wt
25992 !! html/parsoid
25993 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25994 !! wikitext
25995 -ISBN 1234567890's
25996 !! html/php
25997 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25998 </p>
25999 !! end
26000
26001 !! test
26002 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26003 !! options
26004 parsoid=html2wt
26005 !! html/*
26006 <p>this is not a link: http://example.com
26007 </p>
26008 !! wikitext
26009 this is not a link: <nowiki>http://example.com</nowiki>
26010 !! end
26011
26012 !! test
26013 Links 15. Link trails can't become link prefixes.
26014 !! options
26015 language=is
26016 parsoid=html2wt
26017 !! html/parsoid
26018 <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>
26019 !! wikitext
26020 [[Söfnuður]]-[[00]]
26021 !! html/php
26022 <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>
26023 </p>
26024 !! end
26025
26026 #### --------------- Quotes ---------------
26027 #### 1. Quotes inside <b> and <i>
26028 #### 2. Link fragments separated by <i> and <b> tags
26029 #### 3. Link fragments inside <i> and <b>
26030 #### 4. No escaping needed
26031 #### --------------------------------------
26032 !! test
26033 1a. Quotes inside <b> and <i>
26034 !! options
26035 parsoid=html2wt
26036 !! html/*
26037 <p><i>'foo'</i>
26038 <i>''foo''</i>
26039 <i>'''foo'''</i>
26040 <i>foo</i>'s
26041 <b>'foo'</b>
26042 <b>''foo''</b>
26043 <b>'''foo'''</b>
26044 <b>foo'<i>bar'</i>baz</b>
26045 <b>foo</b>'s
26046 '<i>foo</i>
26047 <i>foo</i>'
26048 <i>foo'</i>'
26049 '<i>foo</i>'
26050 '<b>foo</b>
26051 <b>foo</b>'
26052 '<b>foo</b>'
26053 <i>fools'<span> errand</span></i>
26054 <i><span>fool</span>'s errand</i>
26055 '<i>foo</i> bar '<i>baz</i>
26056 a|!*#-:;+-~[]{}b'<i>x</i>
26057 </p>
26058 !! wikitext
26059 ''<nowiki/>'foo'''
26060 ''<nowiki>''foo''</nowiki>''
26061 ''<nowiki>'''foo'''</nowiki>''
26062 ''foo''<nowiki/>'s
26063 '''<nowiki/>'foo''''
26064 '''<nowiki>''foo''</nowiki>'''
26065 '''<nowiki>'''foo'''</nowiki>'''
26066 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26067 '''foo'''<nowiki/>'s
26068 '''foo''
26069 ''foo''<nowiki/>'
26070 ''foo'''<nowiki/>'
26071 '''foo''<nowiki/>'
26072 ''''foo'''
26073 '''foo'''<nowiki/>'
26074 ''''foo'''<nowiki/>'
26075 ''fools'<span> errand</span>''
26076 ''<span>fool</span>'s errand''
26077 '<nowiki/>''foo'' bar '''baz''
26078 a|!*#-:;+-~[]{}b'''x''
26079 !! end
26080
26081 !! test
26082 1b. Quotes inside <b> and <i> with other tags on same line
26083 !! options
26084 parsoid=html2wt
26085 !! html/parsoid
26086 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26087 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26088 <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>
26089 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26090 '<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>
26091 '<i>foo</i> <div title="name">test</div>
26092 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26093 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26094 <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>
26095 </ol>
26096 !! wikitext
26097 '''a'' foo ''[[bar]]''
26098 ''a''' foo ''[[bar]]''
26099 ''a''' foo '''{{echo|[[bar]]}}'''
26100 [[foo]] x'''[[bar]]''
26101 '''foo'' <ref>test</ref>
26102 '''foo'' <div title="name">test</div>
26103 '''foo'' and <br> bar
26104 <references />
26105 !! end
26106
26107 !! test
26108 2. Link fragments separated by <i> and <b> tags
26109 !! options
26110 parsoid=html2wt
26111 !! html/parsoid
26112 <p>[[<i>foo</i>hello]]</p>
26113 <p>[[<b>foo</b>hello]]</p>
26114 !! wikitext
26115 [[''foo''<nowiki>hello]]</nowiki>
26116
26117 [['''foo'''<nowiki>hello]]</nowiki>
26118 !! end
26119
26120 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26121 # this is one of the shortcomings of this format
26122 !! test
26123 3. Link fragments inside <i> and <b>
26124 !! options
26125 parsoid=html2wt
26126 !! html/parsoid
26127 <p><i>[[foo</i>]]</p>
26128 <p><b>[[foo</b>]]</p>
26129 !! wikitext
26130 ''[[foo''<nowiki>]]</nowiki>
26131
26132 '''[[foo'''<nowiki>]]</nowiki>
26133 !! end
26134
26135 !! test
26136 4. No escaping needed
26137 !! options
26138 parsoid=html2wt
26139 !! html/parsoid
26140 <p>'<span><i>bar</i></span>'
26141 '<span><b>bar</b></span>'
26142 'a:b'foo
26143 </p>
26144 !! wikitext
26145 '<span>''bar''</span>'
26146 '<span>'''bar'''</span>'
26147 'a:b'foo
26148 !! end
26149
26150 #### ----------- Paragraphs ---------------
26151 #### 1. No unnecessary escapes
26152 #### --------------------------------------
26153
26154 !! test
26155 1. No unnecessary escapes
26156 !! options
26157 parsoid=html2wt
26158 !! html/parsoid
26159 <p>bar <span>[[foo]]</span>
26160 </p><p>=bar <span>[[foo]]</span>
26161 </p><p>[[bar <span>[[foo]]</span>
26162 </p><p>]]bar <span>[[foo]]</span>
26163 </p><p>=bar <span>foo]]</span>=
26164 </p>
26165 !! wikitext
26166 bar <span><nowiki>[[foo]]</nowiki></span>
26167
26168 =bar <span><nowiki>[[foo]]</nowiki></span>
26169
26170 [[bar <span><nowiki>[[foo]]</nowiki></span>
26171
26172 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26173
26174 =bar <span>foo]]</span><nowiki>=</nowiki>
26175 !!end
26176
26177 #### ----------------------- PRE --------------------------
26178 #### 1. Leading whitespace in SOL context should be escaped
26179 #### ------------------------------------------------------
26180 !! test
26181 1. Leading whitespace in SOL context should be escaped
26182 !! options
26183 parsoid=html2wt
26184 !! html/parsoid
26185 <p> a</p>
26186
26187 <p> a</p>
26188
26189 <p> a(tab)</p>
26190
26191 <p> a
26192 <!--cmt-->
26193 a</p>
26194
26195 <p>a
26196 b</p>
26197
26198 <p>a
26199 b</p>
26200
26201 <p>a
26202 b</p>
26203 !! wikitext
26204 <nowiki> </nowiki>a
26205
26206 <nowiki> </nowiki> a
26207
26208 a(tab)
26209
26210 <nowiki> </nowiki> a
26211 <!--cmt-->
26212 <nowiki> </nowiki>a
26213
26214 a
26215 <nowiki> </nowiki>b
26216
26217 a
26218 b
26219
26220 a
26221 b
26222 !! html/php
26223 <p> a
26224 </p><p> a
26225 </p><p> a(tab)
26226 </p><p> a
26227 a
26228 </p><p>a
26229 b
26230 </p><p>a
26231 b
26232 </p><p>a
26233 b
26234 </p>
26235 !! end
26236
26237 !! test
26238 2. Leading whitespace in non-indent-pre contexts should not be escaped
26239 !! options
26240 parsoid=html2wt
26241 !! html/parsoid
26242 <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>
26243 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26244 <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>
26245 b</span></li>
26246 </ol>
26247 !! wikitext
26248 foo <ref>''a''
26249 b</ref>
26250 <references />
26251 !! end
26252
26253 !! test
26254 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26255 !! options
26256 parsoid=html2wt
26257 !! html/parsoid
26258 <blockquote>
26259 <p>
26260 a
26261 <span>b</span>
26262 c</p>
26263 </blockquote>
26264 !! wikitext
26265 <blockquote>
26266 a
26267 <span>b</span>
26268 c
26269 </blockquote>
26270 !! end
26271
26272 !! test
26273 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26274 !! options
26275 parsoid=html2wt
26276 !! html/parsoid
26277 <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>
26278 !! wikitext
26279 [[File:Foobar.jpg|thumb|caption]]
26280 !! end
26281
26282 !! test
26283 5. Nowiki escaping should account for indent-pres
26284 !! options
26285 parsoid=html2wt
26286 !! html/parsoid
26287 <pre>==foo==</pre>
26288 !! wikitext
26289 ==foo==
26290 !! end
26291
26292 !!test
26293 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26294 !! options
26295 parsoid=html2wt
26296 !! html/parsoid
26297 <pre>
26298 * foo
26299 * bar
26300 </pre>
26301 !! wikitext
26302 * foo
26303 * bar
26304 !! end
26305
26306 #### --------------- Behavior Switches --------------------
26307
26308 !! test
26309 1. Valid behavior switches should be escaped
26310 !! options
26311 parsoid=html2wt
26312 !! html/parsoid
26313 __TOC__
26314 <i>__TOC__</i>
26315 !! wikitext
26316 <nowiki>__TOC__</nowiki>
26317 ''<nowiki>__TOC__</nowiki>''
26318 !! end
26319
26320 !! test
26321 2. Invalid behavior switches should not be escaped
26322 !! options
26323 parsoid=html2wt
26324 !! html/parsoid
26325 __TOO__
26326 __|__
26327 !! wikitext
26328 __TOO__
26329 __|__
26330 !! end
26331
26332 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26333 !! test
26334 Behavior switches should be SOL-transparent
26335 !! options
26336 parsoid=html2wt
26337 !! html/parsoid
26338 <meta property="mw:PageProp/toc" />
26339
26340 <!-- this one's bogus -->
26341 <pre>__TOO__</pre>
26342
26343 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26344
26345 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26346 !! wikitext
26347 __TOC__
26348
26349 <!-- this one's bogus -->
26350 __TOO__
26351
26352 __TOC__ foo
26353
26354 __TOC__
26355 bar
26356 !! end
26357
26358 #### --------------- HTML tags ---------------
26359 #### 1. a tags
26360 #### 2. other tags
26361 #### 3. multi-line html tag
26362 #### 4. extension tags
26363 #### -----------------------------------------
26364 !! test
26365 1. a tags
26366 !! options
26367 parsoid=html2wt
26368 !! html/parsoid
26369 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26370 !! wikitext
26371 <a href="http://google.com">google</a>
26372 !! end
26373
26374 !! test
26375 2. other tags
26376 !! options
26377 parsoid=html2wt
26378 !! html/parsoid
26379 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26380 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26381 <li> &lt;td&gt;</li></ul>
26382
26383 !! wikitext
26384 * <nowiki><div>foo</div></nowiki>
26385 * <nowiki><div style="color:red">foo</div></nowiki>
26386 * <nowiki><td></nowiki>
26387 !! end
26388
26389 !! test
26390 3. multi-line html tag
26391 !! options
26392 parsoid=html2wt
26393 !! html/parsoid
26394 <p>&lt;div
26395 &gt;foo&lt;/div
26396 &gt;
26397 </p>
26398 !! wikitext
26399 <nowiki><div
26400 >foo</div
26401 ></nowiki>
26402 !! end
26403
26404 !! test
26405 4. extension tags
26406 !! options
26407 parsoid=html2wt
26408 !! html/parsoid
26409 <p>&lt;ref&gt;foo&lt;/ref&gt;
26410 </p><p>&lt;ref&gt;bar
26411 </p><p>baz&lt;/ref&gt;
26412 </p>
26413 !! wikitext
26414 <nowiki><ref>foo</ref></nowiki>
26415
26416 <nowiki><ref>bar</nowiki>
26417
26418 baz<nowiki></ref></nowiki>
26419 !! end
26420
26421 #### --------------- Others ---------------
26422 !! test
26423 Escaping nowikis
26424 !! options
26425 parsoid=html2wt
26426 !! html/parsoid
26427 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26428 </p>
26429 !! wikitext
26430 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26431 !! end
26432
26433 ## The quote-char in the input is necessary for triggering the bug
26434 !! test
26435 (T54035) Nowiki-escaping should not get tripped by " :" in text
26436 !! options
26437 parsoid=html2wt
26438 !! html/parsoid
26439 <p>foo's bar :</p>
26440 !! wikitext
26441 foo's bar :
26442 !! end
26443
26444 #----------- End of wikitext escaping tests --------------
26445
26446 !! test
26447
26448 Tag-like HTML structures are passed through as text
26449 !! wikitext
26450 <x y>
26451
26452 <x.y>
26453
26454 <x-y>
26455
26456 1>2
26457
26458 x<y
26459
26460 a>b
26461
26462 1<d e>f
26463 !! html
26464 <p>&lt;x y&gt;
26465 </p><p>&lt;x.y&gt;
26466 </p><p>&lt;x-y&gt;
26467 </p><p>1&gt;2
26468 </p><p>x&lt;y
26469 </p><p>a&gt;b
26470 </p><p>1&lt;d e&gt;f
26471 </p>
26472 !! end
26473
26474 !! test
26475 HTML tag with necessary entities in attributes
26476 !! wikitext
26477 <span title="&amp;amp;">foo</span>
26478 !! html
26479 <p><span title="&amp;amp;">foo</span>
26480 </p>
26481 !! end
26482
26483 !! test
26484 HTML tag with 'unnecessary' entity encoding in attributes
26485 !! wikitext
26486 <span title="&amp;">foo</span>
26487 !! html
26488 <p><span title="&amp;">foo</span>
26489 </p>
26490 !! end
26491
26492 !! test
26493 HTML tag with broken attribute value quoting
26494 !! options
26495 parsoid=wt2html,html2html
26496 !! wikitext
26497 <span title="Hello world>Foo</span>
26498 !! html/php
26499 <p><span title="Hello world">Foo</span>
26500 </p>
26501 !! html/parsoid
26502 <p><span title="Hello world">Foo</span></p>
26503 !! end
26504
26505 !! test
26506 Self-closed tag with broken attribute value quoting
26507 !! options
26508 parsoid=wt2html,html2html
26509 !! wikitext
26510 <div title="Hello world />Foo
26511 !! html/php+tidy
26512 <div title="Hello world"></div><p>Foo
26513 </p>
26514 !! html/parsoid
26515 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26516 !! end
26517
26518 !! test
26519 Table with broken attribute value quoting
26520 !! options
26521 parsoid=wt2html,html2html
26522 !! wikitext
26523 {|
26524 | title="Hello world|Foo
26525 |}
26526 !! html/php
26527 <table>
26528 <tr>
26529 <td title="Hello world">Foo
26530 </td></tr></table>
26531
26532 !! html/parsoid
26533 <table>
26534 <tr>
26535 <td title="Hello world">Foo
26536 </td></tr></table>
26537
26538 !! end
26539
26540 !! test
26541 Table with broken attribute value quoting on consecutive lines
26542 !! options
26543 parsoid=wt2html,html2html
26544 !! wikitext
26545 {|
26546 | title="Hello world|Foo
26547 | style="color:red|Bar
26548 |}
26549 !! html/php
26550 <table>
26551 <tr>
26552 <td title="Hello world">Foo
26553 </td>
26554 <td style="color:red">Bar
26555 </td></tr></table>
26556
26557 !! html/parsoid
26558 <table><tbody>
26559 <tr>
26560 <td title="Hello world">Foo
26561 </td><td style="color: red">Bar
26562 </td></tr></tbody></table>
26563
26564 !! end
26565
26566 !!test
26567 Accept empty td cell attribute
26568 !! wikitext
26569 {|
26570 | align="center" |foo|| |
26571 |}
26572 !! html
26573 <table>
26574 <tr>
26575 <td align="center">foo</td>
26576 <td>
26577 </td></tr></table>
26578
26579 !!end
26580
26581 !!test
26582 Non-empty attributes in th-cells
26583 !! wikitext
26584 {|
26585 !Foo!! style="color: red" |Bar
26586 |}
26587 !! html
26588 <table>
26589 <tr>
26590 <th>Foo</th>
26591 <th style="color: red">Bar
26592 </th></tr></table>
26593
26594 !!end
26595
26596 !!test
26597 Accept empty attributes in th-cells
26598 !! wikitext
26599 {|
26600 !|foo!!|bar
26601 |}
26602 !! html
26603 <table>
26604 <tr>
26605 <th>foo</th>
26606 <th>bar
26607 </th></tr></table>
26608
26609 !!end
26610
26611 !!test
26612 Empty table rows go away
26613 !! wikitext
26614 {|
26615 |Hello
26616 |there
26617 |- class="foo"
26618 |-
26619 |}
26620 !! html
26621 <table>
26622 <tr>
26623 <td>Hello
26624 </td>
26625 <td>there
26626 </td></tr>
26627
26628 </table>
26629
26630 !! end
26631
26632 ###
26633 ### Parsoid-centric tests for testing RTing of inter-element separators
26634 ### Edge cases not tested by existing parser tests and specific to
26635 ### Parsoid-specific serialization strategies.
26636 ###
26637
26638 !!test
26639 RT-ed inter-element separators should be valid separators
26640 !! wikitext
26641 {|
26642 |- [[foo]]
26643 |}
26644 !! html/php
26645 <table>
26646
26647 </table>
26648
26649 !! html/parsoid
26650 <table>
26651 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26652 </tbody></table>
26653 !!end
26654
26655 # Parsoid-only test of a DOM pass
26656 !!test
26657 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26658 !! wikitext
26659 {|
26660 |<small>foo
26661 bar
26662 |}
26663
26664 {|
26665 |<small>foo<small>
26666 |}
26667 !! html/parsoid
26668 <table>
26669 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26670 <p>bar</p></small></td></tr>
26671 </tbody></table>
26672
26673 <table>
26674 <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>
26675 </tbody></table>
26676 !!end
26677
26678 # Note that the "style" attribute is really a template parameter here.
26679 # The = would have to be {{=}} if you wanted the literal.
26680 !!test
26681 Empty TD followed by TD with tpl-generated attribute
26682 !! wikitext
26683 {|
26684 |-
26685 |
26686 |{{echo|style='color:red'}}|foo
26687 |}
26688 !! html
26689 <table>
26690
26691 <tr>
26692 <td>
26693 </td>
26694 <td>foo
26695 </td></tr></table>
26696
26697 !!end
26698
26699 !!test
26700 Indented table with an empty td
26701 !! wikitext
26702 {|
26703 |-
26704 |
26705 |foo
26706 |}
26707 !! html
26708 <table>
26709
26710 <tr>
26711 <td>
26712 </td>
26713 <td>foo
26714 </td></tr></table>
26715
26716 !!end
26717
26718 ## We have some newline diffs RT-ing this edge case
26719 ## and it is not important enough -- we seem to be emitting
26720 ## at most 2 newlines after a </tr> and this is unrelated to
26721 ## the issue from T85627 that this is testing.
26722 !!test
26723 Indented table with blank lines in between (T85627)
26724 !! options
26725 parsoid=wt2html
26726 !! wikitext
26727 {|
26728 |foo
26729
26730
26731 |}
26732 !! html
26733 <table>
26734
26735 <tr>
26736 <td>foo
26737 </td></tr></table>
26738
26739 !!end
26740
26741 !!test
26742 Indented block & table
26743 !! wikitext
26744 <div>foo</div>
26745 {|
26746 |foo
26747 |}
26748 !! html/php
26749 <div>foo</div>
26750 <table>
26751 <tr>
26752 <td>foo
26753 </td></tr></table>
26754
26755 !! html/parsoid
26756 <div data-parsoid='{"stx":"html"}'>foo</div>
26757 <table><tbody>
26758 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26759 </tbody></table>
26760 !!end
26761
26762 !! test
26763 Indent and comment before table row
26764 !! wikitext
26765 {|
26766 <!--hi-->|-
26767 |there
26768 |}
26769 !! html/php
26770 <table>
26771
26772 <tr>
26773 <td>there
26774 </td></tr></table>
26775
26776 !! html/parsoid
26777 <table>
26778 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26779 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26780 </tbody></table>
26781 !! end
26782
26783 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26784 !!test
26785 Empty TR followed by a template-generated TR
26786 !!options
26787 parsoid
26788 !! wikitext
26789 {|
26790 |-
26791 {{echo|<tr><td>foo</td></tr>}}
26792 |}
26793 !! html
26794 <table>
26795 <tbody>
26796 <tr class='mw-empty-elt'></tr>
26797 <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}}]}'>
26798 <td>foo</td></tr>
26799 </tbody></table>
26800 !!end
26801
26802 ## PHP and parsoid output differ for this, and since this is primarily
26803 ## for testing Parsoid's serializer, marking this Parsoid only
26804 !!test
26805 Empty TR followed by mixed-ws-comment line should RT correctly
26806 !!options
26807 parsoid
26808 !! wikitext
26809 {|
26810 |-
26811 <!--c-->
26812 |-
26813 <!--c--> <!--d-->
26814 |}
26815 !! html
26816 <table>
26817 <tbody>
26818 <tr class='mw-empty-elt'></tr>
26819 <!--c-->
26820 <tr>
26821 <!--c--> </tr><!--d-->
26822 </tbody></table>
26823
26824 !!end
26825
26826 !!test
26827 Multi-line image caption generated by templates with/without trailing newlines
26828 !! wikitext
26829 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26830 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26831 !! html/parsoid
26832 <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>
26833 <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>
26834 !!end
26835
26836 !! test
26837 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26838 !! options
26839 parsoid=html2wt
26840 !! html/parsoid
26841 <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>
26842
26843 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26844 !! wikitext
26845 <includeonly>foo</includeonly>
26846 new para
26847
26848 [[Category:Foo]]
26849
26850 = new heading =
26851 !! end
26852
26853 ## PHP emits broken html for this, and since this is primarily
26854 ## a Parsoid serializer test, marking this Parsoid only
26855 !!test
26856 Improperly nested inline or quotes tags with whitespace in between
26857 !! wikitext
26858 <span> <s>x</span> </s>
26859 ''' ''x''' ''
26860 !! html/parsoid
26861 <p><span> <s>x</s></span><s> </s>
26862 <b> <i>x</i></b><i> </i>
26863 </p>
26864 !!end
26865
26866 !!test
26867 Encapsulate protected attributes from wt
26868 !! wikitext
26869 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26870
26871 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26872 | ok
26873 |}
26874 !! html/parsoid
26875 <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>
26876
26877 <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">
26878 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26879 </tbody></table>
26880 !!end
26881
26882 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26883 ## Having nested or stray pre tags results in the attempt to add duplicates,
26884 ## causing an assertion fail. This test tries to prevent that situation.
26885 !!test
26886 Ensure ParagraphWrapper can deal with stray closing pre tags
26887 !!options
26888 parsoid=wt2html
26889 !! wikitext
26890 plain text</pre>
26891 !! html/parsoid
26892 plain text
26893 !!end
26894
26895 !!test
26896 1. Ensure fostered text content is wrapped in element nodes
26897 !!options
26898 parsoid=wt2html
26899 !! wikitext
26900 <table>hi</table><table>ho</table>
26901 !! html/parsoid
26902 <p>hi</p>
26903 <table></table>
26904 <p>ho</p>
26905 <table></table>
26906 !!end
26907
26908 !!test
26909 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26910 !!options
26911 parsoid=wt2html,wt2wt
26912 !! wikitext
26913 <table>
26914 <tr> || ||
26915 <td> a
26916 </table>
26917 !! html/parsoid
26918 <p> || ||
26919 </p><table>
26920 <tbody><tr><td> a</td></tr>
26921 </tbody></table>
26922 !!end
26923
26924 !!test
26925 Encapsulation properly handles null DSR information from foster box
26926 !!options
26927 parsoid=wt2html,wt2wt
26928 !! wikitext
26929 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26930 !! html/parsoid
26931 <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>
26932 !!end
26933
26934 !!test
26935 1. Encapsulate foster-parented transclusion content
26936 !!options
26937 parsoid=wt2wt,wt2html
26938 !! wikitext
26939 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26940 !! html/parsoid
26941 <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>
26942 <tbody>
26943 <tr>
26944 <td>bar</td>
26945 </tr>
26946 </tbody>
26947 </table>
26948 !!end
26949
26950 !!test
26951 2. Encapsulate foster-parented transclusion content
26952 !!options
26953 parsoid=wt2wt,wt2html
26954 !! wikitext
26955 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26956 !! html/parsoid
26957 <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>
26958 <table>
26959 <tbody>
26960 <tr>
26961 <td>bar</td>
26962 </tr>
26963 </tbody>
26964 </table>
26965 !!end
26966
26967 !!test
26968 3. Encapsulate foster-parented transclusion content
26969 !!options
26970 parsoid=wt2wt,wt2html
26971 !! wikitext
26972 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26973 !! html/parsoid
26974 <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;]}">
26975 <p>foo</p>
26976 </div>
26977 <table>
26978 <tbody>
26979 <tr>
26980 <td>bar</td>
26981 </tr>
26982 </tbody>
26983 </table>
26984 !!end
26985
26986 !!test
26987 4. Encapsulate foster-parented transclusion content
26988 !!options
26989 parsoid=wt2wt,wt2html
26990 !! wikitext
26991 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26992 !! html/parsoid
26993 <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;]}">
26994 <p>foo</p>
26995 </div>
26996 <table>
26997 <tbody>
26998 <tr>
26999 <td>bar</td>
27000 </tr>
27001 </tbody>
27002 </table>
27003 !!end
27004
27005 !!test
27006 5. Encapsulate foster-parented transclusion content
27007 !!options
27008 parsoid=wt2wt,wt2html
27009 !! wikitext
27010 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27011 !! html/parsoid
27012 <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>
27013 <table>
27014 <tbody>
27015 <tr>
27016 <td>
27017 <div>
27018 <p>foo</p>
27019 </div>
27020 </td>
27021 </tr>
27022 </tbody>
27023 </table>
27024 !!end
27025
27026 !!test
27027 6. Encapsulate foster-parented transclusion content
27028 !!options
27029 parsoid=wt2wt,wt2html
27030 !! wikitext
27031 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27032 !! html/parsoid
27033 <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>
27034 <table>
27035 <tbody>
27036 <tr>
27037 <td>
27038 <div>
27039 <p>foo</p>
27040 </div>
27041 </td>
27042 </tr>
27043 </tbody>
27044 </table>
27045 <p>ok</p>
27046 !!end
27047
27048 !!test
27049 7. Encapsulate foster-parented transclusion content
27050 !!options
27051 parsoid=wt2wt,wt2html
27052 !! wikitext
27053 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27054 !! html/parsoid
27055 <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>
27056 <table>
27057 <tbody>
27058 <tr>
27059 <td>bar</td>
27060 </tr>
27061 </tbody>
27062 </table>
27063 !!end
27064
27065 # Note that the wt is broken on purpose: the = should be {{=}} if you
27066 # don't want it to be a template parameter key.
27067 !!test
27068 8. Encapsulate foster-parented transclusion content
27069 !!options
27070 parsoid=wt2wt,wt2html
27071 !! wikitext
27072 {{echo|a
27073 }}{|{{echo|style='color:red'}}
27074 |-
27075 |b
27076 |}
27077 !! html/parsoid
27078 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27079 <span> </span>
27080 <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>
27081 <table>
27082 <tbody>
27083 <tr>
27084 <td>b</td>
27085 </tr>
27086 </tbody>
27087 </table>
27088 !!end
27089
27090 !!test
27091 9. Encapsulate foster-parented transclusion content
27092 !!options
27093 parsoid=wt2wt,wt2html
27094 !! wikitext
27095 <table>{{echo|hi</table>hello}}
27096 !! html/parsoid
27097 <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>
27098 !!end
27099
27100 !!test
27101 Table in fosterable position
27102 !!options
27103 parsoid=wt2html
27104 !! wikitext
27105 {{OpenTable}}
27106 <div>
27107 {|
27108 |}
27109 </div>
27110 |}
27111 !! html/parsoid
27112 <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">
27113 </span>
27114 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27115
27116 <table>
27117 </table>
27118 !!end
27119
27120 # Parsoid only for T66747
27121 !! test
27122 Properly encapsulate empty-content transclusions in fosterable positions
27123 !! wikitext
27124 <table>
27125 {{#if:|
27126 <td>foo</td>
27127 }}
27128 </table>
27129 !! html/parsoid
27130 <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"}]]}'>
27131
27132 </table>
27133 !! end
27134
27135 !! test
27136 Always encapsulate foster box when template range is expanded to table
27137 !! options
27138 parsoid=wt2wt
27139 !! wikitext
27140 {|
27141 hello
27142 {{OpenTable}}
27143 |}
27144 !! html/parsoid
27145
27146 !! end
27147
27148 !! test
27149 T115289: Unclosed table
27150 !! wikitext
27151 {{echo|<table>}}<!--c-->[[Category:Two]]
27152 !! html/parsoid
27153 <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>
27154 !! end
27155
27156 !! test
27157 T115289: Don't migrate newlines out of tables with fostered content
27158 !! wikitext
27159 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27160 !! html/parsoid
27161 <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>
27162 !! end
27163
27164 !! test
27165 T73074: More fostering fun
27166 !! wikitext
27167 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27168 !! html/parsoid
27169 <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>
27170 !! end
27171
27172 !!test
27173 Support <object> element with .data attribute
27174 !!options
27175 parsoid=html2wt
27176 !! html/parsoid
27177 <object data="test.swf"></object>
27178 !! wikitext
27179 <object data="test.swf"></object>
27180 !!end
27181
27182 !! test
27183 Don't block XML namespace declaration
27184 !! wikitext
27185 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27186 !! html/php
27187 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27188 </p>
27189 !! html/parsoid
27190 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27191 !! end
27192
27193 # -----------------------------------------------------------------
27194 # The following section of tests are primarily to spec requirements
27195 # around Parsoid's serialization (old, new, edited content)
27196 #
27197 # All these tests are marked Parsoid html2wt and html2html only
27198 # ----------------------------------------------------------------
27199
27200 !! test
27201 Ignore rel attribute in a-tags during serialization to url-links
27202 !! options
27203 parsoid=html2wt
27204 !! html/parsoid
27205 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27206 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27207 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27208 !! wikitext
27209 http://en.wikipedia.org/wiki/Foobar
27210 http://en.wikipedia.org/wiki/Foobar
27211 http://en.wikipedia.org/wiki/Foobar
27212 !! end
27213
27214 # 'mi' is a localinterwiki prefix as well as a language
27215 !! test
27216 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27217 !! options
27218 parsoid=html2wt
27219 !! html/parsoid
27220 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27221 !! wikitext
27222 [[Foo]]
27223 !! end
27224
27225 !! test
27226 Parsoid should accept interwiki shortcuts
27227 !! options
27228 parsoid=html2wt
27229 !! html/parsoid
27230 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27231 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27232 <a href='./fr:Foo'>Foo</a></p>
27233 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27234 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27235 <a href='fr%3AFoo'>Foo</a></p>
27236 <p><a href='FR%3AFoo'>Foo</a>
27237 <a href='./FR:Foo'>Foo</a></p>
27238 !! wikitext
27239 [[:fr:Foo|Foo]]
27240 [[:fr:Foo|Foo]]
27241 [[:fr:Foo|Foo]]
27242
27243 [[:fr:Foo|Foo]]
27244 [[:fr:Foo|Foo]]
27245 [[:fr:Foo|Foo]]
27246
27247 [[:fr:Foo|Foo]]
27248 [[:fr:Foo|Foo]]
27249 !! end
27250
27251 !! test
27252 Parsoid should not accept invalid interwiki shortcuts
27253 !! options
27254 parsoid=html2wt
27255 !! html/parsoid
27256 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27257 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27258 <a href='news:Foo'>Foo</a></p>
27259 !! wikitext
27260 [news:Foo Foo]
27261 [news:Foo Foo]
27262 [news:Foo Foo]
27263 !! end
27264
27265 # See T93839
27266 !! test
27267 New wikilinks should be serialized properly
27268 !! options
27269 parsoid=html2wt
27270 !! html/parsoid
27271 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27272 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27273 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27274 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27275 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27276 !! wikitext
27277 [[Foo]]
27278 [[Foo]]
27279 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27280 http://en.wikipedia.org/wiki/Foo
27281 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27282 !! end
27283
27284 !! test
27285 New wiki links (href variations)
27286 !! options
27287 parsoid=html2wt
27288 !! html/parsoid
27289 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27290 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27291 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27292 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27293 !! wikitext
27294 [[Foo_bar]]
27295 [[Foo_bar]]
27296 [[Foo_bar]]
27297 [[Toxine bactérienne]]
27298 !! end
27299
27300 !! test
27301 New wiki links (content string variations)
27302 !! options
27303 parsoid=html2wt
27304 !! html/parsoid
27305 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27306 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27307 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27308 !! wikitext
27309 [[Foo_bar]]
27310 [[Foo bar]]
27311 [[Foo_bar|./Foo_bar]]
27312 !! end
27313
27314 !! test
27315 New category links (href variations)
27316 !! options
27317 parsoid=html2wt
27318 !! html/parsoid
27319 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27320 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27321 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27322 !! wikitext
27323 [[Category:Toxine bactérienne]]
27324 [[Category:Toxine bactérienne]]
27325 [[Category:Toxine bactérienne]]
27326 !! end
27327
27328 !! test
27329 New sol transparent links don't need indent-pre nowiki protection
27330 !! options
27331 parsoid=html2wt
27332 language=de
27333 !! html/parsoid
27334 <link rel="mw:PageProp/redirect" href="./Main_Page">
27335 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27336 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27337 !! wikitext
27338 #WEITERLEITUNG [[Main Page]]
27339 <!-- this is good --> [[Category:Good]]
27340 <!-- this is great --> [[Kategorie:Great]]
27341 !! end
27342
27343 !! test
27344 New interlanguage links (href variations)
27345 !! options
27346 parsoid=html2wt
27347 !! html/parsoid
27348 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27349 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27350 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27351 !! wikitext
27352 [[es:Toxine bactérienne]]
27353 [[es:Toxine_bactérienne]]
27354 [[es:Toxine_bactérienne]]
27355 !! end
27356
27357 !! test
27358 Image: Modifying size of an image (1)
27359 !! options
27360 parsoid={
27361 "modes": ["wt2wt"],
27362 "changes": [
27363 ["img[height]", "attr", "height", "22"],
27364 ["img[width]", "attr", "width", "200"]
27365 ]
27366 }
27367 !! wikitext
27368 [[Image:Foobar.jpg|230x230px]]
27369 !! wikitext/edited
27370 [[Image:Foobar.jpg|200x200px]]
27371 !!end
27372
27373 !! test
27374 Image: Modifying size of an image (2)
27375 !! options
27376 parsoid={
27377 "modes": ["wt2wt"],
27378 "changes": [
27379 ["img[height]", "attr", "height", "100"],
27380 ["img[width]", "attr", "width", "500"]
27381 ]
27382 }
27383 !! wikitext
27384 [[Image:Foobar.jpg|230x230px]]
27385 !! wikitext/edited
27386 [[Image:Foobar.jpg|500x500px]]
27387 !!end
27388
27389 # Change in size is ignored so long as class='mw-default-size'
27390 !! test
27391 Image: Modifying size of an image (3)
27392 !! options
27393 parsoid={
27394 "modes": ["wt2wt"],
27395 "changes": [
27396 ["figure[class]", "removeClass", "mw-default-size"],
27397 ["figure img", "attr", "height", "19"],
27398 ["figure img", "attr", "width", "170"]
27399 ]
27400 }
27401 !! wikitext
27402 [[Image:Foobar.jpg|thumb]]
27403 !! wikitext/edited
27404 [[Image:Foobar.jpg|thumb|170x170px]]
27405 !!end
27406
27407 !! test
27408 Image: Modifying alignment of an image (T50665)
27409 !! options
27410 parsoid={
27411 "modes": ["wt2wt"],
27412 "changes": [
27413 ["figure[class]", "removeClass", "mw-halign-right"],
27414 ["figure[class]", "addClass", "mw-halign-left"]
27415 ]
27416 }
27417 !! wikitext
27418 [[Image:Foobar.jpg|thumb|caption|right]]
27419 !! wikitext/edited
27420 [[Image:Foobar.jpg|thumb|caption|left]]
27421 !! end
27422
27423 !! test
27424 Image: Modifying mw-default-size of an frameless image (T64805)
27425 !! options
27426 parsoid={
27427 "modes": ["wt2wt"],
27428 "changes": [
27429 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27430 ]
27431 }
27432 !! wikitext
27433 [[Image:Foobar.jpg|frameless|right]]
27434 !! wikitext/edited
27435 [[Image:Foobar.jpg|frameless|right|220x220px]]
27436 !! end
27437
27438 !! test
27439 Image: Modifying valign of an image (T51221)
27440 !! options
27441 parsoid={
27442 "modes": ["wt2wt"],
27443 "changes": [
27444 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27445 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27446 ]
27447 }
27448 !! wikitext
27449 [[File:Foobar.jpg|20px|middle]]
27450 !! wikitext/edited
27451 [[File:Foobar.jpg|20px|text-top]]
27452 !! end
27453
27454 !! test
27455 Image: Modifying alt attribute of an image (T58400)
27456 !! options
27457 parsoid={
27458 "modes": ["wt2wt"],
27459 "changes": [
27460 ["img[alt]", "attr", "alt", "some alternate edited text"]
27461 ]
27462 }
27463 !! wikitext
27464 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27465 !! wikitext/edited
27466 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27467 !!end
27468
27469 !! test
27470 Image: Modifying caption of an image
27471 !! options
27472 parsoid={
27473 "modes": ["wt2wt"],
27474 "changes": [
27475 ["figcaption", "text", "new caption"]
27476 ]
27477 }
27478 !! wikitext
27479 [[Image:Foobar.jpg|thumb|original caption]]
27480 !! wikitext/edited
27481 [[Image:Foobar.jpg|thumb|new caption]]
27482 !!end
27483
27484 !! test
27485 Image: empty alt attribute (T50924)
27486 !! options
27487 parsoid
27488 !! wikitext
27489 [[File:Foobar.jpg|thumb|alt=|bar]]
27490 !! html
27491 <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>
27492 !! end
27493
27494 !! test
27495 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27496 !! options
27497 parsoid=html2wt
27498 language=ar
27499 disabled
27500 !! html/parsoid
27501 <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>
27502 !! wikitext
27503 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27504 !! end
27505
27506 !! test
27507 Image: Block level image should have \n before and after
27508 !! wikitext
27509 123
27510 [[File:Foobar.jpg|right|thumb|150x150px]]
27511 456
27512 !! html/parsoid
27513 <p>123</p>
27514 <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>
27515 <p>456</p>
27516 !! end
27517
27518 !! test
27519 Image: New block level image should have \n before and after (existing content)
27520 !! wikitext
27521 123
27522 [[File:Foobar.jpg|right|thumb|150x150px]]
27523 456
27524 !! html/parsoid
27525 <p>123</p>
27526 <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>
27527 <p>456</p>
27528 !! end
27529
27530 !! test
27531 Image: upright option (parsoid)
27532 !! wikitext
27533 [[File:Foobar.jpg|thumb|upright|caption]]
27534 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27535 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27536 !! html/parsoid
27537 <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>
27538 <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>
27539 <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>
27540 !! end
27541
27542 !! test
27543 Image: upright option is ignored on inline and frame images (parsoid)
27544 !! wikitext
27545 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27546 !! html/parsoid
27547 <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>
27548 !! end
27549
27550 !! test
27551 Image: in template parameter with empty parameter
27552 !! wikitext
27553 {{echo|[[File:Foobar.jpg|link=]]}}
27554 !! html/parsoid
27555 <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>
27556 !! end
27557
27558 !! test
27559 Image: from basic HTML (1)
27560 !! options
27561 parsoid=html2wt
27562 !! html/parsoid
27563 <span typeof="mw:Image">
27564 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27565 </span>
27566 !! wikitext
27567 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27568 !! end
27569
27570 !! test
27571 Image: from basic HTML (2)
27572 !! options
27573 parsoid=html2wt
27574 !! html/parsoid
27575 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27576 !! wikitext
27577 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27578 !! end
27579
27580 !! test
27581 Image: from basic HTML (3)
27582 !! options
27583 parsoid=html2wt
27584 !! html/parsoid
27585 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27586 !! wikitext
27587 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27588 !! end
27589
27590 !! test
27591 Image: from basic HTML (4)
27592 !! options
27593 parsoid=html2wt
27594 !! html/parsoid
27595 <img src="./File:Foobar.jpg">
27596 !! wikitext
27597 [[File:Foobar.jpg|link=]]
27598 !! end
27599
27600 !! test
27601 Image: Invalid title as link
27602 !! wikitext
27603 [[File:Foobar.jpg|link=<]]
27604 !! html/php
27605 <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>
27606 </p>
27607 !! html/parsoid
27608 <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>
27609 !! end
27610
27611 !! test
27612 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27613 !! options
27614 parsoid=html2wt
27615 !! html/parsoid
27616 <ul>
27617 <li><p>foo</p></li>
27618 </ul>
27619 !! wikitext
27620 * foo
27621 !! end
27622
27623 !! test
27624 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27625 !! options
27626 parsoid=html2wt
27627 !! html/parsoid
27628 <ul> <li>foo</li></ul>
27629 !! wikitext
27630 * foo
27631 !! end
27632
27633 !! test
27634 Don't strip leading whitespace when handling indent-pre suppressing tags
27635 !! options
27636 parsoid=html2wt
27637 !! html/parsoid
27638 <table>
27639 <tr><td> indented row</td></tr>
27640 </table>
27641 <blockquote><p>
27642 <b>This is very bold of you!</b>
27643 </p>
27644 <table><tr><td>
27645 indented cell (no pre-wrapping!)
27646 </td></tr></table>
27647 </blockquote>
27648 <p>foo</p>
27649 <div>bar</div>
27650 !! wikitext
27651 {|
27652 | indented row
27653 |}
27654 <blockquote>
27655 '''This is very bold of you!'''
27656
27657 {|
27658 |
27659 indented cell (no pre-wrapping!)
27660 |}
27661 </blockquote>
27662 foo
27663 <div>bar</div>
27664 !! end
27665
27666 !! test
27667 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27668 !! options
27669 parsoid=html2wt
27670 !! html/parsoid
27671 <p>foo</p>
27672 <span>bar</span>
27673
27674 <span>foo2
27675 </span>bar2
27676
27677 <div>foo</div>
27678 <span>bar</span>
27679
27680 <div>
27681 <span>foo</span>
27682 </div>
27683 !! wikitext
27684 foo
27685
27686 <span>bar</span>
27687
27688 <span>foo2
27689 <nowiki> </nowiki></span>bar2
27690
27691 <div>foo</div>
27692 <nowiki> </nowiki><span>bar</span>
27693
27694 <div>
27695 <nowiki> </nowiki><span>foo</span>
27696 </div>
27697 !! end
27698
27699 !! test
27700 Lists: Dont insert newlines in a serialized list item.
27701 !! options
27702 parsoid=html2wt
27703 !! html/parsoid
27704 <ul><li>a<br>b</li><li>c</li></ul>
27705 !! wikitext
27706 * a<br>b
27707 * c
27708 !! end
27709
27710 !! test
27711 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27712 !! options
27713 parsoid={
27714 "modes": ["html2wt"],
27715 "scrubWikitext": false
27716 }
27717 !! html/parsoid
27718 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27719 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27720
27721 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27722 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27723
27724 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27725
27726 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27727 !! wikitext
27728 == hello there [[Category:A1]] ==
27729
27730 == [[Category:A2]] hi pal ==
27731
27732 == <!--foo--> [[Category:A3]] how goes it ==
27733
27734 == it goes well [[Category:A4]] <!--bar--> ==
27735
27736 ==howdy [[Category:A5]]==
27737
27738 == __TOC__ ok ==
27739 !! end
27740
27741 !! test
27742 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27743 !! options
27744 parsoid={
27745 "modes": ["html2wt"],
27746 "scrubWikitext": true
27747 }
27748 !! html/parsoid
27749 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27750 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27751
27752 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27753 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27754
27755 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27756 !! wikitext
27757 == hello there ==
27758 [[Category:A1]]
27759 [[Category:A2]]
27760
27761 == hi pal ==
27762
27763 <!--foo--> [[Category:A3]]
27764
27765 == how goes it ==
27766
27767 == it goes well ==
27768 [[Category:A4]] <!--bar-->
27769
27770 __TOC__
27771
27772 == ok ==
27773 !! end
27774
27775 !! test
27776 Headings: Don't hoist metas that come from templates
27777 !! options
27778 parsoid={
27779 "modes": ["html2wt"],
27780 "scrubWikitext": true
27781 }
27782 !! html/parsoid
27783 <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>
27784 !! wikitext
27785 == {{echo|foo [[Category:Foo]]}} ==
27786 !! end
27787
27788 !! test
27789 Headings: Category in ref isn't hoisted
27790 !! options
27791 parsoid={
27792 "modes": ["html2wt"],
27793 "scrubWikitext": true
27794 }
27795 !! html/parsoid
27796 <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>
27797
27798 <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>
27799 !! wikitext
27800 == foo <ref>bar
27801 [[Category:Baz]] </ref> ==
27802
27803 <references />
27804 !! end
27805
27806 !! test
27807 Parsoid: Serialize positional parameters with = in them as named parameter
27808 !! options
27809 parsoid=html2wt
27810 !! html/parsoid
27811 <p about="#mwt1" typeof="mw:Transclusion"
27812 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27813
27814 <p about="#mwt1" typeof="mw:Transclusion"
27815 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27816
27817 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27818 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27819 <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>
27820 !! wikitext
27821 {{echo|1=f=oo}}
27822
27823 {{echo|1=f=oo|2=bar}}
27824
27825 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27826 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27827 {{echo|<nowiki>f=oo</nowiki>|bar}}
27828 !! end
27829
27830 !! test
27831 Parsoid: Serialize positional parameters with = in extlink as named parameter
27832 !! options
27833 parsoid=html2wt
27834 !! html/parsoid
27835 <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>
27836 !! wikitext
27837 {{echo|1=http://stuff?is=ok}}
27838 !! end
27839
27840 !! test
27841 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27842 !! options
27843 parsoid=html2wt
27844 !! html/parsoid
27845 <div>a<p>b</p></div>
27846 <div>a
27847 <p>b</p></div>
27848 <div>
27849 a
27850 <p>b</p></div>
27851 !! wikitext
27852 <div>a
27853 b
27854 </div>
27855 <div>a
27856 b
27857 </div>
27858 <div>
27859 a
27860
27861 b
27862 </div>
27863 !! end
27864
27865 !! test
27866 Substrings resembling wikitext in hrefs should not get nowiki escapes
27867 !! options
27868 parsoid=html2wt
27869 !! html/parsoid
27870 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27871 !! wikitext
27872 [[Foo''bar''baz]]
27873 !! end
27874
27875 !! test
27876 Enforce single-line context in the serializer
27877 !! options
27878 parsoid=html2wt
27879 !! html/parsoid
27880 <h2>testing
27881 123</h2>
27882
27883 <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">
27884 </span><span about="#mwt1">you</span> </h2>
27885
27886 <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>
27887
27888 <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
27889 there</span></li></ol>
27890
27891 <ul><li>asd
27892 sdf</li></ul>
27893
27894 <ul><li>foo
27895 bar
27896 baz</li>
27897 <li>foo <b>bar</b>
27898 baz</li></ul>
27899
27900 <dl><dt>hi
27901 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27902 ho</dd></dl>
27903
27904 <dl><dd> <table>
27905 <tbody><tr><td> ha
27906 ha
27907 ha</td></tr>
27908 </tbody></table></dd></dl>
27909 !! wikitext
27910 == testing 123 ==
27911
27912 == hi {{bogus|there
27913 you}} ==
27914
27915 == foo <ref>hello
27916 there</ref> ==
27917
27918 <references />
27919
27920 * asd sdf
27921
27922 * foo bar baz
27923 * foo '''bar''' baz
27924
27925 ; hi ho : hi ho
27926
27927 : {|
27928 | ha
27929 ha
27930 ha
27931 |}
27932 !! end
27933
27934 !! test
27935 Serialize new placeholder space without spans
27936 !! options
27937 parsoid=html2wt
27938 !! html/parsoid
27939 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27940
27941 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27942
27943 <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>
27944 !! wikitext
27945 foo : bar
27946
27947 foo : bar
27948
27949 <ref>foo : bar</ref>ok
27950 !! end
27951
27952
27953 #-----------------------
27954 # Tag minimization tests
27955 #-----------------------
27956
27957 !! test
27958 1. I/B quote minimization: wikitext-only tags should be combined
27959 !! options
27960 parsoid=html2wt
27961 !! html/parsoid
27962 <p><i>A</i><i>B</i></p>
27963 <p><b>A</b><b>B</b></p>
27964 <p><i>A</i><b><i>B</i></b></p>
27965 <p><b>A</b><i><b>B</b></i></p>
27966 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27967 <p><i><b>A</b></i><i><b>B</b></i></p>
27968 <p><i><b>A</b></i><b><i>B</i></b></p>
27969 <p><b><i>A</i></b><i><b>B</b></i></p>
27970 !! wikitext
27971 ''AB''
27972
27973 '''AB'''
27974
27975 ''A'''B'''''
27976
27977 '''A''B'''''
27978
27979 '''A''BC''D'''
27980
27981 '''''AB'''''
27982
27983 '''''AB'''''
27984
27985 '''''AB'''''
27986 !! end
27987
27988 !! test
27989 2. I/B quote minimization: wikitext and html tags should not be combined
27990 !! options
27991 parsoid=html2wt
27992 !! html/parsoid
27993 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27994 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27995 !! wikitext
27996 ''A''<i>B</i>
27997
27998 ''A''<nowiki/>'''<i>B</i>'''
27999 !! end
28000
28001 !! test
28002 3. I/B quote minimization: templated content stops minimization
28003 !! options
28004 parsoid=html2wt
28005 !! html/parsoid
28006 <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>
28007 <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>
28008 !! wikitext
28009 ''A''{{echo|''B''}}
28010
28011 ''A''{{echo|'''''B'''''}}
28012 !! end
28013
28014 !! test
28015 4. I/B quote minimization: new content should be mimimized with adjacent old content
28016 !! options
28017 parsoid=html2wt
28018 !! html/parsoid
28019 <p><i>A</i><i>B</i></p>
28020 <p><b>A</b><b>B</b></p>
28021 <p><i>A</i><b><i>B</i></b></p>
28022 !! wikitext
28023 ''AB''
28024
28025 '''AB'''
28026
28027 ''A'''B'''''
28028 !! end
28029
28030 !! test
28031 5a. Merge adjacent quote nodes if they've been edited
28032 !! options
28033 parsoid={
28034 "modes": ["wt2wt", "selser"],
28035 "changes": [
28036 ["p", "contents", "remove", ":contains('b')"]
28037 ]
28038 }
28039 !! wikitext
28040 ''a''b''c''
28041 !! wikitext/edited
28042 ''ac''
28043 !! end
28044
28045 !! test
28046 5b. Merge adjacent quote nodes if they've been edited
28047 !! options
28048 parsoid={
28049 "modes": ["wt2wt", "selser"],
28050 "changes": [
28051 ["#x", "remove"]
28052 ]
28053 }
28054 !! wikitext
28055 ''a''<span id="x">b</span>''c''
28056 !! wikitext/edited
28057 ''ac''
28058 !! end
28059
28060 !! test
28061 1. Merge adjacent link nodes as long as at least one element is new
28062 !! options
28063 parsoid={
28064 "modes": ["html2wt"],
28065 "scrubWikitext": true
28066 }
28067 !! html/parsoid
28068 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28069 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28070 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28071 !! wikitext
28072 [[Football]]
28073 [[Football]]
28074 [[Football|Foot]][[Football|ball]]
28075 !! end
28076
28077 !! test
28078 2. Merge adjacent link nodes and enable additional normalizations
28079 !! options
28080 parsoid={
28081 "modes": ["html2wt"],
28082 "scrubWikitext": true
28083 }
28084 !! html/parsoid
28085 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28086 !! wikitext
28087 [[Football|''Football'']]
28088 !! end
28089
28090 !! test
28091 3. Don't merge adjacent link nodes if scrubWikitext is false
28092 !! options
28093 parsoid={
28094 "modes": ["html2wt"],
28095 "scrubWikitext": false
28096 }
28097 !! html/parsoid
28098 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28099 !! wikitext
28100 [[Football|Foot]][[Football|ball]]
28101 !! end
28102
28103 #------------------------------
28104 # End of tag minimization tests
28105 #------------------------------
28106
28107 !!test
28108 T56262: New entities
28109 !! options
28110 parsoid=html2wt
28111 !! html/parsoid
28112 <span typeof="mw:Entity">&nbsp;</span>
28113 !! wikitext
28114 &nbsp;
28115 !! end
28116
28117 ## Note that there is no wikitext output for 'unknownproperty' ##
28118 ## Unknown magic words are silently dropped ##
28119
28120 !! test
28121 Magic words
28122 !! options
28123 parsoid=html2wt
28124 !! html/parsoid
28125 <meta property='mw:PageProp/toc' />
28126 <meta property='mw:PageProp/notoc' />
28127 <meta property='mw:PageProp/forcetoc' />
28128 <meta property='mw:PageProp/index' />
28129 <meta property='mw:PageProp/noindex' />
28130 <meta property='mw:PageProp/nogallery' />
28131 <meta property='mw:PageProp/noeditsection' />
28132 <meta property='mw:PageProp/notitleconvert' />
28133 <meta property='mw:PageProp/nocontentconvert' />
28134 <meta property='mw:PageProp/unknownproperty' />
28135 !! wikitext
28136 __TOC__
28137 __NOTOC__
28138 __FORCETOC__
28139 __INDEX__
28140 __NOINDEX__
28141 __NOGALLERY__
28142 __NOEDITSECTION__
28143 __NOTITLECONVERT__
28144 __NOCONTENTCONVERT__
28145 !! end
28146
28147 !! test
28148 Consecutive <pre>s should not get merged
28149 !! options
28150 parsoid=html2wt,html2html
28151 !! html/parsoid
28152 <pre>a</pre><pre>b</pre>
28153
28154 <pre>c
28155 </pre><pre>
28156 d</pre>
28157
28158 <pre>e
28159
28160 </pre><pre>
28161
28162 f</pre>
28163 !! wikitext
28164 a
28165
28166 b
28167
28168 c
28169
28170 d
28171
28172 e
28173
28174
28175
28176 f
28177 !! end
28178
28179 !! test
28180 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28181 !! options
28182 parsoid=html2wt
28183 !! html/parsoid
28184 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28185 !! wikitext
28186 [[Special:BookSources/1234567890|ISBN 1234567895]]
28187 !! end
28188
28189 !! test
28190 Edited RFC links not serializable as RFC links should serialize as extlinks
28191 !! options
28192 parsoid=html2wt
28193 !! html/parsoid
28194 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28195 !! wikitext
28196 [https://tools.ietf.org/html/rfc123 New RFC]
28197 !! end
28198
28199 !! test
28200 Edited PMID links not serializable as PMID links should serialize as extlinks
28201 !! options
28202 parsoid=html2wt
28203 !! html/parsoid
28204 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28205 !! wikitext
28206 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28207 !! end
28208
28209 !! test
28210 WTS of autolinks with trailing/surrounding context
28211 !! options
28212 parsoid=html2wt
28213 !! html/parsoid
28214 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28215 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28216 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28217 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28218 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28219 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28220 !! wikitext
28221 http://cscott.net'''foo'''
28222
28223 http://cscott.net<b>foo</b>
28224
28225 '''http://cscott.net'''
28226
28227 '''http://cscott.net '''
28228
28229 '''http://cscott.net<nowiki/>x'''
28230
28231 http://cscott.net<nowiki/>x
28232 !! end
28233
28234 !! test
28235 WTS of autolinks with nowikis (round-trip)
28236 !! wikitext
28237 x<nowiki/>http://cscott.net<nowiki/>x
28238 !! html/parsoid
28239 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28240 !! end
28241
28242 # this is the "easy" test because it leaves in place all the
28243 # data-parsoid information indicating this is an autolink
28244 !! test
28245 WTS of autolinks with escapes (editing)
28246 !! options
28247 parsoid={
28248 "modes": ["wt2wt"],
28249 "changes": [
28250 [ "span", "remove" ]
28251 ]
28252 }
28253 !! wikitext
28254 x<nowiki/>http://cscott.net<nowiki/>x
28255 !! wikitext/edited
28256 x<nowiki/>http://cscott.net<nowiki/>x
28257 !! end
28258
28259 !! test
28260 WTS of edited autolink-like text (T103364)
28261 !! options
28262 parsoid={
28263 "modes": ["wt2wt"],
28264 "changes": [
28265 [ "span[typeof]", "removeAttr", "typeof" ]
28266 ]
28267 }
28268 !! wikitext
28269 Not a link: <nowiki>http://example.com</nowiki>.
28270 !! wikitext/edited
28271 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28272 !! end
28273
28274 !! test
28275 WTS of newly-authored autolink-like text (T103364)
28276 !! options
28277 parsoid=html2wt
28278 !! html/parsoid
28279 <p>http://example.com is not a link.</p>
28280 !! wikitext
28281 <nowiki>http://example.com</nowiki> is not a link.
28282 !! end
28283
28284 !! test
28285 WTS of autolink-like text after an autolink (T108563)
28286 !! options
28287 parsoid=html2wt
28288 !! html/parsoid
28289 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28290 !! wikitext
28291 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28292 !! end
28293
28294 !! test
28295 Magic links inside links (not autolinked)
28296 !! wikitext
28297 [[Foo|http://example.com]]
28298 [[Foo|RFC 1234]]
28299 [[Foo|PMID 1234]]
28300 [[Foo|ISBN 123456789x]]
28301
28302 [http://foo.com http://example.com]
28303 [http://foo.com RFC 1234]
28304 [http://foo.com PMID 1234]
28305 [http://foo.com ISBN 123456789x]
28306 !! html+tidy
28307 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28308 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28309 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28310 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28311 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28312 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28313 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28314 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28315 </p>
28316 !! html/parsoid
28317 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28318 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28319 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28320 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28321
28322 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28323 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28324 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28325 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28326 !! end
28327
28328 !! test
28329 Magic links inside image captions (autolinked)
28330 !! wikitext
28331 [[File:Foobar.jpg|thumb|http://example.com]]
28332 [[File:Foobar.jpg|thumb|RFC 1234]]
28333 [[File:Foobar.jpg|thumb|PMID 1234]]
28334 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28335 !! html+tidy
28336 <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>
28337 <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>
28338 <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>
28339 <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>
28340 !! html/parsoid
28341 <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>
28342 <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>
28343 <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>
28344 <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>
28345 !! end
28346
28347 !! test
28348 WTS of magic word text (T109371)
28349 !! options
28350 parsoid=html2wt
28351 !! html/parsoid
28352 <p>RFC 1234</p>
28353 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28354 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28355 !! wikitext
28356 <nowiki>RFC 1234</nowiki>
28357
28358 [http://foo.com RFC 1234]
28359
28360 [[Foo|RFC 1234]]
28361 !! end
28362
28363 !! test
28364 Edited Redirect link should emit a non-piped wikitext link
28365 !! options
28366 parsoid=html2wt
28367 !! html/parsoid
28368 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28369 !! wikitext
28370 #REDIRECT [[Bar]]
28371 !! end
28372
28373 !! test
28374 T75121: Infer extension name from typeOf if data-mw is not present
28375 !! options
28376 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28377 !! html/parsoid
28378 <div typeOf="mw:Extension/foo"></div>
28379 !! wikitext
28380 <foo />
28381 !! end
28382
28383 # Note that the <p> wrapping isn't present in PHP parser output
28384 # The important thing for this test is that P-wrapping doesn't
28385 # interfere with the <nowiki> protection for leading - in <td>
28386 # (which isn't necessary for <th>).
28387 !! test
28388 T88318: p-wrapped dash in table.
28389 !! options
28390 parsoid=html2wt,wt2wt
28391 !! html/parsoid
28392 <table><tbody>
28393 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28394 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28395 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28396 </tbody></table>
28397 !! wikitext
28398 {|
28399 !-
28400 !-
28401 |-
28402 |<nowiki>-</nowiki>
28403 |<nowiki>- </nowiki>
28404 |-
28405 |<small>-</small>
28406 |<br>
28407 -
28408 |<br>
28409 -
28410 |}
28411 !! html/php+tidy
28412 <table>
28413 <tbody><tr>
28414 <th>-
28415 </th>
28416 <th>-
28417 </th></tr>
28418 <tr>
28419 <td>-
28420 </td>
28421 <td>-
28422 </td></tr>
28423 <tr>
28424 <td><small>-</small>
28425 </td>
28426 <td><br />
28427 <p>-
28428 </p>
28429 </td>
28430 <td><br />
28431 <p>-
28432 </p>
28433 </td></tr></tbody></table>
28434 !! end
28435
28436 !! test
28437 T149209: WTS: Handle newlines in table cells properly
28438 !! options
28439 parsoid=html2wt
28440 !! html/parsoid
28441 <table>
28442 <tbody>
28443 <tr><td>a
28444 b
28445 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28446 <tr><td><p>x</p>
28447 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28448 </tbody></table>
28449 <table>
28450 <tbody>
28451 <tr><th>a
28452 b
28453 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28454 <tr><th><p>x</h>
28455 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28456 </tbody></table>
28457 !! wikitext
28458 {|
28459 |a
28460 b
28461 |c
28462 |-
28463 |x
28464 {{!}}y
28465 |}
28466 {|
28467 !a
28468 b
28469 !c
28470 |-
28471 !x
28472 !y
28473 |}
28474 !! end
28475
28476 !! test
28477 T149209: Selser: Handle newlines in table cells properly
28478 !! options
28479 parsoid={
28480 "modes": ["selser"],
28481 "changes": [
28482 [ "#h1", "html", "a\nb\n" ],
28483 [ "#h2", "html", "a\nb\n" ],
28484 [ "#c1", "html", "a\nb\n" ],
28485 [ "#c2", "html", "<p>a</p>" ],
28486 [ "#c3", "html", "<p>a</p>" ],
28487 [ "#c4", "html", "edit-me<p>a</p>" ]
28488 ]
28489 }
28490 !! wikitext
28491 {|
28492 ! id="h1" |edit-me!!1
28493 |-
28494 ! id="h2" |edit-me||2
28495 |-
28496 | id="c1" |edit-me||3
28497 |-
28498 | id="c2" |edit-me||4
28499 |-
28500 | id="c3" |edit-me||p||q||r
28501 |-
28502 | id="c4" |edit-me||p||q||r
28503 |}
28504 !! wikitext/edited
28505 {|
28506 ! id="h1" |a
28507 b
28508 !1
28509 |-
28510 ! id="h2" |a
28511 b
28512 !2
28513 |-
28514 | id="c1" |a
28515 b
28516 |3
28517 |-
28518 | id="c2" |a
28519 |4
28520 |-
28521 | id="c3" |a
28522 |p||q||r
28523 |-
28524 | id="c4" |edit-me
28525 a
28526 |p||q||r
28527 |}
28528 !! end
28529
28530 !! test
28531 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28532 !! options
28533 parsoid=html2wt
28534 !! html/parsoid
28535 <table id='mwAb'>
28536 <td id='mwAc'>foo</td>
28537 <td id='serialize-this'>bar</td>
28538 </table>
28539 !! wikitext
28540 {|
28541 |foo
28542 | id="serialize-this" |bar
28543 |}
28544 !! end
28545
28546 !! test
28547 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28548 !! options
28549 parsoid=html2wt
28550 !! html/parsoid
28551 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28552 !! wikitext
28553 <div id="hello">ok</div>
28554 !! end
28555
28556 !! test
28557 WTS change modes
28558 !! options
28559 parsoid={
28560 "modes": ["wt2wt"],
28561 "changes": [
28562 [ "#xyz", "before", "<b>before</b> stuff " ],
28563 [ "#xyz", "after", " stuff <i>after</i>" ],
28564 [ "#xyz", "html", "x <b>y</b> z" ]
28565 ]
28566 }
28567 !! wikitext
28568 <span id="xyz">hello</span>
28569 !! wikitext/edited
28570 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28571 !! end
28572
28573 !! test
28574 Never serialize a-tag as html, regardless of what data-parsoid has to say
28575 !! options
28576 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28577 !! html/parsoid
28578 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28579 !! wikitext
28580 [[Foo]]
28581 !! end
28582
28583 ## SSS FIXME: This is broken output nevertheless.
28584 ## What might be a reasonable non-broken output for this?
28585 ## This is an edge case unlikely to be seen in production
28586 ## that I am not wasting more time on this right now.
28587 !! test
28588 Never serialize a-tag as html, no matter what attributes it has
28589 !! options
28590 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28591 !! html/parsoid
28592 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28593 !! wikitext
28594 [http://boo.org http://boohoo.org]
28595 !! end
28596
28597 # Misnested is an indication that selser can reuse the source but these have
28598 # shown to sneak through on occasion. See T101768.
28599 # The original wikitext here is: [http://test.com [[one]] two three]
28600 !! test
28601 Strip span tags added to mark misnested links
28602 !! options
28603 parsoid=html2wt
28604 !! html/parsoid
28605 <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>
28606 !! wikitext
28607 [http://test.com][[one]] two three
28608 !! end
28609
28610 !! test
28611 Catch regression when unpacking misnested links
28612 !! options
28613 parsoid=wt2html
28614 !! wikitext
28615 {{echo|hi}}[http://example.com [[ho]]]
28616 !! html/parsoid
28617 <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>
28618 !! end
28619
28620 !! test
28621 Catch regression when unpacking with trailing content
28622 !! wikitext
28623 {{echo|Foo <references/> bar}}
28624 !! html/parsoid
28625 <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>
28626 !! end
28627
28628 !! test
28629 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28630 !! options
28631 parsoid=html2wt
28632 !! html/parsoid
28633 <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|}"]}'>
28634 <tbody><tr><td>d
28635 </td></tr>
28636 </tbody></table>
28637 !! wikitext
28638 {{echo|a}}
28639 {|{{echo|c
28640 {{!}}d
28641 }}
28642 |}
28643 !! end
28644
28645 ## This test verifies the presence and computation of this attribute indirectly
28646 ## by making an edit and ensuring that the serialization is correct (which it would be
28647 ## only if firstWikitextNode is properly set).
28648 !! test
28649 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28650 !! options
28651 parsoid= {
28652 "modes": ["wt2wt"],
28653 "changes": [
28654 [ "div#x", "remove" ],
28655 [ "div", "before", "<div>new</div>" ]
28656 ]
28657 }
28658 !! wikitext
28659 <div id="x">foo</div>
28660 {|
28661 {{echo|<div>boo</div>
28662 {{!}}b}}
28663 |c
28664 |}
28665 !! wikitext/edited
28666
28667 <div>new</div>
28668 {|
28669 {{echo|<div>boo</div>
28670 {{!}}b}}
28671 |c
28672 |}
28673 !! end
28674
28675 # --------------------------------------------
28676 # Tests spec'ing wikitext serialization norms |
28677 # --------------------------------------------
28678
28679 !! test
28680 Serialize multi-line indent-pre starting with wikitext syntax
28681 !! options
28682 parsoid=html2wt
28683 !! html/parsoid
28684 <pre>* 1
28685 ** 2
28686 * 3</pre>
28687 !! wikitext
28688 * 1
28689 ** 2
28690 * 3
28691 !! end
28692
28693 !! test
28694 1. Categories should always be serialized on their own line
28695 !! options
28696 parsoid=html2wt
28697 !! html/parsoid
28698 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28699 !! wikitext
28700 foo
28701 [[Category:Foo]]
28702 bar
28703 !! end
28704
28705 !! test
28706 2. Categories that are part of templates should not introduce a line break
28707 !! wikitext
28708 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28709 !! html/parsoid
28710 <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>
28711 !! end
28712
28713 # Careful while editing these next 2 tests. There are \u200f characters
28714 # before and after the <link> tags in the HTML and following some
28715 # of the categories in wikitext
28716 # Do not remove these characters in edits.
28717 #
28718 # As part of the serialization, these bidi characters will get stripped.
28719 !! test
28720 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28721 !! options
28722 parsoid={
28723 "modes": ["html2wt"],
28724 "scrubWikitext": true
28725 }
28726 !! html/parsoid
28727 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28728 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28729 !! wikitext
28730 [[קטגוריה:טקסים]]
28731 [[קטגוריה: שיטות משפט]]
28732 !! end
28733
28734 !! test
28735 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28736 !! options
28737 parsoid={
28738 "modes": ["html2wt"],
28739 "scrubWikitext": true
28740 }
28741 !! html/parsoid
28742 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28743 !! wikitext
28744 [[קטגוריה:טקסים]]
28745 ‏y
28746 !! end
28747
28748 !! test
28749 Lists: Add space after bullets
28750 !! options
28751 parsoid=html2wt
28752 !! html/parsoid
28753 <ul>
28754 <li>foo</li>
28755 <li> bar</li>
28756 <li><span> baz</span></li>
28757 </ul>
28758 !! wikitext
28759 * foo
28760 * bar
28761 * <span> baz</span>
28762 !! end
28763
28764 !! test
28765 1. Headings: Add space before/after == (T53744)
28766 !! options
28767 parsoid=html2wt
28768 !! html/parsoid
28769 <h2>foo</h2>
28770 <h2> bar</h2>
28771 <h2>baz </h2>
28772 <h2><span> baz</span></h2>
28773 !! wikitext
28774 == foo ==
28775
28776 == bar ==
28777
28778 == baz ==
28779
28780 == <span> baz</span> ==
28781 !! end
28782
28783 !! test
28784 2. Headings: Add space before/after == even after hoisted content
28785 !! options
28786 parsoid={
28787 "modes": ["html2wt"],
28788 "scrubWikitext": true
28789 }
28790 !! html/parsoid
28791 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28792 !! wikitext
28793 [[Category:A2]]
28794
28795 == ok ==
28796 !! end
28797
28798 !! test
28799 1. Headings: suppress newly created empty headings
28800 !! options
28801 parsoid={
28802 "modes": ["html2wt"],
28803 "scrubWikitext": true
28804 }
28805 !! html/parsoid
28806 <h2></h2>
28807 !! wikitext
28808 !! end
28809
28810 !! test
28811 2. Headings: don't suppress empty headings if scrubWikitext is false
28812 !! options
28813 parsoid=html2wt
28814 !! html/parsoid
28815 <h2></h2>
28816 !! wikitext
28817 ==<nowiki/>==
28818 !! end
28819
28820 !! test
28821 3. Headings: suppress empty headings on edits
28822 !! options
28823 parsoid={
28824 "modes": ["selser"],
28825 "scrubWikitext": true,
28826 "changes": [
28827 [ "#x", "remove"]
28828 ]
28829 }
28830 !! wikitext
28831 ==<span id="x">foo</span>==
28832 !! wikitext/edited
28833 !! end
28834
28835 !! test
28836 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28837 !! options
28838 parsoid={
28839 "modes": ["html2wt"],
28840 "scrubWikitext": true
28841 }
28842 !! html/parsoid
28843 <h2>foo<br/>bar</h2>
28844 <h2>foo <span><br/>bar</span> baz</h2>
28845 !! wikitext
28846 == foo bar ==
28847
28848 == foo <span> bar</span> baz ==
28849 !! end
28850
28851 !! test
28852 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28853 !! options
28854 parsoid={
28855 "modes": ["html2wt"],
28856 "scrubWikitext": false
28857 }
28858 !! html/parsoid
28859 <h2>foo<br/>bar</h2>
28860 !! wikitext
28861 == foo<br> bar ==
28862 !! end
28863
28864 !! test
28865 1. WT Quote Tags: suppress newly created empty style tags
28866 !! options
28867 parsoid={
28868 "modes": ["html2wt"],
28869 "scrubWikitext": true
28870 }
28871 !! html/parsoid
28872 <i></i><b></b>
28873 !! wikitext
28874 !! end
28875
28876 !! test
28877 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28878 !! options
28879 parsoid=html2wt
28880 !! html/parsoid
28881 <i></i><b></b>
28882 !! wikitext
28883 ''<nowiki/>'''''<nowiki/>'''
28884 !! end
28885
28886 !! test
28887 3. WT Quote Tags: suppress empty style tags on edits
28888 !! options
28889 parsoid={
28890 "modes": ["selser"],
28891 "scrubWikitext": true,
28892 "changes": [
28893 [ "#x", "remove"]
28894 ]
28895 }
28896 !! wikitext
28897 '''<span id="x">foo</span>'''
28898 !! wikitext/edited
28899 !! end
28900
28901 !! test
28902 1. Anchors: suppress newly created empty anchors
28903 !! options
28904 parsoid={
28905 "modes": ["html2wt"],
28906 "scrubWikitext": true
28907 }
28908 !! html/parsoid
28909 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28910 !! wikitext
28911 !! end
28912
28913 !! test
28914 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28915 !! options
28916 parsoid={
28917 "modes": ["html2wt"],
28918 "scrubWikitext": false
28919 }
28920 !! html/parsoid
28921 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28922 !! wikitext
28923 [[Test|<nowiki/>]]
28924 !! end
28925
28926 !! test
28927 3. Anchors: suppress empty anchors on edits
28928 !! options
28929 parsoid={
28930 "modes": ["selser"],
28931 "scrubWikitext": true,
28932 "changes": [
28933 [ "#x", "remove"]
28934 ]
28935 }
28936 !! wikitext
28937 [[Test|<span id="x">foo</span>]]
28938 !! wikitext/edited
28939 !! end
28940
28941 !! test
28942 3a. Anchors: do not suppress numbered extlinks
28943 !! options
28944 parsoid={
28945 "modes": ["wt2wt"],
28946 "scrubWikitext": true
28947 }
28948 !! wikitext
28949 [http://foo.com]
28950 !! html/parsoid
28951 <a rel="mw:ExtLink" href="http://foo.com"></a>
28952 !! end
28953
28954 !! test
28955 3b. Anchors: do not suppress numbered extlinks
28956 !! options
28957 parsoid={
28958 "modes": ["wt2wt"],
28959 "scrubWikitext": true,
28960 "changes": [
28961 [ "#x", "remove"]
28962 ]
28963 }
28964 !! wikitext
28965 [http://foo.com <span id="x">foo</span>]
28966 !! wikitext/edited
28967 [http://foo.com]
28968 !! end
28969
28970 !!test
28971 Normalizations should be restricted to edited content
28972 !!options
28973 parsoid={
28974 "modes": ["selser"],
28975 "scrubWikitext": true,
28976 "changes": [
28977 [ "h1", "before", "<i></i>"]
28978 ]
28979 }
28980 !!wikitext
28981 a
28982 = =
28983 b
28984 !!wikitext/edited
28985 a
28986 = =
28987 b
28988 !!end
28989
28990 !! test
28991 1. Multiple normalizations (html2wt)
28992 !! options
28993 parsoid={
28994 "modes": ["html2wt"],
28995 "scrubWikitext": true
28996 }
28997 !! html
28998 <h2><i></i></h2>
28999 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29000 </a><b><i></i></b>x</p>
29001 !! wikitext
29002
29003 [[foo]]
29004 x
29005
29006 !! end
29007
29008 !! test
29009 2. Multiple normalizations (selser)
29010 !! options
29011 parsoid={
29012 "modes": ["selser"],
29013 "scrubWikitext": true,
29014 "changes": [
29015 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29016 ]
29017 }
29018 !! wikitext
29019 <span id="x">foo</span>
29020 !! wikitext/edited
29021 <span id="x">foo</span>
29022
29023 x
29024 !! end
29025
29026 !! test
29027 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29028 !! options
29029 parsoid={
29030 "modes": ["html2wt"],
29031 "scrubWikitext": true
29032 }
29033 !! html/parsoid
29034 <p> hi</p>
29035 <p> hello</p>
29036 !! wikitext
29037 hi
29038
29039 hello
29040 !! end
29041
29042 !! test
29043 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29044 !! options
29045 parsoid=html2wt
29046 !! html/parsoid
29047 <p> hi</p>
29048 <p> hello</p>
29049 !! wikitext
29050 <nowiki> </nowiki>hi
29051
29052 <nowiki> </nowiki> hello
29053 !! end
29054
29055 !! test
29056 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29057 !! options
29058 parsoid={
29059 "modes": ["html2wt"],
29060 "scrubWikitext": true
29061 }
29062 !! html/parsoid
29063 <p>Foo
29064 bar
29065 baz</p>
29066
29067 <table><tr><td>Foo
29068 bar
29069 baz bang</td></tr></table>
29070
29071 <p><!--boo--> foo
29072 bar</p>
29073
29074 <p> foo
29075 bar<span>boo</span></p>
29076 !! wikitext
29077 Foo
29078 bar
29079 baz
29080
29081 {|
29082 |Foo
29083 bar
29084 baz bang
29085 |}
29086
29087 <!--boo-->foo
29088 bar
29089
29090 foo
29091 bar<span>boo</span>
29092 !! end
29093
29094 !! test
29095 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29096 !! options
29097 parsoid={
29098 "modes": ["selser"],
29099 "scrubWikitext": true,
29100 "changes": [
29101 [ "p", "html", " a\n b" ]
29102 ]
29103 }
29104 !! wikitext
29105 xyz
29106 !! wikitext/edited
29107 a
29108 b
29109 !! end
29110
29111 !! test
29112 1. New links that end in spaces
29113 !! options
29114 parsoid={
29115 "modes": ["html2wt"],
29116 "scrubWikitext": false
29117 }
29118 !! html/parsoid
29119 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29120 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29121 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29122 !! wikitext
29123 [[Berlin ]]<nowiki/>is the capital of Germany.
29124
29125 [[Foo ]]'''bar'''
29126
29127 [[Boston ]] is a city.
29128 !! end
29129
29130 !! test
29131 2. New links that end in spaces
29132 !! options
29133 parsoid={
29134 "modes": ["html2wt"],
29135 "scrubWikitext": true
29136 }
29137 !! html/parsoid
29138 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29139 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29140 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29141 !! wikitext
29142 [[Berlin]] is the capital of Germany.
29143
29144 [[Foo]] '''bar'''
29145
29146 [[Boston]] is a city.
29147 !! end
29148
29149 !! test
29150 1. Table cells with escapable prefixes
29151 !! options
29152 parsoid={
29153 "modes": ["html2wt"],
29154 "scrubWikitext": false
29155 }
29156 !! html
29157 <table>
29158 <tr><td>a</td></tr>
29159 <tr><td>-</td></tr>
29160 <tr><td>+</td></tr>
29161 </table>
29162 !! wikitext
29163 {|
29164 |a
29165 |-
29166 |<nowiki>-</nowiki>
29167 |-
29168 |<nowiki>+</nowiki>
29169 |}
29170 !! end
29171
29172 !! test
29173 2. Table cells with escapable prefixes
29174 !! options
29175 parsoid={
29176 "modes": ["html2wt"],
29177 "scrubWikitext": true
29178 }
29179 !! html
29180 <table>
29181 <tr><td>a</td></tr>
29182 <tr><td>-</td></tr>
29183 <tr><td>+</td></tr>
29184 </table>
29185 !! wikitext
29186 {|
29187 |a
29188 |-
29189 | -
29190 |-
29191 | +
29192 |}
29193 !! end
29194
29195 !! test
29196 3a. Table cells with escapable prefixes after edits
29197 !! options
29198 parsoid={
29199 "modes": ["selser"],
29200 "scrubWikitext": true,
29201 "changes": [
29202 [ "table tbody tr:first-child td:first-child", "remove"]
29203 ]
29204 }
29205 !! wikitext
29206 {|
29207 |a||-
29208 |}
29209 !! wikitext/edited
29210 {|
29211 | -
29212 |}
29213 !! end
29214
29215 !! test
29216 3b. Table cells with escapable prefixes after edits
29217 !! options
29218 parsoid={
29219 "modes": ["selser"],
29220 "scrubWikitext": true,
29221 "changes": [
29222 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29223 [ "#x", "remove" ]
29224 ]
29225 }
29226 !! wikitext
29227 {|
29228 |pqr
29229 |<span id="x">foo</span>+
29230 |}
29231 !! wikitext/edited
29232 {|
29233 | -
29234 | +
29235 |}
29236 !! end
29237
29238 # FIXME: This test will fail because
29239 # normalization doesn't realize that the id attribute
29240 # will eliminate the escapable scenario
29241 !! test
29242 4a. Table cells without escapable prefixes after edits
29243 !! options
29244 parsoid={
29245 "modes": ["selser"],
29246 "scrubWikitext": true,
29247 "changes": [
29248 [ "#x", "html", "-" ]
29249 ]
29250 }
29251 !! wikitext
29252 {|
29253 | id="x" |abcd
29254 |}
29255 !! wikitext/edited
29256 {|
29257 | id="x" |-
29258 |}
29259 !! end
29260
29261 ## This tests normalizer's ability to discriminate between
29262 ## cells having identical content.
29263 !! test
29264 4b. Table cells without escapable prefixes after edits
29265 !! options
29266 parsoid={
29267 "modes": ["selser"],
29268 "scrubWikitext": true,
29269 "changes": [
29270 [ "td", "html", "-" ]
29271 ]
29272 }
29273 !! wikitext
29274 {|
29275 |a||b
29276 |}
29277 !! wikitext/edited
29278 {|
29279 | -||-
29280 |}
29281 !! end
29282
29283 ## This tests normalizer's ability to not be tripped by
29284 ## comments (and whitespace)
29285 !! test
29286 4c. Table cells without escapable prefixes after edits
29287 !! options
29288 parsoid={
29289 "modes": ["selser"],
29290 "scrubWikitext": true,
29291 "changes": [
29292 [ "table tbody tr td:first-child", "remove" ]
29293 ]
29294 }
29295 !! wikitext
29296 {|
29297 |-
29298 <!--foo--> |a||-
29299 |}
29300 !! wikitext/edited
29301 {|
29302 |-
29303 <!--foo--> | -
29304 |}
29305 !! end
29306
29307 ## This tests normalizer's ability to handle HTML cells
29308 !! test
29309 4d. Table cells without escapable prefixes after edits
29310 !! options
29311 parsoid={
29312 "modes": ["selser"],
29313 "scrubWikitext": true,
29314 "changes": [
29315 [ "td", "html", "-" ]
29316 ]
29317 }
29318 !! wikitext
29319 <table>
29320 <tr><td>a</td></tr>
29321 </table>
29322 !! wikitext/edited
29323 <table>
29324 <tr><td>-</td></tr>
29325 </table>
29326 !! end
29327
29328 ## T111151 Remove font elements without attributes
29329 !! test
29330 5a. font tags without attributes should be dropped in scrubWikitext mode
29331 !! options
29332 parsoid={
29333 "modes": ["html2wt"],
29334 "scrubWikitext": true
29335 }
29336 !! html
29337 <font>foo</font>
29338 <font><font>bar</font></font>
29339 <font class="x">boo</font>
29340 !! wikitext
29341 foo
29342 bar
29343 <font class="x">boo</font>
29344 !! end
29345
29346 !! test
29347 5b. font tags should not be dropped without scrubWikitext being enabled
29348 !! options
29349 parsoid={
29350 "modes": ["html2wt"],
29351 "scrubWikitext": false
29352 }
29353 !! html
29354 <font>foo</font>
29355 !! wikitext
29356 <font>foo</font>
29357 !! end
29358
29359 !! test
29360 Escape nowiki DOM elements
29361 !! options
29362 parsoid=html2wt
29363 !! html/parsoid
29364 <nowiki><i>foo</i></nowiki>
29365 !! wikitext
29366 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29367 !! end
29368
29369 # This is meant to be an interim fix while we go about figuring out
29370 # how to not introduce these trailing <nowiki/>s in the first place.
29371 !! test
29372 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29373 !! options
29374 parsoid=html2wt
29375 !! html/parsoid
29376 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29377 y</p>
29378 <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>
29379 <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>
29380 !! wikitext
29381 x
29382 y
29383
29384 {{echo|
29385 1 = <nowiki/>}}
29386
29387 {{echo|
29388 1 = <nowiki/>
29389 }}
29390 !! end
29391
29392 # ---------------------------------------------------
29393 # End of tests spec'ing wikitext serialization norms |
29394 # ---------------------------------------------------
29395
29396 # T104032
29397 !! test
29398 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29399 !! options
29400 parsoid=html2wt
29401 !! html/parsoid
29402 a<p>b</p>
29403 <b>c</b><p>d</p>
29404 <table><tr>
29405 <td>a<p>b</p></td>
29406 <td><b>c</b><p>d</p></td>
29407 </tr></table>
29408 !! wikitext
29409 a
29410
29411 b
29412
29413 '''c'''
29414
29415 d
29416 {|
29417 |a
29418 b
29419 |'''c'''
29420 d
29421 |}
29422 !! end
29423
29424 !! test
29425 Anchor without href scenarios
29426 !! options
29427 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29428 !! html/parsoid
29429 <a class="bc"></a>
29430 <a class="no">dice</a>
29431 <a name="foo"></a>
29432 !! wikitext
29433
29434 dice
29435 <span name="foo"></span>
29436 !! end
29437
29438 !! test
29439 New transclusion added after a list should be serialized after the list
29440 !! options
29441 parsoid=html2wt
29442 !! html/parsoid
29443 <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>
29444 !! wikitext
29445 * a
29446 {{echo|foo}}
29447 !! end
29448
29449 # -----------------------------------------------------------------
29450 # End of section for Parsoid-only html2wt tests for serialization
29451 # of new content
29452 # -----------------------------------------------------------------
29453
29454 # -----------------------------------------------------------------
29455 # The following section of tests are primarily to spec behavior of
29456 # the selective serializer. All these tests have manual selser
29457 # changes. The automated selser changes for all tests handle the
29458 # wide variation of changes, but these tests here capture specs
29459 # deterministically.
29460 # ----------------------------------------------------------------
29461
29462 ## T90517
29463 !! test
29464 Selser: New comments should not be lost
29465 !! options
29466 parsoid={
29467 "modes": ["selser"],
29468 "changes": [
29469 [ "#a", "after", "<!--c1-->" ],
29470 [ "#b", "before", "<!--c2-->" ]
29471 ]
29472 }
29473 !! wikitext
29474 <span id="a">a</span>
29475
29476 <span id="b">b</span>
29477 !! wikitext/edited
29478 <span id="a">a</span><!--c1-->
29479
29480 <!--c2--><span id="b">b</span>
29481 !! end
29482
29483 ## T89383
29484 !! test
29485 Selser: Check for validity of DSR before using it
29486 !! options
29487 parsoid={
29488 "modes": ["selser"],
29489 "changes": [
29490 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29491 ]
29492 }
29493 !! wikitext
29494 <span id="a">a</span>
29495 !! wikitext/edited
29496 {{DISPLAYTITLE:foo}}
29497 <span id="a">a</span>
29498 !! end
29499
29500 !! test
29501 1. DOMDiff: Changes to <ref> content should be looked up using id
29502 !! options
29503 parsoid={
29504 "modes": ["selser"],
29505 "changes": [
29506 ["#X", "after", "bar"],
29507 ["#Y", "after", "baz"]
29508 ]
29509 }
29510 !! wikitext
29511 X <ref><span id="X">foo</span></ref>
29512 Y <ref name="a" />
29513 <references>
29514 <ref name="a"><span id="Y">foo</span></ref>
29515 </references>
29516 !! wikitext/edited
29517 X <ref><span id="X">foo</span>bar</ref>
29518 Y <ref name="a" />
29519 <references>
29520 <ref name="a"><span id="Y">foo</span>baz</ref>
29521 </references>
29522 !! end
29523
29524 !! test
29525 2. DOMDiff: Changes to <ref> content should be looked up using id
29526 !! options
29527 parsoid={
29528 "modes": ["selser"],
29529 "changes": [
29530 ["#Z", "after", "bar"]
29531 ]
29532 }
29533 !! wikitext
29534 A <ref>foo bar for a</ref>
29535 B <ref group="X" name="b" />
29536
29537 <references />
29538
29539 <references group="X">
29540 <ref name="b"><span id="Z">foo</span></ref>
29541 </references>
29542 !! wikitext/edited
29543 A <ref>foo bar for a</ref>
29544 B <ref group="X" name="b" />
29545
29546 <references />
29547
29548 <references group="X">
29549 <ref name="b"><span id="Z">foo</span>bar</ref>
29550 </references>
29551 !! end
29552
29553 !! test
29554 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29555 !! options
29556 parsoid={
29557 "modes": ["selser"],
29558 "changes": [
29559 [ "div:first-child", "text", "bar" ]
29560 ]
29561 }
29562 !! wikitext
29563 <div style="{{1x|color:red;}}%">foo</div>
29564 !! wikitext/edited
29565 <div style="{{1x|color:red;}}%">bar</div>
29566 !! end
29567
29568 !! test
29569 Empty LI (T49673)
29570 !! wikitext
29571 *a
29572 *
29573 *
29574 *b
29575 !! html+tidy
29576 <ul><li>a</li>
29577 <li class="mw-empty-elt"></li>
29578 <li class="mw-empty-elt"></li>
29579 <li>b</li></ul>
29580 !! end
29581
29582 !! test
29583 Thumbnail output
29584 !! wikitext
29585 [[File:Thumb.png|thumb]]
29586 !! html/php+tidy
29587 <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>
29588 !! html/parsoid
29589 <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>
29590 !! end
29591
29592 !! test
29593 unclosed internal link XSS (T137264)
29594 !! wikitext
29595 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29596 !! html/php
29597 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29598 </p>
29599 !! html/parsoid
29600 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29601 !! end
29602
29603 !! test
29604 Validating that <style> isn't eaten by tidy (T167349)
29605 !! options
29606 styletag=1
29607 !! wikitext
29608 <div class="foo">
29609 <style>.foo::before { content: "<foo>"; }</style>
29610 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29611 </div>
29612 !! html/php+tidy
29613 <div class="foo">
29614 <style>.foo::before { content: "<foo>"; }</style>
29615 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29616 </div>
29617 !! end
29618
29619 !! test
29620 Validating that <style> isn't wrapped in a paragraph (T186965)
29621 !! options
29622 styletag=1
29623 !! wikitext
29624 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29625
29626 <style>.foo::before { content: "<foo>"; }</style>
29627
29628 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29629
29630 But if it's on a line with other content, let it be wrapped.
29631
29632 <style>.foo::before { content: "<foo>"; }</style> bar
29633
29634 foo <style>.foo::before { content: "<foo>"; }</style>
29635
29636 foo <style>.foo::before { content: "<foo>"; }</style> bar
29637
29638 And the same if we have non-paragraph-breaking whitespace
29639
29640 foo
29641 <style>.foo::before { content: "<foo>"; }</style>
29642 bar
29643 !! html/php
29644 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29645 </p>
29646 <style>.foo::before { content: "<foo>"; }</style>
29647 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29648 <p>But if it's on a line with other content, let it be wrapped.
29649 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29650 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29651 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29652 </p><p>And the same if we have non-paragraph-breaking whitespace
29653 </p><p>foo
29654 <style>.foo::before { content: "<foo>"; }</style>
29655 bar
29656 </p>
29657 !! end
29658
29659 !! test
29660 Validating that <link> isn't wrapped in a paragraph (T186965)
29661 !! options
29662 styletag=1
29663 !! wikitext
29664 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29665
29666 <link rel="foo" href="bar"/>
29667
29668 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29669
29670 But if it's on a line with other content, let it be wrapped.
29671
29672 <link rel="foo" href="bar"/> bar
29673
29674 foo <link rel="foo" href="bar"/>
29675
29676 foo <link rel="foo" href="bar"/> bar
29677
29678 And the same if we have non-paragraph-breaking whitespace
29679
29680 foo
29681 <link rel="foo" href="bar"/>
29682 bar
29683 !! html/php
29684 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29685 </p>
29686 <link rel="foo" href="bar"/>
29687 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29688 <p>But if it's on a line with other content, let it be wrapped.
29689 </p><p><link rel="foo" href="bar"/> bar
29690 </p><p>foo <link rel="foo" href="bar"/>
29691 </p><p>foo <link rel="foo" href="bar"/> bar
29692 </p><p>And the same if we have non-paragraph-breaking whitespace
29693 </p><p>foo
29694 <link rel="foo" href="bar"/>
29695 bar
29696 </p>
29697 !! end
29698
29699 !! test
29700 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29701 !! config
29702 wgFragmentMode=[ 'html5', 'legacy' ]
29703 !! wikitext
29704 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29705 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29706 !! html/php
29707 <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>
29708 <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>
29709 </p>
29710 !! html/parsoid
29711 <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>
29712 <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>
29713 !! end
29714
29715 !! test
29716 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29717 !! config
29718 wgFragmentMode=[ 'legacy' ]
29719 !! wikitext
29720 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29721 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29722 !! html/php
29723 <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>
29724 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29725 </p>
29726 !! end
29727
29728 !! test
29729 Decoding of HTML entities in embedded HTML tags
29730 !! wikitext
29731 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29732 !! html/php
29733 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29734
29735 !! html/parsoid
29736 <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>
29737 !! end
29738
29739 !! test
29740 Decoding of HTML entities in indicator names for IDs (T104196)
29741 !! options
29742 parsoid=wt2html,html2html
29743 showindicators
29744 !! wikitext
29745 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29746 !! html/php
29747 1&2&3&amp;4&amp;amp;5=Indicator
29748
29749 !! html/parsoid
29750 <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>
29751 !! end
29752
29753 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29754 !! test
29755 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29756 !! options
29757 showindicators
29758 !! wikitext
29759 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29760 !! html/php
29761 1&2&3&amp;4&amp;amp;5=Indicator
29762
29763 !! html/parsoid
29764 <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>
29765 !! end
29766
29767 # This fragment mode is what Parsoid supports.
29768 !! test
29769 HTML5 ids: fallback to legacy
29770 !! config
29771 wgFragmentMode=[ 'html5', 'legacy' ]
29772 !! wikitext
29773 ==Foo bar==
29774
29775 ==foo Bar==
29776
29777 ==Тест==
29778
29779 ==Тест==
29780
29781 ==тест==
29782
29783 ==Hey < # " > % : '==
29784 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29785
29786 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29787
29788 <!-- These two links should produce identical HTML -->
29789 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29790
29791 !! html/php
29792 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29793 <ul>
29794 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29795 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29796 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29797 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29798 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29799 <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>
29800 </ul>
29801 </div>
29802
29803 <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>
29804 <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>
29805 <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>
29806 <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>
29807 <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>
29808 <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>
29809 <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>
29810 </p><p>💩 <span id="💩"></span>
29811 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29812 </p>
29813 !! html/parsoid
29814 <h2 id="Foo_bar">Foo bar</h2>
29815
29816 <h2 id="foo_Bar_2">foo Bar</h2>
29817
29818 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29819
29820 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29821
29822 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29823
29824 <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>
29825 <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>
29826
29827 <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>
29828
29829 <!-- These two links should produce identical HTML -->
29830 <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>
29831 !! end
29832
29833 # Parsoid doesn't support this mode
29834 !! test
29835 HTML5 ids: legacy with a fallback to modern
29836 !! config
29837 wgFragmentMode=[ 'legacy', 'html5' ]
29838 !! wikitext
29839 ==Foo bar==
29840
29841 ==foo Bar==
29842
29843 ==Тест==
29844
29845 ==Тест==
29846
29847 ==тест==
29848
29849 ==Hey < # " > % : '==
29850 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29851
29852 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29853
29854 <!-- These two links should produce identical HTML -->
29855 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29856
29857 !! html/php
29858 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29859 <ul>
29860 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29861 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29862 <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>
29863 <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>
29864 <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>
29865 <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>
29866 </ul>
29867 </div>
29868
29869 <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>
29870 <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>
29871 <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>
29872 <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>
29873 <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>
29874 <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>
29875 <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>
29876 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29877 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29878 </p>
29879 !! end
29880
29881 # Parsoid doesn't support this mode.
29882 !! test
29883 HTML5 ids: no legacy
29884 !! config
29885 wgFragmentMode=[ 'html5' ]
29886 !! wikitext
29887 ==Foo bar==
29888
29889 ==foo Bar==
29890
29891 ==Тест==
29892
29893 ==Тест==
29894
29895 ==тест==
29896
29897 ==Hey < # " > % : '==
29898 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29899
29900 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29901
29902 <!-- These two links should produce identical HTML -->
29903 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29904
29905 !! html/php
29906 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29907 <ul>
29908 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29909 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29910 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29911 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29912 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29913 <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>
29914 </ul>
29915 </div>
29916
29917 <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>
29918 <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>
29919 <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>
29920 <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>
29921 <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>
29922 <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>
29923 <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>
29924 </p><p>💩 <span id="💩"></span>
29925 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29926 </p>
29927 !! end
29928
29929 !! test
29930 T90902: Normalize weird characters in section IDs
29931 !! config
29932 wgFragmentMode=[ 'html5', 'legacy' ]
29933 !! wikitext
29934 ==Foo&nbsp;bar==
29935 [[#Foo&nbsp;bar]]
29936
29937 !! html/php
29938 <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>
29939 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29940 </p>
29941 !! end
29942
29943 !! test
29944 T51672: Test for brackets in attributes of elements in external link texts
29945 !! wikitext
29946 [http://example.com/ link <span title="title with [brackets]">span</span>]
29947 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29948
29949 !! html/php
29950 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29951 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29952 </p>
29953 !! html/parsoid
29954 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29955 <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>
29956 !! end
29957
29958 !! test
29959 T72875: Test for brackets in attributes of elements in internal link texts
29960 !! wikitext
29961 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29962 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29963
29964 !! html/php
29965 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29966 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29967 </p>
29968 !! html/parsoid
29969 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
29970 <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>
29971 !! end
29972
29973 !! test
29974 T179544: {{anchorencode:}} output should be always usable in links
29975 !! config
29976 wgFragmentMode=[ 'html5' ]
29977 !! wikitext
29978 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
29979 !! html/php
29980 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
29981 </p>
29982 !! html/parsoid
29983 <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>
29984 !! end
29985
29986 ## ------------------------------
29987 ## Parsoid section-wrapping tests
29988 ## ------------------------------
29989 !! test
29990 Section wrapping for well-nested sections (no leading content)
29991 !! options
29992 parsoid={
29993 "wrapSections": true
29994 }
29995 !! wikitext
29996 =1=
29997 a
29998
29999 =2=
30000 b
30001
30002 ==2.1==
30003 c
30004
30005 ==2.2==
30006 d
30007
30008 ===2.2.1===
30009 e
30010
30011 =3=
30012 f
30013 !! html/parsoid
30014 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30015 <p>a</p>
30016
30017 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30018 <p>b</p>
30019
30020 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30021 <p>c</p>
30022
30023 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30024 <p>d</p>
30025
30026 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30027 <p>e</p>
30028
30029 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30030 <p>f</p>
30031
30032 </section>
30033 !! end
30034
30035 !! test
30036 Section wrapping for well-nested sections (with leading content)
30037 !! options
30038 parsoid={
30039 "wrapSections": true
30040 }
30041 !! wikitext
30042 Para 1.
30043
30044 Para 2 with a <div>nested in it</div>
30045
30046 Para 3.
30047
30048 =1=
30049 a
30050
30051 =2=
30052 b
30053
30054 ==2.1==
30055 c
30056 !! html/parsoid
30057 <section data-mw-section-id="0"><p>Para 1.</p>
30058
30059 <p>Para 2 with a </p><div>nested in it</div>
30060
30061 <p>Para 3.</p>
30062
30063 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30064 <p>a</p>
30065
30066 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30067 <p>b</p>
30068
30069 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30070 <p>c</p>
30071
30072 </section></section>
30073 !! end
30074
30075 !! test
30076 Section wrapping with template-generated sections (good nesting 1)
30077 !! options
30078 parsoid={
30079 "wrapSections": true
30080 }
30081 !! wikitext
30082 =1=
30083 a
30084
30085 {{echo|1=
30086 ==1.1==
30087 b
30088 }}
30089
30090 ==1.2==
30091 c
30092
30093 =2=
30094 d
30095 !! html/parsoid
30096 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30097 <p>a</p>
30098
30099 <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">
30100 </span><p about="#mwt1">b</p>
30101 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30102 <p>c</p>
30103
30104 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30105 <p>d</p></section>
30106 !! end
30107
30108 # In this example, the template scope is mildly expanded to incorporate the
30109 # trailing newline after the transclusion since that is part of section 1.1.1
30110 !! test
30111 Section wrapping with template-generated sections (good nesting 2)
30112 !! options
30113 parsoid={
30114 "wrapSections": true,
30115 "modes": ["wt2html", "wt2wt"]
30116 }
30117 !! wikitext
30118 =1=
30119 a
30120
30121 {{echo|1=
30122 ==1.1==
30123 b
30124 ===1.1.1===
30125 d
30126 }}
30127 =2=
30128 e
30129 !! html/parsoid
30130 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30131 <p>a</p>
30132
30133 <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">
30134 </span><p about="#mwt1">b</p><span about="#mwt1">
30135 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30136 </span><p about="#mwt1">d</p><span about="#mwt1">
30137 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30138 <p>e</p></section>
30139 !! end
30140
30141 # In this example, the template scope is mildly expanded to incorporate the
30142 # trailing newline after the transclusion since that is part of section 1.2.1
30143 !! test
30144 Section wrapping with template-generated sections (good nesting 3)
30145 !! options
30146 parsoid={
30147 "wrapSections": true,
30148 "modes": ["wt2html", "wt2wt"]
30149 }
30150 !! wikitext
30151 =1=
30152 a
30153
30154 {{echo|1=
30155 x
30156 ==1.1==
30157 b
30158 ==1.2==
30159 c
30160 ===1.2.1===
30161 d
30162 }}
30163 =2=
30164 e
30165 !! html/parsoid
30166 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30167 <p>a</p>
30168
30169 <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">
30170 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30171 </span><p about="#mwt1">b</p><span about="#mwt1">
30172 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30173 </span><p about="#mwt1">c</p><span about="#mwt1">
30174 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30175 </span><p about="#mwt1">d</p><span about="#mwt1">
30176 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30177 <p>e</p></section>
30178 !! end
30179
30180 # Because of section-wrapping and template-wrapping interactions,
30181 # the scope of the template is expanded so that the template markup
30182 # is valid in the presence of <section> tags.
30183 # This exercises the s1 is null scenario in the wrapSections code
30184 !! test
30185 Section wrapping with template-generated sections (bad nesting 1)
30186 !! options
30187 parsoid={
30188 "wrapSections": true
30189 }
30190 !! wikitext
30191 <div>
30192 a
30193
30194 {{echo|
30195 =1=
30196 b
30197 }}
30198
30199 c
30200 </div>
30201 !! html/parsoid
30202 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30203 <p>a</p>
30204
30205 <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"]}'>
30206 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30207 </span><p about="#mwt1">b
30208 </p><span about="#mwt1">
30209
30210 </span><p about="#mwt1">c</p><span about="#mwt1">
30211 </span></section></div></section>
30212 !! end
30213
30214 # Because of section-wrapping and template-wrapping interactions,
30215 # the scope of the template is expanded so that the template markup
30216 # is valid in the presence of <section> tags.
30217 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30218 !! test
30219 Section wrapping with template-generated sections (bad nesting 2)
30220 !! options
30221 parsoid={
30222 "wrapSections": true
30223 }
30224 !! wikitext
30225 =1=
30226 a
30227
30228 {{echo|1=
30229 =2=
30230 b
30231 ==2.1==
30232 c
30233 }}
30234
30235 d
30236
30237 =3=
30238 e
30239 !! html/parsoid
30240 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30241 <p>a</p>
30242
30243 </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">
30244 </span><p about="#mwt1">b</p><span about="#mwt1">
30245 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30246 </span><p about="#mwt1">c</p><span about="#mwt1">
30247
30248 </span><p about="#mwt1">d</p><span about="#mwt1">
30249
30250 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30251 <p>e</p></section>
30252 !! end
30253
30254 # Because of section-wrapping and template-wrapping interactions,
30255 # additional template wrappers are added to <section> tags
30256 # so that template wrapping semantics are valid whether section
30257 # tags are retained or stripped. But, the template scope can expand
30258 # greatly when accounting for section tags.
30259 # This exercises the s1 and s2 are in different subtrees scenario
30260 !! test
30261 Section wrapping with template-generated sections (bad nesting 3)
30262 !! options
30263 parsoid={
30264 "wrapSections": true,
30265 "modes": ["wt2html", "wt2wt"]
30266 }
30267 !! wikitext
30268 =1=
30269 a
30270
30271 {{echo|1=
30272 ==1.2==
30273 b
30274 =2=
30275 c
30276 }}
30277
30278 d
30279
30280 =3=
30281 e
30282 !! html/parsoid
30283 <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>
30284 <p>a</p>
30285
30286 <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">
30287 </span><p about="#mwt1">b</p><span about="#mwt1">
30288 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30289 </span><p about="#mwt1">c</p>
30290
30291 <p>d</p>
30292 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30293 <p>e</p></section>
30294 !! end
30295
30296 !! test
30297 Section wrapping with uneditable lead section + div wrapping multiple sections
30298 !! options
30299 parsoid={
30300 "wrapSections": true
30301 }
30302 !! wikitext
30303 foo
30304
30305 <div style="border:1px solid red;">
30306 =1=
30307 a
30308
30309 ==1.1==
30310 b
30311
30312 =2=
30313 c
30314 </div>
30315
30316 =3=
30317 d
30318
30319 ==3.1==
30320 e
30321 !! html/parsoid
30322 <section data-mw-section-id="-1"><p>foo</p>
30323
30324 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30325 <section data-mw-section-id="1"><h1 id="1">1</h1>
30326 <p>a</p>
30327
30328 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30329 <p>b</p>
30330
30331 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30332 <p>c</p>
30333 </section></div>
30334
30335 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30336 <p>d</p>
30337
30338 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30339 <p>e</p>
30340 </section></section>
30341 !! end
30342
30343 !! test
30344 Section wrapping with editable lead section + div overlapping multiple sections
30345 !! options
30346 parsoid={
30347 "wrapSections": true
30348 }
30349 !! wikitext
30350 foo
30351
30352 =1=
30353 a
30354 <div style="border:1px solid red;">
30355 b
30356
30357 ==1.1==
30358 c
30359
30360 =2=
30361 d
30362 </div>
30363 e
30364
30365 =3=
30366 f
30367
30368 ==3.1==
30369 g
30370 !! html/parsoid
30371 <section data-mw-section-id="0"><p>foo</p>
30372
30373 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30374 <p>a</p>
30375 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30376 <p>b</p>
30377
30378 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30379 <p>c</p>
30380
30381 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30382 <p>d</p>
30383 </section></div>
30384 <p>e</p>
30385
30386 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30387 <p>f</p>
30388
30389 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30390 <p>g</p>
30391 </section></section>
30392 !! end
30393
30394 !! test
30395 HTML header tags should not be wrapped in section tags
30396 !! options
30397 parsoid={
30398 "wrapSections": true
30399 }
30400 !! wikitext
30401 foo
30402
30403 <h1>a</h1>
30404
30405 =b=
30406
30407 <h1>c</h1>
30408
30409 =d=
30410 !! html/parsoid
30411 <section data-mw-section-id="0"><p>foo</p>
30412
30413 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30414
30415 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30416
30417 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30418
30419 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30420 !! end
30421
30422 !! test
30423 Lead section containing only whitespace and comments.
30424 !! options
30425 parsoid={
30426 "wrapSections": true
30427 }
30428 !! wikitext
30429
30430 <!-- this is a comment, presumably significant to editors -->
30431 =1=
30432 a
30433
30434 =2=
30435 b
30436 !! html/parsoid
30437 <section data-mw-section-id="0" data-parsoid="{}">
30438 <!-- this is a comment, presumably significant to editors -->
30439 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30440 <p>a</p>
30441
30442 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30443 <p>b</p></section>
30444 !! end
30445
30446 !! test
30447 Pseudo-sections emitted by templates should have id -2
30448 !! options
30449 parsoid={
30450 "wrapSections": true
30451 }
30452 !! wikitext
30453 foo
30454 {{echo|<div>
30455 ==a==
30456 ==b==
30457 </div>
30458 }}
30459 !! html/parsoid
30460 <section data-mw-section-id="-1"><p>foo</p>
30461 </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}}]}'>
30462 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30463 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30464 </section></div><span about="#mwt1">
30465 </span></section>
30466 !! end
30467
30468 ##########################################################################
30469 Tests demonstrating white-space insensitivity in input wikitext
30470 for wikitext headings, wikitext list items, and wikitext table captions,
30471 headings, and cells. HTML versions of the same should preserve whitespace.
30472 ##########################################################################
30473 !! test
30474 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30475 !! wikitext
30476 __NOTOC__
30477 == <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> ==
30478 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30479 ; <!--term to define--> term : <!--term's definition--> definition
30480 {|
30481 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30482 |-
30483 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30484 |-
30485 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30486 |-
30487 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30488 |-
30489 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30490 |}
30491 : {|
30492 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30493 |} foo <!--c1-->
30494 !! html/php+tidy
30495 <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>
30496 <ul><li>List item</li></ul>
30497 <dl><dt>term&#160;</dt>
30498 <dd>definition</dd></dl>
30499 <table>
30500 <caption>Table Caption
30501 </caption>
30502 <tbody><tr>
30503 <th>Table Heading 1</th>
30504 <th>Table Heading 2
30505 </th></tr>
30506 <tr>
30507 <td>Table Cell 1</td>
30508 <td>Table Cell 2
30509 </td></tr>
30510 <tr>
30511 <td>class="foo"</td>
30512 <td>Table Cell 3
30513 </td></tr>
30514 <tr>
30515 <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
30516 </td></tr></tbody></table>
30517 <dl><dd><table>
30518 <tbody><tr>
30519 <td>Table Cell 1</td>
30520 <td>Table Cell 2
30521 </td></tr></tbody></table> foo</dd></dl>
30522 !! end
30523
30524 # Looks like <caption> is not accepted in HTML
30525 !! test
30526 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30527 !! wikitext
30528 __NOTOC__
30529 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> <h2>
30530 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30531 <table>
30532 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30533 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30534 </table>
30535 !! html/php+tidy
30536 <h2> Heading </h2><h2>
30537 <ul><li> List item </li></ul>
30538 <table>
30539 <tbody><tr><th> Table Heading </th><th></th></tr>
30540 <tr><td> Table Cell </td><th></th></tr>
30541 </tbody></table>
30542 </h2>
30543 !! end
30544
30545 !! test
30546 Do not trim whitespace in links and quotes
30547 !! wikitext
30548 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30549 [[Foo| some text ]]
30550 !! html/php+tidy
30551 <p>foo <i> italic </i> and <b> bold </b>
30552 <a href="/wiki/Foo" title="Foo"> some text </a>
30553 </p>
30554 !! end