Fix whitespace trimming in 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 !! html/parsoid
9780 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9781 </li><li about="#mwt1">b
9782 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9783 !!end
9784
9785 !!test
9786 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9787 !! wikitext
9788 *a
9789 <!--This line will NOT split the list-->
9790 *b
9791 <!--This line will NOT split the list either-->
9792 *c
9793 <!--foo--> <!----> <!--This line NOT split the list either-->
9794 *d
9795 !! html
9796 <ul><li>a</li>
9797 <li>b</li>
9798 <li>c</li>
9799 <li>d</li></ul>
9800
9801 !!end
9802
9803 !!test
9804 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9805 !! wikitext
9806 *a
9807 <!--This line will NOT split the list-->
9808 *b
9809 <!--This line will NOT split the list either-->
9810 *c
9811 <!--foo--> <!----> <!--This line NOT split the list
9812 either-->
9813 *d
9814 !! html
9815 <ul><li>a</li>
9816 <li>b</li>
9817 <li>c</li>
9818 <li>d</li></ul>
9819
9820 !!end
9821
9822 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9823 # That pass could possibly be removed.
9824 !!test
9825 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9826 !!options
9827 parsoid=wt2html,wt2wt
9828 !! wikitext
9829 *foo
9830 *<li>li-hack
9831 *{{echo|<li>templated li-hack}}
9832 *<!--foo--><li> unsupported li-hack with preceding comments
9833
9834 <ul>
9835 <li><li>not a li-hack
9836 </li>
9837 </ul>
9838 !! html+tidy
9839 <ul><li>foo</li>
9840 <li class="mw-empty-elt"></li><li>li-hack</li>
9841 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9842 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9843 <ul>
9844 <li class="mw-empty-elt"></li><li>not a li-hack
9845 </li>
9846 </ul>
9847 !! html/parsoid
9848 <ul><li> foo</li>
9849 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9850 <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>
9851 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9852
9853 <ul data-parsoid='{"stx":"html"}'>
9854 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9855 </li>
9856 </ul>
9857
9858 !!end
9859
9860 !! test
9861 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9862 !! options
9863 parsoid
9864 !! wikitext
9865 #foo
9866 ##bar
9867 *foo
9868 **bar
9869 :foo
9870 ::bar
9871 !! html
9872 <ol>
9873 <li>foo<ol>
9874 <li>bar</li>
9875 </ol></li>
9876 </ol><ul>
9877 <li>foo<ul>
9878 <li>bar</li>
9879 </ul></li>
9880 </ul><dl>
9881 <dd>foo<dl>
9882 <dd>bar</dd>
9883 </dl></dd>
9884 </dl>
9885 !! end
9886
9887 !! test
9888 Parsoid: Test of whitespace serialization with Templated bullets
9889 !! options
9890 parsoid
9891 !! wikitext
9892 * {{bullet}}
9893 !! html/parsoid
9894 <ul>
9895 <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>
9896 </ul>
9897 !! end
9898
9899 # ------------------------------------------------------------------------
9900 # The next set of tests are about Parsoid's ability to handle badly nested
9901 # tags (parse, minimize scope of fixup, and roundtrip back)
9902 # ------------------------------------------------------------------------
9903
9904 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9905 # Parsoid's list handling is more aware of block structure.
9906 !! test
9907 Unbalanced closing block tags break a list
9908 !! wikitext
9909 <div>
9910 *a</div><div>
9911 *b</div>
9912 !! html+tidy
9913 <div>
9914 <ul><li>a</li></ul></div><div>
9915 <li>b</li></div>
9916 !! html/parsoid
9917 <div><ul>
9918 <li>a</li>
9919 </ul></div>
9920 <div><ul>
9921 <li>b</li>
9922 </ul></div>
9923 !! end
9924
9925 !! test
9926 Unbalanced closing non-block tags don't break a list
9927 !! wikitext
9928 <span>
9929 *a</span><span>
9930 *b</span>
9931 !! html/php+tidy
9932 <p><span>
9933 </span></p>
9934 <ul><li>a<span></span></li>
9935 <li>b</li></ul>
9936 !! html/parsoid
9937 <span>
9938 <ul>
9939 <li>a<span></span></li>
9940 <li>b</li>
9941 </ul>
9942 </span>
9943 !! end
9944
9945 # Parsoid does some post-dom-building cleanup
9946 # which is why its output differs from Remex.
9947 !! test
9948 Unclosed formatting tags that straddle lists are closed and reopened
9949 !! options
9950 parsoid=wt2html,wt2wt,html2html
9951 !! wikitext
9952 #<s> a
9953 #b </s>
9954 !! html/php+tidy
9955 <ol><li><s> a</s></li><s>
9956 </s><li><s>b </s></li></ol>
9957 !! html/parsoid
9958 <ol><li><s> a</s></li>
9959 <li><s>b </s></li></ol>
9960 !! end
9961
9962 # Output is ugly because of all the misnested tag fixups.
9963 # Remex is wrapping p-tags around empty elements.
9964 # Parsoid has special-case handling of this pattern of
9965 # wrapping lists in formatting tags.
9966 # FIXME: Should we remove this code from Parsoid? Or add
9967 # special support in Remex? If the latter, maybe just wait
9968 # for Parsoid to become the default parser.
9969 # See T70395.
9970 !!test
9971 1. List embedded in a formatting tag
9972 !! wikitext
9973 <small>
9974 *foo
9975 </small>
9976 !! html/php+tidy
9977 <p><small>
9978 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
9979 </p>
9980 !! html/parsoid
9981 <small>
9982 <ul>
9983 <li>foo</li>
9984 </ul>
9985 </small>
9986 !!end
9987
9988 # Output is ugly because of all the misnested tag fixups
9989 # Remex is wrapping p-tags around empty elements.
9990 # Parsoid has code that strips useless p-tags.
9991 !!test
9992 2. List embedded in a formatting tag in a misnested way
9993 !! wikitext
9994 <small>
9995 *a
9996 *b</small>
9997 !! html/php+tidy
9998 <p><small>
9999 </small></p><small></small><ul><small><li>a</li>
10000 </small><li><small>b</small></li></ul>
10001 !! html/parsoid
10002 <small></small>
10003 <ul><small>
10004 <li>a</li>
10005 </small>
10006 <li><small>b</small></li>
10007 </ul>
10008 !!end
10009
10010 !! test
10011 Table with missing opening <tr> tag
10012 !! options
10013 parsoid=wt2html,wt2wt
10014 !! wikitext
10015 <table>
10016 <td>foo</td>
10017 </tr>
10018 </table>
10019 !! html+tidy
10020 <table>
10021 <tbody><tr><td>foo</td>
10022 </tr>
10023 </tbody></table>
10024 !! end
10025
10026 ###
10027 ### Magic Words
10028 ###
10029
10030 # Note that the current date is hard-coded as
10031 # 1970-01-01T00:02:03Z (a Thursday)
10032 # when running parser tests. The timezone is also fixed to GMT, so
10033 # local date will be identical to current date.
10034
10035 !! test
10036 Magic Word: {{CURRENTDAY}}
10037 !! wikitext
10038 {{CURRENTDAY}}
10039 !! html
10040 <p>1
10041 </p>
10042 !! end
10043
10044 !! test
10045 Magic Word: {{CURRENTDAY2}}
10046 !! wikitext
10047 {{CURRENTDAY2}}
10048 !! html
10049 <p>01
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{CURRENTDAYNAME}}
10055 !! wikitext
10056 {{CURRENTDAYNAME}}
10057 !! html
10058 <p>Thursday
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{CURRENTDOW}}
10064 !! wikitext
10065 {{CURRENTDOW}}
10066 !! html
10067 <p>4
10068 </p>
10069 !! end
10070
10071 !! test
10072 Magic Word: {{CURRENTMONTH}}
10073 !! wikitext
10074 {{CURRENTMONTH}}
10075 !! html
10076 <p>01
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{CURRENTMONTH1}}
10082 !! wikitext
10083 {{CURRENTMONTH1}}
10084 !! html
10085 <p>1
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{CURRENTMONTHABBREV}}
10091 !! wikitext
10092 {{CURRENTMONTHABBREV}}
10093 !! html
10094 <p>Jan
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{CURRENTMONTHNAME}}
10100 !! wikitext
10101 {{CURRENTMONTHNAME}}
10102 !! html
10103 <p>January
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{CURRENTMONTHNAMEGEN}}
10109 !! wikitext
10110 {{CURRENTMONTHNAMEGEN}}
10111 !! html
10112 <p>January
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{CURRENTTIME}}
10118 !! wikitext
10119 {{CURRENTTIME}}
10120 !! html
10121 <p>00:02
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{CURRENTHOUR}}
10127 !! wikitext
10128 {{CURRENTHOUR}}
10129 !! html
10130 <p>00
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{CURRENTWEEK}} (T6594)
10136 !! wikitext
10137 {{CURRENTWEEK}}
10138 !! html
10139 <p>1
10140 </p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{CURRENTYEAR}}
10145 !! wikitext
10146 {{CURRENTYEAR}}
10147 !! html
10148 <p>1970
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{CURRENTTIMESTAMP}}
10154 !! wikitext
10155 {{CURRENTTIMESTAMP}}
10156 !! html
10157 <p>19700101000203
10158 </p>
10159 !! end
10160
10161 !! test
10162 Magic Words LOCAL (UTC)
10163 !! wikitext
10164 *{{LOCALMONTH}}
10165 *{{LOCALMONTH1}}
10166 *{{LOCALMONTHNAME}}
10167 *{{LOCALMONTHNAMEGEN}}
10168 *{{LOCALMONTHABBREV}}
10169 *{{LOCALDAY}}
10170 *{{LOCALDAY2}}
10171 *{{LOCALDAYNAME}}
10172 *{{LOCALYEAR}}
10173 *{{LOCALTIME}}
10174 *{{LOCALHOUR}}
10175 *{{LOCALWEEK}}
10176 *{{LOCALDOW}}
10177 *{{LOCALTIMESTAMP}}
10178 !! html
10179 <ul><li>01</li>
10180 <li>1</li>
10181 <li>January</li>
10182 <li>January</li>
10183 <li>Jan</li>
10184 <li>1</li>
10185 <li>01</li>
10186 <li>Thursday</li>
10187 <li>1970</li>
10188 <li>00:02</li>
10189 <li>00</li>
10190 <li>1</li>
10191 <li>4</li>
10192 <li>19700101000203</li></ul>
10193
10194 !! end
10195
10196 !! test
10197 Magic Word: {{FULLPAGENAME}}
10198 !! options
10199 title=[[User:Ævar Arnfjörð Bjarmason]]
10200 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10201 !! wikitext
10202 {{FULLPAGENAME}}
10203 !! html/*
10204 <p>User:Ævar Arnfjörð Bjarmason
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{FULLPAGENAMEE}}
10210 !! options
10211 title=[[User:Ævar Arnfjörð Bjarmason]]
10212 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10213 !! wikitext
10214 {{FULLPAGENAMEE}}
10215 !! html/*
10216 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10217 </p>
10218 !! end
10219
10220 !! test
10221 Magic Word: {{TALKSPACE}}
10222 !! options
10223 title=[[User:Ævar Arnfjörð Bjarmason]]
10224 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10225 !! wikitext
10226 {{TALKSPACE}}
10227 !! html/*
10228 <p>User talk
10229 </p>
10230 !! end
10231
10232 !! test
10233 Magic Word: {{TALKSPACE}}, same namespace
10234 !! options
10235 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10236 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10237 !! wikitext
10238 {{TALKSPACE}}
10239 !! html/*
10240 <p>User talk
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{TALKSPACE}}, main namespace
10246 !! options
10247 title=[[Parser Test]]
10248 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10249 !! wikitext
10250 {{TALKSPACE}}
10251 !! html/*
10252 <p>Talk
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{TALKSPACEE}}
10258 !! options
10259 title=[[User:Ævar Arnfjörð Bjarmason]]
10260 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10261 !! wikitext
10262 {{TALKSPACEE}}
10263 !! html/*
10264 <p>User_talk
10265 </p>
10266 !! end
10267
10268 !! test
10269 Magic Word: {{SUBJECTSPACE}}
10270 !! options
10271 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10272 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10273 !! wikitext
10274 {{SUBJECTSPACE}}
10275 !! html/*
10276 <p>User
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Word: {{SUBJECTSPACE}}, same namespace
10282 !! options
10283 title=[[User:Ævar Arnfjörð Bjarmason]]
10284 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10285 !! wikitext
10286 {{SUBJECTSPACE}}
10287 !! html/*
10288 <p>User
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{SUBJECTSPACE}}, main namespace
10294 !! options
10295 title=[[Parser Test]]
10296 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10297 !! wikitext
10298 {{SUBJECTSPACE}}
10299 !! html/*
10300
10301 !! end
10302
10303 !! test
10304 Magic Word: {{SUBJECTSPACEE}}
10305 !! options
10306 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10307 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10308 !! wikitext
10309 {{SUBJECTSPACEE}}
10310 !! html/*
10311 <p>User
10312 </p>
10313 !! end
10314
10315 !! test
10316 Magic Word: {{NAMESPACE}}
10317 !! options
10318 title=[[User:Ævar Arnfjörð Bjarmason]]
10319 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10320 !! wikitext
10321 {{NAMESPACE}}
10322 !! html/*
10323 <p>User
10324 </p>
10325 !! end
10326
10327 !! test
10328 Magic Word: {{NAMESPACEE}}
10329 !! options
10330 title=[[User:Ævar Arnfjörð Bjarmason]]
10331 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10332 !! wikitext
10333 {{NAMESPACEE}}
10334 !! html/*
10335 <p>User
10336 </p>
10337 !! end
10338
10339 !! test
10340 Magic Word: {{NAMESPACENUMBER}}
10341 !! options
10342 title=[[User:Ævar Arnfjörð Bjarmason]]
10343 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10344 !! wikitext
10345 {{NAMESPACENUMBER}}
10346 !! html/*
10347 <p>2
10348 </p>
10349 !! end
10350
10351 !! test
10352 Magic Word: {{SUBPAGENAME}}
10353 !! options
10354 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10355 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10356 !! wikitext
10357 {{SUBPAGENAME}}
10358 !! html/*
10359 <p>sub ö
10360 </p>
10361 !! end
10362
10363 !! test
10364 Magic Word: {{SUBPAGENAMEE}}
10365 !! options
10366 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10367 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10368 !! wikitext
10369 {{SUBPAGENAMEE}}
10370 !! html/*
10371 <p>sub_%C3%B6
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{ROOTPAGENAME}}
10377 !! options
10378 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10379 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10380 !! wikitext
10381 {{ROOTPAGENAME}}
10382 !! html/*
10383 <p>Ævar Arnfjörð Bjarmason
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{ROOTPAGENAMEE}}
10389 !! options
10390 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10391 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10392 !! wikitext
10393 {{ROOTPAGENAMEE}}
10394 !! html/*
10395 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10396 </p>
10397 !! end
10398
10399 !! test
10400 Magic Word: {{BASEPAGENAME}}
10401 !! options
10402 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10403 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10404 !! wikitext
10405 {{BASEPAGENAME}}
10406 !! html/*
10407 <p>Ævar Arnfjörð Bjarmason
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{BASEPAGENAMEE}}
10413 !! options
10414 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10415 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10416 !! wikitext
10417 {{BASEPAGENAMEE}}
10418 !! html/*
10419 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10420 </p>
10421 !! end
10422
10423 !! test
10424 Magic Word: {{TALKPAGENAME}}
10425 !! options
10426 title=[[User:Ævar Arnfjörð Bjarmason]]
10427 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10428 !! wikitext
10429 {{TALKPAGENAME}}
10430 !! html/*
10431 <p>User talk:Ævar Arnfjörð Bjarmason
10432 </p>
10433 !! end
10434
10435 !! test
10436 Magic Word: {{TALKPAGENAMEE}}
10437 !! options
10438 title=[[User:Ævar Arnfjörð Bjarmason]]
10439 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10440 !! wikitext
10441 {{TALKPAGENAMEE}}
10442 !! html/*
10443 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{SUBJECTPAGENAME}}
10449 !! options
10450 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{SUBJECTPAGENAME}}
10454 !! html/*
10455 <p>User:Ævar Arnfjörð Bjarmason
10456 </p>
10457 !! end
10458
10459 !! test
10460 Magic Word: {{SUBJECTPAGENAMEE}}
10461 !! options
10462 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10463 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10464 !! wikitext
10465 {{SUBJECTPAGENAMEE}}
10466 !! html/*
10467 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10468 </p>
10469 !! end
10470
10471 !! test
10472 Magic Word: {{NUMBEROFFILES}}
10473 !! options
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{NUMBEROFFILES}}
10477 !! html/*
10478 <p>7
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{PAGENAME}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{PAGENAME}}
10489 !! html/*
10490 <p>Ævar Arnfjörð Bjarmason
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{PAGENAME}} with metacharacters
10496 !! options
10497 title=[['foo & bar = baz']]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 ''{{PAGENAME}}''
10501 !! html+tidy
10502 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10508 !! options
10509 title=[[*RFC 1234 http://example.com/]]
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{PAGENAME}}
10513 !! html+tidy
10514 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{PAGENAMEE}}
10520 !! options
10521 title=[[User:Ævar Arnfjörð Bjarmason]]
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{PAGENAMEE}}
10525 !! html/*
10526 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10532 !! options
10533 title=[[*RFC 1234 http://example.com/]]
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{PAGENAMEE}}
10537 !! html+tidy
10538 <p>&#42;RFC_1234_http&#58;//example.com/
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{REVISIONID}}
10544 !! options
10545 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10546 showflags
10547 !! wikitext
10548 {{REVISIONID}}
10549 !! html/*
10550 <p>1337
10551 </p>
10552 flags=vary-revision-id
10553 !! end
10554
10555 !! test
10556 Magic Word: {{SCRIPTPATH}}
10557 !! options
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SCRIPTPATH}}
10561 !! html/*
10562
10563 !! end
10564
10565 !! test
10566 Magic Word: {{STYLEPATH}}
10567 !! options
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{STYLEPATH}}
10571 !! html/*
10572 <p>/skins
10573 </p>
10574 !! end
10575
10576 !! test
10577 Magic Word: {{SERVER}}
10578 !! options
10579 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10580 !! wikitext
10581 {{SERVER}}
10582 !! html/*
10583 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10584 </p>
10585 !! end
10586
10587 !! test
10588 Magic Word: {{SERVERNAME}}
10589 !! options
10590 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10591 !! wikitext
10592 {{SERVERNAME}}
10593 !! html/*
10594 <p>example.org
10595 </p>
10596 !! end
10597
10598 !! test
10599 Magic Word: {{SITENAME}}
10600 !! options
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{SITENAME}}
10604 !! html/*
10605 <p>MediaWiki
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{PAGELANGUAGE}}
10611 !! options
10612 language=fr
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{PAGELANGUAGE}}
10616 !! html/*
10617 <p>fr
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10623 !! options
10624 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10625 !! wikitext
10626 {{PAGELANGUAGE}}
10627 !! html/*
10628 <p>en
10629 </p>
10630 !! end
10631
10632 !! test
10633 Case-sensitive magic words, when cased differently, should just be template transclusions
10634 !! wikitext
10635 {{CurrentMonth}}
10636 {{currentday}}
10637 {{cURreNTweEK}}
10638 {{currentHour}}
10639 !! html
10640 <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>
10641 <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>
10642 <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>
10643 <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>
10644 </p>
10645 !! end
10646
10647 !! test
10648 Case-insensitive magic words should still work with weird casing.
10649 !! wikitext
10650 {{sErVeRNaMe}}
10651 {{LCFirst:AOEU}}
10652 {{ucFIRST:aoeu}}
10653 {{SERver}}
10654 !! html
10655 <p>example.org
10656 aOEU
10657 Aoeu
10658 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10659 </p>
10660 !! end
10661
10662 # From plwiki:PLOS_ONE
10663 !! test
10664 Parsoid: Page property magic word with magic word contents
10665 !! wikitext
10666 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10667 !! html/parsoid
10668 <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>"}]]}'/>
10669 !! end
10670
10671 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10672 # But, this is a limitation of our representation and is documented in
10673 # TemplateHandler.js in processSpecialMagicWord
10674 !! test
10675 Parsoid: Template-generated DISPLAYTITLE
10676 !! wikitext
10677 {{{{echo|DISPLAYTITLE}}:Foo}}
10678 !! options
10679 showtitle
10680 !! config
10681 wgAllowDisplayTitle=true
10682 wgRestrictDisplayTitle=false
10683 !! html/php
10684 Foo
10685
10686 !! html/parsoid
10687 <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"}]]}'/>
10688 !! end
10689
10690 !! test
10691 Namespace 1 {{ns:1}}
10692 !! wikitext
10693 {{ns:1}}
10694 !! html
10695 <p>Talk
10696 </p>
10697 !! end
10698
10699 !! test
10700 Namespace 1 {{ns:01}}
10701 !! wikitext
10702 {{ns:01}}
10703 !! html
10704 <p>Talk
10705 </p>
10706 !! end
10707
10708 !! test
10709 Namespace 0 {{ns:0}} (T6783)
10710 !! wikitext
10711 {{ns:0}}
10712 !! html
10713
10714 !! end
10715
10716 !! test
10717 Namespace 0 {{ns:00}} (T6783)
10718 !! wikitext
10719 {{ns:00}}
10720 !! html
10721
10722 !! end
10723
10724 !! test
10725 Namespace -1 {{ns:-1}}
10726 !! wikitext
10727 {{ns:-1}}
10728 !! html
10729 <p>Special
10730 </p>
10731 !! end
10732
10733 !! test
10734 Namespace User {{ns:User}}
10735 !! wikitext
10736 {{ns:User}}
10737 !! html
10738 <p>User
10739 </p>
10740 !! end
10741
10742 !! test
10743 Namespace User talk {{ns:User_talk}}
10744 !! wikitext
10745 {{ns:User_talk}}
10746 !! html
10747 <p>User talk
10748 </p>
10749 !! end
10750
10751 !! test
10752 Namespace User talk {{ns:uSeR tAlK}}
10753 !! wikitext
10754 {{ns:uSeR tAlK}}
10755 !! html
10756 <p>User talk
10757 </p>
10758 !! end
10759
10760 !! test
10761 Namespace File {{ns:File}}
10762 !! wikitext
10763 {{ns:File}}
10764 !! html
10765 <p>File
10766 </p>
10767 !! end
10768
10769 !! test
10770 Namespace File {{ns:Image}}
10771 !! wikitext
10772 {{ns:Image}}
10773 !! html
10774 <p>File
10775 </p>
10776 !! end
10777
10778 !! test
10779 Namespace (lang=de) Benutzer {{ns:User}}
10780 !! options
10781 language=de
10782 !! wikitext
10783 {{ns:User}}
10784 !! html
10785 <p>Benutzer
10786 </p>
10787 !! end
10788
10789 !! test
10790 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10791 !! options
10792 language=de
10793 !! wikitext
10794 {{ns:3}}
10795 !! html
10796 <p>Benutzer Diskussion
10797 </p>
10798 !! end
10799
10800 !! test
10801 Urlencode
10802 !! wikitext
10803 {{urlencode:hi world?!}}
10804 {{urlencode:hi world?!|WIKI}}
10805 {{urlencode:hi world?!|PATH}}
10806 {{urlencode:hi world?!|QUERY}}
10807 !! html/php
10808 <p>hi+world%3F%21
10809 hi_world%3F!
10810 hi%20world%3F%21
10811 hi+world%3F%21
10812 </p>
10813 !! end
10814
10815 !! test
10816 Magic Word: prioritize type info over data-parsoid
10817 !! options
10818 parsoid=html2wt
10819 !! html/parsoid
10820 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10821 !! wikitext
10822 __FORCETOC__
10823 !! end
10824
10825 !! test
10826 Magic Word: serialize on separate line (parsoid)
10827 !! options
10828 parsoid=wt2wt,html2wt
10829 !! wikitext
10830 foo
10831 __NOTOC__
10832 bar
10833 !! html/parsoid
10834 foo<meta property="mw:PageProp/notoc"/>bar
10835 !! end
10836
10837 !! test
10838 Magic Word: rt non-english wikis
10839 !! options
10840 parsoid=wt2wt
10841 language=de
10842 !! wikitext
10843 __NOEDITSECTION__
10844 !! html/parsoid
10845 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10846 !! end
10847
10848 !!test
10849 __proto__ is treated as normal wikitext (T105997)
10850 !!wikitext
10851 __proto__
10852 !!html
10853 <p>__proto__
10854 </p>
10855 !!end
10856
10857 ###
10858 ### Magic links
10859 ###
10860 !! test
10861 Magic links: internal link to RFC (T2479)
10862 !! wikitext
10863 [[RFC 123]]
10864 !! html/php
10865 <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>
10866 </p>
10867 !! html/parsoid
10868 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10869 !! end
10870
10871 !! test
10872 Magic links: RFC (T2479)
10873 !! wikitext
10874 RFC 822
10875 !! html/php
10876 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10877 </p>
10878 !! html/parsoid
10879 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10880 !! end
10881
10882 !! test
10883 Magic links: RFC (T67278)
10884 !! wikitext
10885 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10886 !! html/php
10887 <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.
10888 </p>
10889 !! html/parsoid
10890 <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>
10891 !! end
10892
10893 !! test
10894 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10895 !! wikitext
10896 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10897 RFC
10898 822
10899 !! html/php
10900 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10901 RFC
10902 822
10903 </p>
10904 !! html/parsoid
10905 <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>
10906 RFC
10907 822</p>
10908 !! end
10909
10910 !! test
10911 Magic links: ISBN (T3937)
10912 !! wikitext
10913 ISBN 0-306-40615-2
10914 !! html/php
10915 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10916 </p>
10917 !! html/parsoid
10918 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10919 !! end
10920
10921 !! test
10922 Magic links: ISBN (T67278)
10923 !! wikitext
10924 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10925 !! html/php
10926 <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.
10927 </p>
10928 !! html/parsoid
10929 <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>
10930 !! end
10931
10932 !! test
10933 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10934 !! wikitext
10935 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10936 ISBN
10937 9780316098113
10938 ISBN 978
10939 0316098113
10940 !! html/php
10941 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10942 ISBN
10943 9780316098113
10944 ISBN 978
10945 0316098113
10946 </p>
10947 !! html/parsoid
10948 <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>
10949 ISBN
10950 9780316098113
10951 ISBN 978
10952 0316098113</p>
10953 !! end
10954
10955 !! test
10956 Magic links: PMID incorrectly converts space to underscore
10957 !! wikitext
10958 PMID 1234
10959 !! html/php
10960 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10961 </p>
10962 !! html/parsoid
10963 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10964 !! end
10965
10966 !! test
10967 Magic links: PMID (T67278)
10968 !! wikitext
10969 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10970 !! html/php
10971 <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.
10972 </p>
10973 !! html/parsoid
10974 <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>
10975 !! end
10976
10977 !! test
10978 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10979 !! wikitext
10980 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10981 PMID
10982 1234
10983 !! html/php
10984 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10985 PMID
10986 1234
10987 </p>
10988 !! html/parsoid
10989 <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>
10990 PMID
10991 1234</p>
10992 !! end
10993
10994 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10995 # since these are ExtLinkText, not MagicLinkText
10996 !! test
10997 Magic links: use appropriate serialization for "almost" magic links.
10998 !! wikitext
10999 X[[Special:BookSources/0978739256|foo]]
11000
11001 X[https://tools.ietf.org/html/rfc1234 foo]
11002 !! html/php
11003 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11004 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11005 </p>
11006 !! html/parsoid
11007 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11008 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11009 !! end
11010
11011 !! test
11012 Magic links: All disabled (T47942)
11013 !! options
11014 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11015 !! wikitext
11016 ISBN 0-306-40615-2
11017 PMID 1234
11018 RFC 4321
11019 !! html/php
11020 <p>ISBN 0-306-40615-2
11021 PMID 1234
11022 RFC 4321
11023 </p>
11024 !! end
11025
11026 ###
11027 ### Templates
11028 ####
11029
11030 !! test
11031 Nonexistent template
11032 !! wikitext
11033 {{thistemplatedoesnotexist}}
11034 !! html
11035 <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>
11036 </p>
11037 !! end
11038
11039 !! test
11040 Template with invalid target containing tags
11041 !! wikitext
11042 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11043 !! html
11044 <p>{{a<b>b</b>|foo|a=b|a = b}}
11045 </p>
11046 !! end
11047
11048 !! test
11049 Template with invalid target containing unclosed tag
11050 !! wikitext
11051 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11052 !! html
11053 <p>{{a<b>|foo|a=b|a = b}}</b>
11054 </p>
11055 !! end
11056
11057 !! test
11058 Template with invalid target containing wikilink
11059 !! wikitext
11060 {{[[Main Page]]}}
11061 !! html/php
11062 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11063 </p>
11064 !! html/parsoid
11065 <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>
11066 !! end
11067
11068 !! test
11069 Template with just whitespace in it, T70421
11070 !! wikitext
11071 {{echo|{{ }}}}
11072 !! html/parsoid
11073 <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>
11074 !! end
11075
11076 !! article
11077 Template:test
11078 !! text
11079 This is a test template
11080 !! endarticle
11081
11082 !! test
11083 Simple template
11084 !! wikitext
11085 {{test}}
11086 !! html
11087 <p>This is a test template
11088 </p>
11089 !! end
11090
11091 !! test
11092 Template with explicit namespace
11093 !! wikitext
11094 {{Template:test}}
11095 !! html
11096 <p>This is a test template
11097 </p>
11098 !! end
11099
11100
11101 !! article
11102 Template:paramtest
11103 !! text
11104 This is a test template with parameter {{{param}}}
11105 !! endarticle
11106
11107 !! test
11108 Template parameter
11109 !! wikitext
11110 {{paramtest|param=foo}}
11111 !! html
11112 <p>This is a test template with parameter foo
11113 </p>
11114 !! end
11115
11116 !! article
11117 Template:paramtestnum
11118 !! text
11119 [[{{{1}}}|{{{2}}}]]
11120 !! endarticle
11121
11122 !! test
11123 Template unnamed parameter
11124 !! wikitext
11125 {{paramtestnum|Main Page|the main page}}
11126 !! html
11127 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11128 </p>
11129 !! end
11130
11131 !! article
11132 Template:templatesimple
11133 !! text
11134 (test)
11135 !! endarticle
11136
11137 !! article
11138 Template:templateredirect
11139 !! text
11140 #redirect [[Template:templatesimple]]
11141 !! endarticle
11142
11143 !! article
11144 Template:templateasargtestnum
11145 !! text
11146 {{{{{1}}}}}
11147 !! endarticle
11148
11149 !! article
11150 Template:templateasargtest
11151 !! text
11152 {{template{{{templ}}}}}
11153 !! endarticle
11154
11155 !! article
11156 Template:templateasargtest2
11157 !! text
11158 {{{{{templ}}}}}
11159 !! endarticle
11160
11161 !! test
11162 Template with template name as unnamed argument
11163 !! wikitext
11164 {{templateasargtestnum|templatesimple}}
11165 !! html
11166 <p>(test)
11167 </p>
11168 !! end
11169
11170 !! test
11171 Template with template name as argument
11172 !! wikitext
11173 {{templateasargtest|templ=simple}}
11174 !! html
11175 <p>(test)
11176 </p>
11177 !! end
11178
11179 !! test
11180 Template with template name as argument (2)
11181 !! wikitext
11182 {{templateasargtest2|templ=templatesimple}}
11183 !! html
11184 <p>(test)
11185 </p>
11186 !! end
11187
11188 !! article
11189 Template:templateasargtestdefault
11190 !! text
11191 {{{{{templ|templatesimple}}}}}
11192 !! endarticle
11193
11194 !! article
11195 Template:templa
11196 !! text
11197 '''templ'''
11198 !! endarticle
11199
11200 !! test
11201 Template with default value
11202 !! wikitext
11203 {{templateasargtestdefault}}
11204 !! html
11205 <p>(test)
11206 </p>
11207 !! end
11208
11209 !! test
11210 Template with default value (value set)
11211 !! wikitext
11212 {{templateasargtestdefault|templ=templa}}
11213 !! html
11214 <p><b>templ</b>
11215 </p>
11216 !! end
11217
11218 !! test
11219 Template redirect
11220 !! wikitext
11221 {{templateredirect}}
11222 !! html/php
11223 <p>(test)
11224 </p>
11225 !! html/parsoid
11226 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11227 !! end
11228
11229 !! test
11230 Template with argument in separate line
11231 !! wikitext
11232 {{ templateasargtest |
11233 templ = simple }}
11234 !! html
11235 <p>(test)
11236 </p>
11237 !! end
11238
11239 !! test
11240 Template with complex template as argument
11241 !! wikitext
11242 {{paramtest|
11243 param ={{ templateasargtest |
11244 templ = simple }}}}
11245 !! html
11246 <p>This is a test template with parameter (test)
11247 </p>
11248 !! end
11249
11250 !! test
11251 Templates with templated name
11252 !! wikitext
11253 {{{{echo|echo}}|foo}}
11254 {{{{echo|inner list}} }}
11255 !! html
11256 <p>foo
11257 </p>
11258 <ul><li>item 1</li></ul>
11259
11260 !! html/parsoid
11261 <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>
11262 <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>
11263 !! end
11264
11265 ## Regression test; the output here isn't really that interesting.
11266 !! test
11267 Templates with templated name and top level template args
11268 !! wikitext
11269 {{1{{2{{{3}}}|4=5}}}}
11270 !! html/parsoid
11271 <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>
11272 !! end
11273
11274 # Parsoid markup is deliberate "broken". This is an edge case.
11275 # See long comment in TemplateHandler.js:convertAttribsToString.
11276 !! test
11277 Templates with invalid templated targets
11278 !! wikitext
11279 {{echo
11280 {{echo|foo}}
11281 }}
11282 !! html/php
11283 <p>{{echo
11284 foo
11285 }}
11286 </p>
11287 !! html/parsoid
11288 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11289 foo }}</p>
11290 !! end
11291
11292 !! test
11293 Template with thumb image (with link in description)
11294 !! wikitext
11295 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11296 !! html/php
11297 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>
11298
11299 !! html+tidy
11300 <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>
11301 !! html/parsoid
11302 <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>
11303 !! end
11304
11305 !! article
11306 Template:complextemplate
11307 !! text
11308 {{{1}}} {{paramtest|
11309 param ={{{param}}}}}
11310 !! endarticle
11311
11312 !! test
11313 Template with complex arguments
11314 !! wikitext
11315 {{complextemplate|
11316 param ={{ templateasargtest |
11317 templ = simple }}|[[Template:complextemplate|link]]}}
11318 !! html
11319 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11320 </p>
11321 !! end
11322
11323 !! test
11324 T2553: link with two variables in a piped link
11325 !! wikitext
11326 {|
11327 |[[{{{1}}}|{{{2}}}]]
11328 |}
11329 !! html/php
11330 <table>
11331 <tr>
11332 <td>[[{{{1}}}|{{{2}}}]]
11333 </td></tr></table>
11334
11335 !! html/parsoid
11336 <table>
11337 <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>
11338 </tbody></table>
11339 !! end
11340
11341 # See: T2553
11342 !! test
11343 Abort table cell attribute parsing on wikilink
11344 !! wikitext
11345 {|
11346 |testing [[one|two]] |three||four
11347 |testing one two |three||four
11348 |testing="[[one|two]]" |three||four
11349 |}
11350 !! html/php
11351 <table>
11352 <tr>
11353 <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>
11354 <td>four
11355 </td>
11356 <td>three</td>
11357 <td>four
11358 </td>
11359 <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>
11360 <td>four
11361 </td></tr></table>
11362
11363 !! html/parsoid
11364 <table>
11365 <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>
11366 <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>
11367 <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>
11368 </tbody></table>
11369 !! end
11370
11371 !! test
11372 Don't abort table cell attribute parsing if wikilink is found in template arg
11373 !! wikitext
11374 {|
11375 |Test {{#tag:ref|One two "[[three]]" four}}
11376 |}
11377 !! html/parsoid
11378 <table>
11379 <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>
11380 </tbody></table>
11381 !! end
11382
11383 !! test
11384 Magic variable as template parameter
11385 !! wikitext
11386 {{paramtest|param={{SITENAME}}}}
11387 !! html
11388 <p>This is a test template with parameter MediaWiki
11389 </p>
11390 !! end
11391
11392 !! article
11393 Template:linktest
11394 !! text
11395 [[{{{param}}}|link]]
11396 !! endarticle
11397
11398 !! test
11399 Template parameter as link source
11400 !! wikitext
11401 {{linktest|param=Main Page}}
11402 !! html
11403 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11404 </p>
11405 !! end
11406
11407 !!article
11408 Template:paramtest2
11409 !! text
11410 including another template, {{paramtest|param={{{arg}}}}}
11411 !! endarticle
11412
11413 !! test
11414 Template passing argument to another template
11415 !! wikitext
11416 {{paramtest2|arg='hmm'}}
11417 !! html
11418 <p>including another template, This is a test template with parameter 'hmm'
11419 </p>
11420 !! end
11421
11422 !! article
11423 Template:Linktest2
11424 !! text
11425 Main Page
11426 !! endarticle
11427
11428 !! test
11429 Template as link source
11430 !! wikitext
11431 [[{{linktest2}}]]
11432
11433 [[{{linktest2}}|Main Page]]
11434
11435 [[{{linktest2}}]]Page
11436 !! html
11437 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11438 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11439 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11440 </p>
11441 !! end
11442
11443
11444 !! article
11445 Template:loop1
11446 !! text
11447 {{loop2}}
11448 !! endarticle
11449
11450 !! article
11451 Template:loop2
11452 !! text
11453 {{loop1}}
11454 !! endarticle
11455
11456 !! test
11457 Template infinite loop
11458 !! wikitext
11459 {{loop1}}
11460 !! html
11461 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11462 </p>
11463 !! end
11464
11465 !! test
11466 Template from main namespace
11467 !! wikitext
11468 {{:Main Page}}
11469 !! html
11470 <p>blah blah
11471 </p>
11472 !! end
11473
11474 !! article
11475 Template:table
11476 !! text
11477 {|
11478 | 1 || 2
11479 |-
11480 | 3 || 4
11481 |}
11482 !! endarticle
11483
11484 !! test
11485 T2529: Template with table, not included at beginning of line
11486 !! wikitext
11487 foo {{table}}
11488 !! html
11489 <p>foo
11490 </p>
11491 <table>
11492 <tr>
11493 <td>1</td>
11494 <td>2
11495 </td></tr>
11496 <tr>
11497 <td>3</td>
11498 <td>4
11499 </td></tr></table>
11500
11501 !! end
11502
11503 !! test
11504 T2523: Template shouldn't eat newline (or add an extra one before table)
11505 !! wikitext
11506 foo
11507 {{table}}
11508 !! html
11509 <p>foo
11510 </p>
11511 <table>
11512 <tr>
11513 <td>1</td>
11514 <td>2
11515 </td></tr>
11516 <tr>
11517 <td>3</td>
11518 <td>4
11519 </td></tr></table>
11520
11521 !! end
11522
11523 !! test
11524 T2041: Template parameters shown as broken links
11525 !! wikitext
11526 {{{parameter}}}
11527 !! html
11528 <p>{{{parameter}}}
11529 </p>
11530 !! end
11531
11532 !! test
11533 Template with targets containing wikilinks
11534 !! options
11535 parsoid=wt2html
11536 !! wikitext
11537 {{[[foo]]}}
11538
11539 {{[[{{echo|foo}}]]}}
11540
11541 {{{{echo|[[foo}}]]}}
11542 !! html/php
11543 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11544 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11545 </p><p>{{[[foo}}]]
11546 </p>
11547 !! html/parsoid
11548 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11549 <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>
11550 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11551 !! end
11552
11553 !! article
11554 Template:''
11555 !! text
11556 bar
11557 !! endarticle
11558
11559 !! test
11560 Templates: Double quotes as template target
11561 !! wikitext
11562 foo {{''}} baz
11563 !! html/php
11564 <p>foo bar baz
11565 </p>
11566 !! html/parsoid
11567 <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
11568 </p>
11569 !! end
11570
11571 ## This test is about making sure Parsoid's data-mw is well formed in the
11572 ## face of multiple templates with intersecting and overlapping ranges. The
11573 ## wikitext itself is wretched.
11574 !! test
11575 Templates with intersecting and overlapping ranges
11576 !! wikitext
11577 {|{{echo|
11578 <p>ha</p>}}
11579 {|{{echo|
11580 <p>ho</p>}}
11581 {{echo|{{!}}hi}}
11582 |}
11583 !! html/php+tidy
11584 <p>ha</p><table>
11585
11586 </table><p>ho</p><table>
11587
11588 <tbody><tr>
11589 <td>hi
11590 </td></tr></tbody></table>
11591 !! html/parsoid
11592 <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":""}]]}'>
11593
11594 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11595
11596 <tbody><tr><td>hi</td></tr>
11597 </tbody></table>
11598 !! end
11599
11600 !! article
11601 Template:MSGNW test
11602 !! text
11603 ''None'' of '''this''' should be
11604 * interpreted
11605 but rather passed unmodified
11606 {{test}}
11607 <gallery>
11608 File:Foobar.jpg
11609 </gallery>
11610 <!-- comment -->
11611 !! endarticle
11612
11613 # hmm, fix this or just deprecate msgnw and document its behavior?
11614 !! test
11615 msgnw keyword
11616 !! wikitext
11617 {{msgnw:MSGNW test}}
11618 !! html/php
11619 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11620 &#42; interpreted
11621 &#32;but rather passed unmodified
11622 &#123;&#123;test&#125;&#125;
11623 &#60;gallery&#62;
11624 File:Foobar.jpg
11625 &#60;/gallery&#62;
11626 &#60;!-- comment --&#62;
11627 </p>
11628 !! end
11629
11630 !! test
11631 int keyword
11632 !! wikitext
11633 {{int:youhavenewmessages|lots of money|not!}}
11634 !! html
11635 <p>You have lots of money (not!).
11636 </p>
11637 !! end
11638
11639 !! test
11640 int keyword - non-existing message
11641 !! wikitext
11642 {{int:var}}
11643 !! html
11644 <p>⧼var⧽
11645 </p>
11646 !! end
11647
11648 !! article
11649 Template:Includes
11650 !! text
11651 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11652 !! endarticle
11653
11654 !! test
11655 <includeonly> and <noinclude> being included
11656 !! wikitext
11657 {{Includes}}
11658 !! html
11659 <p>Foobar
11660 </p>
11661 !! end
11662
11663 !! article
11664 Template:Includes2
11665 !! text
11666 <onlyinclude>Foo</onlyinclude>bar
11667 !! endarticle
11668
11669 !! test
11670 <onlyinclude> being included
11671 !! wikitext
11672 {{Includes2}}
11673 !! html
11674 <p>Foo
11675 </p>
11676 !! end
11677
11678
11679 !! article
11680 Template:Includes3
11681 !! text
11682 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11683 !! endarticle
11684
11685 !! test
11686 <onlyinclude> and <includeonly> being included
11687 !! wikitext
11688 {{Includes3}}
11689 !! html
11690 <p>Foo
11691 </p>
11692 !! end
11693
11694 !! test
11695 <includeonly> and <noinclude> on a page
11696 !! wikitext
11697 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11698 !! html
11699 <p>Foozar
11700 </p>
11701 !! end
11702
11703 !! test
11704 Un-closed <noinclude>
11705 !! wikitext
11706 <noinclude>
11707 !! html
11708 !! end
11709
11710 !! test
11711 <onlyinclude> on a page
11712 !! wikitext
11713 <onlyinclude>Foo</onlyinclude>bar
11714 !! html
11715 <p>Foobar
11716 </p>
11717 !! end
11718
11719 !! test
11720 Un-closed <onlyinclude>
11721 !! wikitext
11722 <onlyinclude>
11723 !! html
11724 !! end
11725
11726 !!test
11727 Self-closed noinclude, includeonly, onlyinclude tags
11728 !! wikitext
11729 <noinclude />
11730 <includeonly />
11731 <onlyinclude />
11732 !! html
11733 <p><br />
11734 </p>
11735 !!end
11736
11737 !!test
11738 Unbalanced includeonly and noinclude tags
11739 !! wikitext
11740 {|
11741 |a</noinclude>
11742 |b</noinclude></noinclude>
11743 |c</noinclude></includeonly>
11744 |d</includeonly></includeonly>
11745 |}
11746 !! html
11747 <table>
11748 <tr>
11749 <td>a
11750 </td>
11751 <td>b
11752 </td>
11753 <td>c&lt;/includeonly&gt;
11754 </td>
11755 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11756 </td></tr></table>
11757
11758 !!end
11759
11760 !! article
11761 Template:Includeonly section
11762 !! text
11763 <includeonly>
11764 ==Includeonly section==
11765 </includeonly>
11766 ==Section T-1==
11767 !!endarticle
11768
11769 !! test
11770 T8563: Edit link generation for section shown by <includeonly>
11771 !! wikitext
11772 {{includeonly section}}
11773 !! html
11774 <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>
11775 <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>
11776
11777 !! end
11778
11779 # Uses same input as the contents of [[Template:Includeonly section]]
11780 !! test
11781 T8563: Section extraction for section shown by <includeonly>
11782 !! options
11783 section=T-2
11784 !! wikitext
11785 <includeonly>
11786 ==Includeonly section==
11787 </includeonly>
11788 ==Section T-2==
11789 !! html
11790 ==Section T-2==
11791 !! end
11792
11793 !! test
11794 T8563: Edit link generation for section suppressed by <includeonly>
11795 !! wikitext
11796 <includeonly>
11797 ==Includeonly section==
11798 </includeonly>
11799 ==Section 1==
11800 !! html
11801 <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>
11802
11803 !! end
11804
11805 !! test
11806 T8563: Section extraction for section suppressed by <includeonly>
11807 !! options
11808 section=1
11809 !! wikitext
11810 <includeonly>
11811 ==Includeonly section==
11812 </includeonly>
11813 ==Section 1==
11814 !! html
11815 ==Section 1==
11816 !! end
11817
11818 !! test
11819 Un-closed <includeonly>
11820 !! wikitext
11821 <includeonly>
11822 !! html/php
11823 !! html/parsoid
11824 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11825 !! end
11826
11827 ## We used to, but no longer wt2wt this test since the default serializer
11828 ## will normalize the include directives to serialize on their own line.
11829 ## Selser will take care of preserving formatting in scenarios where they
11830 ## intermingled with other wikitext.
11831 !! test
11832 Includes and comments at SOL
11833 !! options
11834 parsoid=wt2html,html2html
11835 !! wikitext
11836 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11837
11838 <noinclude>
11839 some
11840 </noinclude>*stuff
11841 *here
11842
11843 <includeonly>can have stuff</includeonly>===here===
11844
11845 !! html/php
11846 <h2><span class="mw-headline" id="hu">hu</span></h2>
11847 <p>some
11848 </p>
11849 <ul><li>stuff</li>
11850 <li>here</li></ul>
11851 <h3><span class="mw-headline" id="here">here</span></h3>
11852
11853 !! html/parsoid
11854 <!-- 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>
11855
11856 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11857 <p>some</p>
11858 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11859 <li>here</li></ul>
11860
11861 <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>
11862
11863 !! end
11864
11865 # TODO: test with DOM fragment reuse!
11866 !! test
11867 Parsoid: DOM fragment reuse
11868 !! options
11869 parsoid=wt2wt,wt2html
11870 !! wikitext
11871 a{{echo|b<table></table>c}}d
11872
11873 a{{echo|b
11874 <table></table>
11875 c}}d
11876
11877 {{echo|a
11878
11879 <table></table>
11880
11881 b}}
11882 !! html
11883 <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>
11884
11885 <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">
11886 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11887 </span><p about="#mwt2">cd</p>
11888
11889 <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">
11890
11891 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11892
11893 </span><p about="#mwt3">b</p>
11894 !! end
11895
11896 !! test
11897 Parsoid: Merge double tds (T52603)
11898 !! options
11899 parsoid
11900 !! wikitext
11901 {|
11902 |{{echo|{{!}} foo}}
11903 |}
11904 !! html
11905 <table><tbody>
11906 <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>
11907 </tbody></table>
11908 !! end
11909
11910 !! test
11911 Parsoid: Merge double tds in nested transclusion content (T52603)
11912 !! options
11913 parsoid
11914 !! wikitext
11915 {{echo|<div>}}
11916 {|
11917 |{{echo|{{!}} foo}}
11918 |}
11919 {{echo|</div>}}
11920 !! html
11921 <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}}]}'>
11922 <table><tbody>
11923 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11924 </tbody></table>
11925 </div>
11926 !! end
11927
11928 ###
11929 ### <includeonly> and <noinclude> in attributes
11930 ###
11931 !!test
11932 0. includeonly around the entire attribute
11933 !! wikitext
11934 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11935 !! html
11936 <p><span id="v2">bar</span>
11937 </p>
11938 !!end
11939
11940 !!test
11941 1. includeonly in html attr key
11942 !! wikitext
11943 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11944 !! html
11945 <p><span id="foo">bar</span>
11946 </p>
11947 !!end
11948
11949 !!test
11950 2. includeonly in html attr value
11951 !! wikitext
11952 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11953 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11954 !! html
11955 <p><span id="v1">bar</span>
11956 <span id="v1">bar</span>
11957 </p>
11958 !!end
11959
11960 !!test
11961 3. includeonly in part of an attr value
11962 !! wikitext
11963 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11964 !! html
11965 <p><span style="color:red;">bar</span>
11966 </p>
11967 !!end
11968
11969 !!test
11970 4. includeonly in table attributes
11971 !! wikitext
11972 {|
11973 |- <noinclude>
11974 |-
11975 |a
11976 </noinclude>
11977 |- <includeonly>
11978 |-
11979 |b
11980 </includeonly>
11981 |}
11982 !! html
11983 <table>
11984
11985
11986 <tr>
11987 <td>a
11988 </td></tr>
11989 </table>
11990
11991 !!end
11992
11993 ###
11994 ### Preprocessor precedence tests
11995 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11996 ###
11997 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11998 !! test
11999 Preprocessor precedence 1: link is rightmost opening
12000 !! options
12001 parsoid=wt2html
12002 !! wikitext
12003 {{[[Foo|bar}}]]
12004
12005 But close-brace is not a valid character in a link title:
12006 {{[[Foo}}|bar]]
12007
12008 However, we can still tell this was handled as a link in the preprocessor:
12009 {{echo|[[Foo}}|bar]]|bat}}
12010 !! html/php
12011 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12012 </p><p>But close-brace is not a valid character in a link title:
12013 {{[[Foo}}|bar]]
12014 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12015 [[Foo}}|bar]]
12016 </p>
12017 !! html/parsoid
12018 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12019 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12020 <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>
12021 !! end
12022
12023 !! test
12024 Preprocessor precedence 2: template is rightmost opening
12025 !! options
12026 language=zh
12027 !! wikitext
12028 -{{echo|foo}-}}-
12029 !! html/php
12030 <p>-foo}--
12031 </p>
12032 !! html/parsoid
12033 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12034 !! end
12035
12036 !! test
12037 Preprocessor precedence 3: language converter is rightmost opening
12038 !! options
12039 language=zh
12040 parsoid=wt2html
12041 !! wikitext
12042 {{echo|hi}}
12043
12044 {{-{R|echo|hi}}}-
12045
12046 [[-{R|raw]]}-
12047 !! html/php
12048 <p>hi
12049 </p><p>{{echo|hi}}
12050 </p><p>[[raw]]
12051 </p>
12052 !! html/parsoid
12053 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12054 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12055 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12056 !! end
12057
12058 !! test
12059 Preprocessor precedence 4: left-most angle bracket
12060 !! options
12061 language=zh
12062 !! wikitext
12063 <!--{raw}-->
12064 !! html/php
12065 !! html/parsoid
12066 <!--{raw}-->
12067 !! end
12068
12069 !! article
12070 Template:Precedence5
12071 !! text
12072 {{{{{1}}}}}
12073 !! endarticle
12074
12075 !! test
12076 Preprocessor precedence 5: tplarg takes precedence over template
12077 !! wikitext
12078 {{Precedence5|Bullet}}
12079 !! html/php
12080 <ul><li>Bar</li></ul>
12081
12082 !! html/parsoid
12083 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12084 !! end
12085
12086 !! test
12087 Preprocessor precedence 6: broken link is rightmost opening
12088 !! options
12089 parsoid=wt2html
12090 !! wikitext
12091 {{echo|[[Foo}}
12092
12093 {{echo|[[Foo|bar|bat=baz}}
12094 !! html/php
12095 <p>{{echo|[[Foo}}
12096 </p><p>{{echo|[[Foo|bar|bat=baz}}
12097 </p>
12098 !! html/parsoid
12099 <p>{{echo|[[Foo}}</p>
12100 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12101 !! end
12102
12103 # This next test exposes a difference between PHP and Parsoid:
12104 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12105 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12106 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12107 # outer `[[Foo` extends until the `y]]`
12108 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12109 # intermediate result (after template expansion), and link processing
12110 # happens on this intermediate result, which moves the wikilink
12111 # boundary leftward to `[[Foo|Bar]]`
12112 # 2b) Parsoid works in a single step, so it's going to keep the
12113 # wikilink as extending to the `y]]`
12114 # 3a) Then PHP does linktrail processing which slurps up the trailing
12115 # `xy` inside the link.
12116 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12117 # `z` inside the link.
12118 # This is "correct" behavior. Parsoid's basic worldview is that the
12119 # `]]` inside the template shouldn't be allowed to leak out to affect
12120 # the surrounding wikilink. PHP may match Parsoid (in the future)
12121 # if you use {{#balance}} (T114445).
12122
12123 !! test
12124 Preprocessor precedence 7: broken template is rightmost opening
12125 !! options
12126 parsoid=wt2html
12127 !! wikitext
12128 [[Foo|{{echo|Bar]]
12129
12130 [[Foo|{{echo|Bar]]-x}}-y]]-z
12131
12132 Careful: linktrails can move the end of the wikilink:
12133 [[Foo|{{echo|y']]a}}l]]l
12134 !! html/php
12135 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12136 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12137 </p><p>Careful: linktrails can move the end of the wikilink:
12138 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12139 </p>
12140 !! html/parsoid
12141 <p>[[Foo|{{echo|Bar]]</p>
12142 <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>
12143 <p>Careful: linktrails can move the end of the wikilink:
12144 <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>
12145 !! end
12146
12147 !! test
12148 Preprocessor precedence 8: broken language converter is rightmost opening
12149 !! options
12150 language=zh
12151 !! wikitext
12152 [[Foo-{R|raw]]
12153 !! html
12154 <p>[[Foo-{R|raw]]
12155 </p>
12156 !! end
12157
12158 !! article
12159 Template:Preprocessor_precedence_9
12160 !! text
12161 ;4: {{{{1}}}}
12162 ;5: {{{{{2}}}}}
12163 ;6: {{{{{{3}}}}}}
12164 ;7: {{{{{{{4}}}}}}}
12165 !! endarticle
12166
12167 !! test
12168 Preprocessor precedence 9: groups of braces
12169 !! wikitext
12170 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12171 !! html/php
12172 <dl><dt>4</dt>
12173 <dd>{Four}</dd>
12174 <dt>5</dt>
12175 <dd></dd></dl>
12176 <ul><li>Bar</li></ul>
12177 <dl><dt>6</dt>
12178 <dd>Four</dd>
12179 <dt>7</dt>
12180 <dd>{Bullet}</dd></dl>
12181
12182 !! html/parsoid
12183 <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}}]}'>
12184 <dt>4</dt>
12185 <dd>{Four}</dd>
12186 <dt>5</dt>
12187 <dd></dd>
12188 </dl><ul about="#mwt1">
12189 <li>Bar</li>
12190 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12191 <dt>6</dt>
12192 <dd>Four</dd>
12193 <dt>7</dt>
12194 <dd>{Bullet}</dd>
12195 </dl>
12196 !! end
12197
12198 !! article
12199 Template:Preprocessor_precedence_10
12200 !! text
12201 ;1: -{R|raw}-
12202 ;2: -{{Bullet}}-
12203 ;3: -{{{1}}}-
12204 ;4: -{{{{2}}}}-
12205 ;5: -{{{{{3}}}}}-
12206 ;6: -{{{{{{4}}}}}}-
12207 ;7: -{{{{{{{5}}}}}}}-
12208 !! endarticle
12209
12210 !! test
12211 Preprocessor precedence 10: groups of braces with leading dash
12212 !! options
12213 language=zh
12214 !! wikitext
12215 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12216 !! html/php
12217 <dl><dt>1</dt>
12218 <dd>raw</dd>
12219 <dt>2</dt>
12220 <dd>-</dd></dl>
12221 <ul><li>Bar-</li></ul>
12222 <dl><dt>3</dt>
12223 <dd>-Three-</dd>
12224 <dt>4</dt>
12225 <dd>raw2</dd>
12226 <dt>5</dt>
12227 <dd>-</dd></dl>
12228 <ul><li>Bar-</li></ul>
12229 <dl><dt>6</dt>
12230 <dd>-Three-</dd>
12231 <dt>7</dt>
12232 <dd>raw2</dd></dl>
12233
12234 !! html/parsoid
12235 <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}}]}'>
12236 <dt>1</dt>
12237 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12238 <dt>2</dt>
12239 <dd>-</dd>
12240 </dl><ul about="#mwt1">
12241 <li>Bar-</li>
12242 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12243 <dt>3</dt>
12244 <dd>-Three-</dd>
12245 <dt>4</dt>
12246 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12247 <dt>5</dt>
12248 <dd>-</dd>
12249 </dl><ul about="#mwt1">
12250 <li>Bar-</li>
12251 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12252 <dt>6</dt>
12253 <dd>-Three-</dd>
12254 <dt>7</dt>
12255 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12256 </dl>
12257 !! end
12258
12259 !! test
12260 Preprocessor precedence 11: found during visual diff testing
12261 !! wikitext
12262 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12263
12264 {{echo|-{{echo|-{{echo|x}}}}}}
12265
12266 {{echo|-{{echo|x}}}}
12267 !! html/php
12268 <p><span>-<span>-x</span></span>
12269 </p><p>--x
12270 </p><p>-x
12271 </p>
12272 !! html/parsoid
12273 <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>
12274
12275 <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>
12276
12277 <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>
12278 !! end
12279
12280 !! test
12281 Preprocessor precedence 12: broken language converter closed by brace.
12282 !! options
12283 parsoid=wt2html
12284 !! wikitext
12285 This form breaks the template, which is unfortunate:
12286 *{{echo|foo-{bar}bat}}
12287
12288 But if the broken language converter markup is inside an extension
12289 tag, nothing bad happens:
12290 *<nowiki>foo-{bar}bat</nowiki>
12291 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12292 *<pre>foo-{bar}bat</pre>
12293 *{{echo|<pre>foo-{bar}bat</pre>}}
12294
12295 <tag>foo-{bar}bat</tag>
12296 {{echo|<tag>foo-{bar}bat</tag>}}
12297
12298 !! html/php+tidy
12299 <p>This form breaks the template, which is unfortunate:
12300 </p>
12301 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12302 <p>But if the broken language converter markup is inside an extension
12303 tag, nothing bad happens:
12304 </p>
12305 <ul><li>foo-&#123;bar}bat</li>
12306 <li>foo-&#123;bar}bat</li>
12307 <li><pre>foo-{bar}bat</pre></li>
12308 <li><pre>foo-{bar}bat</pre></li></ul>
12309 <pre>'foo-{bar}bat'
12310 array (
12311 )
12312 </pre>
12313 <pre>'foo-{bar}bat'
12314 array (
12315 )
12316 </pre>
12317 !! html/parsoid
12318 <p>This form breaks the template, which is unfortunate:</p>
12319 <ul>
12320 <li>{{echo|foo-{bar}bat}}</li>
12321 </ul>
12322 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12323 <ul>
12324 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12325 <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>
12326 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12327 <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>
12328 </ul>
12329 <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>
12330 !! end
12331
12332 !! test
12333 Preprocessor precedence 13: broken language converter in external link
12334 !! options
12335 parsoid=wt2html
12336 !! wikitext
12337 *[http://example.com/-{foo Example in URL]
12338 *[http://example.com Example in -{link} description]
12339 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12340 !! html/php+tidy
12341 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12342 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12343 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12344 !! html/parsoid
12345 <ul>
12346 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12347 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12348 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12349 </ul>
12350 !! end
12351
12352 !! test
12353 Preprocessor precedence 14: broken language converter in comment
12354 !! wikitext
12355 *<!--{{foo}}-->...should be ok
12356 *<!---{{foo}}-->...extra dashes
12357 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12358 !! html/php+tidy
12359 <ul><li>...should be ok</li>
12360 <li>...extra dashes</li>
12361 <li>foobat...should be ok</li></ul>
12362 !! html/parsoid
12363 <ul>
12364 <li><!--{{foo}}-->...should be ok</li>
12365 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12366 <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>
12367 </ul>
12368 !! end
12369
12370 !! test
12371 Preprocessor precedence 15: broken brace markup in headings
12372 !! config
12373 wgFragmentMode=[ 'html5', 'legacy' ]
12374 !! options
12375 parsoid=wt2html
12376 !! wikitext
12377 __NOTOC__ __NOEDITSECTION__
12378 ===1 foo[bar 1===
12379 1
12380 ===2 foo[[bar 2===
12381 2
12382 ===3 foo{bar 3===
12383 3
12384 ===4 foo{{bar 4===
12385 4
12386 ===5 foo{{{bar 5===
12387 5
12388 ===6 foo-{bar 6===
12389 6
12390 !! html/php+tidy
12391 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12392 <p>1
12393 </p>
12394 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12395 <p>2
12396 </p>
12397 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12398 <p>3
12399 </p>
12400 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12401 <p>4
12402 </p>
12403 <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>
12404 <p>5
12405 </p>
12406 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12407 <p>6
12408 </p>
12409 !! html/parsoid
12410 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12411 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12412 <p>1</p>
12413 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12414 <p>2</p>
12415 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12416 <p>3</p>
12417 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12418 <p>4</p>
12419 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12420 <p>5</p>
12421 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12422 <p>6</p>
12423 !! end
12424
12425 !! test
12426 Preprocessor precedence 16: matching closing braces to opening braces
12427 !! options
12428 language=zh
12429 parsoid=wt2html
12430 !! wikitext
12431 -{{{echo|foo}}bar}-
12432 !! html/php
12433 <p>foobar
12434 </p>
12435 !! html/parsoid
12436 <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>
12437 !! end
12438
12439 !! test
12440 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12441 !! options
12442 parsoid=wt2html
12443 !! wikitext
12444 {{echo|hi {{}}}}
12445 !! html/php
12446 <p>hi {{}}
12447 </p>
12448 !! html/parsoid
12449 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12450 !! end
12451
12452 ###
12453 ### Token Stream Patcher tests
12454 ###
12455 ### These tests won't always pass wt2wt and other modes because
12456 ### on serialization, the table will be output on a new line.
12457 ### For now, we are blacklisting them, and using this to test selser.
12458 ###
12459
12460 !!test
12461 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12462 !!options
12463 parsoid=wt2html,wt2wt
12464 !!wikitext
12465 {{echo|}}{| width = '100%'
12466 |foo
12467 |}
12468 !!html/parsoid
12469 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12470 <tbody><tr><td>foo</td></tr>
12471 </tbody></table>
12472 !!end
12473
12474 ## We used to, but no longer wt2wt this test since the default serializer
12475 ## will normalize the include directives to serialize on their own line.
12476 ## Selser will take care of preserving formatting in scenarios where they
12477 ## intermingled with other wikitext.
12478 !!test
12479 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12480 !!options
12481 parsoid=wt2html
12482 !!wikitext
12483 <includeonly>a</includeonly>{| {{{b}}}
12484 |c
12485 |}
12486 !!html/parsoid
12487 <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":""}]]}'>
12488 <tbody><tr><td>c</td></tr>
12489 </tbody></table>
12490 !!end
12491
12492 !! test
12493 Table wikitext syntax outside wiki-tables
12494 !! wikitext
12495 a
12496 |+ not a caption
12497 ! not a table heading
12498 |- not a table row
12499 | not a table cell
12500 | class="foo bar" | baz
12501 b
12502 |}
12503 |-
12504 c
12505 !! html
12506 <p>a
12507 |+ not a caption
12508 ! not a table heading
12509 |- not a table row
12510 | not a table cell
12511 | class="foo bar" | baz
12512 b
12513 |}
12514 |-
12515 c
12516 </p>
12517 !! end
12518
12519 ###
12520 ### Testing parsing of templates where a template arg
12521 ### has the same name as the template itself.
12522 ###
12523
12524 !! article
12525 Template:quote
12526 !! text
12527 {{{quote|{{{1}}}}}}
12528 !! endarticle
12529
12530 !!test
12531 Templates: Template Name/Arg clash: 1. Use of positional param
12532 !! wikitext
12533 {{quote|foo}}
12534 !! html
12535 <p>foo
12536 </p>
12537 !!end
12538
12539 !!test
12540 Templates: Template Name/Arg clash: 2. Use of named param
12541 !! wikitext
12542 {{quote|quote=foo}}
12543 !! html
12544 <p>foo
12545 </p>
12546 !!end
12547
12548 !!test
12549 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12550 !! wikitext
12551 {{quote|quote}}
12552 !! html
12553 <p>quote
12554 </p>
12555 !!end
12556
12557 ###
12558 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12559 ###
12560
12561 !!test
12562 Templates: 1. Simple use
12563 !! wikitext
12564 {{echo|Foo}}
12565 !! html
12566 <p>Foo
12567 </p>
12568 !!end
12569
12570 !!test
12571 Templates: 2. Inside a block tag
12572 !! wikitext
12573 <div>{{echo|Foo}}</div>
12574 <blockquote>{{echo|Foo}}</blockquote>
12575 !! html
12576 <div>Foo</div>
12577 <blockquote>Foo</blockquote>
12578
12579 !! html+tidy
12580 <div>Foo</div>
12581 <blockquote><p>Foo</p></blockquote>
12582 !!end
12583
12584 !!test
12585 Templates: P-wrapping: 1a. Templates on consecutive lines
12586 !! wikitext
12587 {{echo|Foo}}
12588 {{echo|bar}}
12589 !! html
12590 <p>Foo
12591 bar
12592 </p>
12593 !!end
12594
12595 !!test
12596 Templates: P-wrapping: 1b. Templates on consecutive lines
12597 !! wikitext
12598 Foo
12599
12600 {{echo|bar}}
12601 {{echo|baz}}
12602 !! html
12603 <p>Foo
12604 </p><p>bar
12605 baz
12606 </p>
12607 !!end
12608
12609 !!test
12610 Templates: P-wrapping: 1c. Templates on consecutive lines
12611 !! wikitext
12612 {{echo|Foo}}
12613 {{echo|bar}} <div>baz</div>
12614 !! html
12615 <p>Foo
12616 </p>
12617 bar <div>baz</div>
12618
12619 !! html+tidy
12620 <p>Foo
12621 </p><p>
12622 bar </p><div>baz</div>
12623 !! end
12624
12625 !!test
12626 Templates: P-wrapping: 1d. Template preceded by comment-only line
12627 !!options
12628 parsoid
12629 !! wikitext
12630 <!-- foo -->
12631 {{echo|Bar}}
12632 !! html
12633 <!-- foo -->
12634
12635 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12636 !!end
12637
12638 !!test
12639 Templates: Inline Text: 1. Multiple template uses
12640 !! wikitext
12641 {{echo|Foo}}bar{{echo|baz}}
12642 !! html
12643 <p>Foobarbaz
12644 </p>
12645 !!end
12646
12647 !!test
12648 Templates: Inline Text: 2. Back-to-back template uses
12649 !! wikitext
12650 {{echo|Foo}}{{echo|bar}}
12651 !! html
12652 <p>Foobar
12653 </p>
12654 !!end
12655
12656 !!test
12657 Templates: Block Tags: 1. Multiple template uses
12658 !! wikitext
12659 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12660 !! html
12661 <div>Foo</div><div>bar</div><div>baz</div>
12662
12663 !!end
12664
12665 !!test
12666 Templates: Block Tags: 2. Back-to-back template uses
12667 !! wikitext
12668 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12669 !! html
12670 <div>Foo</div><div>bar</div>
12671
12672 !!end
12673
12674 # This is an edge case relating to paragraph wrapping.
12675 !!test
12676 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12677 !! wikitext
12678 {{echo|a
12679 b</p>}}
12680 !! html/parsoid
12681 <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
12682 b</p>
12683 !!end
12684
12685 !!test
12686 Templates: Links: 1. Simple example
12687 !! wikitext
12688 {{echo|[[Foo|bar]]}}
12689 !! html
12690 <p><a href="/wiki/Foo" title="Foo">bar</a>
12691 </p>
12692 !!end
12693
12694 !!test
12695 Templates: Links: 2. Generation of link href
12696 !! wikitext
12697 [[{{echo|Foo}}|bar]]
12698 !! html
12699 <p><a href="/wiki/Foo" title="Foo">bar</a>
12700 </p>
12701 !!end
12702
12703 !!test
12704 Templates: Links: 3. Generation of part of a link href
12705 !! wikitext
12706 [[Fo{{echo|o}}|bar]]
12707
12708 [[Foo{{echo|bar}}]]
12709
12710 [[Foo{{echo|bar}}baz]]
12711
12712 [[Foo{{echo|bar}}|bar]]
12713
12714 [[:Foo{{echo|bar}}]]
12715
12716 [[:Foo{{echo|bar}}|bar]]
12717 !! html
12718 <p><a href="/wiki/Foo" title="Foo">bar</a>
12719 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12720 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12721 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12722 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12723 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12724 </p>
12725 !!end
12726
12727 !!test
12728 Templates: Links: 4. Multiple templates generating link href
12729 !! wikitext
12730 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12731 !! html
12732 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12733 </p>
12734 !!end
12735
12736 !!test
12737 Templates: Links: 5. Generation of link text
12738 !! wikitext
12739 [[Foo|{{echo|bar}}]]
12740 !! html
12741 <p><a href="/wiki/Foo" title="Foo">bar</a>
12742 </p>
12743 !!end
12744
12745 !!test
12746 Templates: Links: 5. Nested templates (only outermost template should be marked)
12747 !! wikitext
12748 {{echo|[[{{echo|Foo}}|bar]]}}
12749 !! html
12750 <p><a href="/wiki/Foo" title="Foo">bar</a>
12751 </p>
12752 !!end
12753
12754 !!test
12755 Templates: HTML Tag: 1. Generation of HTML attr. key
12756 !! wikitext
12757 <div {{echo|style}}="color:red;">foo</div>
12758 !! html
12759 <div style="color:red;">foo</div>
12760
12761 !!end
12762
12763 !!test
12764 Templates: HTML Tag: 2. Generation of HTML attr. value
12765 !! wikitext
12766 <div style={{echo|'color:red;'}}>foo</div>
12767 !! html
12768 <div style="color:red;">foo</div>
12769
12770 !!end
12771
12772 !!test
12773 Templates: HTML Tag: 3. Generation of HTML attr key and value
12774 !! wikitext
12775 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12776 !! html
12777 <div style="color:red;">foo</div>
12778
12779 !!end
12780
12781 !!test
12782 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12783 !! wikitext
12784 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12785 !! html
12786 <div title="This is a long title with just one piece templated">foo</div>
12787
12788 !!end
12789
12790 !!test
12791 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12792 !! wikitext
12793 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12794 !! html
12795 <div title="This is a long title with just one piece templated">foo</div>
12796
12797 !!end
12798
12799 !!test
12800 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12801 !! wikitext
12802 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12803 !! html
12804 <div title="This is a long title with just one piece templated">foo</div>
12805
12806 !!end
12807
12808 # SSS FIXME: While it is great we added support for all this,
12809 # do we want to make this part of the spec? Maybe we want to
12810 # deprecate this kind of usage in the future?
12811 !!test
12812 Templates: HTML Tag: 7. Generation of partial attribute key string
12813 !! wikitext
12814 <div st{{echo|yle}}="color:red;">foo</div>
12815 !! html
12816 <div style="color:red;">foo</div>
12817
12818 !!end
12819
12820 !! test
12821 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12822 !! wikitext
12823 <div {{echo|1=id="v1"}}>bar</div>
12824 !! html
12825 <div id="v1">bar</div>
12826
12827 !!end
12828
12829 !! test
12830 Templates: HTML Tag: 9. Multiple template-generated attributes
12831 !! wikitext
12832 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12833 !! html
12834 <div id="v1" title="foo">bar</div>
12835
12836 !!end
12837
12838 !! test
12839 Templates: Support for templates generating attributes and content
12840 !! wikitext
12841 {| {{mixed_attr_content_template}}
12842 |-
12843 |bar
12844 |}
12845 !! html/php
12846 <table style="color:red;" title="T48811">
12847
12848 <tr>
12849 <td>foo
12850 </td></tr>
12851 <tr>
12852 <td>bar
12853 </td></tr></table>
12854
12855 !! html/parsoid
12856 <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|}"]}'>
12857 <tbody><tr>
12858 <td>foo</td></tr>
12859 <tr>
12860 <td>bar</td></tr>
12861 </tbody></table>
12862 !!end
12863
12864 !! test
12865 1. Entities and nowikis inside templated attributes should be handled correctly
12866 !! wikitext
12867 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12868 !! html/php
12869 <div style="background:#f9f9f9;">foo</div>
12870
12871 !! html/parsoid
12872 <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>
12873 !! end
12874
12875 !! test
12876 2. Entities and nowikis inside templated attributes should be handled correctly
12877 !! wikitext
12878 {|
12879 |{{table_attribs_3}}
12880 |}
12881 !! html/php
12882 <table>
12883 <tr>
12884 <td style="background:#f9f9f9;">Foo
12885 </td></tr></table>
12886
12887 !! html/parsoid
12888 <table>
12889 <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>
12890 </tbody></table>
12891 !! end
12892
12893 !! test
12894 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12895 !! wikitext
12896 {{tbl-start}}
12897 |{{table_attribs_3}}
12898 {{tbl-end}}
12899 !! html/php
12900 <table>
12901 <tr>
12902 <td style="background:#f9f9f9;">Foo
12903 </td></tr></table>
12904
12905 !! html/parsoid
12906 <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}}]}'>
12907 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12908 </tbody></table>
12909 !! end
12910
12911 # T107622
12912 !! test
12913 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12914 !! wikitext
12915 {|
12916 |{{table_attribs_6}} hi
12917 |}
12918 !! html/php
12919 <table>
12920 <tr>
12921 <td style="background: red;">hi
12922 </td></tr></table>
12923
12924 !! html/parsoid
12925 <table>
12926 <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>
12927 </tbody></table>
12928 !! end
12929
12930 !!test
12931 Templates: HTML Tables: 1. Generating start of a HTML table
12932 !! wikitext
12933 {{echo|<table><tr><td>foo</td>}}</tr></table>
12934 !! html
12935 <table><tr><td>foo</td></tr></table>
12936
12937 !!end
12938
12939 !!test
12940 Templates: HTML Tables: 2a. Generating middle of a HTML table
12941 !! wikitext
12942 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12943 !! html
12944 <table><tr><td>foo</td></tr></table>
12945
12946 !!end
12947
12948 !!test
12949 Templates: HTML Tables: 2b. Generating middle of a HTML table
12950 !! wikitext
12951 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12952 !! html
12953 <table><tr><td>foo</td></tr></table>
12954
12955 !!end
12956
12957 !!test
12958 Templates: HTML Tables: 3. Generating end of a HTML table
12959 !! wikitext
12960 <table><tr>{{echo|<td>foo</td></tr></table>}}
12961 !! html
12962 <table><tr><td>foo</td></tr></table>
12963
12964 !!end
12965
12966 !!test
12967 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12968 !! wikitext
12969 {{echo|<table>}}<tr><td>foo</td></tr></table>
12970 !! html
12971 <table><tr><td>foo</td></tr></table>
12972
12973 !!end
12974
12975 !!test
12976 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12977 !! wikitext
12978 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12979 !! html
12980 <table><tr><td>foo</td></tr></table>
12981
12982 !!end
12983
12984 !!test
12985 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12986 !! wikitext
12987 <table><tr>{{echo|<td>}}foo</td></tr></table>
12988 !! html
12989 <table><tr><td>foo</td></tr></table>
12990
12991 !!end
12992
12993 !!test
12994 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12995 !! wikitext
12996 <table><tr><td>foo{{echo|</td>}}</tr></table>
12997 !! html
12998 <table><tr><td>foo</td></tr></table>
12999
13000 !!end
13001
13002 !!test
13003 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13004 !! wikitext
13005 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13006 !! html
13007 <table><tr><td>foo</td></tr></table>
13008
13009 !!end
13010
13011 !!test
13012 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13013 !! wikitext
13014 <table><tr><td>foo</td></tr>{{echo|</table>}}
13015 !! html
13016 <table><tr><td>foo</td></tr></table>
13017
13018 !!end
13019
13020 !!test
13021 Templates: HTML Tables: 5. Proper fostering of categories from inside
13022 !!options
13023 parsoid=wt2html,wt2wt
13024 !! wikitext
13025 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13026 <!--Two categories (T52330)-->
13027 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13028 !! html
13029 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13030 <!--Two categories (T52330)-->
13031 <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>
13032 !!end
13033
13034 !!test
13035 Templates: Wiki Tables: 1a. Fostering of entire template content
13036 !! wikitext
13037 {|
13038 {{echo|a}}
13039 |}
13040 !! html
13041 <table>
13042 a
13043 <tr><td></td></tr></table>
13044
13045 !! html/php+tidy
13046
13047 a
13048 <table><tbody><tr><td></td></tr></tbody></table>
13049 !! html/parsoid
13050 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13051
13052 </table>
13053 !! end
13054
13055 !!test
13056 Templates: Wiki Tables: 1b. Fostering of entire template content
13057 !! wikitext
13058 {|
13059 {{echo|<div>}}
13060 foo
13061 {{echo|</div>}}
13062 |}
13063 !! html
13064 <table>
13065 <div>
13066 <p>foo
13067 </p>
13068 </div>
13069 <tr><td></td></tr></table>
13070
13071 !! html/php+tidy
13072 <div>
13073 <p>foo
13074 </p>
13075 </div><table>
13076
13077 <tbody><tr><td></td></tr></tbody></table>
13078 !! html/parsoid
13079 <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|}"]}'>
13080 <p>foo</p>
13081 </div><table about="#mwt3">
13082
13083 </table>
13084 !! end
13085
13086 !!test
13087 Templates: Wiki Tables: 2. Fostering of partial template content
13088 !! wikitext
13089 {|
13090 {{echo|a
13091 <div>b</div>}}
13092 |}
13093 !! html
13094 <table>
13095 a
13096 <div>b</div>
13097 <tr><td></td></tr></table>
13098
13099 !! html/php+tidy
13100
13101 a
13102 <div>b</div><table>
13103 <tbody><tr><td></td></tr></tbody></table>
13104 !! html/parsoid
13105 <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">
13106
13107
13108 </table>
13109 !! end
13110
13111 !!test
13112 Templates: Wiki Tables: 3. td-content via multiple templates
13113 !! wikitext
13114 {|
13115 {{echo|{{pipe}}a}}{{echo|b}}
13116 |}
13117 !! html
13118 <table>
13119 <tr>
13120 <td>ab
13121 </td></tr></table>
13122
13123 !!end
13124
13125 !!test
13126 Templates: Wiki Tables: 4. Templated tags, no content
13127 !! wikitext
13128 {{tbl-start}}
13129 {{tbl-end}}
13130 !! html
13131 <table>
13132 <tr><td></td></tr></table>
13133
13134 !!end
13135
13136 !!test
13137 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13138 !! wikitext
13139 {{tbl-start}}
13140 |foo
13141 {{tbl-end}}
13142 !! html
13143 <table>
13144 <tr>
13145 <td>foo
13146 </td></tr></table>
13147
13148 !!end
13149
13150 !!test
13151 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13152 !! wikitext
13153 {{tbl-start}}
13154 {{!}}foo
13155 {{tbl-end}}
13156 !! html
13157 <table>
13158 <tr>
13159 <td>foo
13160 </td></tr></table>
13161
13162 !!end
13163
13164 ## This test case is very specific to Parsoid's internals
13165 ## and is hence only tested for Parsoid's code. Parsoid uses
13166 ## a <meta> marker tag for <ref> tags and they are expanded
13167 ## much later. We are verifying that this <meta> tag usage
13168 ## doesn't prevent foster parenting.
13169 !!test
13170 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13171 !!wikitext
13172 {{PartialTable}}<ref>foo</ref>
13173 |}
13174
13175 <references />
13176 !!html/parsoid
13177 <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">
13178 <tbody>
13179 </tbody></table>
13180
13181 <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>
13182 !!end
13183
13184 !! test
13185 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13186 !! wikitext
13187 {{echo|
13188 {{{!}}
13189 {{!}}-}}
13190 <onlyinclude>
13191 |foo
13192 </onlyinclude>
13193 {{!}}}
13194 !! html/parsoid
13195 <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{{!}}}"]}'>
13196 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13197 <tbody><tr>
13198
13199 <td>foo
13200 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13201 </tbody></table>
13202 !! end
13203
13204 !!test
13205 Templates: Lists: Multi-line list-items via templates
13206 !! wikitext
13207 *{{echo|a {{nonexistent|
13208 unused}}}}
13209 *{{echo|b {{nonexistent|
13210 unused}}}}
13211 !! html
13212 <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>
13213 <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>
13214
13215 !!end
13216
13217 !!test
13218 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13219 !! wikitext
13220 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13221 !! html
13222 <p><i>ab</i>c<i>d</i>e
13223 </p>
13224 !!end
13225
13226 !!test
13227 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13228 (PHP parser generates misnested html)
13229 !! wikitext
13230 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13231 !! html/parsoid
13232 <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>
13233 !!end
13234
13235 !!test
13236 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13237 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13238 !! options
13239 parsoid=wt2html,wt2wt
13240 !! wikitext
13241 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13242 !! html
13243 <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>
13244 <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>
13245 <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>
13246 !!end
13247
13248 !!test
13249 Templates: Ugly nesting: 4. Divs opened/closed across templates
13250 !! wikitext
13251 a<div>b{{echo|c</div>d}}e
13252 !! html
13253 a<div>bc</div>de
13254
13255 !! html+tidy
13256 <p>a</p><div>bc</div><p>de
13257 </p>
13258 !! end
13259
13260 !! test
13261 Templates: Ugly templates: 3. newline-only template parameter
13262 !! wikitext
13263 foo {{echo|
13264 }}
13265 !! html
13266 <p>foo
13267 </p>
13268 !! end
13269
13270 # This looks like a bug: a single newline triggers p/br for some reason.
13271 !! test
13272 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13273 !! wikitext
13274 {{echo|
13275 }}
13276 !! html
13277 <p><br />
13278 </p>
13279 !! end
13280
13281 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13282 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13283 !! test
13284 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13285 !! wikitext
13286 {{echo|<table>}}
13287 {{echo|<div>foo}}
13288 {{echo|</table>}}
13289 !! html/parsoid
13290 <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
13291 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13292 </table>
13293 !! end
13294
13295 # T66017 -- ugly wikitext with fostered content generates two template ranges
13296 # that are "identical" and generate nesting cycles in the algorithm
13297 !! test
13298 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13299 !! wikitext
13300 {{echo|<table><tr><td><table>}}
13301 {{echo|<div>}}
13302 {{echo|</div>}}
13303 !! html/parsoid
13304 <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"}'>
13305 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13306 </table></td></tr></tbody></table>
13307 !! end
13308
13309 !! test
13310 Templates: Parameters substituted at the top-level
13311 !! wikitext
13312 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13313
13314 {{{foo|bar|baz}}}
13315 !! html/php
13316 <p><i>who</i> me? <b>never!</b>
13317 </p><p>bar
13318 </p>
13319 !! html/parsoid
13320 <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>
13321
13322 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13323 !! end
13324
13325 !! test
13326 Templates: Param with empty arg in the final position
13327 !! wikitext
13328 {{{hi|}}}
13329 !! html/parsoid
13330 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13331 !! end
13332
13333 !!test
13334 Parser Functions: 1. Simple example
13335 !! wikitext
13336 {{uc:foo}}
13337 !! html
13338 <p>FOO
13339 </p>
13340 !!end
13341
13342 !!test
13343 Parser Functions: 2. Nested use (only outermost should be marked up)
13344 !! wikitext
13345 {{uc:{{lc:FOO}}}}
13346 !! html
13347 <p>FOO
13348 </p>
13349 !!end
13350
13351 ###
13352 ### Pre-save transform tests
13353 ###
13354 !! test
13355 pre-save transform: subst:
13356 !! options
13357 pst
13358 !! wikitext
13359 {{subst:test}}
13360 !! html/php
13361 This is a test template
13362 !! end
13363
13364 !! test
13365 pre-save transform: normal template
13366 !! options
13367 pst
13368 !! wikitext
13369 {{test}}
13370 !! html/php
13371 {{test}}
13372 !! end
13373
13374 !! test
13375 pre-save transform: nonexistent template
13376 !! options
13377 pst
13378 !! wikitext
13379 {{thistemplatedoesnotexist}}
13380 !! html/php
13381 {{thistemplatedoesnotexist}}
13382 !! end
13383
13384 !! test
13385 pre-save transform: subst magic variables
13386 !! options
13387 pst
13388 !! wikitext
13389 {{subst:SITENAME}}
13390 !! html/php
13391 MediaWiki
13392 !! end
13393
13394 # This is T2089, which I fixed. -- wtm
13395 !! test
13396 pre-save transform: subst: templates with parameters
13397 !! options
13398 pst
13399 !! wikitext
13400 {{subst:paramtest|param="something else"}}
13401 !! html/php
13402 This is a test template with parameter "something else"
13403 !! end
13404
13405 !! article
13406 Template:nowikitest
13407 !! text
13408 <nowiki>'''not wiki'''</nowiki>
13409 !! endarticle
13410
13411 !! test
13412 pre-save transform: nowiki in subst (T3188)
13413 !! options
13414 pst
13415 !! wikitext
13416 {{subst:nowikitest}}
13417 !! html/php
13418 <nowiki>'''not wiki'''</nowiki>
13419 !! end
13420
13421 !! article
13422 Template:commenttest
13423 !! text
13424 This template has <!-- a comment --> in it.
13425 !! endarticle
13426
13427 !! test
13428 pre-save transform: comment in subst (T3936)
13429 !! options
13430 pst
13431 !! wikitext
13432 {{subst:commenttest}}
13433 !! html/php
13434 This template has <!-- a comment --> in it.
13435 !! end
13436
13437 !! test
13438 pre-save transform: unclosed tag
13439 !! options
13440 pst
13441 !! wikitext
13442 <nowiki>'''not wiki'''
13443 !! html/php
13444 <nowiki>'''not wiki'''
13445 !! end
13446
13447 !! test
13448 pre-save transform: mixed tag case
13449 !! options
13450 pst
13451 !! wikitext
13452 <NOwiki>'''not wiki'''</noWIKI>
13453 !! html/php
13454 <NOwiki>'''not wiki'''</noWIKI>
13455 !! end
13456
13457 !! test
13458 pre-save transform: unclosed comment in <nowiki>
13459 !! options
13460 pst
13461 !! wikitext
13462 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13463 !! html/php
13464 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13465 !!end
13466
13467 # Leading @ in this template definition works around a limitation
13468 # in parsoid's parserTests which otherwise strips the <span> from the
13469 # result (confusing it for a template wrapper)
13470 !! article
13471 Template:dangerous
13472 !!text
13473 @<span onmouseover="alert('crap')">Oh no</span>
13474 !!endarticle
13475
13476 !!test
13477 (confirming safety of fix for subst T3936)
13478 !! wikitext
13479 {{Template:dangerous}}
13480 !! html
13481 <p>@<span>Oh no</span>
13482 </p>
13483 !! end
13484
13485 !! test
13486 pre-save transform: comment containing gallery (T7024)
13487 !! options
13488 pst
13489 !! wikitext
13490 <!-- <gallery>data</gallery> -->
13491 !! html/php
13492 <!-- <gallery>data</gallery> -->
13493 !!end
13494
13495 !! test
13496 pre-save transform: comment containing extension
13497 !! options
13498 pst
13499 !! wikitext
13500 <!-- <tag>data</tag> -->
13501 !! html/php
13502 <!-- <tag>data</tag> -->
13503 !!end
13504
13505 !! test
13506 pre-save transform: comment containing nowiki
13507 !! options
13508 pst
13509 !! wikitext
13510 <!-- <nowiki>data</nowiki> -->
13511 !! html/php
13512 <!-- <nowiki>data</nowiki> -->
13513 !!end
13514
13515 !! test
13516 pre-save transform: <noinclude> in subst (T5298)
13517 !! options
13518 pst
13519 !! wikitext
13520 {{subst:Includes}}
13521 !! html/php
13522 Foobar
13523 !! end
13524
13525 !! test
13526 pre-save transform: <onlyinclude> in subst (T5298)
13527 !! options
13528 pst
13529 !! wikitext
13530 {{subst:Includes2}}
13531 !! html/php
13532 Foo
13533 !! end
13534
13535 !! article
13536 Template:SubstTest
13537 !!text
13538 {{<includeonly>subst:</includeonly>Includes}}
13539 !! endarticle
13540
13541 !! article
13542 Template:SafeSubstTest
13543 !! text
13544 {{<includeonly>safesubst:</includeonly>Includes}}
13545 !! endarticle
13546
13547 !! test
13548 T24297: safesubst: works during PST
13549 !! options
13550 pst
13551 !! wikitext
13552 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13553 !! html/php
13554 FoobarFoobar
13555 !! end
13556
13557 !! test
13558 T24297: safesubst: works during normal parse
13559 !! wikitext
13560 {{SafeSubstTest}}
13561 !! html
13562 <p>Foobar
13563 </p>
13564 !! end
13565
13566 !! test
13567 subst: does not work during normal parse
13568 !! wikitext
13569 {{SubstTest}}
13570 !! html
13571 <p>{{subst:Includes}}
13572 </p>
13573 !! end
13574
13575 !! test
13576 pre-save transform: context links ("pipe trick")
13577 !! options
13578 pst
13579 !! wikitext
13580 [[Article (context)|]]
13581 [[Bar:Article|]]
13582 [[:Bar:Article|]]
13583 [[Bar:Article (context)|]]
13584 [[:Bar:Article (context)|]]
13585 [[|Article]]
13586 [[|Article (context)]]
13587 [[Bar:X (Y) Z|]]
13588 [[:Bar:X (Y) Z|]]
13589 !! html/php
13590 [[Article (context)|Article]]
13591 [[Bar:Article|Article]]
13592 [[:Bar:Article|Article]]
13593 [[Bar:Article (context)|Article]]
13594 [[:Bar:Article (context)|Article]]
13595 [[Article]]
13596 [[Article (context)]]
13597 [[Bar:X (Y) Z|X (Y) Z]]
13598 [[:Bar:X (Y) Z|X (Y) Z]]
13599 !! end
13600
13601 !! test
13602 pre-save transform: context links ("pipe trick") with interwiki prefix
13603 !! options
13604 pst
13605 !! wikitext
13606 [[interwiki:Article|]]
13607 [[:interwiki:Article|]]
13608 [[interwiki:Bar:Article|]]
13609 [[:interwiki:Bar:Article|]]
13610 !! html/php
13611 [[interwiki:Article|Article]]
13612 [[:interwiki:Article|Article]]
13613 [[interwiki:Bar:Article|Bar:Article]]
13614 [[:interwiki:Bar:Article|Bar:Article]]
13615 !! end
13616
13617 !! test
13618 pre-save transform: context links ("pipe trick") with parens in title
13619 !! options
13620 pst title=[[Somearticle (context)]]
13621 !! wikitext
13622 [[|Article]]
13623 !! html/php
13624 [[Article (context)|Article]]
13625 !! end
13626
13627 !! test
13628 pre-save transform: context links ("pipe trick") with comma in title
13629 !! options
13630 pst title=[[Someplace, Somewhere]]
13631 !! wikitext
13632 [[|Otherplace]]
13633 [[Otherplace, Elsewhere|]]
13634 [[Otherplace, Elsewhere, Anywhere|]]
13635 !! html/php
13636 [[Otherplace, Somewhere|Otherplace]]
13637 [[Otherplace, Elsewhere|Otherplace]]
13638 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13639 !! end
13640
13641 !! test
13642 pre-save transform: context links ("pipe trick") with parens and comma
13643 !! options
13644 pst title=[[Someplace (IGNORED), Somewhere]]
13645 !! wikitext
13646 [[|Otherplace]]
13647 [[Otherplace (place), Elsewhere|]]
13648 !! html/php
13649 [[Otherplace, Somewhere|Otherplace]]
13650 [[Otherplace (place), Elsewhere|Otherplace]]
13651 !! end
13652
13653 !! test
13654 pre-save transform: context links ("pipe trick") with comma and parens
13655 !! options
13656 pst title=[[Who, me? (context)]]
13657 !! wikitext
13658 [[|Yes, you.]]
13659 [[Me, Myself, and I (1937 song)|]]
13660 !! html/php
13661 [[Yes, you. (context)|Yes, you.]]
13662 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13663 !! end
13664
13665 !! test
13666 pre-save transform: context links ("pipe trick") with namespace
13667 !! options
13668 pst title=[[Ns:Somearticle]]
13669 !! wikitext
13670 [[|Article]]
13671 !! html/php
13672 [[Ns:Article|Article]]
13673 !! end
13674
13675 !! test
13676 pre-save transform: context links ("pipe trick") with namespace and parens
13677 !! options
13678 pst title=[[Ns:Somearticle (context)]]
13679 !! wikitext
13680 [[|Article]]
13681 !! html/php
13682 [[Ns:Article (context)|Article]]
13683 !! end
13684
13685 !! test
13686 pre-save transform: context links ("pipe trick") with namespace and comma
13687 !! options
13688 pst title=[[Ns:Somearticle, Context, Whatever]]
13689 !! wikitext
13690 [[|Article]]
13691 !! html/php
13692 [[Ns:Article, Context, Whatever|Article]]
13693 !! end
13694
13695 !! test
13696 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13697 !! options
13698 pst title=[[Ns:Somearticle, Context (context)]]
13699 !! wikitext
13700 [[|Article]]
13701 !! html/php
13702 [[Ns:Article (context)|Article]]
13703 !! end
13704
13705 !! test
13706 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13707 !! options
13708 pst title=[[Ns:Somearticle (IGNORED), Context]]
13709 !! wikitext
13710 [[|Article]]
13711 !! html/php
13712 [[Ns:Article, Context|Article]]
13713 !! end
13714
13715 !! test
13716 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13717 !! options
13718 pst
13719 !! wikitext
13720 [[Article(context)|]]
13721 [[Bar:Article(context)|]]
13722 [[:Bar:Article(context)|]]
13723 [[|Article(context)]]
13724 [[Bar:X(Y)Z|]]
13725 [[:Bar:X(Y)Z|]]
13726 !! html/php
13727 [[Article(context)|Article]]
13728 [[Bar:Article(context)|Article]]
13729 [[:Bar:Article(context)|Article]]
13730 [[Article(context)]]
13731 [[Bar:X(Y)Z|X(Y)Z]]
13732 [[:Bar:X(Y)Z|X(Y)Z]]
13733 !! end
13734
13735 !! test
13736 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13737 !! options
13738 pst
13739 !! wikitext
13740 [[Article (context)|]]
13741 [[Bar:Article (context)|]]
13742 [[:Bar:Article (context)|]]
13743 [[|Article (context)]]
13744 [[Bar:X (Y) Z|]]
13745 [[:Bar:X (Y) Z|]]
13746 !! html/php
13747 [[Article (context)|Article]]
13748 [[Bar:Article (context)|Article]]
13749 [[:Bar:Article (context)|Article]]
13750 [[Article (context)]]
13751 [[Bar:X (Y) Z|X (Y) Z]]
13752 [[:Bar:X (Y) Z|X (Y) Z]]
13753 !! end
13754
13755 !! test
13756 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13757 !! options
13758 pst
13759 !! wikitext
13760 [[Article(context)|]]
13761 [[Bar:Article(context)|]]
13762 [[:Bar:Article(context)|]]
13763 [[|Article(context)]]
13764 [[Bar:X(Y)Z|]]
13765 [[:Bar:X(Y)Z|]]
13766 !! html/php
13767 [[Article(context)|Article]]
13768 [[Bar:Article(context)|Article]]
13769 [[:Bar:Article(context)|Article]]
13770 [[Article(context)]]
13771 [[Bar:X(Y)Z|X(Y)Z]]
13772 [[:Bar:X(Y)Z|X(Y)Z]]
13773 !! end
13774
13775 !! test
13776 pre-save transform: context links ("pipe trick") with commas (T23660)
13777 !! options
13778 pst
13779 !! wikitext
13780 [[Article (context), context|]]
13781 [[Article (context),context|]]
13782 [[Bar:Article (context), context|]]
13783 [[Bar:Article (context),context|]]
13784 [[:Bar:Article (context), context|]]
13785 [[:Bar:Article (context),context|]]
13786 !! html/php
13787 [[Article (context), context|Article]]
13788 [[Article (context),context|Article]]
13789 [[Bar:Article (context), context|Article]]
13790 [[Bar:Article (context),context|Article]]
13791 [[:Bar:Article (context), context|Article]]
13792 [[:Bar:Article (context),context|Article]]
13793 !! end
13794
13795 !! test
13796 Parsoid: backwards pipe trick
13797 !! wikitext
13798 [[|'''bar''']]
13799 !! html/php
13800 <p>[[|<b>bar</b>]]
13801 </p>
13802 !! html/parsoid
13803 <p>[[|<b>bar</b>]]</p>
13804 !! end
13805
13806 !! test
13807 pre-save transform: trim trailing empty lines
13808 !! options
13809 pst
13810 !! wikitext
13811 Empty lines are trimmed
13812
13813
13814
13815
13816 !! html/php
13817 Empty lines are trimmed
13818 !! end
13819
13820 !! test
13821 pre-save transform: Signature expansion
13822 !! options
13823 pst
13824 !! wikitext
13825 * ~~~
13826 * ~~~~
13827 * ~~~~~
13828 * <noinclude>~~~</noinclude>
13829 * <includeonly>~~~</includeonly>
13830 * <onlyinclude>~~~</onlyinclude>
13831 !! html/php
13832 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13833 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13834 * 00:02, 1 January 1970 (UTC)
13835 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13836 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13837 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13838 !! end
13839
13840
13841 !! test
13842 ParserOutput flags from signature expansion (T84843)
13843 !! options
13844 pst
13845 showflags
13846 !! wikitext
13847 ~~~~
13848 !! html/php
13849 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13850 flags=user-signature
13851 !! end
13852
13853
13854 !! test
13855 pre-save transform: Signature expansion in nowiki tags (T2093)
13856 !! options
13857 pst disabled
13858 !! wikitext
13859 Shall not expand:
13860
13861 <nowiki>~~~~</nowiki>
13862
13863 <includeonly><nowiki>~~~~</nowiki></includeonly>
13864
13865 <noinclude><nowiki>~~~~</nowiki></noinclude>
13866
13867 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13868
13869 {{subst:Foo}} shall be converted to FOO
13870
13871 As well as inside noinclude/onlyinclude
13872 <noinclude>{{subst:Foo}}</noinclude>
13873 <onlyinclude>{{subst:Foo}}</onlyinclude>
13874
13875 But not inside includeonly
13876 <includeonly>{{subst:Foo}}</includeonly>
13877 !! html/php
13878 Shall not expand:
13879
13880 <nowiki>~~~~</nowiki>
13881
13882 <includeonly><nowiki>~~~~</nowiki></includeonly>
13883
13884 <noinclude><nowiki>~~~~</nowiki></noinclude>
13885
13886 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13887
13888 FOO shall be converted to FOO
13889
13890 As well as inside noinclude/onlyinclude
13891 <noinclude>FOO</noinclude>
13892 <onlyinclude>FOO</onlyinclude>
13893
13894 But not inside includeonly
13895 <includeonly>{{subst:Foo}}</includeonly>
13896 !! end
13897
13898 !! test
13899 Parsoid: Recognize nowiki with trailing space in tags
13900 !! options
13901 parsoid=wt2html
13902 !! wikitext
13903 <nowiki ><div>[[foo]]</nowiki >
13904
13905 a<nowiki / >b
13906
13907 c<nowiki />d
13908
13909 e<nowiki/ >f
13910 !! html
13911 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13912 <p>ab</p>
13913 <p>cd</p>
13914 <p>ef</p>
13915 !! end
13916
13917 !! test
13918 Parsoid: Recognize nowiki with odd capitalization
13919 !! options
13920 parsoid=wt2html
13921 !! wikitext
13922 <noWikI ><div>[[foo]]</Nowiki >
13923 !! html
13924 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13925 !! end
13926
13927
13928 !! test
13929 Parsoid: Escape nowiki with trailing space in tags
13930 !! options
13931 parsoid=html2wt
13932 !! html/parsoid
13933 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13934 <p>a&lt;nowiki /&gt;b</p>
13935 <p>c&lt;nowiki/ &gt;d</p>
13936 !! wikitext
13937 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13938
13939 a&lt;nowiki /&gt;b
13940
13941 c&lt;nowiki/ &gt;d
13942 !! end
13943
13944 !! test
13945 Parsoid: Escape weird noWikI capitalizations
13946 !! options
13947 parsoid=html2wt
13948 !! html/parsoid
13949 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13950 !! wikitext
13951 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13952 !! end
13953
13954 ###
13955 ### Message transform tests
13956 ###
13957 !! test
13958 message transform: magic variables
13959 !! options
13960 msg
13961 !! wikitext
13962 {{SITENAME}}
13963 !! html
13964 MediaWiki
13965 !! end
13966
13967 !! test
13968 message transform: should not transform wiki markup
13969 !! options
13970 msg
13971 !! wikitext
13972 ''test''
13973 !! html
13974 ''test''
13975 !! end
13976
13977 !! test
13978 message transform: <noinclude> in transcluded template (T6926)
13979 !! options
13980 msg
13981 !! wikitext
13982 {{Includes}}
13983 !! html
13984 Foobar
13985 !! end
13986
13987 !! test
13988 message transform: <onlyinclude> in transcluded template (T6926)
13989 !! options
13990 msg
13991 !! wikitext
13992 {{Includes2}}
13993 !! html
13994 Foo
13995 !! end
13996
13997 !! test
13998 {{#special:}} page name, known
13999 !! options
14000 msg
14001 !! wikitext
14002 {{#special:Recentchanges}}
14003 !! html
14004 Special:RecentChanges
14005 !! end
14006
14007 !! test
14008 {{#special:}} page name with subpage, known
14009 !! options
14010 msg
14011 !! wikitext
14012 {{#special:Recentchanges/param}}
14013 !! html
14014 Special:RecentChanges/param
14015 !! end
14016
14017 !! test
14018 {{#special:}} page name, unknown
14019 !! options
14020 msg
14021 !! wikitext
14022 {{#special:foobar nonexistent}}
14023 !! html
14024 Special:Foobar nonexistent
14025 !! end
14026
14027 !! test
14028 {{#speciale:}} page name, known
14029 !! options
14030 msg
14031 !! wikitext
14032 {{#speciale:Recentchanges}}
14033 !! html
14034 Special:RecentChanges
14035 !! end
14036
14037 !! test
14038 {{#speciale:}} page name with subpage, known
14039 !! options
14040 msg
14041 !! wikitext
14042 {{#speciale:Recentchanges/param}}
14043 !! html
14044 Special:RecentChanges/param
14045 !! end
14046
14047 !! test
14048 {{#speciale:}} page name, unknown
14049 !! options
14050 msg
14051 !! wikitext
14052 {{#speciale:foobar nonexistent}}
14053 !! html
14054 Special:Foobar_nonexistent
14055 !! end
14056
14057 ###
14058 ### Images
14059 ###
14060 ### For Parsoid-specific tests, see
14061 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14062
14063 !! test
14064 Simple image
14065 !! options
14066 parsoid=wt2html,wt2wt,html2html
14067 !! wikitext
14068 [[Image:foobar.jpg]]
14069 !! html/php
14070 <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>
14071 </p>
14072 !! html/parsoid
14073 <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>
14074 !! end
14075
14076 !! test
14077 Serialize simple image with span wrapper
14078 !! options
14079 parsoid=html2wt
14080 !! html/parsoid
14081 <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>
14082 !! wikitext
14083 [[File:Foobar.jpg]]
14084 !! end
14085
14086 !! test
14087 Simple image (using File: namespace, now canonical)
14088 !! wikitext
14089 [[File:Foobar.jpg]]
14090 !! html/php
14091 <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>
14092 </p>
14093 !! html/parsoid
14094 <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>
14095 !! end
14096
14097 !! test
14098 Right-aligned image
14099 !! wikitext
14100 [[File:Foobar.jpg|right]]
14101 !! html/php
14102 <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>
14103
14104 !! html/parsoid
14105 <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>
14106 !! end
14107
14108 !! test
14109 Image with caption
14110 !! wikitext
14111 [[File:Foobar.jpg|right|Caption text]]
14112 !! html/php
14113 <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>
14114
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 Image with caption, T55312 #1
14121 !! wikitext
14122 [[File:Foobar.jpg|right|Caption page stuff]]
14123 !! html/php
14124 <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>
14125
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 !! test
14131 Image with caption, T55312 #2
14132 !! wikitext
14133 [[File:Foobar.jpg|right|Caption page=]]
14134 !! html/php
14135 <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>
14136
14137 !! html/parsoid
14138 <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>
14139 !! end
14140
14141 !! test
14142 Image with caption, T55312 #3
14143 !! wikitext
14144 [[File:Foobar.jpg|right|Caption page=stuff]]
14145 !! html/php
14146 <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>
14147
14148 !! html/parsoid
14149 <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>
14150 !! end
14151
14152 !! test
14153 Image caption with pipe entity
14154 !! wikitext
14155 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14156 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14157 !! html/php
14158 <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>
14159 <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>
14160
14161 !! html/parsoid
14162 <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>
14163 <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>
14164 !! end
14165
14166 !! test
14167 Allow empty links in image captions (T62753)
14168 !! options
14169 thumbsize=220
14170 !! wikitext
14171 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14172 [[]]
14173 [[Link2]]
14174 ]]
14175 !! html/php
14176 <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>
14177
14178 !! html/parsoid
14179 <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>
14180 [[]]
14181 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14182 </figcaption></figure>
14183 !! end
14184
14185 !! test
14186 Titles in unlinked images (T23454)
14187 !! wikitext
14188 [[File:Foobar.jpg|link=|stuff]]
14189 !! html/php
14190 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14191 </p>
14192 !! html/parsoid
14193 <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>
14194 !! end
14195
14196 !! test
14197 Link with empty target
14198 !! wikitext
14199 [[]]
14200 !! html
14201 <p>[[]]
14202 </p>
14203 !! end
14204
14205 !! test
14206 Image with link trail
14207 !! wikitext
14208 Linktrails should not work for images: [[File:Foobar.jpg]]s
14209 !! html/php
14210 <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
14211 </p>
14212 !! html/parsoid
14213 <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>
14214 !! end
14215
14216 !! test
14217 Image with empty attribute
14218 !! options
14219 parsoid=wt2html,wt2wt,html2html
14220 !! wikitext
14221 [[File:Foobar.jpg|right||Caption text]]
14222 !! html/php
14223 <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>
14224
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 !! test
14230 1. Block image with individual attributes from templates
14231 !! wikitext
14232 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14233 !! html/php
14234 <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>
14235
14236 !! html/parsoid
14237 <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>
14238 !! end
14239
14240 !! test
14241 2. Block Image with individual attributes from templates
14242 !! wikitext
14243 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14244 !! html/php
14245 <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>
14246
14247 !! html/parsoid
14248 <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>
14249 !! end
14250
14251 !! test
14252 3. Inline image with individual attributes from templates
14253 !! wikitext
14254 [[File:Foobar.jpg|{{echo|50px}}]]
14255 !! html/php
14256 <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>
14257 </p>
14258 !! html/parsoid
14259 <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>
14260 !! end
14261
14262 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14263 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14264 !! test
14265 Image with multiple attributes from the same template
14266 !! wikitext
14267 [[File:Foobar.jpg|{{image_attribs}}]]
14268 !! html/php
14269 <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>
14270
14271 !! html/parsoid
14272 <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>
14273 !! end
14274
14275 !! test
14276 Image with link tails
14277 !! options
14278 thumbsize=220
14279 !! wikitext
14280 123[[File:Foobar.jpg]]456
14281 123[[File:Foobar.jpg|right]]456
14282 123[[File:Foobar.jpg|thumb]]456
14283 !! html/php
14284 <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
14285 </p>
14286 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
14287 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
14288
14289 !! html/php+tidy
14290 <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
14291 </p><p>
14292 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
14293 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
14294 </p>
14295 !! html/parsoid
14296 <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>
14297 <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>
14298 <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>
14299 !! end
14300
14301 !! test
14302 Image with multiple captions -- only last one is accepted
14303 !! wikitext
14304 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14305 !! html/php
14306 <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>
14307
14308 !! html/parsoid
14309 <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>
14310 !! end
14311
14312 !! test
14313 Image with multiple widths -- use last
14314 !! wikitext
14315 [[File:Foobar.jpg|200px|300px|caption]]
14316 !! html/php
14317 <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>
14318 </p>
14319 !! html/parsoid
14320 <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>
14321 !! end
14322
14323 !! test
14324 Image with multiple alignments -- use first (T50664)
14325 !! options
14326 thumbsize=220
14327 !! wikitext
14328 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14329
14330 [[File:Foobar.jpg|middle|text-top|caption]]
14331 !! html/php
14332 <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>
14333 <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>
14334 </p>
14335 !! html/parsoid
14336 <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>
14337 <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>
14338 !! end
14339
14340 !! test
14341 Image with width attribute at different positions
14342 !! wikitext
14343 [[File:Foobar.jpg|200px|right|Caption]]
14344 [[File:Foobar.jpg|right|200px|Caption]]
14345 [[File:Foobar.jpg|right|Caption|200px]]
14346 !! html/php
14347 <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>
14348 <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>
14349 <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>
14350
14351 !! html/parsoid
14352 <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>
14353 <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>
14354 <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>
14355 !! end
14356
14357 # a sad bit of backward-compatibility
14358 !! test
14359 Image with size specified with pxpx (T15500, T53628)
14360 !! options
14361 parsoid=wt2html,wt2wt,html2html
14362 !! wikitext
14363 [[File:Foobar.jpg|20pxpx]]
14364 [[File:Foobar.jpg|200x20pxpx]]
14365 !! html/php
14366 <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>
14367 <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>
14368 </p>
14369 !! html/parsoid
14370 <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>
14371 !! end
14372
14373 !! test
14374 Image with link parameter, wiki target
14375 !! wikitext
14376 [[File:Foobar.jpg|link=Main Page]]
14377 !! html/php
14378 <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>
14379 </p>
14380 !! html/parsoid
14381 <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>
14382 !! end
14383
14384 # parsoid T51293 (part 1)
14385 !! test
14386 Image with link parameter, URL target
14387 !! wikitext
14388 [[File:Foobar.jpg|link=http://example.com/]]
14389 !! html/php
14390 <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>
14391 </p>
14392 !! html/parsoid
14393 <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>
14394 !! end
14395
14396 # parsoid T51293 (part 2)
14397 !! test
14398 Image with link parameter, protocol-less URL target
14399 !! wikitext
14400 [[File:Foobar.jpg|link=//example.com/]]
14401 !! html/php
14402 <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>
14403 </p>
14404 !! html/parsoid
14405 <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>
14406 !! end
14407
14408 !! test
14409 Escaping non-block captions (T107435)
14410 !! options
14411 parsoid={
14412 "modes": ["wt2wt"],
14413 "changes": [
14414 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14415 ]
14416 }
14417 !! wikitext
14418 [[Image:Foobar.jpg|caption]]
14419 !! wikitext/edited
14420 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14421 !! end
14422
14423 # wgExternalLinkTarget not supported by Parsoid
14424 !! test
14425 Image with link parameter, wgExternalLinkTarget
14426 !! wikitext
14427 [[Image:foobar.jpg|link=http://example.com/]]
14428 !! config
14429 wgExternalLinkTarget='foobar'
14430 !! html/php
14431 <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>
14432 </p>
14433 !! end
14434
14435 !! test
14436 Image with link parameter, wgNoFollowLinks set to false
14437 !! wikitext
14438 [[Image:foobar.jpg|link=http://example.com/]]
14439 !! config
14440 wgNoFollowLinks=false
14441 !! html/php
14442 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14443 </p>
14444 !! end
14445
14446 !! test
14447 Image with link parameter, wgNoFollowDomainExceptions
14448 !! wikitext
14449 [[Image:foobar.jpg|link=http://example.com/]]
14450 !! config
14451 wgNoFollowDomainExceptions='example.com'
14452 !! html/php
14453 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14454 </p>
14455 !! end
14456
14457 # wgExternalLinkTarget not supported by Parsoid
14458 !! test
14459 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14460 !! wikitext
14461 [[Image:foobar.jpg|link=http://example.com/|Title]]
14462 !! config
14463 wgExternalLinkTarget='foobar'
14464 !! html/php
14465 <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>
14466 </p>
14467 !! end
14468
14469 !! test
14470 Image with empty link parameter
14471 !! wikitext
14472 [[File:Foobar.jpg|link=]]
14473 !! html/php
14474 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14475 </p>
14476 !! html/parsoid
14477 <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>
14478 !! end
14479
14480 !! test
14481 Image with link parameter (wiki target) and unnamed parameter
14482 !! wikitext
14483 [[File:Foobar.jpg|link=Main_Page|Title]]
14484 !! html/php
14485 <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>
14486 </p>
14487 !! html/parsoid
14488 <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>
14489 !! end
14490
14491 !! test
14492 Image with link parameter (URL target) and unnamed parameter
14493 !! wikitext
14494 [[File:Foobar.jpg|link=http://example.com/|Title]]
14495 !! html/php
14496 <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>
14497 </p>
14498 !! html/parsoid
14499 <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>
14500 !! end
14501
14502 !! test
14503 Thumbnail image with link parameter
14504 !! options
14505 thumbsize=220
14506 parsoid=wt2html,wt2wt,html2html
14507 !! wikitext
14508 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14509 !! html/php
14510 <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>
14511
14512 !! html/parsoid
14513 <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>
14514 !! end
14515
14516 !! test
14517 Manually-specified thumbnail image
14518 !! options
14519 thumbsize=220
14520 !! wikitext
14521 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14522 !! html/php
14523 <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>
14524
14525 !! html/parsoid
14526 <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>
14527 !! end
14528
14529 !! test
14530 Manually-specified thumbnail image with explicit link to wiki page
14531 !! options
14532 thumbsize=220
14533 parsoid=wt2html,wt2wt,html2html
14534 !! wikitext
14535 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14536 !! html/php
14537 <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>
14538
14539 !! html/parsoid
14540 <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>
14541 !! end
14542
14543 !! test
14544 Manually-specified thumbnail image with explicit link to url
14545 !! options
14546 thumbsize=220
14547 parsoid=wt2html,wt2wt,html2html
14548 !! wikitext
14549 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14550 !! html/php
14551 <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>
14552
14553 !! html/parsoid
14554 <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>
14555 !! end
14556
14557 !! test
14558 Manually-specified thumbnail image with explicit no link
14559 !! options
14560 thumbsize=220
14561 parsoid=wt2html,wt2wt,html2html
14562 !! wikitext
14563 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14564 !! html/php
14565 <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>
14566
14567 !! html/parsoid
14568 <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>
14569 !! end
14570
14571 !! test
14572 Manually-specified thumbnail image with explicit link and alt text
14573 !! options
14574 thumbsize=220
14575 parsoid=wt2html,wt2wt,html2html
14576 !! wikitext
14577 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14578 !! html/php
14579 <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>
14580
14581 !! html/parsoid
14582 <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>
14583 !! end
14584
14585 !! test
14586 Image with frame and link
14587 !! options
14588 parsoid=wt2html,wt2wt,html2html
14589 !! wikitext
14590 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14591 !! html/php
14592 <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>
14593
14594 !! html/parsoid
14595 <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>
14596 !! end
14597
14598 !! test
14599 Image with frame and link and explicit alt
14600 !! options
14601 parsoid=wt2html,wt2wt,html2html
14602 !! wikitext
14603 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14604 !! html/php
14605 <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>
14606
14607 !! html/parsoid
14608 <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>
14609 !! end
14610
14611 !! test
14612 Image with wiki markup in implicit alt
14613 !! wikitext
14614 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14615
14616 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14617 !! html/php
14618 <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>
14619 </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>
14620 </p>
14621 !! html/parsoid
14622 <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>
14623
14624 <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>
14625 !! end
14626
14627 !! test
14628 Alt image option should handle most kinds of wikitext without barfing
14629 !! wikitext
14630 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14631 !! html/php
14632 <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>
14633
14634 !! html/parsoid
14635 <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>
14636 !! end
14637
14638 !! test
14639 Image with table with attributes in caption
14640 !! options
14641 parsoid=wt2html,html2html
14642 !! wikitext
14643 [[File:Foobar.jpg|thumb|
14644 {| class="123" |
14645 |- class="456" |
14646 | ha
14647 |}
14648 ]]
14649 !! html/parsoid
14650 <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>
14651 <table class="123">
14652 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14653 <td> ha</td></tr>
14654 </tbody></table>
14655 </figcaption></figure>
14656 !! end
14657
14658 !! test
14659 Image with table with rows from templates in caption
14660 !! wikitext
14661 [[File:Foobar.jpg|thumb|
14662 {|
14663 {{echo|{{!}} hi}}
14664 |}
14665 ]]
14666 !! html/parsoid
14667 <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>
14668 <table>
14669 <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>
14670 </tbody></table>
14671 </figcaption></figure>
14672 !! end
14673
14674 !! test
14675 Image with nested tables in caption
14676 !! wikitext
14677 [[File:Foobar.jpg|thumb|Foo<br />
14678 {|
14679 |
14680 {|
14681 |z
14682 |}
14683 |}
14684 ]]
14685 !! html/parsoid
14686 <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}'/>
14687 <table>
14688 <tbody><tr><td>
14689 <table>
14690 <tbody><tr><td>z</td></tr>
14691 </tbody></table></td></tr>
14692 </tbody></table>
14693 </figcaption></figure>
14694 !! end
14695
14696 ###################
14697 # Conflicting image format options.
14698 # First option specified should 'win'.
14699 # All three cases in each test should be identical.
14700
14701 !! test
14702 Image with 'frameless' first.
14703 !! options
14704 parsoid=wt2html,wt2wt,html2html
14705 !! wikitext
14706 [[File:Foobar.jpg|frameless|caption]]
14707
14708 [[File:Foobar.jpg|frameless|frame|caption]]
14709
14710 [[File:Foobar.jpg|frameless|thumb|caption]]
14711 !! html/php
14712 <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>
14713 </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>
14714 </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>
14715 </p>
14716 !! html/parsoid
14717 <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>
14718 <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>
14719 <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>
14720 !! end
14721
14722 !! test
14723 Image with 'frame' first.
14724 !! options
14725 parsoid=wt2html,wt2wt,html2html
14726 !! wikitext
14727 [[File:Foobar.jpg|frame|caption]]
14728 [[File:Foobar.jpg|frame|frameless|caption]]
14729 [[File:Foobar.jpg|frame|thumb|caption]]
14730 !! html/php
14731 <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>
14732 <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>
14733 <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>
14734
14735 !! html/parsoid
14736 <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>
14737 <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>
14738 <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>
14739 !! end
14740
14741 !! test
14742 Image with 'thumb' first.
14743 !! options
14744 parsoid=wt2html,wt2wt,html2html
14745 !! wikitext
14746 [[File:Foobar.jpg|thumb|caption]]
14747 [[File:Foobar.jpg|thumb|frameless|caption]]
14748 [[File:Foobar.jpg|thumb|frame|caption]]
14749 !! html/php
14750 <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>
14751 <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>
14752 <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>
14753
14754 !! html/parsoid
14755 <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>
14756 <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>
14757 <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>
14758 !! end
14759
14760 ###################
14761 # Image sizing.
14762 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14763 # and https://phabricator.wikimedia.org/T64258
14764 # Foobar has actual size of 1941x220
14765 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14766 # a scalable format.
14767 # 2. Framed images always ignore size options; always render at default size.
14768 # 3. "Unspecified format" and border are the only types which can be
14769 # enlarged.
14770
14771 !! test
14772 Image: unspecified format and border enlarge
14773 !! options
14774 parsoid=wt2html,wt2wt,html2html
14775 !! wikitext
14776 [[File:Foobar.jpg|2000px]]
14777
14778 [[File:Foobar.jpg|border|2000px]]
14779 !! html/php
14780 <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>
14781 </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>
14782 </p>
14783 !! html/parsoid
14784 <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>
14785 <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>
14786 !! end
14787
14788 !! test
14789 Image: "unspecified format" and border reduce
14790 !! options
14791 parsoid=wt2html,wt2wt,html2html
14792 !! wikitext
14793 [[File:Foobar.jpg|1000px]]
14794
14795 [[File:Foobar.jpg|border|1000px]]
14796 !! html/php
14797 <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>
14798 </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>
14799 </p>
14800 !! html/parsoid
14801 <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>
14802 <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>
14803 !! end
14804
14805 !! test
14806 Image: thumbs reduce
14807 !! options
14808 parsoid=wt2html,wt2wt,html2html
14809 !! wikitext
14810 [[File:Foobar.jpg|thumb|50px]]
14811 !! html/php
14812 <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>
14813
14814 !! html/parsoid
14815 <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>
14816 !! end
14817
14818 !! test
14819 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14820 !! options
14821 parsoid=wt2html,wt2wt,html2html
14822 !! wikitext
14823 [[File:Foobar.jpg|thumb|2000px]]
14824
14825 [[File:Foobar.svg|thumb|2000px]]
14826 !! html/php
14827 <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>
14828 <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>
14829
14830 !! html/parsoid
14831 <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>
14832 <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>
14833 !! end
14834
14835 !! test
14836 Image: frameless can reduce in size
14837 !! options
14838 parsoid=wt2html,wt2wt,html2html
14839 !! wikitext
14840 [[File:Foobar.jpg|frameless|50px]]
14841 !! html/php
14842 <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>
14843 </p>
14844 !! html/parsoid
14845 <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>
14846 !! end
14847
14848 !! test
14849 Image: bitmap frameless can't be enlarged past original size, but vector can
14850 !! options
14851 parsoid=wt2html,wt2wt,html2html
14852 !! wikitext
14853 [[File:Foobar.jpg|frameless|2000px]]
14854
14855 [[File:Foobar.svg|frameless|2000px]]
14856 !! html/php
14857 <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>
14858 </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>
14859 </p>
14860 !! html/parsoid
14861 <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>
14862 <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>
14863 !! end
14864
14865 !! test
14866 Image: framed images are always unscaled.
14867 !! options
14868 parsoid=wt2html,wt2wt,html2html
14869 !! wikitext
14870 [[File:Foobar.jpg|frame]]
14871
14872 [[File:Foobar.jpg|frame|50px]]
14873
14874 [[File:Foobar.jpg|frame|50x50px]]
14875
14876 [[File:Foobar.jpg|frame|2000px]]
14877 !! html/php
14878 <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>
14879 <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>
14880 <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>
14881 <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>
14882
14883 !! html/parsoid
14884 <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>
14885 <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>
14886 <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>
14887 <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>
14888 !! end
14889
14890 ###################
14891
14892 !! test
14893 Link to image page- image page normally doesn't exists, hence edit link
14894 Add test with existing image page
14895 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14896 !! wikitext
14897 [[:Image:test]]
14898 !! html
14899 <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>
14900 </p>
14901 !! end
14902
14903 !! test
14904 T20784 Link to non-existent image page with caption should use caption as link text
14905 !! wikitext
14906 [[:Image:test|caption]]
14907 !! html
14908 <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>
14909 </p>
14910 !! end
14911
14912 !! test
14913 Frameless image caption with a free URL
14914 !! wikitext
14915 [[File:Foobar.jpg|http://example.com]]
14916 !! html/php
14917 <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>
14918 </p>
14919 !! html/parsoid
14920 <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>
14921 !! end
14922
14923 !! test
14924 Thumbnail image caption with a free URL
14925 !! options
14926 thumbsize=220
14927 !! wikitext
14928 [[File:Foobar.jpg|thumb|http://example.com]]
14929 !! html/php
14930 <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>
14931
14932 !! html/parsoid
14933 <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>
14934 !! end
14935
14936 !! test
14937 Thumbnail image caption with a free URL and explicit alt
14938 !! options
14939 thumbsize=220
14940 parsoid=wt2html,wt2wt,html2html
14941 !! wikitext
14942 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14943 !! html/php
14944 <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>
14945
14946 !! html/parsoid
14947 <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>
14948 !! end
14949
14950 !! test
14951 SVG thumbnails with no language set
14952 !! options
14953 !! wikitext
14954 [[File:Foobar.svg|thumb|caption]]
14955 !! html/php
14956 <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>
14957
14958 !! html/parsoid
14959 <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>
14960 !! end
14961
14962 !! test
14963 SVG thumbnails with language de
14964 !! options
14965 parsoid=wt2html,wt2wt,html2html
14966 !! wikitext
14967 [[File:Foobar.svg|thumb|caption|lang=de]]
14968 !! html/php
14969 <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>
14970
14971 !! html/parsoid
14972 <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>
14973 !! end
14974
14975 !! test
14976 SVG thumbnails with invalid language code
14977 !! options
14978 parsoid=wt2html,wt2wt,html2html
14979 !! wikitext
14980 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
14981 !! html/php
14982 <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>
14983
14984 !! html/parsoid
14985 <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>
14986 !! end
14987
14988 !! test
14989 T3887: A ISBN with a thumbnail
14990 !! wikitext
14991 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14992 !! html/php
14993 <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>
14994
14995 !! html/parsoid
14996 <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>
14997 !! end
14998
14999 !! test
15000 T3887: A RFC with a thumbnail
15001 !! wikitext
15002 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15003 !! html/php
15004 <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>
15005
15006 !! html/parsoid
15007 <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>
15008 !! end
15009
15010 !! test
15011 T3887: A mailto link with a thumbnail
15012 !! wikitext
15013 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15014 !! html/php
15015 <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>
15016
15017 !! html/parsoid
15018 <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>
15019 !! end
15020
15021 # Pending resolution to T2368
15022 !! test
15023 T2648: Frameless image caption with a link
15024 !! wikitext
15025 [[File:Foobar.jpg|text with a [[link]] in it]]
15026 !! html/php
15027 <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>
15028 </p>
15029 !! html/parsoid
15030 <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>
15031 !! end
15032
15033 !! test
15034 T2648: Frameless image caption with a link (suffix)
15035 !! wikitext
15036 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15037 !! html/php
15038 <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>
15039 </p>
15040 !! html/parsoid
15041 <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>
15042 !! end
15043
15044 !! test
15045 T2648: Frameless image caption with an interwiki link
15046 !! wikitext
15047 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15048 !! html/php
15049 <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>
15050 </p>
15051 !! html/parsoid
15052 <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>
15053 !! end
15054
15055 !! test
15056 T2648: Frameless image caption with a piped interwiki link
15057 !! wikitext
15058 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15059 !! html/php
15060 <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>
15061 </p>
15062 !! html/parsoid
15063 <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>
15064 !! end
15065
15066 !! test
15067 T107474: Frameless image caption with <nowiki>
15068 !! wikitext
15069 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15070 !! html/parsoid
15071 <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>
15072 !! end
15073
15074 !! test
15075 Escape HTML special chars in image alt text
15076 !! wikitext
15077 [[File:Foobar.jpg|& < > "]]
15078 !! html/php
15079 <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>
15080 </p>
15081 !! html/parsoid
15082 <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>
15083 !! end
15084
15085 !! test
15086 Escape HTML special chars in image alt text with LanguageConverter
15087 !! options
15088 language=zh
15089 !! wikitext
15090 [[File:Foobar.jpg|& < > "]]
15091 !! html/php
15092 <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>
15093 </p>
15094 !! html/parsoid
15095 <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>
15096 !! end
15097
15098 !! test
15099 Entities in file name and attributes
15100 !! wikitext
15101 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15102 !! html/php
15103 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15104 </p>
15105 !! html/parsoid
15106 <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>
15107 !! end
15108
15109 !! test
15110 T2499: Alt text should have &#1234;, not &amp;1234;
15111 !! wikitext
15112 [[File:Foobar.jpg|&#9792;]]
15113 !! html/php
15114 <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>
15115 </p>
15116 !! html/parsoid
15117 <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>
15118 !! end
15119
15120 !! test
15121 Broken image caption with link
15122 !! options
15123 parsoid=wt2html,wt2wt,html2html
15124 !! wikitext
15125 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15126 !! html/php
15127 <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.
15128 </p>
15129 !! html/parsoid
15130 <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>
15131 !! end
15132
15133 !! test
15134 Image caption containing another image
15135 !! wikitext
15136 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15137 !! html/php
15138 <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>
15139
15140 !! html/parsoid
15141 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>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>
15142 !! end
15143
15144 !! test
15145 Image: caption containing a newline
15146 !! wikitext
15147 [[File:Foobar.jpg|This
15148 *is some text]]
15149 !! html/php
15150 <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>
15151 </p>
15152 !! html/parsoid
15153 <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>
15154 !!end
15155
15156 !!test
15157 Image: caption containing leading space
15158 (The leading space should not trigger nowiki escaping in wt2wt mode)
15159 !! wikitext
15160 [[File:Foobar.jpg|thumb| bar]]
15161 !! html/php
15162 <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>
15163
15164 !! html/parsoid
15165 <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>
15166 !!end
15167
15168 # html/php output not have newlines after table, td, th, etc. because
15169 # Linker::makeThumbLink2() replaces the newlines with spaces since
15170 # the table is inside a caption.
15171 # FIXME: Verify if that circa 2004 fix is still required.
15172 !! test
15173 Image: caption containing a table
15174 !! options
15175 parsoid=wt2html,wt2wt,html2html
15176 !! wikitext
15177 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15178 {|
15179 !Foo!!Bar
15180 |-
15181 |Foo1||Bar1
15182 |}
15183 and some more text.]]
15184 !! html/php
15185 <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>
15186
15187 !! html/parsoid
15188 <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
15189 <table>
15190 <tbody>
15191 <tr><th>Foo</th><th>Bar</th></tr>
15192 <tr>
15193 <td>Foo1</td>
15194 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15195 !! end
15196
15197 !! test
15198 T5090: External links other than http: in image captions
15199 !! wikitext
15200 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15201 !! html/php
15202 <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>
15203
15204 !! html/parsoid
15205 <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>
15206 !! end
15207
15208 !! test
15209 Custom class
15210 !! options
15211 parsoid=wt2html,wt2wt,html2html
15212 !! wikitext
15213 [[Image:foobar.jpg|a|class=b]]
15214 !! html/php
15215 <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>
15216 </p>
15217 !! html/parsoid
15218 <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>
15219 !! end
15220
15221 !! test
15222 Localized image handling (1).
15223 !! options
15224 parsoid=wt2html,wt2wt,html2html
15225 language=es
15226 !! wikitext
15227 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15228 !! html/php
15229 <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>
15230
15231 !! html/parsoid
15232 <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>
15233 !! end
15234
15235 !! test
15236 Localized image handling (2).
15237 !! options
15238 thumbsize=220
15239 parsoid=wt2html,wt2wt,html2html
15240 language=es
15241 !! wikitext
15242 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15243 !! html/php
15244 <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>
15245
15246 !! html/parsoid
15247 <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>
15248 !! end
15249
15250 !! test
15251 Localized image handling (3).
15252 !! options
15253 language=fa
15254 parsoid=html2wt
15255 !! html/parsoid
15256 <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>
15257 !! wikitext
15258 [[File:Foobar.jpg|بندانگشتی]]
15259 !! end
15260
15261 !! test
15262 "border", "frameless" and "class" attributes on an image.
15263 !! options
15264 thumbsize=220
15265 parsoid=wt2html,wt2wt,html2html
15266 !! wikitext
15267 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15268 !! html/php
15269 <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>
15270 </p>
15271 !! html/parsoid
15272 <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>
15273 !! end
15274
15275 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15276 !! test
15277 Invalid image attributes (T64500)
15278 !! options
15279 thumbsize=220
15280 parsoid=wt2html,wt2wt,html2html
15281 !! wikitext
15282 [[File:Foobar.jpg|thumb|float|left|caption]]
15283
15284 [[File:Foobar.jpg|thumb|righ|caption]]
15285
15286 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15287 !! html/php
15288 <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>
15289 <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>
15290 <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>
15291
15292 !! html/parsoid
15293 <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>
15294 <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>
15295 <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>
15296 !! end
15297
15298 !! article
15299 File:Barfoo.jpg
15300 !! text
15301 #REDIRECT [[File:Barfoo.jpg]]
15302 !! endarticle
15303
15304 # FIXME: Parsoid should run this test -- but we'd need to teach the
15305 # mockAPI about the redirected Barfoo.jpg image.
15306 !! test
15307 Redirected image
15308 !! wikitext
15309 [[Image:Barfoo.jpg]]
15310 !! html/php
15311 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15312 </p>
15313 !! end
15314
15315 !! test
15316 Missing image with uploads disabled
15317 !! options
15318 wgEnableUploads=0
15319 !! wikitext
15320 [[File:Foobaz.jpg]]
15321 !! html/php
15322 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15323 </p>
15324 !! html/parsoid
15325 <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>
15326 !! end
15327
15328 # Parsoid-specific testing for images
15329 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15330 # Currently imperfect due to a flaw in the Parsoid testrunner
15331 # Work in progress
15332 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15333 # image tests.
15334
15335 !! test
15336 Parsoid-specific image handling - simple image with size and middle alignment
15337 !! wikitext
15338 [[File:Foobar.jpg|middle|50px]]
15339 !! html/parsoid
15340 <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>
15341 !! end
15342
15343 !! test
15344 Parsoid-specific image handling - simple image with size, middle alignment,
15345 non-standard namespace alias
15346 !! options
15347 parsoid=wt2wt,wt2html,html2html
15348 !! wikitext
15349 [[Image:Foobar.jpg|middle|50px]]
15350 !! html/parsoid
15351 <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>
15352 !! end
15353
15354 !! test
15355 Parsoid-specific image handling - simple image with size and middle alignment
15356 (existing content)
15357 !! wikitext
15358 [[File:Foobar.jpg|50px|middle]]
15359 !! html/parsoid
15360 <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>
15361 !! end
15362
15363 !! test
15364 Parsoid-specific image handling - simple image with size and middle alignment
15365 and non-standard namespace name
15366 !! options
15367 parsoid=wt2html,wt2wt,html2html
15368 !! wikitext
15369 [[Image:Foobar.jpg|50px|middle]]
15370 !! html/parsoid
15371 <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>
15372 !! end
15373
15374 !! test
15375 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15376 !! wikitext
15377 [[File:Foobar.jpg|500x10px|baseline|caption]]
15378 !! html/parsoid
15379 <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>
15380 !! end
15381
15382 !! test
15383 Parsoid-specific image handling - simple image with border and size spec
15384 !! wikitext
15385 [[File:Foobar.jpg|50px|border|caption]]
15386 !! html/parsoid
15387 <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>
15388 !! end
15389
15390 !! test
15391 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15392 !! wikitext
15393 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15394 !! html/parsoid
15395 <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>
15396 !! end
15397
15398 !! test
15399 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15400 (existing content)
15401 !! wikitext
15402 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15403 !! html/parsoid
15404 <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>
15405 !! end
15406
15407 !! test
15408 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15409 !! wikitext
15410 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15411 !! html/parsoid
15412 <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>
15413 !! end
15414
15415 !! test
15416 Parsoid-specific image handling - thumbnail with specific size, halign,
15417 valign, and caption (existing content)
15418 !! wikitext
15419 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15420 !! html/parsoid
15421 <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>
15422 !! end
15423
15424 !! test
15425 Parsoid-specific image handling - framed image with specific size and caption
15426 (size is ignored)
15427 !! options
15428 parsoid=wt2html,wt2wt,html2html
15429 !! wikitext
15430 [[File:Foobar.jpg|frame|500x50px|caption]]
15431 !! html/parsoid
15432 <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>
15433 !! end
15434
15435 !! test
15436 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15437 (size is ignored)
15438 !! options
15439 parsoid=wt2html,wt2wt,html2html
15440 !! wikitext
15441 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15442 !! html/parsoid
15443 <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>
15444 !! end
15445
15446 !! test
15447 Parsoid-specific image handling - frameless image with specific size, border, and caption
15448 !! wikitext
15449 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15450 !! html/parsoid
15451 <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>
15452 !! end
15453
15454 !! test
15455 Parsoid-specific image handling - simple image with a formatted caption
15456 !! wikitext
15457 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15458 !! html/parsoid
15459 <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>
15460 !! end
15461
15462 !! test
15463 Parsoid-specific image handling - caption with a template in it
15464 !! wikitext
15465 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15466 !! html/parsoid
15467 <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>
15468 !! end
15469
15470 !! test
15471 Parsoid-specific image handling - caption with unbalanced tags in it
15472 !! options
15473 parsoid=wt2html,wt2wt,html2html
15474 !! wikitext
15475 foo
15476 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15477 bar
15478 !! html/parsoid
15479 <p>foo</p>
15480 <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>
15481 <p>bar</p>
15482 !! end
15483
15484 !! test
15485 Parsoid-specific image handling - empty caption (1)
15486 !! options
15487 parsoid=wt2html,wt2wt
15488 !! wikitext
15489 [[File:Foobar.jpg|thumb|]]
15490 !! html/parsoid
15491 <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>
15492 !! end
15493
15494 # empty captions don't get serialized unless we're in the "round trip" case
15495 !! test
15496 Parsoid-specific image handling - empty caption (2)
15497 !! options
15498 parsoid=html2wt
15499 !! html/parsoid
15500 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15501 <a href="./File:Foobar.jpg">
15502 <img resource="./File:Foobar.jpg"
15503 src="//example.com/images/3/3a/Foobar.jpg"
15504 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15505 height="25" width="220"/>
15506 </a>
15507 <figcaption></figcaption>
15508 </figure>
15509 !! wikitext
15510 [[File:Foobar.jpg|thumb]]
15511 !! end
15512
15513 !! test
15514 Parsoid-specific image handling - whitespace caption
15515 !! wikitext
15516 [[File:Foobar.jpg|thumb| ]]
15517 !! html/parsoid
15518 <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>
15519 !! end
15520
15521 !! test
15522 Parsoid-specific image handling - lang option
15523 !! wikitext
15524 foo
15525 [[File:Foobar.svg|lang=de|caption]]
15526 bar
15527 !! html/parsoid
15528 <p>foo
15529 <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>
15530 bar</p>
15531 !! end
15532
15533 ## Edge case bugs in Parsoid from T93580
15534 !! test
15535 T93580: 1. Templated <ref> inside block images
15536 !! wikitext
15537 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15538
15539 <references />
15540 !! html/parsoid
15541 <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>
15542
15543 <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>
15544 !! end
15545
15546 !! test
15547 T93580: 2. <ref> inside inline images
15548 !! wikitext
15549 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15550
15551 <references />
15552 !! html/parsoid
15553 <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>
15554
15555 <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>
15556 !! end
15557
15558 !! test
15559 T93580: 3. Templated <ref> inside inline images
15560 !! wikitext
15561 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15562
15563 <references />
15564 !! html/parsoid
15565 <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>
15566
15567 <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>
15568 !! end
15569
15570 ###
15571 ### Subpages
15572 ###
15573 !! article
15574 Subpage test/subpage
15575 !! text
15576 foo
15577 !! endarticle
15578
15579 !! test
15580 Subpage link
15581 !! options
15582 subpage title=[[Subpage test]]
15583 !! wikitext
15584 [[/subpage]]
15585 !! html
15586 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15587 </p>
15588 !! end
15589
15590 !! test
15591 Subpage noslash link
15592 !! options
15593 subpage title=[[Subpage test]]
15594 !! wikitext
15595 [[/subpage/]]
15596 !! html
15597 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15598 </p>
15599 !! end
15600
15601 !! article
15602 Subpage test/1/2/subpage
15603 !! text
15604 blah
15605 !! endarticle
15606
15607 !! test
15608 Relative subpage noslash link
15609 !! options
15610 parsoid=wt2wt,wt2html,html2html
15611 subpage title=[[Subpage test/1/2/3/4]]
15612 !! wikitext
15613 [[../../subpage/]]
15614
15615 [[../../subpage]]
15616 !! html/php
15617 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15618 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15619 </p>
15620 !! html/parsoid
15621 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15622 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15623 !! end
15624
15625 !! test
15626 Parsoid: dot-slash prefixed wikilinks
15627 !! wikitext
15628 [[./foo]]
15629
15630 [[././bar]]
15631
15632 [[././baz/]]
15633 !! html/php
15634 <p>[[./foo]]
15635 </p><p>[[././bar]]
15636 </p><p>[[././baz/]]
15637 </p>
15638 !! html/parsoid
15639 <p>[[./foo]]
15640 </p><p>[[././bar]]
15641 </p><p>[[././baz/]]
15642 </p>
15643 !! end
15644
15645 !! test
15646 Render invalid page names as plain text (T53090)
15647 !! wikitext
15648 [[./../foo|bar]]
15649 [[foo�|bar]]
15650 [[foo/.|bar]]
15651 [[foo/..|bar]]
15652 [[foo~~~bar]]
15653 [[foo>bar]]
15654 [[foo[bar]]
15655 [[.]]
15656 [[..]]
15657 [[foo././bar]]
15658 [[foo[http://example.com]xyz]]
15659
15660 [[{{echo|./../foo}}|bar]]
15661 [[{{echo|foo/.}}|bar]]
15662 [[{{echo|foo/..}}|bar]]
15663 [[{{echo|foo~~~~bar}}]]
15664 [[{{echo|foo>bar}}]]
15665 [[{{echo|foo././bar}}]]
15666 [[{{echo|foo{bar}}]]
15667 [[{{echo|foo}bar}}]]
15668 [[{{echo|foo[bar}}]]
15669 [[{{echo|foo]bar}}]]
15670 [[{{echo|foo<bar}}]]
15671 !!html/php
15672 <p>[[./../foo|bar]]
15673 [[foo�|bar]]
15674 [[foo/.|bar]]
15675 [[foo/..|bar]]
15676 [[foo~~~bar]]
15677 [[foo&gt;bar]]
15678 [[foo[bar]]
15679 [[.]]
15680 [[..]]
15681 [[foo././bar]]
15682 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15683 </p><p>[[./../foo|bar]]
15684 [[foo/.|bar]]
15685 [[foo/..|bar]]
15686 [[foo~~~~bar]]
15687 [[foo&gt;bar]]
15688 [[foo././bar]]
15689 [[foo{bar]]
15690 [[foo}bar]]
15691 [[foo[bar]]
15692 [[foo]bar]]
15693 [[foo&lt;bar]]
15694 </p>
15695 !!html/parsoid
15696 <p>[[./../foo|bar]]
15697 [[foo�|bar]]
15698 [[foo/.|bar]]
15699 [[foo/..|bar]]
15700 [[foo~~~bar]]
15701 [[foo>bar]]
15702 [[foo[bar]]
15703 [[.]]
15704 [[..]]
15705 [[foo././bar]]
15706 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15707
15708 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15709 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15710 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15711 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15712 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15713 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15714 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15715 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15716 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15717 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15718 [[<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>
15719 !!end
15720
15721 !! test
15722 Disabled subpages
15723 !! wikitext
15724 [[/subpage]]
15725 !! html
15726 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15727 </p>
15728 !! end
15729
15730 !! test
15731 T2561: {{/Subpage}}
15732 !! options
15733 subpage title=[[Page]]
15734 !! wikitext
15735 {{/Subpage}}
15736 !! html
15737 <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>
15738 </p>
15739 !! end
15740
15741 ###
15742 ### Categories
15743 ###
15744 !! article
15745 Category:MediaWiki User's Guide
15746 !! text
15747 blah
15748 !! endarticle
15749
15750 !! test
15751 Link to category
15752 !! wikitext
15753 [[:Category:MediaWiki User's Guide]]
15754 !! html
15755 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15756 </p>
15757 !! end
15758
15759 !! test
15760 Simple category
15761 !! options
15762 cat
15763 !! wikitext
15764 [[Category:MediaWiki User's Guide]]
15765 !! html/php
15766 cat=MediaWiki_User's_Guide sort=
15767 !! html/parsoid
15768 <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"}}'/>
15769 !! end
15770
15771 !! test
15772 PAGESINCATEGORY invalid title fatal (r33546 fix)
15773 !! wikitext
15774 {{PAGESINCATEGORY:<bogus>}}
15775 !! html
15776 <p>0
15777 </p>
15778 !! end
15779
15780 !! test
15781 Category with different sort key
15782 !! options
15783 cat
15784 !! wikitext
15785 [[Category:MediaWiki User's Guide|Foo]]
15786 !! html/php
15787 cat=MediaWiki_User's_Guide sort=Foo
15788 !! html/parsoid
15789 <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"}}'/>
15790 !! end
15791
15792 !! test
15793 Category with identical sort key
15794 !! options
15795 cat
15796 !! wikitext
15797 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15798 !! html/php
15799 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15800 !! html/parsoid
15801 <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"}}'/>
15802 !! end
15803
15804 !! test
15805 Category with empty sort key
15806 !! options
15807 cat
15808 pst
15809 !! wikitext
15810 [[Category:MediaWiki User's Guide|]]
15811 !! html/php
15812 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15813 !! end
15814
15815 !! test
15816 Category with empty sort key and parentheses
15817 !! options
15818 cat
15819 pst
15820 !! wikitext
15821 [[Category:Foo (bar)|]]
15822 !! html/php
15823 [[Category:Foo (bar)|Foo]]
15824 !! end
15825
15826 !! test
15827 Category with link tail
15828 !! options
15829 cat
15830 pst
15831 !! wikitext
15832 123[[Category:Foo]]456
15833 !! html/php
15834 123[[Category:Foo]]456
15835 !! end
15836
15837 !! test
15838 Category with template
15839 !! options
15840 cat
15841 pst
15842 !! wikitext
15843 [[Category:{{echo|Foo}}]]
15844 !! html/php
15845 [[Category:{{echo|Foo}}]]
15846 !! end
15847
15848 !! test
15849 Category with template in sort key
15850 !! options
15851 cat
15852 pst
15853 !! wikitext
15854 [[Category:Foo|{{echo|Bar}}]]
15855 !! html/php
15856 [[Category:Foo|{{echo|Bar}}]]
15857 !! end
15858
15859 !! test
15860 Category with template in sort key and title
15861 !! options
15862 cat
15863 pst
15864 !! wikitext
15865 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15866 !! html/php
15867 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15868 !! end
15869
15870 ## We used to, but no longer wt2wt this test since the default serializer
15871 ## will normalize all categories to serialize on their own line.
15872 ## This wikitext usage is going to be fairly uncommon in production and
15873 ## selser will take care of preserving formatting in those scenarios.
15874 !! test
15875 Category / paragraph interactions
15876 !! options
15877 parsoid=wt2html
15878 !! wikitext
15879 Foo [[Category:Baz]] Bar
15880
15881 Foo [[Category:Baz]]
15882 Bar
15883
15884 Foo
15885 [[Category:Baz]]
15886 Bar
15887
15888 Foo
15889 [[Category:Baz]] Bar
15890
15891 Foo
15892 [[Category:Baz]]
15893 [[Category:Baz]]
15894 [[Category:Baz]]
15895 Bar
15896
15897 [[Category:Baz]]
15898 [[Category:Baz]]
15899 [[Category:Baz]]
15900
15901 [[Category:Baz]]
15902 {{echo|[[Category:Baz]]}}
15903 [[Category:Baz]]
15904 !! html/php
15905 <p>Foo Bar
15906 </p><p>Foo
15907 Bar
15908 </p><p>Foo
15909 Bar
15910 </p><p>Foo Bar
15911 </p><p>Foo
15912 Bar
15913 </p>
15914 !! html/parsoid
15915 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15916 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15917 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15918 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15919 <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>
15920 <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}}]}'/>
15921 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15922 !! end
15923
15924 ## We used to, but no longer wt2wt this test since the default serializer
15925 ## will normalize all categories to serialize on their own line.
15926 ## This wikitext usage is going to be fairly uncommon in production and
15927 ## selser will take care of preserving formatting in those scenarios.
15928 ##
15929 ## The whitespace on the empty line is part of the test. Please do not delete
15930 !! test
15931 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15932 !! options
15933 parsoid=wt2html
15934 !! wikitext
15935 This
15936
15937 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15938
15939 {{echo|[[Category:Foo]] and so should this!}}
15940 !! html/php
15941 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15942 </p>
15943 !! html/parsoid
15944 <p>This
15945
15946 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15947
15948 <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>
15949 !! end
15950
15951 ## Parsoid will not try to wt2wt this while preserving newlines because
15952 ## it suppresses excess newlines within list items -- and we don't want to
15953 ## introduce a special case just for categories, which is, in reality somewhat
15954 ## odd behavior -- categories are unlikely to be used in list items like this
15955 ## in top-level pages and are only likely to show up in template-generated
15956 ## list items where this RT-ing is a non-issue.
15957 ##
15958 ## The whitespace on the empty line is part of the test. Please do not delete
15959 !! test
15960 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15961 !! options
15962 parsoid=wt2html
15963 !! wikitext
15964 * This
15965
15966 [[Category:Foo]] and this should be part of the same list item
15967 * So should this
15968
15969 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15970 !! html
15971 <ul><li>This and this should be part of the same list item</li>
15972 <li>So should this and this should be part of the same list item</li></ul>
15973 !! html/parsoid
15974 <ul>
15975 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15976 <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>
15977 </ul>
15978 !! end
15979
15980 ## Newlines and categories that follow the last item of a list
15981 ## are treated differently because this (list followed by categories)
15982 ## is an extremely common pattern on wikis.
15983 !! test
15984 3. Categories and newlines: newline suppression for last list item should RT properly
15985 !! wikitext
15986 * a
15987 * b
15988
15989 [[Category:Foo]]
15990
15991 [[Category:Bar]]
15992 [[Category:Baz]]
15993 !! html/parsoid
15994 <ul><li> a</li>
15995 <li> b</li></ul>
15996
15997 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15998
15999 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16000 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16001 !! end
16002
16003 !! test
16004 4. Categories and newlines: newline suppression for last list item should RT properly
16005 !! wikitext
16006 * a
16007 **** b
16008
16009 [[Category:Foo]]
16010 !! html/parsoid
16011 <ul><li> a
16012 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16013
16014 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16015 !! end
16016
16017 ## only wt2html for this to make sure the algo only applies to the rightmost path
16018 !! test
16019 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16020 !! options
16021 parsoid=wt2html
16022 !! wikitext
16023 * a
16024 ** b
16025 [[Category:Foo]]
16026 * c
16027 ** d
16028 [[Category:Foo]]
16029 !! html/parsoid
16030 <ul><li> a
16031 <ul><li> b
16032 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16033 <li> c
16034 <ul><li> d</li></ul></li></ul>
16035 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16036 !! end
16037
16038 ## We used to, but no longer wt2wt this test since the default serializer
16039 ## will normalize all categories to serialize on their own line.
16040 ## This wikitext usage is going to be fairly uncommon in production and
16041 ## selser will take care of preserving formatting in those scenarios.
16042 !! test
16043 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16044 !! options
16045 parsoid=wt2html
16046 !! wikitext
16047 * a [[Category:Foo]]
16048 !! html/parsoid
16049 <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>
16050 !! end
16051
16052 # This test also demonstrates because of newline+category tunneling
16053 # through the list hander, template wrapping doesn't expand to the
16054 # containing list when the list item swallows the category.
16055 !! test
16056 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16057 !! wikitext
16058 * {{echo|a
16059 [[Category:Foo]]}}
16060 !! html/parsoid
16061 <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
16062 </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>
16063 !! end
16064
16065 !! test
16066 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16067 !! wikitext
16068 * a
16069
16070 {{echo|[[Category:Foo]]
16071 [[Category:Bar]]}}
16072 [[Category:Baz]]
16073 !! html/parsoid
16074 <ul><li> a</li></ul>
16075
16076 <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">
16077 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16078 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16079 !! end
16080
16081 !! test
16082 9. Categories and newlines: should behave properly with linkprefix (T87753)
16083 !! options
16084 language=ar
16085 !! wikitext
16086 foo bar
16087 foo bar
16088 [[تصنيف:Foo]]
16089 [[تصنيف:Bar]]
16090 !! html/php
16091 <p>foo bar
16092 foo bar
16093 </p>
16094 !! html/parsoid
16095 <p>foo bar
16096 foo bar</p>
16097 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16098 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16099 !! end
16100
16101 !! test
16102 10. No regressions on internal links following category (T174639)
16103 !! options
16104 parsoid=wt2html,html2html
16105 !! wikitext
16106 [[Category:Foo]]<div>a
16107
16108 [[Foo]]</div>
16109 !! html/php
16110 <div>a
16111 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16112
16113 !! html/parsoid
16114 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16115
16116 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16117 !! end
16118
16119 # Note that Parsoid differs slightly from PHP due to T175421
16120 !! test
16121 11. Special case where only newlines separate links (T175416)
16122 !! options
16123 parsoid=wt2html,html2html
16124 !! wikitext
16125 [[Category:Foo]]
16126
16127 [[Foo]][[es:Alimento]]
16128
16129 [[Foo]]
16130 !! html/php
16131 <p><br />
16132 <a href="/wiki/Foo" title="Foo">Foo</a>
16133 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16134 </p>
16135 !! html/parsoid
16136 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16137
16138 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16139
16140 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16141 !! end
16142
16143 !! test
16144 Category links with multiple namespaces
16145 !! wikitext
16146 [[Category:Project:Foo]]
16147 !! html/parsoid
16148 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16149 !! end
16150
16151 !! test
16152 Parsoid: Serialize link to category page with colon escape
16153 !! options
16154 parsoid
16155 !! wikitext
16156
16157 [[:Category:Foo]]
16158 [[:Category:Foo|Bar]]
16159 !! html
16160 <p>
16161 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16162 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16163 </p>
16164 !! end
16165
16166 # We used to, but no longer wt2wt this test since the default serializer
16167 # will normalize all categories to serialize on their own line.
16168 # This wikitext usage is going to be fairly uncommon in production and
16169 # selser will take care of preventing whitespace insertion if this
16170 # occurs in an article.
16171 #
16172 # html2html disabled for the same reason (whitespace insertion between
16173 # x and y).
16174 #
16175 # html2wt disabled because it localizes the "Category" namespace.
16176 !! test
16177 Link prefix/suffixes aren't applied to category links
16178 !! options
16179 parsoid=wt2html
16180 language=is
16181 !! wikitext
16182 x[[Category:Foo]]y
16183 !! html/php
16184 <p>xy
16185 </p>
16186 !! html/parsoid
16187 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16188 !! end
16189
16190 !! test
16191 Link prefix/suffixes aren't applied to language links
16192 !! options
16193 parsoid=wt2html
16194 language=is
16195 !! wikitext
16196 x[[es:Foo]]y
16197 !! html/php
16198 <p>xy
16199 </p>
16200 !! html/parsoid
16201 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16202 !! end
16203
16204 !! test
16205 Parsoid: Serialize link to file page with colon escape
16206 !! options
16207 parsoid
16208 !! wikitext
16209
16210 [[:File:Foo.png]]
16211 [[:File:Foo.png|Bar]]
16212 !! html
16213 <p>
16214 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16215 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16216 </p>
16217 !! end
16218
16219 !! test
16220 Parsoid: Serialize a genuine category link without colon escape
16221 !! options
16222 parsoid
16223 !! wikitext
16224 [[Category:Foo]]
16225 [[Category:Foo|Bar]]
16226 !! html
16227 <link rel="mw:PageProp/Category" href="./Category:Foo">
16228 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16229 !! end
16230
16231 !! test
16232 Normalize hrefs properly before testing for invalid link targets (T72894)
16233 !! options
16234 parsoid=html2wt
16235 !! html/parsoid
16236 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16237 !! wikitext
16238 [[Category:Toxine bactérienne]]
16239 !! end
16240
16241 !! test
16242 Parsoid: Defaultsort
16243 !! wikitext
16244 {{DEFAULTSORT:Foo}}
16245 !! html/parsoid
16246 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16247 !! end
16248
16249 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16250 # But, this is a limitation of our representation and is documented in
16251 # TemplateHandler.js in processSpecialMagicWord
16252 !! test
16253 Parsoid: Defaultsort (template-generated)
16254 !! wikitext
16255 {{{{echo|DEFAULTSORT}}:Foo}}
16256 !! html/parsoid
16257 <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"}]]}'/>
16258 !! end
16259
16260 ###
16261 ### Inter-language links
16262 ###
16263 !! test
16264 Interlanguage links
16265 !! options
16266 ill
16267 !! wikitext
16268 [[es:Alimento]]
16269 [[fr:Nourriture]]
16270 [[zh:食品]]
16271 !! html/php
16272 es:Alimento fr:Nourriture zh:食品
16273 !! html/parsoid
16274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16275 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16276 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16277 !! end
16278
16279 !! test
16280 Duplicate interlanguage links (T26502)
16281 !! options
16282 ill
16283 !! wikitext
16284 [[es:1]]
16285 [[es:2]]
16286 [[fr:1]]
16287 [[fr:2]]
16288 !! html/php
16289 es:1 fr:1
16290 !! html/parsoid
16291 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16292 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16293 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16294 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16295 !! end
16296
16297 ###
16298 ### Sections
16299 ###
16300 !! test
16301 Basic section headings
16302 !! wikitext
16303 ==Headline 1==
16304 Some text
16305
16306 ==Headline 2==
16307 More
16308 ===Smaller headline===
16309 Blah blah
16310 !! html
16311 <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>
16312 <p>Some text
16313 </p>
16314 <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>
16315 <p>More
16316 </p>
16317 <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>
16318 <p>Blah blah
16319 </p>
16320 !! end
16321
16322 !! test
16323 Section headings with TOC
16324 !! wikitext
16325 ==Headline 1==
16326 ===Subheadline 1===
16327 =====Skipping a level=====
16328 ======Skipping a level======
16329
16330 ==Headline 2==
16331 Some text
16332 ===Another headline===
16333 !! html
16334 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16335 <ul>
16336 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16337 <ul>
16338 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16339 <ul>
16340 <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>
16341 <ul>
16342 <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>
16343 </ul>
16344 </li>
16345 </ul>
16346 </li>
16347 </ul>
16348 </li>
16349 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16350 <ul>
16351 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16352 </ul>
16353 </li>
16354 </ul>
16355 </div>
16356
16357 <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>
16358 <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>
16359 <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>
16360 <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>
16361 <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>
16362 <p>Some text
16363 </p>
16364 <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>
16365
16366 !! end
16367
16368 !! test
16369 TOC anchors don't collide
16370 !! wikitext
16371 __FORCETOC__
16372 ==Headline 2==
16373 ==Headline==
16374 ==Headline 2==
16375 ==Headline==
16376 !! html/php
16377 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16378 <ul>
16379 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16380 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16381 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16382 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16383 </ul>
16384 </div>
16385
16386 <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>
16387 <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>
16388 <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>
16389 <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>
16390
16391 !! end
16392
16393 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16394 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16395 !! test
16396 Handling of sections up to level 6 and beyond
16397 !! options
16398 parsoid=wt2html
16399 !! wikitext
16400 =Level 1 Heading=
16401 ==Level 2 Heading==
16402 ===Level 3 Heading===
16403 ====Level 4 Heading====
16404 =====Level 5 Heading=====
16405 ======Level 6 Heading======
16406 =======Level 7 Heading=======
16407 ========Level 8 Heading========
16408 =========Level 9 Heading=========
16409 ==========Level 10 Heading==========
16410 !! html/php
16411 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16412 <ul>
16413 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16414 <ul>
16415 <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>
16416 <ul>
16417 <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>
16418 <ul>
16419 <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>
16420 <ul>
16421 <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>
16422 <ul>
16423 <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>
16424 <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>
16425 <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>
16426 <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>
16427 <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>
16428 </ul>
16429 </li>
16430 </ul>
16431 </li>
16432 </ul>
16433 </li>
16434 </ul>
16435 </li>
16436 </ul>
16437 </li>
16438 </ul>
16439 </div>
16440
16441 <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>
16442 <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>
16443 <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>
16444 <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>
16445 <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>
16446 <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>
16447 <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>
16448 <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>
16449 <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>
16450 <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>
16451
16452 !! html/parsoid
16453 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16454 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16455 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16456 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16457 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16458 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16459 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16460 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16461 <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>
16462 <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>
16463 !! end
16464
16465 !! test
16466 TOC regression (T11764)
16467 !! wikitext
16468 ==title 1==
16469 ===title 1.1===
16470 ====title 1.1.1====
16471 ===title 1.2===
16472 ==title 2==
16473 ===title 2.1===
16474 !! html
16475 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16476 <ul>
16477 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16478 <ul>
16479 <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>
16480 <ul>
16481 <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>
16482 </ul>
16483 </li>
16484 <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>
16485 </ul>
16486 </li>
16487 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16488 <ul>
16489 <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>
16490 </ul>
16491 </li>
16492 </ul>
16493 </div>
16494
16495 <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>
16496 <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>
16497 <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>
16498 <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>
16499 <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>
16500 <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>
16501
16502 !! end
16503
16504 !! test
16505 TOC for heading containing <span id="..."></span> (T96153)
16506 !! wikitext
16507 __FORCETOC__
16508 ==<span id="old-anchor"></span>New title==
16509 !! html/php
16510 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16511 <ul>
16512 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16513 </ul>
16514 </div>
16515
16516 <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>
16517
16518 !! end
16519
16520 !! test
16521 TOC with wgMaxTocLevel=3 (T8204)
16522 !! options
16523 wgMaxTocLevel=3
16524 !! wikitext
16525 ==title 1==
16526 ===title 1.1===
16527 ====title 1.1.1====
16528 ===title 1.2===
16529 ==title 2==
16530 ===title 2.1===
16531 !! html
16532 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16533 <ul>
16534 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16535 <ul>
16536 <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>
16537 <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>
16538 </ul>
16539 </li>
16540 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16541 <ul>
16542 <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>
16543 </ul>
16544 </li>
16545 </ul>
16546 </div>
16547
16548 <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>
16549 <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>
16550 <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>
16551 <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>
16552 <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>
16553 <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>
16554
16555 !! end
16556
16557 !! test
16558 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16559 !! options
16560 wgMaxTocLevel=3
16561 !! wikitext
16562 ==Section 1==
16563 ===Section 1.1===
16564 ====Section 1.1.1====
16565 ====Section 1.1.1.1====
16566 ==Section 2==
16567 !! html
16568 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16569 <ul>
16570 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16571 <ul>
16572 <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>
16573 </ul>
16574 </li>
16575 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16576 </ul>
16577 </div>
16578
16579 <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>
16580 <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>
16581 <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>
16582 <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>
16583 <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>
16584
16585 !! end
16586
16587
16588 !! test
16589 Resolving duplicate section names
16590 !! wikitext
16591 ==Foo bar==
16592 ==Foo bar==
16593 !! html
16594 <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>
16595 <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>
16596
16597 !! end
16598
16599 !! test
16600 Resolving duplicate section names with differing case (T12721)
16601 !! wikitext
16602 ==Foo bar==
16603 ==Foo Bar==
16604 !! html
16605 <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>
16606 <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>
16607
16608 !! end
16609
16610 !! article
16611 Template:sections
16612 !! text
16613 ===Section 1===
16614 ==Section 2==
16615 !! endarticle
16616
16617 !! test
16618 Template with sections, __NOTOC__
16619 !! wikitext
16620 __NOTOC__
16621 ==Section 0==
16622 {{sections}}
16623 ==Section 4==
16624 !! html
16625 <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>
16626 <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>
16627 <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>
16628 <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>
16629
16630 !! end
16631
16632 !! test
16633 __NOEDITSECTION__ keyword
16634 !! wikitext
16635 __NOEDITSECTION__
16636 ==Section 1==
16637 ==Section 2==
16638 !! html
16639 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16640 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16641
16642 !! end
16643
16644 !! test
16645 Link inside a section heading
16646 !! wikitext
16647 ==Section with a [[Main Page|link]] in it==
16648 !! html
16649 <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>
16650
16651 !! end
16652
16653 !! test
16654 TOC regression (T14077)
16655 !! wikitext
16656 __TOC__
16657 ==title 1==
16658 ===title 1.1===
16659 ==title 2==
16660 !! html
16661 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16662 <ul>
16663 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16664 <ul>
16665 <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>
16666 </ul>
16667 </li>
16668 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16669 </ul>
16670 </div>
16671
16672 <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>
16673 <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>
16674 <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>
16675
16676 !! end
16677
16678 !! test
16679 T3219 URL next to image (good)
16680 !! wikitext
16681 http://example.com [[File:Foobar.jpg]]
16682 !! html/php
16683 <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>
16684 </p>
16685 !! html/parsoid
16686 <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>
16687 !!end
16688
16689 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16690 !! test
16691 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16692 !! options
16693 parsoid=wt2html,html2html
16694 !! wikitext
16695 ===
16696 The line above must have a trailing space!
16697 === <!--
16698 --> <!-- -->
16699 But just in case it doesn't...
16700 !! html/php
16701 <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>
16702 <p>The line above must have a trailing space!
16703 </p>
16704 <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>
16705 <p>But just in case it doesn't...
16706 </p>
16707 !! html/parsoid
16708 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16709 <p>The line above must have a trailing space!</p>
16710 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16711 --> <!-- -->
16712 <p>But just in case it doesn't...</p>
16713 !! end
16714
16715 !! test
16716 Header with special characters (T27462)
16717 !! wikitext
16718 The tooltips shall not show entities to the user (ie. be double escaped)
16719
16720 ==text > text==
16721 section 1
16722
16723 ==text < text==
16724 section 2
16725
16726 ==text & text==
16727 section 3
16728
16729 ==text ' text==
16730 section 4
16731
16732 ==text " text==
16733 section 5
16734 !! html/php
16735 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16736 </p>
16737 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16738 <ul>
16739 <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>
16740 <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>
16741 <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>
16742 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16743 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16744 </ul>
16745 </div>
16746
16747 <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>
16748 <p>section 1
16749 </p>
16750 <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>
16751 <p>section 2
16752 </p>
16753 <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>
16754 <p>section 3
16755 </p>
16756 <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>
16757 <p>section 4
16758 </p>
16759 <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>
16760 <p>section 5
16761 </p>
16762 !! html/parsoid
16763 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16764
16765 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16766 <p>section 1</p>
16767
16768 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16769 <p>section 2</p>
16770
16771 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16772 <p>section 3</p>
16773
16774 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16775 <p>section 4</p>
16776
16777 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16778 <p>section 5</p>
16779 !! end
16780
16781 !! test
16782 Header with space, plus and underscore as entity
16783 !! wikitext
16784 Id should not contain + for spaces
16785
16786 ==Space between Text==
16787 section 1
16788
16789 ==Space-Entity&#32;between&#32;Text==
16790 section 2
16791
16792 ==Plus+between+Text==
16793 section 3
16794
16795 ==Plus-Entity&#43;between&#43;Text==
16796 section 4
16797
16798 ==Underscore_between_Text==
16799 section 5
16800
16801 ==Underscore-Entity&#95;between&#95;Text==
16802 section 6
16803
16804 [[#Space between Text]]
16805 [[#Space-Entity&#32;between&#32;Text]]
16806 [[#Plus+between+Text]]
16807 [[#Plus-Entity&#43;between&#43;Text]]
16808 [[#Underscore_between_Text]]
16809 [[#Underscore-Entity&#95;between&#95;Text]]
16810 !! html/php
16811 <p>Id should not contain + for spaces
16812 </p>
16813 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16814 <ul>
16815 <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>
16816 <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>
16817 <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>
16818 <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>
16819 <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>
16820 <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>
16821 </ul>
16822 </div>
16823
16824 <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>
16825 <p>section 1
16826 </p>
16827 <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>
16828 <p>section 2
16829 </p>
16830 <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>
16831 <p>section 3
16832 </p>
16833 <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>
16834 <p>section 4
16835 </p>
16836 <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>
16837 <p>section 5
16838 </p>
16839 <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>
16840 <p>section 6
16841 </p><p><a href="#Space_between_Text">#Space between Text</a>
16842 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16843 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16844 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16845 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16846 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16847 </p>
16848 !! html/parsoid
16849 <p>Id should not contain + for spaces</p>
16850
16851 <h2 id="Space_between_Text">Space between Text</h2>
16852 <p>section 1</p>
16853
16854 <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>
16855 <p>section 2</p>
16856
16857 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16858 <p>section 3</p>
16859
16860 <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>
16861 <p>section 4</p>
16862
16863 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16864 <p>section 5</p>
16865
16866 <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>
16867 <p>section 6</p>
16868
16869 <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>
16870 <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>
16871 <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>
16872 <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>
16873 <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>
16874 <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>
16875 !! end
16876
16877 # Parsoid html2wt disabled because it adds padding spaces around =
16878 !! test
16879 Headers with excess '=' characters
16880 (Are similar tests necessary beyond the 1st level?)
16881 !! options
16882 parsoid=wt2html,wt2wt,html2html
16883 !! wikitext
16884 =foo==
16885 ==foo=
16886 =''italic'' heading==
16887 ==''italic'' heading=
16888 !! html/php
16889 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16890 <ul>
16891 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16892 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16893 <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>
16894 <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>
16895 </ul>
16896 </div>
16897
16898 <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>
16899 <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>
16900 <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>
16901 <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>
16902
16903 !! html/parsoid
16904 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16905 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16906 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16907 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16908 !! end
16909
16910 !! test
16911 HTML headers vs TOC (T25393)
16912 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16913 !! wikitext
16914 <h1>Header 1</h1>
16915 ==Header 1.1==
16916 ==Header 1.2==
16917
16918 <h1>Header 2
16919 </h1>
16920 ==Header 2.1==
16921 ==Header 2.2==
16922 __NOEDITSECTION__
16923 !! html/php
16924 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16925 <ul>
16926 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16927 <ul>
16928 <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>
16929 <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>
16930 </ul>
16931 </li>
16932 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16933 <ul>
16934 <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>
16935 <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>
16936 </ul>
16937 </li>
16938 </ul>
16939 </div>
16940
16941 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16942 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16943 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16944 <h1><span class="mw-headline" id="Header_2">Header 2
16945 </span></h1>
16946 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16947 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16948
16949 !! html/parsoid
16950 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16951 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
16952 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
16953
16954 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16955 </h1>
16956 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
16957 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
16958 <meta property="mw:PageProp/noeditsection"/>
16959 !! end
16960
16961 !! test
16962 Single-line or multiline-comments can follow headings
16963 !! options
16964 parsoid=wt2html,wt2wt
16965 !! wikitext
16966 ==foo==<!---->
16967 ==bar==<!--c1-->
16968 ==baz==<!--
16969 c2
16970 c3-->
16971 !! html/php
16972 <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>
16973 <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>
16974 <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>
16975
16976 !! html/parsoid
16977 <h2 id="foo">foo</h2><!---->
16978 <h2 id="bar">bar</h2><!--c1-->
16979 <h2 id="baz">baz</h2><!--
16980 c2
16981 c3-->
16982 !! end
16983
16984 !! test
16985 T3219 URL next to image (broken)
16986 !! wikitext
16987 http://example.com[[File:Foobar.jpg]]
16988 !! html/php
16989 <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>
16990 </p>
16991 !! html/parsoid
16992 <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>
16993 !!end
16994
16995 !! test
16996 T3186 news: in the middle of text
16997 !! wikitext
16998 http://en.wikinews.org/wiki/Wikinews:Workplace
16999 !! html
17000 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17001 </p>
17002 !!end
17003
17004
17005 !! test
17006 Namespaced link must have a title
17007 !! wikitext
17008 [[Project:]]
17009 !! html
17010 <p>[[Project:]]
17011 </p>
17012 !!end
17013
17014 !! test
17015 Namespaced link must have a title (bad fragment version)
17016 !! wikitext
17017 [[Project:#fragment]]
17018 !! html
17019 <p>[[Project:#fragment]]
17020 </p>
17021 !!end
17022
17023
17024 ###
17025 ### HTML tags and HTML attributes
17026 ###
17027
17028 !! test
17029 div with no attributes
17030 !! wikitext
17031 <div>HTML rocks</div>
17032 !! html
17033 <div>HTML rocks</div>
17034
17035 !! end
17036
17037 !! test
17038 div with double-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 single-quoted 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 unquoted attribute
17057 !! wikitext
17058 <div id=rock>HTML rocks</div>
17059 !! html
17060 <div id="rock">HTML rocks</div>
17061
17062 !! end
17063
17064 !! test
17065 div with illegal double attributes
17066 !! wikitext
17067 <div id="a" id="b">HTML rocks</div>
17068 !! html
17069 <div id="b">HTML rocks</div>
17070
17071 !!end
17072
17073 !! test
17074 div with empty attribute value, space before equals
17075 !! options
17076 parsoid=wt2html,html2html
17077 !! wikitext
17078 <div class =>HTML rocks</div>
17079 !! html/php
17080 <div class="">HTML rocks</div>
17081
17082 !! html/parsoid
17083 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17084 !! end
17085
17086 !! test
17087 div with multiple empty attribute values
17088 !! config
17089 wgFragmentMode=[ 'html5', 'legacy' ]
17090 !! options
17091 parsoid=wt2html,html2html
17092 !! wikitext
17093 <div id= title=>HTML rocks</div>
17094 !! html/php
17095 <div id="title=">HTML rocks</div>
17096
17097 !! html/parsoid
17098 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17099 !! end
17100
17101 # FIXME Parsoid doesn't actually match PHP here.
17102 # Probably we should use the synthetic <foo /> or <indicator>
17103 # extensions for this test, which are enabled when running parser tests.
17104 !! test
17105 Extension tag in attribute value
17106 !! wikitext
17107 <span title="<translate>123</translate>">ok</span>
17108 !! html/php+disabled
17109 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17110 </p>
17111 !! html/parsoid
17112 <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>
17113 !! end
17114
17115 !! test
17116 table with multiple empty attribute values
17117 !! options
17118 parsoid=wt2html,html2html
17119 !! wikitext
17120 {| title= id=
17121 |hi
17122 |}
17123 !! html/php
17124 <table title="id=">
17125 <tr>
17126 <td>hi
17127 </td></tr></table>
17128
17129 !! html/parsoid
17130 <table title="id=">
17131 <tbody><tr><td>hi</td></tr>
17132 </tbody></table>
17133 !! end
17134
17135 !! test
17136 div with braces in attribute value
17137 !! wikitext
17138 <div title="{}">Foo</div>
17139 !! html/php
17140 <div title="&#123;&#125;">Foo</div>
17141
17142 !! html/parsoid
17143 <div title="{}">Foo</div>
17144 !! end
17145
17146 !! test
17147 div with empty attribute value, no space before equals
17148 !! options
17149 parsoid=wt2html,html2html
17150 !! wikitext
17151 <div class=>HTML rocks</div>
17152 !! html/php
17153 <div class="">HTML rocks</div>
17154
17155 !! html/parsoid
17156 <div class="">HTML rocks</div>
17157 !! end
17158
17159 !! test
17160 HTML multiple attributes correction
17161 !! wikitext
17162 <p class="error" class="awesome">Awesome!</p>
17163 !! html
17164 <p class="awesome">Awesome!</p>
17165
17166 !!end
17167
17168 !! test
17169 Table multiple attributes correction
17170 !! wikitext
17171 {|
17172 !+ class="error" class="awesome"|status
17173 |}
17174 !! html
17175 <table>
17176 <tr>
17177 <th class="awesome">status
17178 </th></tr></table>
17179
17180 !!end
17181
17182 !! test
17183 DIV IN UPPERCASE
17184 !! wikitext
17185 <DIV ID="x">HTML ROCKS</DIV>
17186 !! html
17187 <div id="x">HTML ROCKS</div>
17188
17189 !!end
17190
17191 !! test
17192 Non-ASCII pseudo-tags are rendered as text
17193 !! wikitext
17194 <khyô>
17195 !! html
17196 <p>&lt;khyô&gt;
17197 </p>
17198 !! end
17199
17200 !! test
17201 Pseudo-tag with URL 'name' renders as url link
17202 !! wikitext
17203 <http://example.com/>
17204 !! html
17205 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17206 </p>
17207 !! end
17208
17209 !! test
17210 text with amp in the middle of nowhere
17211 !! wikitext
17212 Remember AT&T?
17213 !! html
17214 <p>Remember AT&amp;T?
17215 </p>
17216 !! end
17217
17218 !! test
17219 text with character entity: eacute
17220 !! wikitext
17221 I always thought &eacute; was a cute letter.
17222 !! html+tidy
17223 <p>I always thought &#233; was a cute letter.
17224 </p>
17225 !! end
17226
17227 !! test
17228 text with entity-escaped character entity-like string: eacute
17229 !! wikitext
17230 I always thought &amp;eacute; was a cute letter.
17231 !! html
17232 <p>I always thought &amp;eacute; was a cute letter.
17233 </p>
17234 !! end
17235
17236 !! test
17237 text with undefined character entity: xacute
17238 !! wikitext
17239 I always thought &xacute; was a cute letter.
17240 !! html
17241 <p>I always thought &amp;xacute; was a cute letter.
17242 </p>
17243 !! end
17244
17245 !! test
17246 HTML5 tags
17247 !! wikitext
17248 <data value="5">five</data>
17249 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17250 <mark>This highlighted text</mark>
17251 !! html
17252 <p><data value="5">five</data>
17253 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17254 <mark>This highlighted text</mark>
17255 </p>
17256 !! end
17257
17258 !! test
17259 HTML tag with leading space is parsed as text
17260 !! wikitext
17261 < div>foo< /div>
17262 !! html
17263 <p>&lt; div&gt;foo&lt; /div&gt;
17264 </p>
17265 !! end
17266
17267 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17268 ## the HTML5 parsing spec.
17269 !! test
17270 Element with broken attribute syntax
17271 !! options
17272 parsoid=wt2html
17273 !! wikitext
17274 <div style=" style="123">hi</div>
17275 <div =>ho</div>
17276 !! html/php
17277 <div style="123">hi</div>
17278 <div>ho</div>
17279
17280 !! html/parsoid
17281 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17282 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17283 !! end
17284
17285 ###
17286 ### Nesting tests (see T43545, T52604, T53081)
17287 ###
17288
17289 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17290 # Note that html2wt is considerably more difficult if we use <b> in
17291 # the test case, instead of <small>
17292 !! test
17293 Ensure that HTML adoption agency algorithm is properly implemented.
17294 !! wikitext
17295 <small>X<small>Y</small>Z</small>
17296 !! html
17297 <p><small>X<small>Y</small>Z</small>
17298 </p>
17299 !! end
17300
17301 # This was T43545 in the PHP parser.
17302 !! test
17303 Nesting of <kbd>
17304 !! wikitext
17305 <kbd>X<kbd>Y</kbd>Z</kbd>
17306 !! html+tidy
17307 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17308 </p>
17309 !! end
17310
17311 # The following cases were T53081 in the PHP parser.
17312 # Note that there are some other nestable tags (b, i, etc) which are
17313 # not covered; see T53081 for discussion.
17314
17315 !! test
17316 Nesting of <em>
17317 !! wikitext
17318 <em>X<em>Y</em>Z</em>
17319 !! html+tidy
17320 <p><em>X<em>Y</em>Z</em>
17321 </p>
17322 !! end
17323
17324 !! test
17325 Nesting of <strong>
17326 !! wikitext
17327 <strong>X<strong>Y</strong>Z</strong>
17328 !! html+tidy
17329 <p><strong>X<strong>Y</strong>Z</strong>
17330 </p>
17331 !! end
17332
17333 !! test
17334 Nesting of <q>
17335 !! wikitext
17336 <q>X<q>Y</q>Z</q>
17337 !! html+tidy
17338 <p><q>X<q>Y</q>Z</q>
17339 </p>
17340 !! end
17341
17342 !! test
17343 Nesting of <ruby>
17344 !! wikitext
17345 <ruby>X<ruby>Y</ruby>Z</ruby>
17346 !! html
17347 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17348 </p>
17349 !! end
17350
17351 !! test
17352 Nesting of <bdo>
17353 !! wikitext
17354 <bdo>X<bdo>Y</bdo>Z</bdo>
17355 !! html
17356 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17357 </p>
17358 !! end
17359
17360
17361 ###
17362 ### Media links
17363 ###
17364
17365 !! test
17366 Media link
17367 !! wikitext
17368 [[Media:Foobar.jpg]]
17369 [[Media:Video.ogv]]
17370 [[:Media:Video.ogv]]
17371 !! html/php
17372 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17373 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17374 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17375 </p>
17376 !! html/parsoid
17377 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17378 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17379 <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>
17380 !! end
17381
17382 !! test
17383 Media link with text
17384 !! wikitext
17385 [[Media:Foobar.jpg|A neat file to look at]]
17386 !! html/php
17387 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17388 </p>
17389 !! html/parsoid
17390 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17391 !! end
17392
17393 # FIXME: this is still bad HTML tag nesting
17394 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17395 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17396 !! test
17397 Media link with nasty text
17398 !! wikitext
17399 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17400 !! html/php
17401 <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>
17402
17403 !! html/php+tidy
17404 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
17405 !! html/parsoid
17406 <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>
17407
17408 !! end
17409
17410 !! test
17411 Media link to nonexistent file (T3702)
17412 !! wikitext
17413 [[Media:No such.jpg]]
17414 [[Media:No_such file.jpg]]
17415 !! html/php
17416 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17417 <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>
17418 </p>
17419 !! html/parsoid
17420 <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>
17421 <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>
17422 !! end
17423
17424 !! test
17425 Image link to nonexistent file (T3850 - good)
17426 !! wikitext
17427 [[File:No_such.jpg]]
17428 !! html/php
17429 <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>
17430 </p>
17431 !! html/parsoid
17432 <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>
17433 !! end
17434
17435 !! test
17436 :Image link to nonexistent file (T3850 - bad)
17437 !! wikitext
17438 [[:Image:No such.jpg]]
17439 !! html/php
17440 <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>
17441 </p>
17442 !! html/parsoid
17443 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17444 !! end
17445
17446 !! test
17447 Character reference normalization in link text (T3938)
17448 !! wikitext
17449 [[Main Page|this&that]]
17450 !! html
17451 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17452 </p>
17453 !!end
17454
17455 !! article
17456 אַ
17457 !! text
17458 Test for unicode normalization
17459
17460 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17461 !! endarticle
17462
17463 !! test
17464 (T21451) Links should refer to the normalized form.
17465 !! wikitext
17466 [[&#xFB2E;]]
17467 [[&#x5d0;&#x5b7;]]
17468 [[&#x5d0;ַ]]
17469 [[א&#x5b7;]]
17470 [[אַ]]
17471 !! html
17472 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17473 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17474 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17475 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17476 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17477 </p>
17478 !! end
17479
17480 !! test
17481 Empty attribute crash test (T4067)
17482 !! wikitext
17483 <font color="">foo</font>
17484 !! html
17485 <p><font color="">foo</font>
17486 </p>
17487 !! end
17488
17489 !! test
17490 Empty attribute crash test single-quotes (T4067)
17491 !! wikitext
17492 <font color=''>foo</font>
17493 !! html
17494 <p><font color="">foo</font>
17495 </p>
17496 !! end
17497
17498 !! test
17499 Attribute test: equals, then nothing
17500 !! options
17501 parsoid=wt2html,html2html
17502 !! wikitext
17503 <font color=>foo</font>
17504 !! html/php
17505 <p><font color="">foo</font>
17506 </p>
17507 !! html/parsoid
17508 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17509 !! end
17510
17511 !! test
17512 Attribute test: unquoted value
17513 !! options
17514 parsoid=wt2html,html2html
17515 !! wikitext
17516 <font color=x>foo</font>
17517 !! html/php
17518 <p><font color="x">foo</font>
17519 </p>
17520 !! html/parsoid
17521 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17522 !! end
17523
17524 !! test
17525 Attribute test: unquoted but illegal value (hash)
17526 !! wikitext
17527 <font color=#x>foo</font>
17528 !! html
17529 <p><font color="#x">foo</font>
17530 </p>
17531 !! end
17532
17533 # Parsoid does not serialize to empty attribute syntax,
17534 # so wt2wt and html2wt cases are skipped
17535 !! test
17536 Attribute test: no value (T54330)
17537 !! options
17538 parsoid=wt2html,html2html
17539 !! wikitext
17540 <font color>foo</font>
17541 !! html/php
17542 <p><font color="">foo</font>
17543 </p>
17544 !! html/parsoid
17545 <p><font color="">foo</font></p>
17546 !! end
17547
17548 !! test
17549 T4095: link with three closing brackets
17550 !! wikitext
17551 [[Main Page]]]
17552 !! html/php
17553 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17554 </p>
17555 !! html/parsoid
17556 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17557 !! end
17558
17559 !! test
17560 T4095: link with pipe and three closing brackets
17561 !! wikitext
17562 [[Main Page|link]]]
17563 !! html/php
17564 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17565 </p>
17566 !! html/parsoid
17567 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17568 !! end
17569
17570 !! test
17571 T4095: link with pipe and three closing brackets, version 2
17572 !! wikitext
17573 [[Main Page|[http://example.com/]]]
17574 !! html/php
17575 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17576 </p>
17577 !! html/parsoid
17578 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17579 !! end
17580
17581
17582 ###
17583 ### Safety
17584 ###
17585
17586 !! article
17587 Template:Dangerous attribute
17588 !! text
17589 " onmouseover="alert(document.cookie)
17590 !! endarticle
17591
17592 !! article
17593 Template:Dangerous style attribute
17594 !! text
17595 border-size: expression(alert(document.cookie))
17596 !! endarticle
17597
17598 !! article
17599 Template:Div style
17600 !! text
17601 <div style="float: right; {{{1}}}">Magic div</div>
17602 !! endarticle
17603
17604 !! test
17605 T4304: HTML attribute safety (safe template; regression T4309)
17606 !! wikitext
17607 <div title="{{test}}"></div>
17608 !! html/php
17609 <div title="This is a test template"></div>
17610
17611 !! html/parsoid
17612 <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>
17613 !! end
17614
17615 # Parsoid has enough context to handle this case
17616 !! test
17617 T4304: HTML attribute safety (dangerous template; 2309)
17618 !! wikitext
17619 <div title="{{dangerous attribute}}"></div>
17620 !! html/php
17621 <div title=""></div>
17622
17623 !! html/parsoid
17624 <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>
17625 !! end
17626
17627 !! test
17628 T4304: HTML attribute safety (dangerous style template; 2309)
17629 !! wikitext
17630 <div style="{{dangerous style attribute}}"></div>
17631 !! html/php
17632 <div style="/* insecure input */"></div>
17633
17634 !! html/parsoid
17635 <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>
17636 !! end
17637
17638 !! test
17639 T4304: HTML attribute safety (safe parameter; 2309)
17640 !! wikitext
17641 {{div style|width: 200px}}
17642 !! html/php
17643 <div style="float: right; width: 200px">Magic div</div>
17644
17645 !! html/parsoid
17646 <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>
17647 !! end
17648
17649 !! test
17650 T4304: HTML attribute safety (unsafe parameter; 2309)
17651 !! wikitext
17652 {{div style|width: expression(alert(document.cookie))}}
17653 !! html/php
17654 <div style="/* insecure input */">Magic div</div>
17655
17656 !! html/parsoid
17657 <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>
17658 !! end
17659
17660 ## Parsoid output here differs; needs investigation.
17661 !! test
17662 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17663 !! wikitext
17664 {{div style|"><script>alert(document.cookie)</script>}}
17665 !! html
17666 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17667
17668 !! end
17669
17670 ## Parsoid output here differs; needs investigation.
17671 !! test
17672 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17673 !! wikitext
17674 {{div style|" ><script>alert(document.cookie)</script>}}
17675 !! html
17676 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17677
17678 !! end
17679
17680 !! test
17681 T4304: HTML attribute safety (link)
17682 !! wikitext
17683 <div title="[[Main Page]]"></div>
17684 !! html/php
17685 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17686
17687 !! html/parsoid
17688 <div title="[[Main Page]]"></div>
17689 !! end
17690
17691 !! test
17692 T4304: HTML attribute safety (italics)
17693 !! wikitext
17694 <div title="''foobar''"></div>
17695 !! html
17696 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17697
17698 !! end
17699
17700 !! test
17701 T4304: HTML attribute safety (bold)
17702 !! wikitext
17703 <div title="'''foobar'''"></div>
17704 !! html
17705 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17706
17707 !! end
17708
17709 !! test
17710 T4304: HTML attribute safety (ISBN)
17711 !! wikitext
17712 <div title="ISBN 1234567890"></div>
17713 !! html
17714 <div title="&#73;SBN 1234567890"></div>
17715
17716 !! end
17717
17718 !! test
17719 T4304: HTML attribute safety (RFC)
17720 !! wikitext
17721 <div title="RFC 1234"></div>
17722 !! html
17723 <div title="&#82;FC 1234"></div>
17724
17725 !! end
17726
17727 !! test
17728 T4304: HTML attribute safety (PMID)
17729 !! wikitext
17730 <div title="PMID 1234567890"></div>
17731 !! html
17732 <div title="&#80;MID 1234567890"></div>
17733
17734 !! end
17735
17736 !! test
17737 T4304: HTML attribute safety (web link)
17738 !! wikitext
17739 <div title="http://example.com/"></div>
17740 !! html
17741 <div title="http&#58;//example.com/"></div>
17742
17743 !! end
17744
17745 !! test
17746 T4304: HTML attribute safety (named web link)
17747 !! wikitext
17748 <div title="[http://example.com/ link]"></div>
17749 !! html/php
17750 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17751
17752 !! html/parsoid
17753 <div title="[http://example.com/ link]"></div>
17754 !! end
17755
17756 !! test
17757 T5244: HTML attribute safety (extension; safe)
17758 !! wikitext
17759 <div style="<nowiki>background:blue</nowiki>"></div>
17760 !! html/php
17761 <div style="background:blue"></div>
17762
17763 !! html/parsoid
17764 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17765 !! end
17766
17767 !! test
17768 T5244: HTML attribute safety (extension; unsafe)
17769 !! wikitext
17770 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17771 !! html/php
17772 <div style="/* insecure input */"></div>
17773
17774 !! html/parsoid
17775 <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>
17776 !! end
17777
17778 # More MSIE fun discovered by Tom Gilder
17779
17780 !! test
17781 MSIE CSS safety test: spurious slash
17782 !! wikitext
17783 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17784 !! html/php
17785 <div style="/* insecure input */">evil</div>
17786
17787 !! html/parsoid
17788 <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>
17789 !! end
17790
17791 !! test
17792 MSIE CSS safety test: hex code
17793 !! wikitext
17794 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17795 !! html/php
17796 <div style="/* insecure input */">evil</div>
17797
17798 !! html/parsoid
17799 <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>
17800 !! end
17801
17802 !! test
17803 MSIE CSS safety test: comment in url
17804 !! wikitext
17805 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17806 !! html/php
17807 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17808
17809 !! html/parsoid
17810 <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>
17811 !! end
17812
17813 !! test
17814 MSIE CSS safety test: comment in expression
17815 !! wikitext
17816 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17817 !! html/php
17818 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17819
17820 !! html/parsoid
17821 <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>
17822 !! end
17823
17824 !! test
17825 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17826 !! wikitext
17827 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17828 !! html/php
17829 <p style="/* invalid control char */">A</p>
17830
17831 !! html/parsoid
17832 <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>
17833 !! end
17834
17835 !! test
17836 MSIE 6 CSS safety test: Fullwidth (T57332)
17837 !! wikitext
17838 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17839 <div style="top:EXPRESSION(alert())">B</div>
17840 !! html/php
17841 <p style="/* insecure input */">A</p>
17842 <div style="/* insecure input */">B</div>
17843
17844 !! html/parsoid
17845 <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>
17846 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17847 !! end
17848
17849 !! test
17850 MSIE 6 CSS safety test: IPA extensions (T57332)
17851 !! wikitext
17852 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17853 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17854 !! html/php
17855 <div style="/* insecure input */">A</div>
17856 <p style="/* insecure input */">B</p>
17857
17858 !! html/parsoid
17859 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17860 <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>
17861 !! end
17862
17863 !! test
17864 MSIE 6 CSS safety test: sup/sub script (T57332)
17865 !! wikitext
17866 <div style="background-image:url⁽javascript:alert())">A</div>
17867 <div style="background-image:url₍javascript:alert())">B</div>
17868 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17869 !! html/php
17870 <div style="/* insecure input */">A</div>
17871 <div style="/* insecure input */">B</div>
17872 <p style="/* insecure input */">C</p>
17873
17874 !! html/parsoid
17875 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17876 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17877 <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>
17878 !! end
17879
17880 !! test
17881 Opera -o-link CSS
17882 !! options
17883 parsoid=wt2html,html2html
17884 !! wikitext
17885 <div
17886 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;"
17887 style="-o-link:attr(title);-o-link-source:current">X</div>
17888 !! html/php
17889 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17890
17891 !! html/parsoid
17892 <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>
17893 !! end
17894
17895 !! test
17896 MSIE 6 CSS safety test: Repetition markers (T57332)
17897 !! wikitext
17898 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17899 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17900 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17901 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17902 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17903 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17904 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17905 !! html/php
17906 <p style="/* insecure input */">A</p>
17907 <p style="/* insecure input */">B</p>
17908 <p style="/* insecure input */">C</p>
17909 <p style="/* insecure input */">D</p>
17910 <p style="/* insecure input */">E</p>
17911 <p style="/* insecure input */">F</p>
17912 <p style="/* insecure input */">G</p>
17913
17914 !! html/parsoid
17915 <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>
17916 <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>
17917 <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>
17918 <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>
17919 <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>
17920 <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>
17921 <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>
17922 !! end
17923
17924 !! test
17925 Table attribute legitimate extension
17926 !! wikitext
17927 {|
17928 !+ style="<nowiki>color:blue</nowiki>"|status
17929 |}
17930 !! html
17931 <table>
17932 <tr>
17933 <th style="color:blue">status
17934 </th></tr></table>
17935
17936 !!end
17937
17938 !! test
17939 Table attribute safety
17940 !! wikitext
17941 {|
17942 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
17943 |}
17944 !! html
17945 <table>
17946 <tr>
17947 <th style="/* insecure input */">status
17948 </th></tr></table>
17949
17950 !! end
17951
17952 !! test
17953 CSS line continuation 1
17954 !! wikitext
17955 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17956 !! html
17957 <div style="/* insecure input */"></div>
17958
17959 !! end
17960
17961 !! test
17962 CSS line continuation 2
17963 !! wikitext
17964 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17965 !! html
17966 <div style="/* invalid control char */"></div>
17967
17968 !! end
17969
17970 !! article
17971 Template:Identity
17972 !! text
17973 {{{1}}}
17974 !! endarticle
17975
17976 !! test
17977 Expansion of multi-line templates in attribute values (T8255)
17978 !! wikitext
17979 <div style="background: {{identity|#00FF00}}">-</div>
17980 !! html
17981 <div style="background: #00FF00">-</div>
17982
17983 !! end
17984
17985 !! test
17986 Expansion of multi-line templates in attribute values (T8255 sanity check)
17987 !! wikitext
17988 <div style="background:
17989 #00FF00">-</div>
17990 !! html/php
17991 <div style="background: #00FF00">-</div>
17992
17993 !! html/parsoid
17994 <div style="background:
17995 #00FF00">-</div>
17996 !! end
17997
17998 !! test
17999 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18000 !! wikitext
18001 <div style="background: &#10;#00FF00">-</div>
18002 !! html
18003 <div style="background: &#10;#00FF00">-</div>
18004
18005 !! end
18006
18007 !! test
18008 Tags which are hidden from tidiers cannot pass through the Sanitizer
18009 !! wikitext
18010 <mw:toc><script>alert();</script></mw:toc>
18011 !! html+tidy
18012 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18013 </p>
18014 !! end
18015
18016 ###
18017 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18018 ###
18019
18020 !! test
18021 Parser hook: empty input
18022 !! wikitext
18023 <tag></tag>
18024 !! html/php
18025 <pre>
18026 ''
18027 array (
18028 )
18029 </pre>
18030
18031 !! html/parsoid
18032 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18033 !! end
18034
18035 ## Don't expect parsoid to rt this form.
18036 !! test
18037 Parser hook: empty input using terminated empty elements
18038 !! options
18039 parsoid=wt2html,html2html
18040 !! wikitext
18041 <tag/>
18042 !! html/php
18043 <pre>
18044 NULL
18045 array (
18046 )
18047 </pre>
18048
18049 !! html/parsoid
18050 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18051 !! end
18052
18053 !! test
18054 Parser hook: empty input using terminated empty elements (space before)
18055 !! wikitext
18056 <tag />
18057 !! html/php
18058 <pre>
18059 NULL
18060 array (
18061 )
18062 </pre>
18063
18064 !! html/parsoid
18065 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18066 !! end
18067
18068 !! test
18069 Parser hook: basic input
18070 !! wikitext
18071 <tag>input</tag>
18072 !! html/php
18073 <pre>
18074 'input'
18075 array (
18076 )
18077 </pre>
18078
18079 !! html/parsoid
18080 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18081 !! end
18082
18083 ## Don't expect parsoid to rt this form.
18084 !! test
18085 Parser hook: case insensitive
18086 !! options
18087 parsoid=wt2html,html2html
18088 !! wikitext
18089 <TAG>input</TAG>
18090 !! html/php
18091 <pre>
18092 'input'
18093 array (
18094 )
18095 </pre>
18096
18097 !! html/parsoid
18098 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18099 !! end
18100
18101 ## Don't expect parsoid to rt this form.
18102 !! test
18103 Parser hook: case insensitive, redux
18104 !! options
18105 parsoid=wt2html,html2html
18106 !! wikitext
18107 <TaG>input</TAg>
18108 !! html/php
18109 <pre>
18110 'input'
18111 array (
18112 )
18113 </pre>
18114
18115 !! html/parsoid
18116 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18117 !! end
18118
18119 !! test
18120 Parser hook: nested tags
18121 !! wikitext
18122 <tag><tag></tag></tag>
18123 !! html/php
18124 <pre>
18125 '<tag>'
18126 array (
18127 )
18128 </pre>&lt;/tag&gt;
18129
18130 !! html/parsoid
18131 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18132 !! end
18133
18134 !! test
18135 Parser hook: basic arguments
18136 !! wikitext
18137 <tag width="200" height="100" depth="50" square=""></tag>
18138 !! html/php
18139 <pre>
18140 ''
18141 array (
18142 'width' => '200',
18143 'height' => '100',
18144 'depth' => '50',
18145 'square' => '',
18146 )
18147 </pre>
18148
18149 !! html/parsoid
18150 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18151 !! end
18152
18153 ## Don't expect parsoid to rt this form.
18154 !! test
18155 Parser hook: basic arguments, variations
18156 !! options
18157 parsoid=wt2html,html2html
18158 !! wikitext
18159 <tag width=200 height = "100" depth = '50' square></tag>
18160 !! html/php
18161 <pre>
18162 ''
18163 array (
18164 'width' => '200',
18165 'height' => '100',
18166 'depth' => '50',
18167 'square' => '',
18168 )
18169 </pre>
18170
18171 !! html/parsoid
18172 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18173 !! end
18174
18175 !! test
18176 Parser hook: argument containing a forward slash (T7344)
18177 !! wikitext
18178 <tag filename="/tmp/bla"></tag>
18179 !! html/php
18180 <pre>
18181 ''
18182 array (
18183 'filename' => '/tmp/bla',
18184 )
18185 </pre>
18186
18187 !! html/parsoid
18188 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18189 !! end
18190
18191 ## Don't expect parsoid to rt this form.
18192 !! test
18193 Parser hook: empty input using terminated empty elements (T4374)
18194 !! options
18195 parsoid=wt2html,html2html
18196 !! wikitext
18197 <tag foo=bar/>text
18198 !! html/php
18199 <pre>
18200 NULL
18201 array (
18202 'foo' => 'bar',
18203 )
18204 </pre>text
18205
18206 !! html/parsoid
18207 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18208 !! end
18209
18210 ## </tag> should be output literally since there is no matching tag that begins it
18211 ## Don't expect parsoid to rt this form.
18212 !! test
18213 Parser hook: basic arguments using terminated empty elements (T4374)
18214 !! options
18215 parsoid=wt2html
18216 !! wikitext
18217 <tag width=200 height = "100" depth = '50' square/>
18218 other stuff
18219 </tag>
18220 !! html/php
18221 <pre>
18222 NULL
18223 array (
18224 'width' => '200',
18225 'height' => '100',
18226 'depth' => '50',
18227 'square' => '',
18228 )
18229 </pre>
18230 <p>other stuff
18231 &lt;/tag&gt;
18232 </p>
18233 !! html/parsoid
18234 <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
18235 &lt;/tag></p>
18236 !! end
18237
18238 ## Don't expect parsoid to rt this form.
18239 !! test
18240 Parser hook: Don't allow unclosed extension tags
18241 !! options
18242 parsoid=wt2html
18243 !! wikitext
18244 test <tag>123
18245
18246 this is a '''test'''
18247 !! html/php
18248 <p>test &lt;tag&gt;123
18249 </p><p>this is a <b>test</b>
18250 </p>
18251 !! html/parsoid
18252 <p>test &lt;tag>123</p>
18253
18254 <p>this is a <b>test</b></p>
18255 !! end
18256
18257 ###
18258 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18259 ###
18260
18261 !! test
18262 Parser hook: static parser hook not inside a comment
18263 !! wikitext
18264 <statictag>hello, world</statictag>
18265
18266 <statictag action="flush" />
18267 !! html/php
18268 <p><br />
18269 hello, world
18270 </p>
18271 !! html/parsoid
18272 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18273 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18274 !! end
18275
18276 !! test
18277 Parser hook: static parser hook inside a comment
18278 !! wikitext
18279 <!-- <statictag>hello, world</statictag> -->
18280 <statictag action="flush" />
18281 !! html/php
18282 <p><br />
18283 </p>
18284 !! html/parsoid
18285 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18286 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18287 !! end
18288
18289 # Nested template calls; this case was broken by Parser.php rev 1.506,
18290 # since reverted.
18291
18292 !! article
18293 Template:One-parameter
18294 !! text
18295 (My parameter is: {{{1}}})
18296 !! endarticle
18297
18298 !! article
18299 Template:Map-one-parameter
18300 !! text
18301 {{{{{1}}}|{{{2}}}}}
18302 !! endarticle
18303
18304 !! test
18305 Nested template calls
18306 !! wikitext
18307 {{Map-one-parameter|One-parameter|param}}
18308 !! html
18309 <p>(My parameter is: param)
18310 </p>
18311 !! end
18312
18313
18314 ###
18315 ### Sanitizer
18316 ###
18317
18318 # Remex wraps empty tag runs with p-tags.
18319 # Parsoid strips them out during p-wrapping.
18320 !! test
18321 Sanitizer: Closing of open tags
18322 !! wikitext
18323 <s></s><table></table>
18324 !! html/php+tidy
18325 <p><s></s></p><table></table>
18326 !! html/parsoid
18327 <s></s><table></table>
18328 !! end
18329
18330 !! test
18331 Sanitizer: Closing of open but not closed tags
18332 !! wikitext
18333 <s>foo
18334 !! html
18335 <p><s>foo</s>
18336 </p>
18337 !! end
18338
18339 !! test
18340 Sanitizer: Closing of closed but not open tags
18341 !! options
18342 parsoid=wt2html
18343 !! wikitext
18344 </s>
18345 !! html/php+tidy
18346 <p class="mw-empty-elt">
18347 </p>
18348 !! html/parsoid
18349 !! end
18350
18351 !! test
18352 Sanitizer: Closing of closed but not open table tags
18353 !! options
18354 parsoid=wt2html
18355 !! wikitext
18356 Table not started</td></tr></table>
18357 !! html+tidy
18358 <p>Table not started
18359 </p>
18360 !! end
18361
18362 !! test
18363 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18364 !! config
18365 wgFragmentMode=[ 'html5', 'legacy' ]
18366 !! wikitext
18367 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18368 !! html/php
18369 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18370 </p>
18371 !! html/parsoid
18372 <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>
18373 !! end
18374
18375 !! test
18376 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18377 !! config
18378 wgFragmentMode=[ 'legacy' ]
18379 !! wikitext
18380 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18381 !! html/php
18382 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18383 </p>
18384 !! end
18385
18386 # In HTML5, the restrictions are that id must contain at least one character,
18387 # and must not contain any space characters.
18388 !! test
18389 Sanitizer: Validating the contents of the id attribute (T6515)
18390 !! options
18391 disabled
18392 !! wikitext
18393 <br id="" /><br id="a space" />
18394 !! html
18395 Something ...
18396 !! end
18397
18398 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18399 !! test
18400 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18401 !! options
18402 disabled
18403 !! wikitext
18404 <br id="foo" /><br id="foo" />
18405 !! html
18406 Something need to be done. foo-2 ?
18407 !! end
18408
18409 !! test
18410 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18411 !! wikitext
18412 <div itemscope>
18413 <meta itemprop="hello" content="world">
18414 <meta http-equiv="refresh" content="5">
18415 <meta itemprop="hello" http-equiv="refresh" content="5">
18416 <link itemprop="hello" href="{{SERVER}}">
18417 <link rel="stylesheet" href="{{SERVER}}">
18418 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18419 </div>
18420 !! html
18421 <div itemscope="">
18422 <p> <meta itemprop="hello" content="world" />
18423 &lt;meta http-equiv="refresh" content="5"&gt;
18424 <meta itemprop="hello" content="5" />
18425 <link itemprop="hello" href="http&#58;//example.org" />
18426 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18427 <link itemprop="hello" href="http&#58;//example.org" />
18428 </p>
18429 </div>
18430
18431 !! end
18432
18433 !! test
18434 Sanitizer: Strip comments from CSS attributes
18435 !! options
18436 parsoid=wt2html,wt2wt
18437 !! wikitext
18438 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18439 !! html/php
18440 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18441 </p>
18442 !! html/parsoid
18443 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18444 !! end
18445
18446 !! test
18447 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18448 !! wikitext
18449 [[meatball:Soft"Security]]
18450 !! html/php
18451 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18452 </p>
18453 !! html/parsoid
18454 <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>
18455 !! end
18456
18457 !! test
18458 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18459 !! wikitext
18460 [[meatball:Foo<Bar]]
18461 [[meatball:Foo>Bar]]
18462 [[meatball:Foo&lt;bar]]
18463 [[meatball:Foo&gt;bar]]
18464 !! html/php
18465 <p>[[meatball:Foo&lt;Bar]]
18466 [[meatball:Foo&gt;Bar]]
18467 [[meatball:Foo&lt;bar]]
18468 [[meatball:Foo&gt;bar]]
18469 </p>
18470 !! html/parsoid
18471 <p>[[meatball:Foo&lt;Bar]]
18472 [[meatball:Foo>Bar]]
18473 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18474 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18475 !! end
18476
18477 !! test
18478 Language converter: output gets cut off unexpectedly (T7757)
18479 !! options
18480 language=zh
18481 !! wikitext
18482 this bit is safe: }-
18483
18484 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18485
18486 then we get cut off here: }-
18487
18488 all additional text is vanished
18489 !! html/php
18490 <p>this bit is safe: }-
18491 </p><p>but if we add a conversion instance: xxx
18492 </p><p>then we get cut off here: }-
18493 </p><p>all additional text is vanished
18494 </p>
18495 !! html/parsoid
18496 <p>this bit is safe: }-</p>
18497 <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>
18498 <p>then we get cut off here: }-</p>
18499 <p>all additional text is vanished</p>
18500 !! end
18501
18502 !! test
18503 Language converter glossary rules inside attributes (T119158)
18504 !! options
18505 language=sr variant=sr-el
18506 !! wikitext
18507 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18508
18509 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18510 !! html/php
18511 <p>
18512 </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>
18513 </p>
18514 !! html/parsoid
18515 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18516
18517 <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>
18518 !! end
18519
18520 !! test
18521 Self closed html pairs (T7487)
18522 !! wikitext
18523 <center><font id="bug" />Centered text</center>
18524 <div><font id="bug2" />In div text</div>
18525 !! html+tidy
18526 <center><font id="bug"></font>Centered text</center>
18527 <div><font id="bug2"></font>In div text</div>
18528 !! end
18529
18530 !! test
18531 Punctuation: nbsp before exclamation
18532 !! wikitext
18533 C'est grave !
18534 !! html
18535 <p>C'est grave&#160;!
18536 </p>
18537 !! end
18538
18539 !! test
18540 Punctuation: CSS !important (T13874)
18541 !! wikitext
18542 <div style="width:50% !important">important</div>
18543 !! html
18544 <div style="width:50% !important">important</div>
18545
18546 !!end
18547
18548 !! test
18549 Punctuation: CSS ! important (T13874; with space after)
18550 !! wikitext
18551 <div style="width:50% ! important">important</div>
18552 !! html
18553 <div style="width:50% ! important">important</div>
18554
18555 !!end
18556
18557 !! test
18558 HTML bullet list, closed tags (T7497)
18559 !! wikitext
18560 <ul>
18561 <li>One</li>
18562 <li>Two</li>
18563 </ul>
18564 !! html/php
18565 <ul>
18566 <li>One</li>
18567 <li>Two</li>
18568 </ul>
18569
18570 !! html/parsoid
18571 <ul data-parsoid='{"stx":"html"}'>
18572 <li data-parsoid='{"stx":"html"}'>One</li>
18573 <li data-parsoid='{"stx":"html"}'>Two</li>
18574 </ul>
18575
18576 !! end
18577
18578 !! test
18579 HTML bullet list, unclosed tags (T7497)
18580 !! wikitext
18581 <ul>
18582 <li>One
18583 <li>Two
18584 </ul>
18585 !! html/php+tidy
18586 <ul>
18587 <li>One
18588 </li><li>Two
18589 </li></ul>
18590 !! html/parsoid
18591 <ul data-parsoid='{"stx":"html"}'>
18592 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18593 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18594 </ul>
18595
18596 !! end
18597
18598 !! test
18599 HTML ordered list, closed tags (T7497)
18600 !! wikitext
18601 <ol>
18602 <li>One</li>
18603 <li>Two</li>
18604 </ol>
18605 !! html/php
18606 <ol>
18607 <li>One</li>
18608 <li>Two</li>
18609 </ol>
18610
18611 !! html/parsoid
18612 <ol data-parsoid='{"stx":"html"}'>
18613 <li data-parsoid='{"stx":"html"}'>One</li>
18614 <li data-parsoid='{"stx":"html"}'>Two</li>
18615 </ol>
18616
18617 !! end
18618
18619 !! test
18620 HTML ordered list, unclosed tags (T7497)
18621 !! options
18622 !! wikitext
18623 <ol>
18624 <li>One
18625 <li>Two
18626 </ol>
18627 !! html/php+tidy
18628 <ol>
18629 <li>One
18630 </li><li>Two
18631 </li></ol>
18632 !! html/parsoid
18633 <ol data-parsoid='{"stx":"html"}'>
18634 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18635 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18636 </ol>
18637
18638 !! end
18639
18640 !! test
18641 HTML nested bullet list, closed tags (T7497)
18642 !! wikitext
18643 <ul>
18644 <li>One</li>
18645 <li>Two:
18646 <ul>
18647 <li>Sub-one</li>
18648 <li>Sub-two</li>
18649 </ul>
18650 </li>
18651 </ul>
18652 !! html/php
18653 <ul>
18654 <li>One</li>
18655 <li>Two:
18656 <ul>
18657 <li>Sub-one</li>
18658 <li>Sub-two</li>
18659 </ul>
18660 </li>
18661 </ul>
18662
18663 !! html/parsoid
18664 <ul data-parsoid='{"stx":"html"}'>
18665 <li data-parsoid='{"stx":"html"}'>One</li>
18666 <li data-parsoid='{"stx":"html"}'>Two:
18667 <ul data-parsoid='{"stx":"html"}'>
18668 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18669 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18670 </ul>
18671 </li>
18672 </ul>
18673 !! end
18674
18675 !! test
18676 HTML nested bullet list, open tags (T7497)
18677 !! wikitext
18678 <ul>
18679 <li>One
18680 <li>Two:
18681 <ul>
18682 <li>Sub-one
18683 <li>Sub-two
18684 </ul>
18685 </ul>
18686 !! html+tidy
18687 <ul>
18688 <li>One
18689 </li><li>Two:
18690 <ul>
18691 <li>Sub-one
18692 </li><li>Sub-two
18693 </li></ul>
18694 </li></ul>
18695 !! end
18696
18697 !! test
18698 HTML nested ordered list, closed tags (T7497)
18699 !! wikitext
18700 <ol>
18701 <li>One</li>
18702 <li>Two:
18703 <ol>
18704 <li>Sub-one</li>
18705 <li>Sub-two</li>
18706 </ol>
18707 </li>
18708 </ol>
18709 !! html
18710 <ol>
18711 <li>One</li>
18712 <li>Two:
18713 <ol>
18714 <li>Sub-one</li>
18715 <li>Sub-two</li>
18716 </ol>
18717 </li>
18718 </ol>
18719
18720 !! end
18721
18722 !! test
18723 HTML nested ordered list, open tags (T7497)
18724 !! wikitext
18725 <ol>
18726 <li>One
18727 <li>Two:
18728 <ol>
18729 <li>Sub-one
18730 <li>Sub-two
18731 </ol>
18732 </ol>
18733 !! html/php
18734 <ol>
18735 <li>One
18736 <li>Two:
18737 <ol>
18738 <li>Sub-one
18739 <li>Sub-two
18740 </ol>
18741 </ol>
18742
18743 !! html/parsoid
18744 <ol>
18745 <li>One
18746 </li>
18747 <li>Two:
18748 <ol>
18749 <li>Sub-one
18750 </li>
18751 <li>Sub-two
18752 </li>
18753 </ol>
18754 </li>
18755 </ol>
18756
18757 !! end
18758
18759 !! test
18760 HTML ordered list item with parameters oddity
18761 !! wikitext
18762 <ol><li id="fragment">One</li>
18763 </ol>
18764 !! html
18765 <ol><li id="fragment">One</li>
18766 </ol>
18767
18768 !! end
18769
18770 # parsoid doesn't explicitly mark autonumbered links, see T55505
18771 !!test
18772 T7918: autonumbering
18773 !! wikitext
18774 [http://first/] [http://second] [ftp://ftp]
18775
18776 ftp://inlineftp
18777
18778 [mailto:enclosed@mail.tld With target]
18779
18780 [mailto:enclosed@mail.tld]
18781
18782 mailto:inline@mail.tld
18783 !! html/php
18784 <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>
18785 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18786 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18787 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18788 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18789 </p>
18790 !! html/parsoid
18791 <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>
18792 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18793 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18794 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18795 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18796 !! end
18797
18798
18799 #
18800 # Security and HTML correctness
18801 # From Nick Jenkins' fuzz testing
18802 #
18803
18804 !! test
18805 Fuzz testing: Parser13
18806 !! wikitext
18807 {|
18808 | http://a|
18809 !! html
18810 <table>
18811 <tr>
18812 <td>
18813 </td>
18814 </tr>
18815 </table>
18816
18817 !! end
18818
18819 # Note that Parsoid output differs from the PHP parser here: the PHP
18820 # parser breaks the URL for the magic word, while in Parsoid the URL
18821 # production takes precedence.
18822 !! test
18823 Fuzz testing: Parser14
18824 !! wikitext
18825 ==onmouseover===
18826 http://__TOC__
18827 !! html/php
18828 <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>
18829 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18830 <ul>
18831 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18832 </ul>
18833 </div>
18834
18835
18836 !! html/php+tidy
18837 <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>
18838 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18839 <ul>
18840 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18841 </ul>
18842 </div>
18843 !! html/parsoid
18844 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18845 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18846 !! end
18847
18848 !! test
18849 Fuzz testing: Parser14-table
18850 !! options
18851 parsoid=wt2html,html2html
18852 !! wikitext
18853 ==a==
18854 {| STYLE=__TOC__
18855 !! html
18856 <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>
18857 <table style="&#95;_TOC&#95;_">
18858 <tr><td></td></tr>
18859 </table>
18860
18861 !! html+tidy
18862 <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>
18863 <table style="__TOC__">
18864 <tr>
18865 <td></td>
18866 </tr>
18867 </table>
18868 !! html/parsoid
18869 <h2 id="a">a</h2>
18870 <table style="__TOC__"></table>
18871 !! end
18872
18873 # Known to produce bogus xml (extra </td>)
18874 # Don't add the html/php section since it generates broken HTML
18875 !! test
18876 Fuzz testing: Parser16
18877 !! wikitext
18878 {|
18879 !https://||||||
18880 !! html+tidy
18881 <table>
18882 <tbody><tr>
18883 <th>https://</th>
18884 <th></th>
18885 <th></th>
18886 <th>
18887
18888 </th></tr>
18889 </tbody></table>
18890 !! end
18891
18892 !! test
18893 Fuzz testing: Parser21
18894 !! wikitext
18895 {|
18896 !irc://{{ftp://a" onmouseover="alert('hello world');"
18897 |
18898 !! html
18899 <table>
18900 <tr>
18901 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18902 </th>
18903 <td>
18904 </td>
18905 </tr>
18906 </table>
18907
18908 !! end
18909
18910 !! test
18911 Fuzz testing: Parser22
18912 !! wikitext
18913 http://===r:::https://b
18914
18915 {|
18916 !! html
18917 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18918 </p>
18919 <table>
18920 <tr><td></td></tr>
18921 </table>
18922
18923 !! end
18924
18925 # Known to produce bad XML for now
18926 !! test
18927 Fuzz testing: Parser24
18928 !! options
18929 parsoid=wt2html
18930 !! wikitext
18931 {|
18932 {{{|
18933 <u CLASS=
18934 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18935 <br style="onmouseover='alert(document.cookie);' " />
18936
18937 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18938 |
18939 !! html/php
18940 <table>
18941 {{{|
18942 <u class="&#124;">}}}} &gt;
18943 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18944
18945 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18946 <tr>
18947 <td></u>
18948 </td>
18949 </tr>
18950 </table>
18951
18952 !! html/parsoid
18953 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18954 <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>"}'/>}}}} >
18955 <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}'>
18956
18957
18958
18959 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18960 !! end
18961
18962 # Note: the current result listed for this is not what the original one was,
18963 # but the original bug was JavaScript injection, which is fixed in any case.
18964 # It's not clear that the original result listed was any more correct than the
18965 # current one. Original result:
18966 # <p>{{{|
18967 # </p>
18968 # <li class="&#124;&#124;">
18969 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18970 !!test
18971 Fuzz testing: Parser25 (T8055)
18972 !! wikitext
18973 {{{
18974 |
18975 <LI CLASS=||
18976 >
18977 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18978 !! html/php
18979 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18980 </p>
18981 !! html/parsoid
18982 <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"]}'>
18983 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18984 !! end
18985
18986 !!test
18987 Fuzz testing: URL adjacent extension (with space, clean)
18988 !! wikitext
18989 http://example.com <nowiki>junk</nowiki>
18990 !! html/php
18991 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18992 </p>
18993 !! html/parsoid
18994 <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>
18995 !! end
18996
18997 !!test
18998 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18999 !! wikitext
19000 http://example.com<nowiki>junk</nowiki>
19001 !! html/php
19002 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19003 </p>
19004 !! html/parsoid
19005 <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>
19006 !! end
19007
19008 !! test
19009 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19010 !! wikitext
19011 http://example.com<pre>junk</pre>
19012 !! html/php
19013 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19014
19015 !! html/php+tidy
19016 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19017 !! html/parsoid
19018 <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>
19019 !! end
19020
19021 !! test
19022 Fuzz testing: image with bogus manual thumbnail
19023 !! wikitext
19024 [[Image:foobar.jpg|thumbnail= ]]
19025 !! html/php
19026 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19027
19028 !! html/parsoid
19029 <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>
19030 !! end
19031
19032 # Parsoid will emit the newline literally in wt2wt; see next test case.
19033 !! test
19034 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19035 !! options
19036 parsoid=wt2html
19037 !! wikitext
19038 <pre dir="&#10;"></pre>
19039 !! html/php
19040 <pre dir="&#10;"></pre>
19041
19042 !! html/parsoid
19043 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19044 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19045 !! end
19046
19047 !! test
19048 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19049 !! options
19050 parsoid=html2wt
19051 !! html/parsoid
19052 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19053 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19054 !! wikitext
19055 <pre dir="
19056 "></pre>
19057 !! html/php
19058 <pre dir=""></pre>
19059
19060 !! end
19061
19062 !! test
19063 Templates in extension attributes are not expanded
19064 !! wikitext
19065 <pre dir="{{echo|ltr}}"></pre>
19066 !! html/php
19067 <pre dir="{{echo|ltr}}"></pre>
19068
19069 !! html/parsoid
19070 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19071 !! end
19072
19073 !! test
19074 Parsing optional HTML elements (T8171)
19075 !! options
19076 !! wikitext
19077 <table>
19078 <tr>
19079 <td> Some tabular data</td>
19080 <td> More tabular data ...
19081 <td> And yet som tabular data</td>
19082 </tr>
19083 </table>
19084 !! html
19085 <table>
19086 <tr>
19087 <td> Some tabular data</td>
19088 <td> More tabular data ...
19089 </td><td> And yet som tabular data</td>
19090 </tr>
19091 </table>
19092
19093 !! end
19094
19095 !! test
19096 Correct handling of <td>, <tr> (T8171)
19097 !! options
19098 !! wikitext
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 !! html
19107 <table>
19108 <tr>
19109 <td> Some tabular data</td>
19110 <td> More tabular data ...</td>
19111 <td> And yet som tabular data</td>
19112 </tr>
19113 </table>
19114
19115 !! end
19116
19117
19118 !! test
19119 Parsing crashing regression (fr:JavaScript)
19120 !! wikitext
19121 </body></x>
19122 !! html
19123 <p>&lt;/body&gt;&lt;/x&gt;
19124 </p>
19125 !! end
19126
19127 !! test
19128 Inline wiki vs wiki block nesting
19129 !! wikitext
19130 '''Bold paragraph
19131
19132 New wiki paragraph
19133 !! html
19134 <p><b>Bold paragraph</b>
19135 </p><p>New wiki paragraph
19136 </p>
19137 !! end
19138
19139 # FIXME: The current php output is documented
19140 # and desired output is the parsoid target.
19141 !! test
19142 Inline HTML vs wiki block nesting
19143 !! wikitext
19144 <b>Bold paragraph
19145
19146 New wiki paragraph
19147 !! html/php
19148 <p><b>Bold paragraph
19149 </p><p>New wiki paragraph</b>
19150 </p>
19151 !! html/parsoid
19152 <p><b>Bold paragraph</b>
19153 </p><p>New wiki paragraph
19154 </p>
19155 !! end
19156
19157 # Original result was this:
19158 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19159 # </p>
19160 # While that might be marginally more intuitive, maybe, the six-apostrophe
19161 # construct is clearly pathological and the result stated here (which is what
19162 # the parser actually does) is about as reasonable as anything.
19163 !!test
19164 Mixing markup for italics and bold
19165 !! options
19166 !! wikitext
19167 '''bold''''''bold''bolditalics'''''
19168 !! html
19169 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19170 </p>
19171 !! end
19172
19173
19174 !! article
19175 Xyzzyx
19176 !! text
19177 Article for special page transclusion test
19178 !! endarticle
19179
19180 !! test
19181 Special page transclusion
19182 !! options
19183 !! wikitext
19184 {{Special:Prefixindex/Xyzzyx}}
19185 !! html
19186 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19187 </ul>
19188
19189 !! end
19190
19191 !! test
19192 Special page transclusion twice (T7021)
19193 !! options
19194 !! wikitext
19195 {{Special:Prefixindex/Xyzzyx}}
19196 {{Special:Prefixindex/Xyzzyx}}
19197 !! html
19198 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19199 </ul>
19200 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19201 </ul>
19202
19203 !! end
19204
19205 !! test
19206 Transclusion of default MediaWiki message
19207 !! wikitext
19208 {{MediaWiki:Mainpage}}
19209 !! html
19210 <p>Main Page
19211 </p>
19212 !! end
19213
19214 !! test
19215 Transclusion of nonexistent MediaWiki message
19216 !! wikitext
19217 {{MediaWiki:Mainpagexxx}}
19218 !! html
19219 <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>
19220 </p>
19221 !! end
19222
19223 !! test
19224 Transclusion of MediaWiki message with underscore
19225 !! wikitext
19226 {{MediaWiki:history_short}}
19227 !! html
19228 <p>History
19229 </p>
19230 !! end
19231
19232 !! test
19233 Transclusion of MediaWiki message with space
19234 !! wikitext
19235 {{MediaWiki:history short}}
19236 !! html
19237 <p>History
19238 </p>
19239 !! end
19240
19241 !! test
19242 Invalid header with following text
19243 !! wikitext
19244 = x = y
19245 !! html
19246 <p>= x = y
19247 </p>
19248 !! end
19249
19250
19251 !! test
19252 Section extraction test (section 0)
19253 !! options
19254 section=0
19255 !! wikitext
19256 start
19257 ==a==
19258 ===aa===
19259 ====aaa====
19260 ==b==
19261 ===ba===
19262 ===bb===
19263 ====bba====
19264 ===bc===
19265 ==c==
19266 ===ca===
19267 !! html/php
19268 start
19269 !! end
19270
19271 !! test
19272 Section extraction test (section 1)
19273 !! options
19274 section=1
19275 !! wikitext
19276 start
19277 ==a==
19278 ===aa===
19279 ====aaa====
19280 ==b==
19281 ===ba===
19282 ===bb===
19283 ====bba====
19284 ===bc===
19285 ==c==
19286 ===ca===
19287 !! html/php
19288 ==a==
19289 ===aa===
19290 ====aaa====
19291 !! end
19292
19293 !! test
19294 Section extraction test (section 2)
19295 !! options
19296 section=2
19297 !! wikitext
19298 start
19299 ==a==
19300 ===aa===
19301 ====aaa====
19302 ==b==
19303 ===ba===
19304 ===bb===
19305 ====bba====
19306 ===bc===
19307 ==c==
19308 ===ca===
19309 !! html/php
19310 ===aa===
19311 ====aaa====
19312 !! end
19313
19314 !! test
19315 Section extraction test (section 3)
19316 !! options
19317 section=3
19318 !! wikitext
19319 start
19320 ==a==
19321 ===aa===
19322 ====aaa====
19323 ==b==
19324 ===ba===
19325 ===bb===
19326 ====bba====
19327 ===bc===
19328 ==c==
19329 ===ca===
19330 !! html/php
19331 ====aaa====
19332 !! end
19333
19334 !! test
19335 Section extraction test (section 4)
19336 !! options
19337 section=4
19338 !! wikitext
19339 start
19340 ==a==
19341 ===aa===
19342 ====aaa====
19343 ==b==
19344 ===ba===
19345 ===bb===
19346 ====bba====
19347 ===bc===
19348 ==c==
19349 ===ca===
19350 !! html/php
19351 ==b==
19352 ===ba===
19353 ===bb===
19354 ====bba====
19355 ===bc===
19356 !! end
19357
19358 !! test
19359 Section extraction test (section 5)
19360 !! options
19361 section=5
19362 !! wikitext
19363 start
19364 ==a==
19365 ===aa===
19366 ====aaa====
19367 ==b==
19368 ===ba===
19369 ===bb===
19370 ====bba====
19371 ===bc===
19372 ==c==
19373 ===ca===
19374 !! html/php
19375 ===ba===
19376 !! end
19377
19378 !! test
19379 Section extraction test (section 6)
19380 !! options
19381 section=6
19382 !! wikitext
19383 start
19384 ==a==
19385 ===aa===
19386 ====aaa====
19387 ==b==
19388 ===ba===
19389 ===bb===
19390 ====bba====
19391 ===bc===
19392 ==c==
19393 ===ca===
19394 !! html/php
19395 ===bb===
19396 ====bba====
19397 !! end
19398
19399 !! test
19400 Section extraction test (section 7)
19401 !! options
19402 section=7
19403 !! wikitext
19404 start
19405 ==a==
19406 ===aa===
19407 ====aaa====
19408 ==b==
19409 ===ba===
19410 ===bb===
19411 ====bba====
19412 ===bc===
19413 ==c==
19414 ===ca===
19415 !! html/php
19416 ====bba====
19417 !! end
19418
19419 !! test
19420 Section extraction test (section 8)
19421 !! options
19422 section=8
19423 !! wikitext
19424 start
19425 ==a==
19426 ===aa===
19427 ====aaa====
19428 ==b==
19429 ===ba===
19430 ===bb===
19431 ====bba====
19432 ===bc===
19433 ==c==
19434 ===ca===
19435 !! html/php
19436 ===bc===
19437 !! end
19438
19439 !! test
19440 Section extraction test (section 9)
19441 !! options
19442 section=9
19443 !! wikitext
19444 start
19445 ==a==
19446 ===aa===
19447 ====aaa====
19448 ==b==
19449 ===ba===
19450 ===bb===
19451 ====bba====
19452 ===bc===
19453 ==c==
19454 ===ca===
19455 !! html/php
19456 ==c==
19457 ===ca===
19458 !! end
19459
19460 !! test
19461 Section extraction test (section 10)
19462 !! options
19463 section=10
19464 !! wikitext
19465 start
19466 ==a==
19467 ===aa===
19468 ====aaa====
19469 ==b==
19470 ===ba===
19471 ===bb===
19472 ====bba====
19473 ===bc===
19474 ==c==
19475 ===ca===
19476 !! html/php
19477 ===ca===
19478 !! end
19479
19480 !! test
19481 Section extraction test (nonexistent section 11)
19482 !! options
19483 section=11
19484 !! wikitext
19485 start
19486 ==a==
19487 ===aa===
19488 ====aaa====
19489 ==b==
19490 ===ba===
19491 ===bb===
19492 ====bba====
19493 ===bc===
19494 ==c==
19495 ===ca===
19496 !! html/php
19497 !! end
19498
19499 !! test
19500 Section extraction test with bogus heading (section 1)
19501 !! options
19502 section=1
19503 !! wikitext
19504 ==a==
19505 ==bogus== not a legal section
19506 ==b==
19507 !! html/php
19508 ==a==
19509 ==bogus== not a legal section
19510 !! end
19511
19512 !! test
19513 Section extraction test with bogus heading (section 2)
19514 !! options
19515 section=2
19516 !! wikitext
19517 ==a==
19518 ==bogus== not a legal section
19519 ==b==
19520 !! html/php
19521 ==b==
19522 !! end
19523
19524 !! test
19525 Section extraction test with comment after heading (section 1)
19526 !! options
19527 section=1
19528 !! wikitext
19529 ==a==
19530 ==b== <!-- -->
19531 ==c==
19532 !! html/php
19533 ==a==
19534 !! end
19535
19536 !! test
19537 Section extraction test with comment after heading (section 2)
19538 !! options
19539 section=2
19540 !! wikitext
19541 ==a==
19542 ==b== <!-- -->
19543 ==c==
19544 !! html/php
19545 ==b== <!-- -->
19546 !! end
19547
19548 !! test
19549 Section extraction test with bogus <nowiki> heading (section 1)
19550 !! options
19551 section=1
19552 !! wikitext
19553 ==a==
19554 ==bogus== <nowiki>not a legal section</nowiki>
19555 ==b==
19556 !! html/php
19557 ==a==
19558 ==bogus== <nowiki>not a legal section</nowiki>
19559 !! end
19560
19561 !! test
19562 Section extraction test with bogus <nowiki> heading (section 2)
19563 !! options
19564 section=2
19565 !! wikitext
19566 ==a==
19567 ==bogus== <nowiki>not a legal section</nowiki>
19568 ==b==
19569 !! html/php
19570 ==b==
19571 !! end
19572
19573 # Formerly testing for T4587, now resolved by the use of unmarked sections
19574 # instead of respecting commented sections
19575 !! test
19576 Section extraction prefixed by comment (section 1)
19577 !! options
19578 section=1
19579 !! wikitext
19580 <!-- -->==sec1==
19581 ==sec2==
19582 !! html/php
19583 ==sec2==
19584 !!end
19585
19586 !! test
19587 Section extraction prefixed by comment (section 2)
19588 !! options
19589 section=2
19590 !! wikitext
19591 <!-- -->==sec1==
19592 ==sec2==
19593 !! html/php
19594
19595 !!end
19596
19597 # Formerly testing for T4607, now resolved by the use of unmarked sections
19598 # instead of respecting HTML-style headings
19599 !! test
19600 Section extraction, mixed wiki and html (section 1)
19601 !! options
19602 section=1
19603 !! wikitext
19604 <h2>unmarked</h2>
19605 unmarked
19606 ==1==
19607 one
19608 ==2==
19609 two
19610 !! html/php
19611 ==1==
19612 one
19613 !! end
19614
19615 !! test
19616 Section extraction, mixed wiki and html (section 2)
19617 !! options
19618 section=2
19619 !! wikitext
19620 <h2>unmarked</h2>
19621 unmarked
19622 ==1==
19623 one
19624 ==2==
19625 two
19626 !! html/php
19627 ==2==
19628 two
19629 !! end
19630
19631
19632 # Formerly testing for T5342
19633 !! test
19634 Section extraction, heading surrounded by <noinclude>
19635 !! options
19636 section=1
19637 !! wikitext
19638 <noinclude>==unmarked==</noinclude>
19639 ==marked==
19640 !! html/php
19641 ==marked==
19642 !!end
19643
19644 # Test behavior of T21910
19645 !! test
19646 Sectiion with all-equals
19647 !! options
19648 section=2
19649 !! wikitext
19650 ===
19651 The line above must have a trailing space
19652 === <!--
19653 --> <!-- -->
19654 But just in case it doesn't...
19655 !! html/php
19656 === <!--
19657 --> <!-- -->
19658 But just in case it doesn't...
19659 !! end
19660
19661 !! test
19662 Section replacement test (section 0)
19663 !! options
19664 replace=0,"xxx"
19665 !! wikitext
19666 start
19667 ==a==
19668 ===aa===
19669 ====aaa====
19670 ==b==
19671 ===ba===
19672 ===bb===
19673 ====bba====
19674 ===bc===
19675 ==c==
19676 ===ca===
19677 !! html/php
19678 xxx
19679
19680 ==a==
19681 ===aa===
19682 ====aaa====
19683 ==b==
19684 ===ba===
19685 ===bb===
19686 ====bba====
19687 ===bc===
19688 ==c==
19689 ===ca===
19690 !! end
19691
19692 !! test
19693 Section replacement test (section 1)
19694 !! options
19695 replace=1,"xxx"
19696 !! wikitext
19697 start
19698 ==a==
19699 ===aa===
19700 ====aaa====
19701 ==b==
19702 ===ba===
19703 ===bb===
19704 ====bba====
19705 ===bc===
19706 ==c==
19707 ===ca===
19708 !! html/php
19709 start
19710 xxx
19711
19712 ==b==
19713 ===ba===
19714 ===bb===
19715 ====bba====
19716 ===bc===
19717 ==c==
19718 ===ca===
19719 !! end
19720
19721 !! test
19722 Section replacement test (section 2)
19723 !! options
19724 replace=2,"xxx"
19725 !! wikitext
19726 start
19727 ==a==
19728 ===aa===
19729 ====aaa====
19730 ==b==
19731 ===ba===
19732 ===bb===
19733 ====bba====
19734 ===bc===
19735 ==c==
19736 ===ca===
19737 !! html/php
19738 start
19739 ==a==
19740 xxx
19741
19742 ==b==
19743 ===ba===
19744 ===bb===
19745 ====bba====
19746 ===bc===
19747 ==c==
19748 ===ca===
19749 !! end
19750
19751 !! test
19752 Section replacement test (section 3)
19753 !! options
19754 replace=3,"xxx"
19755 !! wikitext
19756 start
19757 ==a==
19758 ===aa===
19759 ====aaa====
19760 ==b==
19761 ===ba===
19762 ===bb===
19763 ====bba====
19764 ===bc===
19765 ==c==
19766 ===ca===
19767 !! html/php
19768 start
19769 ==a==
19770 ===aa===
19771 xxx
19772
19773 ==b==
19774 ===ba===
19775 ===bb===
19776 ====bba====
19777 ===bc===
19778 ==c==
19779 ===ca===
19780 !! end
19781
19782 !! test
19783 Section replacement test (section 4)
19784 !! options
19785 replace=4,"xxx"
19786 !! wikitext
19787 start
19788 ==a==
19789 ===aa===
19790 ====aaa====
19791 ==b==
19792 ===ba===
19793 ===bb===
19794 ====bba====
19795 ===bc===
19796 ==c==
19797 ===ca===
19798 !! html/php
19799 start
19800 ==a==
19801 ===aa===
19802 ====aaa====
19803 xxx
19804
19805 ==c==
19806 ===ca===
19807 !! end
19808
19809 !! test
19810 Section replacement test (section 5)
19811 !! options
19812 replace=5,"xxx"
19813 !! wikitext
19814 start
19815 ==a==
19816 ===aa===
19817 ====aaa====
19818 ==b==
19819 ===ba===
19820 ===bb===
19821 ====bba====
19822 ===bc===
19823 ==c==
19824 ===ca===
19825 !! html/php
19826 start
19827 ==a==
19828 ===aa===
19829 ====aaa====
19830 ==b==
19831 xxx
19832
19833 ===bb===
19834 ====bba====
19835 ===bc===
19836 ==c==
19837 ===ca===
19838 !! end
19839
19840 !! test
19841 Section replacement test (section 6)
19842 !! options
19843 replace=6,"xxx"
19844 !! wikitext
19845 start
19846 ==a==
19847 ===aa===
19848 ====aaa====
19849 ==b==
19850 ===ba===
19851 ===bb===
19852 ====bba====
19853 ===bc===
19854 ==c==
19855 ===ca===
19856 !! html/php
19857 start
19858 ==a==
19859 ===aa===
19860 ====aaa====
19861 ==b==
19862 ===ba===
19863 xxx
19864
19865 ===bc===
19866 ==c==
19867 ===ca===
19868 !! end
19869
19870 !! test
19871 Section replacement test (section 7)
19872 !! options
19873 replace=7,"xxx"
19874 !! wikitext
19875 start
19876 ==a==
19877 ===aa===
19878 ====aaa====
19879 ==b==
19880 ===ba===
19881 ===bb===
19882 ====bba====
19883 ===bc===
19884 ==c==
19885 ===ca===
19886 !! html/php
19887 start
19888 ==a==
19889 ===aa===
19890 ====aaa====
19891 ==b==
19892 ===ba===
19893 ===bb===
19894 xxx
19895
19896 ===bc===
19897 ==c==
19898 ===ca===
19899 !! end
19900
19901 !! test
19902 Section replacement test (section 8)
19903 !! options
19904 replace=8,"xxx"
19905 !! wikitext
19906 start
19907 ==a==
19908 ===aa===
19909 ====aaa====
19910 ==b==
19911 ===ba===
19912 ===bb===
19913 ====bba====
19914 ===bc===
19915 ==c==
19916 ===ca===
19917 !! html/php
19918 start
19919 ==a==
19920 ===aa===
19921 ====aaa====
19922 ==b==
19923 ===ba===
19924 ===bb===
19925 ====bba====
19926 xxx
19927
19928 ==c==
19929 ===ca===
19930 !!end
19931
19932 !! test
19933 Section replacement test (section 9)
19934 !! options
19935 replace=9,"xxx"
19936 !! wikitext
19937 start
19938 ==a==
19939 ===aa===
19940 ====aaa====
19941 ==b==
19942 ===ba===
19943 ===bb===
19944 ====bba====
19945 ===bc===
19946 ==c==
19947 ===ca===
19948 !! html/php
19949 start
19950 ==a==
19951 ===aa===
19952 ====aaa====
19953 ==b==
19954 ===ba===
19955 ===bb===
19956 ====bba====
19957 ===bc===
19958 xxx
19959 !! end
19960
19961 !! test
19962 Section replacement test (section 10)
19963 !! options
19964 replace=10,"xxx"
19965 !! wikitext
19966 start
19967 ==a==
19968 ===aa===
19969 ====aaa====
19970 ==b==
19971 ===ba===
19972 ===bb===
19973 ====bba====
19974 ===bc===
19975 ==c==
19976 ===ca===
19977 !! html/php
19978 start
19979 ==a==
19980 ===aa===
19981 ====aaa====
19982 ==b==
19983 ===ba===
19984 ===bb===
19985 ====bba====
19986 ===bc===
19987 ==c==
19988 xxx
19989 !! end
19990
19991 !! test
19992 Section replacement test with initial whitespace (T15728)
19993 !! options
19994 replace=2,"xxx"
19995 !! wikitext
19996 Preformatted initial line
19997 ==a==
19998 ===a===
19999 !! html/php
20000 Preformatted initial line
20001 ==a==
20002 xxx
20003 !! end
20004
20005
20006 !! test
20007 Section extraction, heading followed by pre with 20 spaces (T8398)
20008 !! options
20009 section=1
20010 !! wikitext
20011 ==a==
20012 a
20013 !! html/php
20014 ==a==
20015 a
20016 !! end
20017
20018 !! test
20019 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20020 !! options
20021 section=1
20022 !! wikitext
20023 ==a==
20024 a
20025 !! html/php
20026 ==a==
20027 a
20028 !! end
20029
20030
20031 !! test
20032 Section extraction, <pre> around bogus header (T12309)
20033 !! options
20034 section=2
20035 !! wikitext
20036 == Section One ==
20037 <pre>
20038 =======
20039 </pre>
20040
20041 == Section Two ==
20042 stuff
20043 !! html/php
20044 == Section Two ==
20045 stuff
20046 !! end
20047
20048 !! test
20049 Section replacement, <pre> around bogus header (T12309)
20050 !! options
20051 replace=2,"xxx"
20052 !! wikitext
20053 == Section One ==
20054 <pre>
20055 =======
20056 </pre>
20057
20058 == Section Two ==
20059 stuff
20060 !! html/php
20061 == Section One ==
20062 <pre>
20063 =======
20064 </pre>
20065
20066 xxx
20067 !! end
20068
20069 !! test
20070 Handling of &#x0A; in URLs
20071 !! wikitext
20072 *irc://&#x0A;a
20073 !! html/php
20074 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20075
20076 !! html/parsoid
20077 <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>
20078 !! end
20079
20080 !! test
20081 Handling of %0A in URLs
20082 !! wikitext
20083 *irc://%0Aa
20084 !! html/php
20085 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20086
20087 !! html/parsoid
20088 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20089 !! end
20090
20091 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20092 !! test
20093 5 quotes, code coverage +1 line
20094 !! options
20095 parsoid=wt2html
20096 !! wikitext
20097 '''''
20098 !! html/php
20099 !! html/parsoid
20100 <b><i></i></b>
20101 !! end
20102
20103 # same html as previous, but wikitext adjusted to match parsoid html2wt
20104 # note that wt2html and html2html will put the <i> before the <b>
20105 !! test
20106 5 quotes, code coverage +1 line w/ nowiki (1)
20107 !! options
20108 parsoid=wt2wt,html2wt
20109 !! wikitext
20110 '''''<nowiki/>'''''
20111 !! html/php
20112 <p><i></i>
20113 </p>
20114 !! html/parsoid
20115 <p><b><i></i></b></p>
20116 !! end
20117
20118 # same as previous, just swapping the <i> and <b>
20119 !! test
20120 5 quotes, code coverage +1 line w/ nowiki (2)
20121 !! wikitext
20122 '''''<nowiki/>'''''
20123 !! html/php
20124 <p><i></i>
20125 </p>
20126 !! html/parsoid
20127 <p><i><b></b></i></p>
20128 !! end
20129
20130 !! test
20131 Special:Search page linking.
20132 !! wikitext
20133 {{Special:search}}
20134 !! html
20135 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20136 </p>
20137 !! end
20138
20139 !! test
20140 {{!}} is a magic word
20141 !! wikitext
20142 {{!}} is a magic word there and {{!}} is still a magic word here
20143 | is not a magic word here but {{!}} is still a magic word here
20144 !! html/php
20145 <p>| is a magic word there and | is still a magic word here
20146 | is not a magic word here but | is still a magic word here
20147 </p>
20148 !! html/parsoid
20149 <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
20150 | 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>
20151 !! end
20152
20153 !! test
20154 Say the magic word
20155 !! options
20156 title=[[Parser test]]
20157 !! wikitext
20158 *{{PAGENAME}}
20159 *{{PAGENAMEE}}
20160 *{{FULLPAGENAME}}
20161 *{{FULLPAGENAMEE}}
20162 *{{BASEPAGENAME}}
20163 *{{BASEPAGENAMEE}}
20164 *{{SUBPAGENAME}}
20165 *{{SUBPAGENAMEE}}
20166 *{{ROOTPAGENAME}}
20167 *{{ROOTPAGENAMEE}}
20168 *{{TALKPAGENAME}}
20169 *{{TALKPAGENAMEE}}
20170 *{{SUBJECTPAGENAME}}
20171 *{{SUBJECTPAGENAMEE}}
20172 *{{NAMESPACEE}}
20173 *{{NAMESPACE}}
20174 *{{NAMESPACENUMBER}}
20175 *{{TALKSPACE}}
20176 *{{TALKSPACEE}}
20177 *{{SUBJECTSPACE}}
20178 *{{SUBJECTSPACEE}}
20179 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20180 !! html
20181 <ul><li>Parser test</li>
20182 <li>Parser_test</li>
20183 <li>Parser test</li>
20184 <li>Parser_test</li>
20185 <li>Parser test</li>
20186 <li>Parser_test</li>
20187 <li>Parser test</li>
20188 <li>Parser_test</li>
20189 <li>Parser test</li>
20190 <li>Parser_test</li>
20191 <li>Talk:Parser test</li>
20192 <li>Talk:Parser_test</li>
20193 <li>Parser test</li>
20194 <li>Parser_test</li>
20195 <li></li>
20196 <li></li>
20197 <li>0</li>
20198 <li>Talk</li>
20199 <li>Talk</li>
20200 <li></li>
20201 <li></li>
20202 <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>
20203
20204 !! end
20205 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20206
20207 !! test
20208 Gallery with valid attributes
20209 !! wikitext
20210 <gallery type="123" summary="345">
20211 File:File:Foobar.jpg
20212 </gallery>
20213 !! html/php
20214 <ul class="gallery mw-gallery-traditional" type="123">
20215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20216 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20217 <div class="gallerytext">
20218 </div>
20219 </div></li>
20220 </ul>
20221
20222 !! html/parsoid
20223 <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"}}'>
20224 <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>
20225 </ul>
20226 !! end
20227
20228 ## Parsoid thinks the "centre" here is a property, not a caption.
20229 !! test
20230 Gallery
20231 !! options
20232 parsoid={
20233 "modes": ["wt2html"],
20234 "nativeGallery": true
20235 }
20236 !! wikitext
20237 <gallery>
20238 image1.png |
20239 image2.gif|||||
20240
20241 image3|
20242 image4 |300px| centre
20243 image5.svg| http://///////
20244 [[x|xx]]]]
20245 * image6
20246 </gallery>
20247 !! html/php
20248 <ul class="gallery mw-gallery-traditional">
20249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20250 <div class="thumb" style="height: 150px;">Image1.png</div>
20251 <div class="gallerytext">
20252 </div>
20253 </div></li>
20254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20255 <div class="thumb" style="height: 150px;">Image2.gif</div>
20256 <div class="gallerytext">
20257 </div>
20258 </div></li>
20259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20260 <div class="thumb" style="height: 150px;">Image3</div>
20261 <div class="gallerytext">
20262 </div>
20263 </div></li>
20264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20265 <div class="thumb" style="height: 150px;">Image4</div>
20266 <div class="gallerytext">
20267 <pre>centre
20268 </pre>
20269 </div>
20270 </div></li>
20271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20272 <div class="thumb" style="height: 150px;">Image5.svg</div>
20273 <div class="gallerytext">
20274 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20275 </p>
20276 </div>
20277 </div></li>
20278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20279 <div class="thumb" style="height: 150px;">* image6</div>
20280 <div class="gallerytext">
20281 </div>
20282 </div></li>
20283 </ul>
20284
20285 !! html/parsoid
20286 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20287 <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>
20288 <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>
20289 <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>
20290 <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>
20291 <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>
20292 <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>
20293 </ul>
20294 !! end
20295
20296 !! test
20297 Gallery (with options, html)
20298 !! options
20299 parsoid={
20300 "modes": ["wt2html", "html2html"],
20301 "nativeGallery": true
20302 }
20303 !! wikitext
20304 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20305 File:Nonexistent.jpg|caption
20306 File:Nonexistent.jpg
20307 image:foobar.jpg|some '''caption''' [[Main Page]]
20308 image:foobar.jpg
20309 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20310 </gallery>
20311 !! html/php
20312 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20313 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20314 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20315 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20316 <div class="gallerytext">
20317 <p>caption
20318 </p>
20319 </div>
20320 </div></li>
20321 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20322 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20323 <div class="gallerytext">
20324 </div>
20325 </div></li>
20326 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20327 <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>
20328 <div class="gallerytext">
20329 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20330 </p>
20331 </div>
20332 </div></li>
20333 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20334 <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>
20335 <div class="gallerytext">
20336 </div>
20337 </div></li>
20338 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20339 <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>
20340 <div class="gallerytext">
20341 <p>blabla.
20342 </p>
20343 </div>
20344 </div></li>
20345 </ul>
20346
20347 !! html/parsoid
20348 <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":{}}'>
20349 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20350 <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>
20351 <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>
20352 <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>
20353 <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>
20354 <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>
20355 </ul>
20356 !! end
20357
20358 !! test
20359 Gallery (with options, extsrc)
20360 !! options
20361 parsoid={
20362 "nativeGallery": false
20363 }
20364 !! wikitext
20365 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20366 File:Nonexistent.jpg|caption
20367 File:Nonexistent.jpg
20368 image:foobar.jpg|some '''caption''' [[Main Page]]
20369 image:foobar.jpg
20370 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20371 </gallery>
20372 !! html/php
20373 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20374 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20375 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20376 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20377 <div class="gallerytext">
20378 <p>caption
20379 </p>
20380 </div>
20381 </div></li>
20382 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20383 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20384 <div class="gallerytext">
20385 </div>
20386 </div></li>
20387 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20388 <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>
20389 <div class="gallerytext">
20390 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20391 </p>
20392 </div>
20393 </div></li>
20394 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20395 <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>
20396 <div class="gallerytext">
20397 </div>
20398 </div></li>
20399 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20400 <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>
20401 <div class="gallerytext">
20402 <p>blabla.
20403 </p>
20404 </div>
20405 </div></li>
20406 </ul>
20407
20408 !! html/parsoid
20409 <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"}}'>
20410 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20411 <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>
20412 <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>
20413 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
20414 <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>
20415 <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>
20416 </ul>
20417 !! end
20418
20419 !! test
20420 Gallery (without px units)
20421 !! wikitext
20422 <gallery widths="70" heights="40">
20423 File:Foobar.jpg
20424 </gallery>
20425 !! html/php
20426 <ul class="gallery mw-gallery-traditional">
20427 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20428 <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>
20429 <div class="gallerytext">
20430 </div>
20431 </div></li>
20432 </ul>
20433
20434 !! html/parsoid
20435 <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"}}'>
20436 <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>
20437 </ul>
20438 !! end
20439
20440 !! test
20441 Gallery (with invalid units)
20442 !! wikitext
20443 <gallery widths="70em" heights="40em">
20444 File:Foobar.jpg
20445 </gallery>
20446 !! html/php
20447 <ul class="gallery mw-gallery-traditional">
20448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20449 <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>
20450 <div class="gallerytext">
20451 </div>
20452 </div></li>
20453 </ul>
20454
20455 !! html/parsoid
20456 <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"}}'>
20457 <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>
20458 </ul>
20459 !! end
20460
20461 !! test
20462 Gallery with link that has fragment
20463 !! options
20464 parsoid={
20465 "modes": ["wt2html", "html2html"],
20466 "nativeGallery": true
20467 }
20468 !! wikitext
20469 <gallery>
20470 image:foobar.jpg|link=Main_Page
20471 image:foobar.jpg|link=Main_Page#section
20472 image:foobar.jpg|link=Main Page#section|caption
20473 </gallery>
20474 !! html/php
20475 <ul class="gallery mw-gallery-traditional">
20476 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20477 <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>
20478 <div class="gallerytext">
20479 </div>
20480 </div></li>
20481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20482 <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>
20483 <div class="gallerytext">
20484 </div>
20485 </div></li>
20486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20487 <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>
20488 <div class="gallerytext">
20489 <p>caption
20490 </p>
20491 </div>
20492 </div></li>
20493 </ul>
20494
20495 !! html/parsoid
20496 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20497 <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>
20498 <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>
20499 <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>
20500 </ul>
20501 !! end
20502
20503 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20504 !! test
20505 Gallery with template inside caption
20506 !! options
20507 parsoid={
20508 "nativeGallery": true
20509 }
20510 !! wikitext
20511 <gallery caption="{{echo|hi}}">
20512 File:Foobar.jpg|{{echo|ho}}
20513 </gallery>
20514 !! html/php
20515 <ul class="gallery mw-gallery-traditional">
20516 <li class='gallerycaption'>{{echo|hi}}</li>
20517 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20518 <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>
20519 <div class="gallerytext">
20520 <p>ho
20521 </p>
20522 </div>
20523 </div></li>
20524 </ul>
20525
20526 !! html/parsoid
20527 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20528 <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>
20529 <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>
20530 </ul>
20531 !! end
20532
20533 !! test
20534 Gallery with wikitext inside caption
20535 !! options
20536 parsoid={
20537 "nativeGallery": true
20538 }
20539 !! wikitext
20540 <gallery>
20541 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20542 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20543 </gallery>
20544 !! html/php
20545 <ul class="gallery mw-gallery-traditional">
20546 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20547 <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>
20548 <div class="gallerytext">
20549 <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>
20550 </p>
20551 </div>
20552 </div></li>
20553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20554 <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>
20555 <div class="gallerytext">
20556 <p>This is a test template
20557 </p>
20558 </div>
20559 </div></li>
20560 </ul>
20561
20562 !! html/parsoid
20563 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20564 <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>
20565 <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>
20566 </ul>
20567 !! end
20568
20569 !! test
20570 Gallery (with showfilename option)
20571 !! options
20572 parsoid={
20573 "nativeGallery": true
20574 }
20575 !! wikitext
20576 <gallery showfilename="">
20577 File:Nonexistent.jpg|caption
20578 File:Nonexistent.jpg
20579 File:Foobar.jpg|some '''caption''' [[Main Page]]
20580 File:Foobar.jpg
20581 </gallery>
20582 !! html/php
20583 <ul class="gallery mw-gallery-traditional">
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 caption
20589 </p>
20590 </div>
20591 </div></li>
20592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20593 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20594 <div class="gallerytext">
20595 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</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="" 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 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20604 </p>
20605 </div>
20606 </div></li>
20607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20608 <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>
20609 <div class="gallerytext">
20610 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20611 </p>
20612 </div>
20613 </div></li>
20614 </ul>
20615
20616 !! html/parsoid
20617 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20618 <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>
20619 <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>
20620 <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>
20621 <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>
20622 </ul>
20623 !! end
20624
20625 ## Should Parsoid be preserving these variations? See T151367
20626 !! test
20627 Gallery (with namespace-less filenames)
20628 !! options
20629 parsoid={
20630 "modes": ["wt2html", "html2html"],
20631 "nativeGallery": true
20632 }
20633 !! wikitext
20634 <gallery>
20635 File:Nonexistent.jpg
20636 Nonexistent.jpg
20637 image:foobar.jpg
20638 foobar.jpg
20639 </gallery>
20640 !! html/php
20641 <ul class="gallery mw-gallery-traditional">
20642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20643 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20644 <div class="gallerytext">
20645 </div>
20646 </div></li>
20647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20648 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20649 <div class="gallerytext">
20650 </div>
20651 </div></li>
20652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20653 <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>
20654 <div class="gallerytext">
20655 </div>
20656 </div></li>
20657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20658 <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>
20659 <div class="gallerytext">
20660 </div>
20661 </div></li>
20662 </ul>
20663
20664 !! html/parsoid
20665 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20666 <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>
20667 <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>
20668 <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>
20669 <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>
20670 </ul>
20671 !! end
20672
20673 !! test
20674 Gallery override link with wikilink (T36852)
20675 !! options
20676 parsoid={
20677 "nativeGallery": true
20678 }
20679 !! wikitext
20680 <gallery>
20681 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20682 </gallery>
20683 !! html/php
20684 <ul class="gallery mw-gallery-traditional">
20685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20686 <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>
20687 <div class="gallerytext">
20688 </div>
20689 </div></li>
20690 </ul>
20691
20692 !! html/parsoid
20693 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20694 <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>
20695 </ul>
20696 !! end
20697
20698 !! test
20699 Gallery override link with absolute external link (T36852)
20700 !! options
20701 parsoid={
20702 "nativeGallery": true
20703 }
20704 !! wikitext
20705 <gallery>
20706 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20707 </gallery>
20708 !! html/php
20709 <ul class="gallery mw-gallery-traditional">
20710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20711 <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>
20712 <div class="gallerytext">
20713 </div>
20714 </div></li>
20715 </ul>
20716
20717 !! html/parsoid
20718 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20719 <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>
20720 </ul>
20721 !! end
20722
20723 !! test
20724 Gallery override link with absolute external link with LanguageConverter
20725 !! options
20726 language=zh
20727 !! wikitext
20728 <gallery>
20729 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20730 </gallery>
20731 !! html/php
20732 <ul class="gallery mw-gallery-traditional">
20733 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20734 <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>
20735 <div class="gallerytext">
20736 <p>caption
20737 </p>
20738 </div>
20739 </div></li>
20740 </ul>
20741
20742 !! html/parsoid
20743 <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"}}'>
20744 <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>
20745 </ul>
20746 !! end
20747
20748 !! test
20749 Gallery override link with malicious javascript (T36852)
20750 !! options
20751 parsoid={
20752 "modes": ["wt2html", "html2html"],
20753 "nativeGallery": true
20754 }
20755 !! wikitext
20756 <gallery>
20757 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20758 </gallery>
20759 !! html/php
20760 <ul class="gallery mw-gallery-traditional">
20761 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20762 <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>
20763 <div class="gallerytext">
20764 </div>
20765 </div></li>
20766 </ul>
20767
20768 !! html/parsoid
20769 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20770 <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>
20771 </ul>
20772 !! end
20773
20774 # Note that parsoid uses the invalid link as a caption, PHP does not.
20775 !! test
20776 Gallery with invalid title as link (T45964)
20777 !! options
20778 parsoid={
20779 "modes": ["wt2html", "html2html"],
20780 "nativeGallery": true
20781 }
20782 !! wikitext
20783 <gallery>
20784 File:Foobar.jpg|link=<
20785 </gallery>
20786 !! html/php
20787 <ul class="gallery mw-gallery-traditional">
20788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20789 <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>
20790 <div class="gallerytext">
20791 </div>
20792 </div></li>
20793 </ul>
20794
20795 !! html/parsoid
20796 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20797 <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>
20798 </ul>
20799 !! end
20800
20801 !! test
20802 Serialize gallery without attrs in data-mw
20803 !! options
20804 parsoid={
20805 "modes": ["html2wt"],
20806 "nativeGallery": true
20807 }
20808 !! html/parsoid
20809 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20810 <li class="gallerycaption">123</li>
20811 <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>
20812 </ul>
20813 !! wikitext
20814 <gallery caption="123">
20815 File:Test.png
20816 </gallery>
20817 !! end
20818
20819 !! test
20820 Gallery with class and style attributes
20821 !! options
20822 parsoid={
20823 "nativeGallery": true
20824 }
20825 !! wikitext
20826 <gallery class="center" style="text-align: center;">
20827 File:Foobar.jpg
20828 </gallery>
20829 !! html/php
20830 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20831 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20832 <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>
20833 <div class="gallerytext">
20834 </div>
20835 </div></li>
20836 </ul>
20837
20838 !! html/parsoid
20839 <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":{}}'>
20840 <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>
20841 </ul>
20842 !! end
20843
20844 !! test
20845 Gallery in slideshow mode
20846 !! options
20847 parsoid={
20848 "nativeGallery": true
20849 }
20850 !! wikitext
20851 <gallery mode="slideshow" showthumbnails="">
20852 File:Foobar.jpg
20853 </gallery>
20854 !! html/php
20855 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20856 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20857 <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>
20858 <div class="gallerytext">
20859 </div>
20860 </div></li>
20861 </ul>
20862
20863 !! html/parsoid
20864 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20865 <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>
20866 </ul>
20867 !! end
20868
20869 !! test
20870 HTML Hex character encoding (spells the word "JavaScript")
20871 !! options
20872 parsoid=wt2html,wt2wt,html2html
20873 !! wikitext
20874 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20875 !! html/php
20876 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20877 </p>
20878 !! html/parsoid
20879 <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>
20880 !! end
20881
20882 !! test
20883 HTML Hex character encoding bogus encoding (T28437 regression check)
20884 !! wikitext
20885 &#xsee;&#XSEE;
20886 !! html
20887 <p>&amp;#xsee;&amp;#XSEE;
20888 </p>
20889 !! end
20890
20891 !! test
20892 HTML Hex character encoding mixed case
20893 !! options
20894 parsoid=wt2html,wt2wt,html2html
20895 !! wikitext
20896 &#xEE;&#Xee;
20897 !! html/php
20898 <p>&#xee;&#xee;
20899 </p>
20900 !! html/parsoid
20901 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20902 !! end
20903
20904 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20905 # Note that U+000C (form feed) is not a valid XML character, so
20906 # it is banned even though allowed in HTML5.
20907 !! test
20908 Illegal character references (T106578)
20909 !! wikitext
20910 ; Null: &#00;
20911 ; FF: &#xC;
20912 ; CR: &#xD;
20913 ; Control (low): &#8;
20914 ; Control (high): &#x7F; &#x9F;
20915 ; Surrogate: &#xD83D;&#xDCA9;
20916 ; This is an okay astral character: &#x1F4A9;
20917 !! html+tidy
20918 <dl><dt>Null</dt>
20919 <dd>&amp;#00;</dd>
20920 <dt>FF</dt>
20921 <dd>&amp;#xC;</dd>
20922 <dt>CR</dt>
20923 <dd>&amp;#xD;</dd>
20924 <dt>Control (low)</dt>
20925 <dd>&amp;#8;</dd>
20926 <dt>Control (high)</dt>
20927 <dd>&amp;#x7F; &amp;#x9F;</dd>
20928 <dt>Surrogate</dt>
20929 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20930 <dt>This is an okay astral character</dt>
20931 <dd>&#x1f4a9;</dd></dl>
20932 !! end
20933
20934 !! test
20935 __FORCETOC__ override
20936 !! wikitext
20937 __NEWSECTIONLINK__
20938 __FORCETOC__
20939 !! html/php
20940 <p><br />
20941 </p>
20942 !! end
20943
20944 !! test
20945 ISBN code coverage
20946 !! wikitext
20947 ISBN 978-0-1234-56&#x20;789
20948 !! html/php
20949 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20950 </p>
20951 !! html/parsoid
20952 <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>
20953 !! end
20954
20955 !! test
20956 ISBN followed by 5 spaces
20957 !! wikitext
20958 ISBN
20959 !! html
20960 <p>ISBN
20961 </p>
20962 !! end
20963
20964 !! test
20965 Double ISBN
20966 !! wikitext
20967 ISBN ISBN 1234567890
20968 !! html/php
20969 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20970 </p>
20971 !! html/parsoid
20972 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20973 !! end
20974
20975 # Uppercase X and lowercase x as well
20976 !! test
20977 ISBN with an X
20978 !! wikitext
20979 ISBN 3-462-04561-X
20980 ISBN 3-462-04561-x
20981 ISBN 080442957X
20982 ISBN 080442957x
20983 ISBN 978080442957X
20984 ISBN 978080442957x
20985 !! html/php
20986 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20987 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20988 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20989 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20990 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20991 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20992 </p>
20993 !! html/parsoid
20994 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20995 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20996 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20997 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20998 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20999 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21000 !! end
21001
21002 !! test
21003 ISBN with empty prefix (parsoid test)
21004 !! wikitext
21005 ISBN 1234567890
21006 !! html/php
21007 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21008 </p>
21009 !! html/parsoid
21010 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21011 !! end
21012
21013 !! test
21014 T24905: <abbr> followed by ISBN followed by </a>
21015 !! wikitext
21016 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21017 !! html/php
21018 <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>
21019 </p>
21020 !! html/parsoid
21021 <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>
21022 !! end
21023
21024 !! test
21025 Double RFC
21026 !! wikitext
21027 RFC RFC 1234
21028 !! html
21029 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21030 </p>
21031 !! end
21032
21033 !! test
21034 Double RFC with a wiki link
21035 !! wikitext
21036 RFC [[RFC 1234]]
21037 !! html
21038 <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>
21039 </p>
21040 !! end
21041
21042 !! test
21043 RFC code coverage
21044 !! wikitext
21045 RFC 983&#x20;987
21046 !! html/php
21047 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21048 </p>
21049 !! html/parsoid
21050 <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>
21051 !! end
21052
21053 !! test
21054 Centre-aligned image
21055 !! wikitext
21056 [[Image:foobar.jpg|centre]]
21057 !! html/php
21058 <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>
21059
21060 !! html/parsoid
21061 <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>
21062 !! end
21063
21064 !! test
21065 None-aligned image
21066 !! wikitext
21067 [[Image:foobar.jpg|none]]
21068 !! html/php
21069 <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>
21070
21071 !! html/parsoid
21072 <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>
21073 !! end
21074
21075 !! test
21076 Width + Height sized image (using px) (height is ignored)
21077 !! wikitext
21078 [[Image:foobar.jpg|640x480px]]
21079 !! html/php
21080 <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>
21081 </p>
21082 !! html/parsoid
21083 <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>
21084 !! end
21085
21086 !! test
21087 Width-sized image (using px, no following whitespace)
21088 !! wikitext
21089 [[Image:foobar.jpg|640px]]
21090 !! html/php
21091 <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>
21092 </p>
21093 !! html/parsoid
21094 <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>
21095 !! end
21096
21097 !! test
21098 Width-sized image (using px, with following whitespace - test regression from r39467)
21099 !! wikitext
21100 [[Image:foobar.jpg|640px ]]
21101 !! html/php
21102 <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>
21103 </p>
21104 !! html/parsoid
21105 <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>
21106 !!end
21107
21108 !! test
21109 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21110 !! wikitext
21111 [[Image:foobar.jpg| 640px]]
21112 !! html/php
21113 <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>
21114 </p>
21115 !! html/parsoid
21116 <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>
21117 !! end
21118
21119 !! test
21120 Image with page parameter
21121 !! options
21122 djvu
21123 !! wikitext
21124 [[File:LoremIpsum.djvu|page=2]]
21125 !! html/php
21126 <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>
21127 </p>
21128 !! html/parsoid
21129 <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>
21130 !! end
21131
21132 !! test
21133 Another italics / bold test
21134 !! wikitext
21135 ''' ''x'
21136 !! html
21137 <pre>'<i> </i>x'
21138 </pre>
21139 !!end
21140
21141 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21142 !! test
21143 dt/dd/dl test
21144 !! wikitext
21145 :;;;::
21146 !! html/php
21147 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21148
21149 !! html/parsoid
21150 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21151
21152 !!end
21153
21154 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21155 !! test
21156 Images with the "|" character in the comment
21157 !! wikitext
21158 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21159 !! html/php
21160 <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>
21161
21162 !! html/parsoid
21163 <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>
21164 !! end
21165
21166 !! test
21167 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21168 !! wikitext
21169 <html><script>alert(1);</script></html>
21170 !! html
21171 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21172 </p>
21173 !! end
21174
21175 !! test
21176 HTML with raw HTML ($wgRawHtml==true)
21177 !! options
21178 wgRawHtml=1
21179 !! wikitext
21180 <html><script>alert(1);</script></html>
21181 !! html/php
21182 <p><script>alert(1);</script>
21183 </p>
21184 !! end
21185
21186 !! test
21187 Parents of subpages, one level up
21188 !! options
21189 subpage title=[[Subpage test/L1/L2/L3]]
21190 !! wikitext
21191 [[../|L2]]
21192 !! html
21193 <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>
21194 </p>
21195 !! end
21196
21197
21198 !! test
21199 Parents of subpages, one level up, not named
21200 !! options
21201 subpage title=[[Subpage test/L1/L2/L3]]
21202 !! wikitext
21203 [[../]]
21204 !! html
21205 <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>
21206 </p>
21207 !! end
21208
21209
21210
21211 !! test
21212 Parents of subpages, two levels up
21213 !! options
21214 subpage title=[[Subpage test/L1/L2/L3]]
21215 !! wikitext
21216 [[../../|L1]]2
21217
21218 [[../../|L1]]l
21219 !! html
21220 <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
21221 </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>
21222 </p>
21223 !! end
21224
21225 !! test
21226 Parents of subpages, two levels up, without trailing slash or name.
21227 !! options
21228 subpage title=[[Subpage test/L1/L2/L3]]
21229 !! wikitext
21230 [[../..]]
21231 !! html
21232 <p>[[../..]]
21233 </p>
21234 !! end
21235
21236 !! test
21237 Parents of subpages, two levels up, with lots of extra trailing slashes.
21238 !! options
21239 subpage title=[[Subpage test/L1/L2/L3]]
21240 !! wikitext
21241 [[../../////]]
21242 !! html
21243 <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>
21244 </p>
21245 !! end
21246
21247 !! article
21248 Subpage test/L1/L2/L3Sibling
21249 !! text
21250 Sibling article
21251 !! endarticle
21252
21253 !! test
21254 Transclusion of a sibling page (one level up)
21255 !! options
21256 subpage title=[[Subpage test/L1/L2/L3]]
21257 !! wikitext
21258 {{../L3Sibling}}
21259 !! html
21260 <p>Sibling article
21261 </p>
21262 !! end
21263
21264 !! test
21265 Transclusion of a child page
21266 !! options
21267 subpage title=[[Subpage test/L1/L2]]
21268 !! wikitext
21269 {{/L3Sibling}}
21270 !! html
21271 <p>Sibling article
21272 </p>
21273 !! end
21274
21275 # This is wt2html only in Parsoid because we add <nowiki>
21276 # because of {{..}} and we don't expect to fix that to
21277 # eliminate the nowikis selective for {{..}} markup.
21278 !! test
21279 Non-transclusion because of too many up levels
21280 !! options
21281 subpage title=[[Subpage test/L1/L2/L3]]
21282 parsoid=wt2html
21283 !! wikitext
21284 {{../../../../More than parent}}
21285 !! html/php
21286 <p>{{../../../../More than parent}}
21287 </p>
21288 !! html/parsoid
21289 <p>{{../../../../More than parent}}</p>
21290 !! end
21291
21292 !! test
21293 Definition list code coverage
21294 !! wikitext
21295 ;title : def
21296 ;title : def
21297 ;title: def
21298 !! html/php
21299 <dl><dt>title &#160;</dt>
21300 <dd>def</dd>
21301 <dt>title&#160;</dt>
21302 <dd>def</dd>
21303 <dt>title</dt>
21304 <dd>def</dd></dl>
21305
21306 !! html/parsoid
21307 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21308 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21309 <dt>title</dt><dd> def</dd></dl>
21310 !! end
21311
21312 !! test
21313 Don't fall for the self-closing div
21314 !! wikitext
21315 <div>hello world</div/>
21316 !! html
21317 <div>hello world</div>
21318
21319 !! end
21320
21321 !! test
21322 MSGNW magic word
21323 !! wikitext
21324 {{MSGNW:msg}}
21325 !! html/php
21326 <p>&#91;&#91;:Template:Msg&#93;&#93;
21327 </p>
21328 !! end
21329
21330 !! test
21331 RAW magic word
21332 !! wikitext
21333 {{RAW:QUERTY}}
21334 !! html
21335 <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>
21336 </p>
21337 !! end
21338
21339 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21340 !! test
21341 Always escape literal '>' in output, not just after '<'
21342 !! wikitext
21343 ><>
21344 !! html
21345 <p>&gt;&lt;&gt;
21346 </p>
21347 !! end
21348
21349 !! test
21350 Template caching
21351 !! wikitext
21352 {{Test}}
21353 {{Test}}
21354 !! html
21355 <p>This is a test template
21356 This is a test template
21357 </p>
21358 !! end
21359
21360
21361 !! article
21362 MediaWiki:Fake
21363 !! text
21364 ==header==
21365 !! endarticle
21366
21367 !! test
21368 Inclusion of !userCanEdit() content
21369 !! wikitext
21370 {{MediaWiki:Fake}}
21371 !! html
21372 <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>
21373
21374 !! end
21375
21376
21377 !! test
21378 Out-of-order TOC heading levels
21379 !! wikitext
21380 ==2==
21381 ======6======
21382 ===3===
21383 =1=
21384 =====5=====
21385 ==2==
21386 !! html
21387 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21388 <ul>
21389 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21390 <ul>
21391 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21392 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21393 </ul>
21394 </li>
21395 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21396 <ul>
21397 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21398 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21399 </ul>
21400 </li>
21401 </ul>
21402 </div>
21403
21404 <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>
21405 <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>
21406 <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>
21407 <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>
21408 <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>
21409 <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>
21410
21411 !! end
21412
21413
21414 !! test
21415 ISBN with a dummy number
21416 !! wikitext
21417 ISBN ---
21418 !! html
21419 <p>ISBN ---
21420 </p>
21421 !! end
21422
21423
21424 !! test
21425 ISBN with space-delimited number
21426 !! wikitext
21427 ISBN 92 9017 032 8
21428 !! html/php
21429 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21430 </p>
21431 !! html/parsoid
21432 <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>
21433 !! end
21434
21435
21436 !! test
21437 ISBN with multiple spaces, no number
21438 !! wikitext
21439 ISBN foo
21440 !! html
21441 <p>ISBN foo
21442 </p>
21443 !! end
21444
21445
21446 !! test
21447 ISBN length
21448 !! wikitext
21449 ISBN 123456789
21450
21451 ISBN 1234567890
21452
21453 ISBN 12345678901
21454 !! html/php
21455 <p>ISBN 123456789
21456 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21457 </p><p>ISBN 12345678901
21458 </p>
21459 !! html/parsoid
21460 <p>ISBN 123456789</p>
21461
21462 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21463
21464 <p>ISBN 12345678901</p>
21465 !! end
21466
21467
21468 !! test
21469 ISBN with trailing year (T9110)
21470 !! wikitext
21471 ISBN 1-234-56789-0 - 2006
21472
21473 ISBN 1 234 56789 0 - 2006
21474 !! html/php
21475 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21476 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21477 </p>
21478 !! html/parsoid
21479 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21480
21481 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21482 !! end
21483
21484
21485 !! test
21486 anchorencode
21487 !! config
21488 wgFragmentMode=[ 'html5', 'legacy' ]
21489 !! wikitext
21490 {{anchorencode:foo bar©#%n}}
21491 !! html/php
21492 <p>foo_bar©#%n
21493 </p>
21494 !! html/parsoid
21495 <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>
21496 !! end
21497
21498 !! test
21499 anchorencode (legacy)
21500 !! config
21501 wgFragmentMode=[ 'legacy' ]
21502 !! wikitext
21503 {{anchorencode:foo bar©#%n}}
21504 !! html/php
21505 <p>foo_bar.C2.A9.23.25n
21506 </p>
21507 !! end
21508
21509 !! test
21510 anchorencode trims spaces
21511 !! config
21512 wgFragmentMode=[ 'html5', 'legacy' ]
21513 !! wikitext
21514 {{anchorencode: __pretty__please__}}
21515 !! html/php
21516 <p>pretty_please
21517 </p>
21518 !! html/parsoid
21519 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21520 !! end
21521
21522 !! test
21523 anchorencode deals with links
21524 !! config
21525 wgFragmentMode=[ 'html5', 'legacy' ]
21526 !! wikitext
21527 {{anchorencode: [[hello|world]] [[hi]]}}
21528 !! html/php
21529 <p>world_hi
21530 </p>
21531 !! html/parsoid
21532 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21533 !! end
21534
21535 !! test
21536 anchorencode deals with templates
21537 !! config
21538 wgFragmentMode=[ 'html5', 'legacy' ]
21539 !! wikitext
21540 {{anchorencode: {{Foo}} x}}
21541 !! html/php
21542 <p>FOO_x
21543 </p>
21544 !! html/parsoid
21545 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21546 !! end
21547
21548 !! test
21549 anchorencode encodes like the TOC generator: (T20431)
21550 !! config
21551 wgFragmentMode=[ 'html5', 'legacy' ]
21552 !! wikitext
21553 ===_ +:.3A%3A _ &&amp;]] x===
21554 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21555 __NOEDITSECTION__
21556 !! html/php
21557 <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>
21558 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21559 </p>
21560 !! html/parsoid
21561 <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>
21562 <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>
21563 <meta property="mw:PageProp/noeditsection"/>
21564 !! end
21565
21566 !! test
21567 anchorencode encodes like the TOC generator: (T20431) (legacy)
21568 !! config
21569 wgFragmentMode=[ 'legacy' ]
21570 !! wikitext
21571 ===_ +:.3A%3A&&amp;]]===
21572 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21573 __NOEDITSECTION__
21574 !! html/php
21575 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21576 <p>.2B:.3A.253A.26.26.5D.5D
21577 </p>
21578 !! end
21579
21580 !! test
21581 T8200: blockquotes and paragraph formatting
21582 !! wikitext
21583 <blockquote>
21584 foo
21585 </blockquote>
21586
21587 bar
21588
21589 baz
21590 !! html
21591 <blockquote>
21592 <p>foo
21593 </p>
21594 </blockquote>
21595 <p>bar
21596 </p>
21597 <pre>baz
21598 </pre>
21599 !! end
21600
21601 !! test
21602 T10293: Use of center tag ruins paragraph formatting
21603 !! wikitext
21604 <center>
21605 foo
21606 </center>
21607
21608 bar
21609
21610 baz
21611 !! html
21612 <center>
21613 <p>foo
21614 </p>
21615 </center>
21616 <p>bar
21617 </p>
21618 <pre>baz
21619 </pre>
21620 !! end
21621
21622 !!test
21623 Parsing of overlapping (improperly nested) inline html tags
21624 !! wikitext
21625 <span><s>x</span></s>
21626 !! html/php
21627 <p><span><s>x&lt;/span&gt;</s></span>
21628 </p>
21629 !! html/parsoid
21630 <p><span><s>x</s></span>
21631 </p>
21632 !!end
21633
21634 ###
21635 ### Language variants related tests
21636 ###
21637
21638 # Parsoid does not mark self-links.
21639 # Parsoid does not convert links; PHP will do any necessary redirects.
21640
21641 !! test
21642 Self-link in language variants
21643 !! options
21644 title=[[Dunav]] language=sr
21645 !! wikitext
21646 Both [[Dunav]] and [[Дунав]] are names for this river.
21647 !! html/php
21648 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21649 </p>
21650 !! html/parsoid
21651 <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>
21652 !! end
21653
21654 !! article
21655 Дуна
21656 !! text
21657 content
21658 !! endarticle
21659
21660 !! test
21661 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21662 !! options
21663 title=[[Duna]] language=sr
21664 !! wikitext
21665 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21666 !! html/php
21667 <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.
21668 </p>
21669 !! html/parsoid
21670 <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>
21671 !! end
21672
21673 !! test
21674 Link to a section of a variant of this title shouldn't be parsed as self-link
21675 !! options
21676 title=[[Duna]] language=sr
21677 !! wikitext
21678 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21679 !! html/php
21680 <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.
21681 </p>
21682 !! html/parsoid
21683 <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>
21684 !! end
21685
21686 !! test
21687 Link to pages in language variants
21688 !! options
21689 language=sr
21690 !! wikitext
21691 Main Page can be written as [[Маин Паге]]
21692 !! html/php
21693 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21694 </p>
21695 !! html/parsoid
21696 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21697 !! end
21698
21699
21700 !! test
21701 Multiple links to pages in language variants
21702 !! options
21703 language=sr
21704 !! wikitext
21705 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21706 !! html/php
21707 <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>.
21708 </p>
21709 !! html/parsoid
21710 <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>
21711 !! end
21712
21713
21714 !! test
21715 Simple template in language variants
21716 !! options
21717 language=sr
21718 !! wikitext
21719 {{тест}}
21720 !! html/php
21721 <p>This is a test template
21722 </p>
21723 !! end
21724
21725
21726 !! test
21727 Template with explicit namespace in language variants
21728 !! options
21729 language=sr
21730 !! wikitext
21731 {{Template:тест}}
21732 !! html/php
21733 <p>This is a test template
21734 </p>
21735 !! end
21736
21737
21738 !! test
21739 Basic test for template parameter in language variants
21740 !! options
21741 language=sr
21742 !! wikitext
21743 {{парамтест|param=foo}}
21744 !! html/php
21745 <p>This is a test template with parameter foo
21746 </p>
21747 !! end
21748
21749 !! test
21750 Simple category in language variants
21751 !! options
21752 language=sr cat
21753 !! wikitext
21754 [[Category:МедиаWики Усер'с Гуиде]]
21755 !! html/php
21756 cat=МедиаWики_Усер'с_Гуиде sort=
21757 !! html/parsoid
21758 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21759 !! end
21760
21761 !! article
21762 Category:分类
21763 !! text
21764 blah
21765 !! endarticle
21766
21767 !! article
21768 Category:分類
21769 !! text
21770 blah
21771 !! endarticle
21772
21773 ## We used to, but no longer wt2wt this test since the default serializer
21774 ## will normalize all categories to serialize on their own line.
21775 ## This wikitext usage is going to be fairly uncommon in production and
21776 ## selser will take care of preserving formatting in those scenarios.
21777 !! test
21778 Don't convert blue categorylinks to another variant (T35210)
21779 !! options
21780 cat
21781 language=zh
21782 parsoid=wt2html
21783 !! wikitext
21784 [[A]][[Category:分类]]
21785 !! html/php
21786 cat=分类 sort=
21787 !! html/parsoid
21788 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21789 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21790 !! end
21791
21792 !! test
21793 Stripping -{}- tags (language variants)
21794 !! options
21795 language=sr
21796 !! wikitext
21797 Latin proverb: -{Ne nuntium necare}-
21798 !! html/php
21799 <p>Latin proverb: Ne nuntium necare
21800 </p>
21801 !! html/parsoid
21802 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21803 !! end
21804
21805
21806 !! test
21807 Prevent conversion with -{}- tags (language variants)
21808 !! options
21809 language=sr variant=sr-ec
21810 !! wikitext
21811 Latinski: -{Ne nuntium necare}-
21812 !! html/php
21813 <p>Латински: Ne nuntium necare
21814 </p>
21815 !! html/parsoid
21816 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21817 !! end
21818
21819
21820 !! test
21821 Prevent conversion of text with -{}- tags (language variants)
21822 !! options
21823 language=sr variant=sr-ec
21824 !! wikitext
21825 Latinski: -{Ne nuntium necare}-
21826 !! html/php
21827 <p>Латински: Ne nuntium necare
21828 </p>
21829 !! html/parsoid
21830 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21831 !! end
21832
21833
21834 !! test
21835 Prevent conversion of links with -{}- tags (language variants)
21836 !! options
21837 language=sr variant=sr-ec
21838 !! wikitext
21839 -{[[Main Page]]}-
21840 !! html/php
21841 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21842 </p>
21843 !! html/parsoid
21844 <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>
21845 !! end
21846
21847
21848 !! test
21849 -{}- tags within headlines (within html for parserConvert())
21850 !! config
21851 wgFragmentMode=[ 'html5', 'legacy' ]
21852 !! options
21853 language=sr variant=sr-ec
21854 !! wikitext
21855 ==-{Naslov}-==
21856
21857 Note that even an unprotected headline ID is not affected by language
21858 conversion:
21859
21860 ==Latinski==
21861 !! html/php
21862 <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>
21863 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21864 цонверсион:
21865 </p>
21866 <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>
21867
21868 !! html/parsoid
21869 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21870
21871 <p>Note that even an unprotected headline ID is not affected by language
21872 conversion:</p>
21873
21874 <h2 id="Latinski">Latinski</h2>
21875 !! end
21876
21877 !! test
21878 Explicit definition of language variant alternatives
21879 !! options
21880 language=zh variant=zh-tw
21881 !! wikitext
21882 -{zh:China;zh-tw:Taiwan}-, not China
21883 !! html/php
21884 <p>Taiwan, not China
21885 </p>
21886 !! html/parsoid
21887 <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>
21888 !! end
21889
21890 !! test
21891 Filter syntax for language variants
21892 !! options
21893 language=zh variant=zh-tw
21894 !! wikitext
21895 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21896 !! html/php
21897 <p>fooblog, WEBJOURNAL, WEBLOGquux
21898 </p>
21899 !! html/parsoid
21900 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21901 !! end
21902
21903 # Note that Parsoid post-processing for language variants needs to
21904 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21905 !! test
21906 Conversion around HTML tags
21907 !! options
21908 language=sr variant=sr-ec
21909 !! wikitext
21910 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21911 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21912 !! html/php
21913 <p>
21914 <span title="ЛаCтин">ски</span>
21915 </p>
21916 !! html/parsoid
21917 <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"}]}'/>
21918 <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>
21919 !! end
21920
21921 !! test
21922 Explicit session-wise two-way language variant mapping (A flag and - flag)
21923 !! options
21924 language=zh variant=zh-tw
21925 !! wikitext
21926 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21927
21928 Taiwan is not China.
21929
21930 But -{A|zh:China; zh-tw:Taiwan}- is China,
21931
21932 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21933
21934 and -{China}- is China.
21935 !! html/php
21936 <p>This is Taiwan, but we'll forget that now.
21937 </p><p>Taiwan is not China.
21938 </p><p>But Taiwan is Taiwan,
21939 </p><p>(This should be stripped!)
21940 </p><p>and China is China.
21941 </p>
21942 !! html/parsoid
21943 <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>
21944 <p>Taiwan is not China.</p>
21945 <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>
21946 <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>
21947 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21948 !! end
21949
21950 !! test
21951 Explicit session-wise one-way language variant mapping (A flag and - flag)
21952 !! options
21953 language=zh variant=zh-tw
21954 !! wikitext
21955 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21956
21957 COUNTRY is China or Taiwan.
21958
21959 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21960
21961 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21962
21963 and -{COUNTRY}- is COUNTRY.
21964 !! html/php
21965 <p>This is Taiwan, but we'll forget that now.
21966 </p><p>COUNTRY is China or Taiwan.
21967 </p><p>But Taiwan is Taiwan,
21968 </p><p>(This should be stripped!)
21969 </p><p>and COUNTRY is COUNTRY.
21970 </p>
21971 !! html/parsoid
21972 <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>
21973 <p>COUNTRY is China or Taiwan.</p>
21974 <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>
21975 <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>
21976 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21977 !! end
21978
21979 !! test
21980 Explicit session-wise two-way language variant mapping (H flag for hide)
21981 !! options
21982 language=zh variant=zh-tw
21983 !! wikitext
21984 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21985
21986 Taiwan is China.
21987 !! html/php
21988 <p>(This should be stripped!)
21989 </p><p>Taiwan is Taiwan.
21990 </p>
21991 !! html/parsoid
21992 <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>
21993 <p>Taiwan is China.</p>
21994 !! end
21995
21996 !! test
21997 Explicit session-wise one-way language variant mapping (H flag for hide)
21998 !! options
21999 language=zh variant=zh-tw
22000 !! wikitext
22001 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22002
22003 COUNTRY is Taiwan or China.
22004 !! html/php
22005 <p>(This should be stripped!)
22006 </p><p>Taiwan is Taiwan or China.
22007 </p>
22008 !! html/parsoid
22009 <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>
22010 <p>COUNTRY is Taiwan or China.</p>
22011 !! end
22012
22013 ## Note that parsoid test runner does not support 'showtitle' option.
22014 !! test
22015 Adding explicit conversion rule for title (T flag)
22016 !! options
22017 language=zh variant=zh-tw showtitle
22018 !! wikitext
22019 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22020
22021 Taiwan is China.
22022 !! html/php
22023 Taiwan
22024 <p>Should be stripped!
22025 </p><p>Taiwan is China.
22026 </p>
22027 !! html/parsoid
22028 <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>
22029 <p>Taiwan is China.</p>
22030 !! end
22031
22032 !! test
22033 Code coverage: T combined with H flag
22034 !! options
22035 language=zh variant=zh-tw showtitle
22036 !! wikitext
22037 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22038
22039 Taiwan is China.
22040 !! html/php
22041 Taiwan
22042 <p>Should be stripped!
22043 </p><p>Taiwan is Taiwan.
22044 </p>
22045 !! html/parsoid
22046 <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>
22047 <p>Taiwan is China.</p>
22048 !! end
22049
22050 !! test
22051 Code coverage: T with no variants
22052 !! options
22053 language=zh variant=zh-tw showtitle
22054 !! wikitext
22055 -{H|zh:China; zh-tw:Taiwan}-
22056 Taiwan is China.-{T|Taiwan is China}-
22057 !! html/php
22058 Taiwan is China
22059 <p>
22060 Taiwan is Taiwan.
22061 </p>
22062 !! html/parsoid
22063 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22064 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22065 !! end
22066
22067 !! test
22068 Code coverage: rules with no variants
22069 !! options
22070 language=zh variant=zh-tw
22071 !! wikitext
22072 -{H|zh:China; zh-tw:Taiwan}-
22073 Taiwan is China.
22074 -{H|China}-
22075 Taiwan is China.
22076 !! html/php
22077 <p>
22078 Taiwan is Taiwan.
22079
22080 Taiwan is China.
22081 </p>
22082 !! html/parsoid
22083 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22084 Taiwan is China.
22085 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22086 Taiwan is China.</p>
22087 !! end
22088
22089
22090 !! test
22091 Code coverage: D flag for conversion rule
22092 !! options
22093 language=zh variant=zh-tw
22094 !! wikitext
22095 -{D|zh-cn:XA; zh-tw:YA}-
22096 -{A;D|zh-cn:XB; zh-tw:YB}-
22097 -{D;H|zh-cn:XC; zh-tw:YC}-
22098
22099 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22100
22101 -{D|0=>zh-tw:1}-
22102 -{A;D|2=>zh-tw:3}-
22103 -{D;H|4=>zh-tw:5}-
22104
22105 XA XB XC YA YB YC FOO BAR BAT 012345
22106 !! html/php
22107 <p>大陆:XA;台灣:YA;
22108
22109 大陆:XC;台灣:YC;
22110 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22111 </p><p>0⇒台灣:1;
22112
22113 4⇒台灣:5;
22114 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22115 </p>
22116 !! html/parsoid
22117 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22118 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22119 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22120 <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>
22121 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22122 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22123 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22124 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22125 !! end
22126
22127 !! test
22128 Code coverage: N flag for conversion rule
22129 !! options
22130 language=zh variant=zh-cn
22131 !! wikitext
22132 -{N|zh-cn}-
22133
22134 -{N|zh-tw}-
22135
22136 -{N|sr-ec}-
22137 !! html/php
22138 <p>大陆
22139 </p><p>台灣
22140 </p><p>српски (ћирилица)‎
22141 </p>
22142 !! html/parsoid
22143 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22144 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22145 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22146 !! end
22147
22148 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22149 !! test
22150 Code coverage: N flag for conversion rule (wt2html only)
22151 !! options
22152 language=zh variant=zh-cn
22153 parsoid=wt2html,html2html
22154 !! wikitext
22155 -{D;N|en}-
22156 !! html/php
22157 <p>English
22158 </p>
22159 !! html/parsoid
22160 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22161 !! end
22162
22163 !! test
22164 Testing that changing the language variant here in the tests actually works
22165 !! options
22166 language=zh variant=zh showtitle
22167 !! wikitext
22168 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22169 !! html/php
22170 China
22171 <p>Should be stripped!
22172 </p>
22173 !! html/parsoid
22174 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22175 !! end
22176
22177 !! test
22178 Recursive conversion of alt and title attrs shouldn't clear converter state
22179 !! options
22180 language=zh variant=zh-cn
22181 showtitle
22182 !! wikitext
22183 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22184 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22185 !! html/php
22186 China
22187 <p>
22188 Should be stripped<span title="Exclamation">!</span>
22189 </p>
22190 !! html/parsoid
22191 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22192 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>
22193 !! end
22194
22195 !! test
22196 T26072: more test on conversion rule for title
22197 !! options
22198 language=zh variant=zh-tw showtitle
22199 !! wikitext
22200 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22201
22202 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22203 !! html/php
22204 Taiwan
22205 <p>This should be stripped!
22206 </p><p>This won't take interferes with the title rule.
22207 </p>
22208 !! html/parsoid
22209 <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>
22210 <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>
22211 !! end
22212
22213 !! test
22214 Partly disable title conversion if variant == main language code
22215 !! options
22216 language=zh variant=zh title=[[ZH]] showtitle
22217 !! wikitext
22218 -{T|zh-cn:CN;zh-tw:TW}-
22219 !! html/php
22220 ZH
22221 <p>
22222 </p>
22223 !! html/parsoid
22224 <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>
22225 !! end
22226
22227 !! test
22228 Partly disable title conversion if variant == main language code, more
22229 !! options
22230 language=zh variant=zh title=[[ZH]] showtitle
22231 !! wikitext
22232 -{T|TW}-
22233 !! html/php
22234 ZH
22235 <p>
22236 </p>
22237 !! html/parsoid
22238 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22239 !! end
22240
22241 !! test
22242 Raw output of variant escape tags (R flag)
22243 !! options
22244 language=zh variant=zh-tw
22245 !! wikitext
22246 Raw: -{R|zh:China;zh-tw:Taiwan}-
22247 !! html/php
22248 <p>Raw: zh:China;zh-tw:Taiwan
22249 </p>
22250 !! html/parsoid
22251 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22252 !! end
22253
22254 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22255 !! test
22256 Raw output of variant escape tags (R flag) (wt2html only)
22257 !! options
22258 language=zh variant=zh-tw
22259 parsoid=wt2html,html2html
22260 !! wikitext
22261 -{Variant}- -{D|syntax}- -{D;R|options}-
22262 !! html/php
22263 <p>Variant syntax options
22264 </p>
22265 !! html/parsoid
22266 <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>
22267 !! end
22268
22269 !! test
22270 Nested markup inside raw output of variant escape tags (R flag)
22271 !! options
22272 language=zh variant=zh-tw
22273 !! wikitext
22274 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22275 !! html/php
22276 <p>Nested raw: nested Taiwan nested
22277 </p>
22278 !! html/parsoid
22279 <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>
22280 !! end
22281
22282 !! test
22283 Nested markup and spaces inside raw output of variant escape tags (R flag)
22284 !! options
22285 language=zh variant=zh-tw
22286 !! wikitext
22287 X-{ outer -{ inner }- outer }-X
22288 !! html/php
22289 <p>X outer inner outer X
22290 </p>
22291 !! html/parsoid
22292 <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>
22293 !! end
22294
22295 !! test
22296 Templates inside raw output of variant escape tags (R flag)
22297 !! options
22298 language=zh variant=zh-tw
22299 !! wikitext
22300 Nested raw: -{R|nested {{echo|hi}} templates}-
22301 !! html/php
22302 <p>Nested raw: nested hi templates
22303 </p>
22304 !! html/parsoid
22305 <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>
22306 !! end
22307
22308 !! test
22309 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22310 !! options
22311 language=zh variant=zh-cn
22312 !! wikitext
22313 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22314 !! html/php
22315 <p>0
22316 </p>
22317 !! html/parsoid
22318 <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>
22319 !! end
22320
22321 !! test
22322 Conversion rules from [numeric-only string] to [something else] (T48634)
22323 !! options
22324 language=zh variant=zh-cn
22325 !! wikitext
22326 -{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
22327 !! html/php
22328 <p>D12345EE12345
22329 </p>
22330 !! html/parsoid
22331 <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>
22332 !! end
22333
22334 !! test
22335 Two-way converter rule entries with an empty value should be ignored (T53551)
22336 !! options
22337 language=zh variant=zh-cn
22338 !! wikitext
22339 -{H|zh-cn:foo;zh-tw:;}-foobar
22340 !! html/php
22341 <p>foobar
22342 </p>
22343 !! html/parsoid
22344 <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>
22345 !! end
22346
22347 !! test
22348 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22349 !! options
22350 language=zh variant=zh-cn
22351 !! wikitext
22352 -{H|=>zh-cn:foo;}-foobar
22353 !! html/php
22354 <p>foobar
22355 </p>
22356 !! html/parsoid
22357 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22358 !! end
22359
22360 !! test
22361 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22362 !! options
22363 language=zh variant=zh-cn
22364 !! wikitext
22365 -{H|}-foobar
22366 !! html/php
22367 <p>foobar
22368 </p>
22369 !! html/parsoid
22370 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22371 !! end
22372
22373 !! test
22374 Nested using of manual convert syntax
22375 !! options
22376 language=zh variant=zh-hk
22377 !! wikitext
22378 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22379 !! html/php
22380 <p>Nested: Hello Hong Kong!
22381 </p>
22382 !! html/parsoid
22383 <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>
22384 !! end
22385
22386 !! test
22387 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22388 !! options
22389 language=zh variant=zh-cn
22390 !! wikitext
22391 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22392 !! html/php
22393 <p><span title="X">A</span>
22394 </p>
22395 !! html/parsoid
22396 <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>
22397 !! end
22398
22399 !! test
22400 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22401 !! options
22402 language=zh variant=zh-cn
22403 !! wikitext
22404 -{<span title="-{X}-">A</span>}-
22405 !! html/php+disabled
22406 <p><span title="X">A</span>
22407 </p>
22408 !! html/parsoid
22409 <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>
22410 !! end
22411
22412 # Parsoid and PHP disagree on how to parse this example: Parsoid
22413 # insists that the content of a language converter element be a valid
22414 # DOM fragment or attribute string
22415 !! test
22416 Language converter markup with block content
22417 !! options
22418 language=zh variant=zh-cn
22419 !! wikitext
22420 <span>a-{b<div>c}-d
22421
22422 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22423
22424 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22425 !! html/php+tidy
22426 <span>ab<div>cd
22427 <span>ab<div>cd
22428 <span>ad
22429 </span></div></span></div></span>
22430 !! html/parsoid
22431 <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>
22432
22433 <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>
22434
22435 <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>
22436 !! end
22437
22438 !! test
22439 LanguageConverter selser (1)
22440 !! options
22441 language=zh variant=zh-cn
22442 parsoid={
22443 "modes": ["wt2wt", "selser"],
22444 "changes": [
22445 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22446 ]
22447 }
22448 !! wikitext
22449 -{raw}-
22450 !! wikitext/edited
22451 -{edited}-
22452 !! end
22453
22454 !! test
22455 LanguageConverter selser (2)
22456 !! options
22457 language=zh variant=zh-cn
22458 parsoid={
22459 "modes": ["wt2wt", "selser"],
22460 "changes": [
22461 ["span[class='x']", "contents", "text", "-{foo}-"],
22462 ["a", "contents", "text", "-{"],
22463 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22464 ]
22465 }
22466 !! wikitext
22467 <span class="x">TEXT1</span>
22468 [http://example.com TEXT2]
22469 [[Foo|TEXT3]]
22470 {{echo|TEXT4}}
22471 !! wikitext/edited
22472 <span class="x"><nowiki>-{foo}-</nowiki></span>
22473 [http://example.com -{]
22474 [[Foo|<nowiki>-{</nowiki>]]
22475 {{1x|<nowiki>-{</nowiki>}}
22476 !! end
22477
22478 # Tests LanguageVariantText in ConstrainedText
22479 !! test
22480 LanguageConverter selser (3)
22481 !! options
22482 language=zh variant=zh-cn
22483 parsoid={
22484 "modes": ["wt2wt", "selser"],
22485 "changes": [
22486 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22487 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22488 ]
22489 }
22490 !! wikitext
22491 {|
22492 |-
22493 |<span>Foo</span>
22494 |}
22495 !! wikitext/edited
22496 {|
22497 |-
22498 |<nowiki/>-{edited}-
22499 |}
22500 !! end
22501
22502 # Tests LanguageVariantText._fromSelSer
22503 !! test
22504 LanguageConverter selser (4)
22505 !! options
22506 language=zh variant=zh-cn
22507 parsoid={
22508 "modes": ["wt2wt", "selser"],
22509 "changes": [
22510 ["td > span.x", "remove"]
22511 ]
22512 }
22513 !! wikitext
22514 {|
22515 |-
22516 |<span class="x">Foo</span>-{Bar}-
22517 ||<span class="x">Foo</span>-{Bar}-
22518 |}
22519 !! wikitext/edited
22520 {|
22521 |-
22522 |<nowiki/>-{Bar}-
22523 ||-{Bar}-
22524 |}
22525 !! end
22526
22527 # Since Parsoid is starting to emit canonical wikitext for links,
22528 # [http://example.com http://example.com] will not RT back to that
22529 # form anymore.
22530 # Parsoid does not language-convert links (it is done in a
22531 # post-processing step)
22532 !! test
22533 Proper conversion of text in external links
22534 !! options
22535 language=sr variant=sr-ec
22536 parsoid=wt2html
22537 !! wikitext
22538 http://www.google.com
22539 gopher://www.google.com
22540 [http://www.google.com http://www.google.com]
22541 [gopher://www.google.com gopher://www.google.com]
22542 [https://www.google.com irc://www.google.com]
22543 [ftp://www.google.com www.google.com/ftp://dir]
22544 [//www.google.com www.google.com]
22545 !! html/php
22546 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22547 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22548 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22549 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22550 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22551 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22552 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22553 </p>
22554 !! html/parsoid
22555 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22556 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22557 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22558 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22559 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22560 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22561 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22562 !! end
22563
22564 !! test
22565 Do not convert roman numbers to language variants
22566 !! options
22567 language=sr variant=sr-ec
22568 !! wikitext
22569 Fridrih IV je car.
22570 !! html/php
22571 <p>Фридрих IV је цар.
22572 </p>
22573 !! html/parsoid
22574 <p>Fridrih IV je car.</p>
22575 !! end
22576
22577 !! test
22578 Unclosed language converter markup "-{"
22579 !! options
22580 language=sr
22581 !! wikitext
22582 -{T|hello
22583 !! html
22584 <p>-{T|hello
22585 </p>
22586 !! end
22587
22588 !! test
22589 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22590 !! options
22591 language=sr
22592 !! wikitext
22593 -{R|=&gt;}-
22594 !! html/php
22595 <p>=&gt;
22596 </p>
22597 !! html/parsoid
22598 <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>
22599 !!end
22600
22601 !! test
22602 Don't break link parsing if language converter markup is in the caption.
22603 !! options
22604 language=sr variant=sr-ec
22605 !! wikitext
22606 [[Main Page|-{R|main page}-]]
22607 !! html/php
22608 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22609 </p>
22610 !! html/parsoid
22611 <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>
22612 !! end
22613
22614 !! test
22615 T146304: Don't break template parsing if language converter markup is in the parameter.
22616 !! options
22617 language=sr variant=sr-ec
22618 !! wikitext
22619 {{echo|-{R|foo}-}}
22620 !! html/php
22621 <p>foo
22622 </p>
22623 !! html/parsoid
22624 <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>
22625 !! end
22626
22627 !! test
22628 T146305: Don't break image parsing if language converter markup is in the caption.
22629 !! options
22630 language=sr
22631 !! wikitext
22632 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22633 !! html/php
22634 <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>
22635
22636 !! html/parsoid
22637 <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>
22638 !! end
22639
22640 !! test
22641 T146305: Don't break image parsing if nested language converter markup is in the caption.
22642 !! options
22643 language=zh variant=zh-cn
22644 !! wikitext
22645 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22646 !! html/php
22647 <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>
22648
22649 !! html/parsoid
22650 <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>
22651 !! end
22652
22653 # XXX html2wt disabled because rich markup in alt is not preserved.
22654 !! test
22655 Don't break gallery if language converter markup is inside.
22656 !! options
22657 language=zh
22658 !! wikitext
22659 <gallery>
22660 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22661 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22662 </gallery>
22663 !! html/php
22664 <ul class="gallery mw-gallery-traditional">
22665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22666 <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>
22667 <div class="gallerytext">
22668 <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>
22669 </p>
22670 </div>
22671 </div></li>
22672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22673 <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>
22674 <div class="gallerytext">
22675 <p>This is a test template
22676 </p>
22677 </div>
22678 </div></li>
22679 </ul>
22680
22681 !! html/parsoid
22682 <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"}}'>
22683 <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>
22684 <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>
22685 </ul>
22686 !! end
22687
22688 !! test
22689 T153135: Don't break list handling if language converter markup is in the item.
22690 !! options
22691 language=zh variant=zh-cn
22692 !! wikitext
22693 ;-{zh-cn:AAA;zh-tw:BBB}-
22694 ;-{R|foo:bar}-
22695 !! html/php
22696 <dl><dt>AAA</dt>
22697 <dt>foo:bar</dt></dl>
22698
22699 !! html/parsoid
22700 <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>
22701 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22702 </dl>
22703 !! end
22704
22705 // Note that parsoid does not protect colons unless language converter
22706 // markup is properly nested, because it is a backtracking parser.
22707 !! test
22708 T153135: Unclosed markup in definition list (code coverage)
22709 !! options
22710 language=zh variant=zh-cn
22711 !! wikitext
22712 ;<b>foo:bar
22713 ;-{zh-cn:AAA
22714 !! html/php+tidy
22715 <dl><dt><b>foo:bar</b></dt><b>
22716 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22717 </b></p>
22718 !! html/parsoid
22719 <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}'>
22720 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22721 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22722 </b></dl>
22723 !! end
22724
22725 !! test
22726 T153135: Nested language converter markup in definition list (code coverage)
22727 !! options
22728 language=zh variant=zh-cn
22729 !! wikitext
22730 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22731 !! html/php
22732 <dl><dt>AAA foo:bar bat:baz</dt>
22733 <dd>def</dd></dl>
22734
22735 !! html/parsoid
22736 <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>
22737 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22738 </dl>
22739 !! end
22740
22741 # html2wt mode disabled due to <nowiki> insertion.
22742 !! test
22743 T153140: Don't break table handling if language converter markup is in the cell.
22744 !! options
22745 language=sr variant=sr-ec
22746 parsoid=wt2html,wt2wt,html2html
22747 !! wikitext
22748 {|
22749 |-
22750 | -{R|B}-
22751 |}
22752 !! html/php
22753 <table>
22754
22755 <tr>
22756 <td>B
22757 </td></tr></table>
22758
22759 !! html/parsoid
22760 <table>
22761 <tbody>
22762 <tr>
22763 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22764 </tr>
22765 </tbody>
22766 </table>
22767 !! end
22768
22769 !! test
22770 Language converter tricky html2wt cases (1)
22771 !! options
22772 language=sr
22773 parsoid=html2wt,wt2wt
22774 !! html/parsoid
22775 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22776 !! wikitext
22777 -{<nowiki>}-</nowiki>}-
22778 !! html/php
22779 <p>&#125;-
22780 </p>
22781 !! end
22782
22783 !! test
22784 Language converter tricky html2wt cases (2)
22785 !! options
22786 language=sr
22787 parsoid=html2wt,wt2wt
22788 !! html/parsoid
22789 <p>-{foo}-</p>
22790 !! wikitext
22791 <nowiki>-{foo}-</nowiki>
22792 !! html/php
22793 <p>-&#123;foo&#125;-
22794 </p>
22795 !! end
22796
22797 !! test
22798 Language converter tricky html2wt cases (3)
22799 !! options
22800 language=sr
22801 parsoid=html2wt,wt2wt
22802 !! html/parsoid
22803 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22804 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22805 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22806 !! wikitext
22807 -{R||}-
22808
22809 -{R|R|raw}-
22810
22811 -{<nowiki>-{foo}-</nowiki>}-
22812 !! html/php
22813 <p>|
22814 </p><p>R|raw
22815 </p><p>-&#123;foo&#125;-
22816 </p>
22817 !! end
22818
22819 !! test
22820 Language converter tricky html2wt cases (4)
22821 !! options
22822 language=sr
22823 parsoid=html2wt,wt2wt
22824 !! html/parsoid
22825 <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>
22826 !! wikitext
22827 -{R|{{echo|hey}}}-
22828 !! html/php
22829 <p>hey
22830 </p>
22831 !! end
22832
22833 # Note that the <nowiki> escaping added by parsoid for source text,
22834 # destination text, and language names only works on the PHP side
22835 # for *destination text*. (HTML entity escaping wouldn't work
22836 # any better.) This is probably a bug, at least for source texts.
22837 # (For language names PHP uses a precise regexp based on the languages
22838 # it currently knows have variants, which is fragile since this set
22839 # can grow/shrink over time.)
22840 !! test
22841 Language converter tricky html2wt cases (5)
22842 !! options
22843 language=zh variant=zh-cn
22844 !! html/parsoid
22845 <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>
22846 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22847 <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>
22848 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22849 <p>a:b=>c xyz</p>
22850 !! wikitext
22851 -{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
22852
22853 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22854
22855 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22856
22857 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22858
22859 a:b=>c xyz
22860 !! html/php+disabled
22861 <p>foobat;xyz=&gt;zh-cn:abc
22862 </p><p>A
22863 </p><p>0;zh-tw:bar
22864 </p><p>abc
22865 </p><p>a:b=&gt;c 0;zh-tw:bar
22866 </p>
22867 !! end
22868
22869 !! test
22870 T179579: Nowiki and lc interaction
22871 !! options
22872 parsoid=wt2html
22873 language=sr
22874 !! wikitext
22875 -{</nowiki>123}-
22876
22877 -{123<nowiki>|</nowiki>456}-
22878 !! html/parsoid
22879 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22880
22881 <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>
22882 !! end
22883
22884 !! test
22885 T2529: Uncovered bullet
22886 !! wikitext
22887 *Foo {{bullet}}
22888 !! html
22889 <ul><li>Foo</li>
22890 <li>Bar</li></ul>
22891
22892 !! end
22893
22894 !! test
22895 T2529: Uncovered bullet in a deeply nested list
22896 !! wikitext
22897 *******Foo {{bullet}}
22898 !! html
22899 <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>
22900 <li>Bar</li></ul>
22901
22902 !! end
22903
22904 !! test
22905 T2529: Uncovered table already at line-start
22906 !! wikitext
22907 x
22908
22909 {{table}}
22910 y
22911 !! html
22912 <p>x
22913 </p>
22914 <table>
22915 <tr>
22916 <td>1</td>
22917 <td>2
22918 </td></tr>
22919 <tr>
22920 <td>3</td>
22921 <td>4
22922 </td></tr></table>
22923 <p>y
22924 </p>
22925 !! end
22926
22927 !! test
22928 T2529: Uncovered bullet in parser function result
22929 !! wikitext
22930 *Foo {{lc:{{bullet}} }}
22931 !! html
22932 <ul><li>Foo</li>
22933 <li>bar</li></ul>
22934
22935 !! end
22936
22937 !! test
22938 T7678: Double-parsed template argument
22939 !! wikitext
22940 {{lc:{{{1}}}|hello}}
22941 !! html
22942 <p>{{{1}}}
22943 </p>
22944 !! end
22945
22946 !! test
22947 T7678: Double-parsed template invocation
22948 !! wikitext
22949 {{lc:{{paramtest {{!}} param = hello }} }}
22950 !! html
22951 <p>{{paramtest | param = hello }}
22952 </p>
22953 !! end
22954
22955 !! test
22956 Case insensitivity of parser functions for non-ASCII characters (T10143)
22957 !! options
22958 language=cs
22959 title=[[Main Page]]
22960 !! wikitext
22961 {{PRVNÍVELKÉ:ěščř}}
22962 {{prvnívelké:ěščř}}
22963 {{PRVNÍMALÉ:ěščř}}
22964 {{prvnímalé:ěščř}}
22965 {{MALÁ:ěščř}}
22966 {{malá:ěščř}}
22967 {{VELKÁ:ěščř}}
22968 {{velká:ěščř}}
22969 !! html
22970 <p>Ěščř
22971 Ěščř
22972 ěščř
22973 ěščř
22974 ěščř
22975 ěščř
22976 ĚŠČŘ
22977 ĚŠČŘ
22978 </p>
22979 !! end
22980
22981 !! test
22982 Morwen/13: Unclosed link followed by heading
22983 !! wikitext
22984 [[link
22985 ==heading==
22986 !! html
22987 <p>[[link
22988 </p>
22989 <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>
22990
22991 !! end
22992
22993 !! test
22994 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22995 !! wikitext
22996 {{foo|
22997 =heading=
22998 !! html
22999 <p>{{foo|
23000 </p>
23001 <h1><span class="mw-headline" id="heading">heading</span></h1>
23002
23003 !! end
23004
23005 !! test
23006 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23007 !! wikitext
23008 {{foo|
23009 ==heading==
23010 !! html
23011 <p>{{foo|
23012 </p>
23013 <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>
23014
23015 !! end
23016
23017 !! test
23018 Tildes in comments
23019 !! options
23020 pst
23021 !! wikitext
23022 <!-- ~~~~ -->
23023 !! html/php
23024 <!-- ~~~~ -->
23025 !! end
23026
23027 !! test
23028 Paragraphs inside divs (no extra line breaks)
23029 !! wikitext
23030 <div>Line one
23031
23032 Line two</div>
23033 !! html
23034 <div>Line one
23035 Line two</div>
23036
23037 !! end
23038
23039 !! test
23040 Paragraphs inside divs (extra line break on open)
23041 !! wikitext
23042 <div>
23043 Line one
23044
23045 Line two</div>
23046 !! html
23047 <div>
23048 <p>Line one
23049 </p>
23050 Line two</div>
23051
23052 !! end
23053
23054 !! test
23055 Paragraphs inside divs (extra line break on close)
23056 !! wikitext
23057 <div>Line one
23058
23059 Line two
23060 </div>
23061 !! html
23062 <div>Line one
23063 <p>Line two
23064 </p>
23065 </div>
23066
23067 !! end
23068
23069 !! test
23070 Paragraphs inside divs (extra line break on open and close)
23071 !! wikitext
23072 <div>
23073 Line one
23074
23075 Line two
23076 </div>
23077 !! html
23078 <div>
23079 <p>Line one
23080 </p><p>Line two
23081 </p>
23082 </div>
23083
23084 !! end
23085
23086 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23087 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23088 !! test
23089 Nesting tags, paragraphs on lines which begin with <div>
23090 !! wikitext
23091 <div></div><strong>A
23092 B</strong>
23093 !! html/php+tidy
23094 <div></div><p><strong>A
23095 </strong></p><strong></strong><p><strong>B</strong>
23096 </p>
23097 !! html/parsoid
23098 <div></div>
23099 <p><strong>A
23100 B</strong>
23101 </p>
23102 !! end
23103
23104 # T8200: <blockquote> should behave like <div> with respect to line breaks
23105 !! test
23106 T8200: paragraphs inside blockquotes (no extra line breaks)
23107 !! wikitext
23108 <blockquote>Line one
23109
23110 Line two</blockquote>
23111 !! html
23112 <blockquote>Line one
23113 Line two</blockquote>
23114
23115 !! html+tidy
23116 <blockquote><p>Line one
23117 Line two</p></blockquote>
23118 !! end
23119
23120 !! test
23121 T8200: paragraphs inside blockquotes (extra line break on open)
23122 !! wikitext
23123 <blockquote>
23124 Line one
23125
23126 Line two</blockquote>
23127 !! html
23128 <blockquote>
23129 <p>Line one
23130 </p>
23131 Line two</blockquote>
23132
23133 !! html+tidy
23134 <blockquote>
23135 <p>Line one
23136 </p><p>
23137 Line two</p></blockquote>
23138 !! end
23139
23140 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23141 !! test
23142 T8200: paragraphs inside blockquotes (extra line break on close)
23143 !! wikitext
23144 <blockquote>Line one
23145
23146 Line two
23147 </blockquote>
23148 !! html
23149 <blockquote>Line one
23150 <p>Line two
23151 </p>
23152 </blockquote>
23153
23154 !! html+tidy
23155 <blockquote><p>Line one
23156 </p><p>Line two
23157 </p>
23158 </blockquote>
23159 !! end
23160
23161 !! test
23162 T8200: paragraphs inside blockquotes (extra line break on open and close)
23163 !! wikitext
23164 <blockquote>
23165 Line one
23166
23167 Line two
23168 </blockquote>
23169 !! html
23170 <blockquote>
23171 <p>Line one
23172 </p><p>Line two
23173 </p>
23174 </blockquote>
23175
23176 !! end
23177
23178 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23179 !! test
23180 Paragraphs inside blockquotes/divs (no extra line breaks)
23181 !! wikitext
23182 <blockquote><div>Line one
23183
23184 Line two</div></blockquote>
23185 !! html
23186 <blockquote><div>Line one
23187 Line two</div></blockquote>
23188
23189 !! end
23190
23191 !! test
23192 Paragraphs inside blockquotes/divs (extra line break on open)
23193 !! wikitext
23194 <blockquote><div>
23195 Line one
23196
23197 Line two</div></blockquote>
23198 !! html
23199 <blockquote><div>
23200 <p>Line one
23201 </p>
23202 Line two</div></blockquote>
23203
23204 !! end
23205
23206 !! test
23207 Paragraphs inside blockquotes/divs (extra line break on close)
23208 !! wikitext
23209 <blockquote><div>Line one
23210
23211 Line two
23212 </div></blockquote>
23213 !! html
23214 <blockquote><div>Line one
23215 <p>Line two
23216 </p>
23217 </div></blockquote>
23218
23219 !! end
23220
23221 !! test
23222 Paragraphs inside blockquotes/divs (extra line break on open and close)
23223 !! wikitext
23224 <blockquote><div>
23225 Line one
23226
23227 Line two
23228 </div></blockquote>
23229 !! html
23230 <blockquote><div>
23231 <p>Line one
23232 </p><p>Line two
23233 </p>
23234 </div></blockquote>
23235
23236 !! end
23237
23238 !! test
23239 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23240 !! options
23241 wgLinkHolderBatchSize=0
23242 !! wikitext
23243 [[meatball:1]]
23244 [[meatball:2]]
23245 [[meatball:3]]
23246 !! html
23247 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23248 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23249 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23250 </p>
23251 !! end
23252
23253 !! test
23254 Free external link invading image caption
23255 !! wikitext
23256 [[Image:Foobar.jpg|thumb|http://x|hello]]
23257 !! html/php
23258 <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>
23259
23260 !! html/parsoid
23261 <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>
23262 !! end
23263
23264 !! test
23265 T17196: localised external link numbers
23266 !! options
23267 language=fa
23268 !! wikitext
23269 [http://en.wikipedia.org/]
23270 !! html/php
23271 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23272 </p>
23273 !! html/parsoid
23274 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23275 !! end
23276
23277 !! test
23278 Multibyte character in padleft
23279 !! wikitext
23280 {{padleft:-Hello|7|Æ}}
23281 !! html/php
23282 <p>Æ-Hello
23283 </p>
23284 !! html/parsoid
23285 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23286 !! end
23287
23288 !! test
23289 Multibyte character in padright
23290 !! wikitext
23291 {{padright:Hello-|7|Æ}}
23292 !! html/php
23293 <p>Hello-Æ
23294 </p>
23295 !! html/parsoid
23296 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23297 !! end
23298
23299 !!test
23300 formatdate parser function
23301 !! wikitext
23302 {{#formatdate:2009-03-24}}
23303 !! html
23304 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23305 </p>
23306 !! end
23307
23308 !!test
23309 formatdate parser function, with default format
23310 !! wikitext
23311 {{#formatdate:2009-03-24|mdy}}
23312 !! html
23313 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23314 </p>
23315 !! end
23316
23317 !! test
23318 Spacing of numbers in formatted dates
23319 !! wikitext
23320 {{#formatdate:January 15}}
23321 !! html
23322 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23323 </p>
23324 !! end
23325
23326 !! test
23327 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
23328 !! options
23329 language=nl title=[[MediaWiki:Common.css]]
23330 !! wikitext
23331 {{#formatdate:2009-03-24|dmy}}
23332 !! html
23333 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23334 </p>
23335 !! end
23336
23337 #
23338 #
23339 #
23340
23341 #
23342 # Edit comments
23343 #
23344
23345 !! test
23346 Edit comment with link
23347 !! options
23348 comment
23349 !! wikitext
23350 I like the [[Main Page]] a lot
23351 !! html/php
23352 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23353 !!end
23354
23355 !! test
23356 Edit comment with link and link text
23357 !! options
23358 comment
23359 !! wikitext
23360 I like the [[Main Page|best pages]] a lot
23361 !! html/php
23362 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23363 !!end
23364
23365 !! test
23366 Edit comment with link and link text with suffix
23367 !! options
23368 comment
23369 !! wikitext
23370 I like the [[Main Page|best page]]s a lot
23371 !! html/php
23372 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23373 !!end
23374
23375 !! test
23376 Edit comment with section link (non-local, eg in history list)
23377 !! options
23378 comment title=[[Main Page]]
23379 !! wikitext
23380 /* External links */ removed bogus entries
23381 !! html/php
23382 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23383 !!end
23384
23385 !! test
23386 Edit comment with section link and text before it (non-local, eg in history list)
23387 !! options
23388 comment title=[[Main Page]]
23389 !! wikitext
23390 pre-comment text /* External links */ removed bogus entries
23391 !! html/php
23392 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>
23393 !!end
23394
23395 !! test
23396 Edit comment with section link (local, eg in diff view)
23397 !! options
23398 comment local title=[[Main Page]]
23399 !! wikitext
23400 /* External links */ removed bogus entries
23401 !! html/php
23402 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23403 !!end
23404
23405 !! test
23406 Edit comment with subpage link (T16080)
23407 !! options
23408 comment
23409 subpage
23410 title=[[Subpage test]]
23411 !! wikitext
23412 Poked at a [[/subpage]] here...
23413 !! html/php
23414 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23415 !!end
23416
23417 !! test
23418 Edit comment with subpage link and link text (T16080)
23419 !! options
23420 comment
23421 subpage
23422 title=[[Subpage test]]
23423 !! wikitext
23424 Poked at a [[/subpage|neat little page]] here...
23425 !! html/php
23426 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23427 !!end
23428
23429 !! test
23430 Edit comment with bogus subpage link in non-subpage NS (T16080)
23431 !! options
23432 comment
23433 title=[[Subpage test]]
23434 !! wikitext
23435 Poked at a [[/subpage]] here...
23436 !! html/php
23437 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...
23438 !!end
23439
23440 !! test
23441 Edit comment with bare anchor link (local, as on diff)
23442 !! options
23443 comment
23444 local
23445 title=[[Main Page]]
23446 !! wikitext
23447 [[#section]]
23448 !! html/php
23449 <a href="#section">#section</a>
23450 !! end
23451
23452 !! test
23453 Edit comment with bare anchor link (non-local, as on history)
23454 !! options
23455 comment
23456 title=[[Main Page]]
23457 !! wikitext
23458 [[#section]]
23459 !! html/php
23460 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23461 !! end
23462
23463 !! test
23464 Anchor starting with underscore
23465 !! options
23466 title=[[Foo]]
23467 !! wikitext
23468 [[#_ref|One]]
23469 !! html/php
23470 <p><a href="#_ref">One</a>
23471 </p>
23472 !! html/parsoid
23473 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23474 !! end
23475
23476 !! test
23477 Id starting with underscore
23478 !! wikitext
23479 <div id="_ref"></div>
23480 !! html/*
23481 <div id="_ref"></div>
23482
23483 !! end
23484
23485 !! test
23486 Edit comment with link with more than one pipe (T99346)
23487 !! options
23488 comment
23489 !! wikitext
23490 [[Main Page|Many|pipes]]
23491 !! html/php
23492 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23493 !! end
23494
23495 !! test
23496 Complex edit comment with link with more than one pipe (T99346)
23497 !! options
23498 comment
23499 !! wikitext
23500 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23501 !! html/php
23502 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;
23503 !! end
23504
23505 !! test
23506 Space normalisation on autocomment (T24784)
23507 !! options
23508 comment
23509 title=[[Main Page]]
23510 !! wikitext
23511 /* __hello__world__ */
23512 !! html/php
23513 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23514 !! end
23515
23516 !! test
23517 percent-encoding and + signs in comments (T28410)
23518 !! options
23519 comment
23520 !! wikitext
23521 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23522 !! html/php
23523 <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>
23524 !! end
23525
23526 # Parsoid doesn't support this yet: see T75581
23527 # but it *should* omit the 'src' attribute if the image is bad.
23528 # PHP side of tests was disabled in
23529 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23530 # because of issues in the PHP parserTests infrastructure
23531 # (but the output below is indeed what the PHP side emits)
23532 !! test
23533 Bad images - basic functionality
23534 !! wikitext
23535 [[File:Bad.jpg]]
23536 !! html/php+disabled
23537 !! html/parsoid
23538 <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>
23539 !! end
23540
23541 !! test
23542 Bad images - T18039: text after bad image disappears
23543 !! wikitext
23544 Foo bar
23545 [[File:Bad.jpg]]
23546 Bar foo
23547 !! html/php+disabled
23548 <p>Foo bar
23549 </p><p>Bar foo
23550 </p>
23551 !! html/parsoid
23552 <p>Foo bar
23553 <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>
23554 Bar foo</p>
23555 !! end
23556
23557 !! test
23558 Verify that displaytitle works (T24501) no displaytitle
23559 !! options
23560 showtitle
23561 !! config
23562 wgAllowDisplayTitle=true
23563 wgRestrictDisplayTitle=false
23564 !! wikitext
23565 this is not the the title
23566 !! html/php
23567 Parser test
23568 <p>this is not the the title
23569 </p>
23570 !! end
23571
23572 !! test
23573 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23574 !! options
23575 showtitle
23576 title=[[Screen]]
23577 !! config
23578 wgAllowDisplayTitle=true
23579 wgRestrictDisplayTitle=false
23580 !! wikitext
23581 this is not the the title
23582 {{DISPLAYTITLE:whatever}}
23583 !! html/php
23584 whatever
23585 <p>this is not the the title
23586 </p>
23587 !! end
23588
23589 !! test
23590 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23591 !! options
23592 showtitle
23593 title=[[Screen]]
23594 !! config
23595 wgAllowDisplayTitle=true
23596 wgRestrictDisplayTitle=true
23597 !! wikitext
23598 this is not the the title
23599 {{DISPLAYTITLE:whatever}}
23600 !! html/php
23601 Screen
23602 <p>this is not the the title
23603 </p>
23604 !! end
23605
23606 !! test
23607 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23608 !! options
23609 showtitle
23610 title=[[Screen]]
23611 !! config
23612 wgAllowDisplayTitle=true
23613 wgRestrictDisplayTitle=true
23614 !! wikitext
23615 this is not the the title
23616 {{DISPLAYTITLE:screen}}
23617 !! html/php
23618 screen
23619 <p>this is not the the title
23620 </p>
23621 !! end
23622
23623 !! test
23624 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23625 !! options
23626 showtitle
23627 title=[[Screen]]
23628 !! config
23629 wgAllowDisplayTitle=false
23630 !! wikitext
23631 this is not the the title
23632 {{DISPLAYTITLE:screen}}
23633 !! html/php
23634 Screen
23635 <p>this is not the the title
23636 <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>
23637 </p>
23638 !! end
23639
23640 !! test
23641 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23642 !! options
23643 showtitle
23644 title=[[Screen]]
23645 !! config
23646 wgAllowDisplayTitle=false
23647 !! wikitext
23648 this is not the the title
23649 !! html/php
23650 Screen
23651 <p>this is not the the title
23652 </p>
23653 !! end
23654
23655 !! test
23656 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23657 !! options
23658 showtitle
23659 title=[[Screen]]
23660 !! config
23661 wgAllowDisplayTitle=true
23662 wgRestrictDisplayTitle=true
23663 !! wikitext
23664 this is not the the title
23665 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23666 !! html/php
23667 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23668 <p>this is not the the title
23669 </p>
23670 !! end
23671
23672 !! test
23673 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23674 !! options
23675 showtitle
23676 title=[[Screen]]
23677 !! config
23678 wgAllowDisplayTitle=true
23679 wgRestrictDisplayTitle=true
23680 !! wikitext
23681 this is not the the title
23682 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23683 !! html/php
23684 <span style="color: red;">s</span>creen
23685 <p>this is not the the title
23686 </p>
23687 !! end
23688
23689 !! test
23690 Page status indicators: Empty name is invalid
23691 !! options
23692 showindicators
23693 !! wikitext
23694 <indicator name=" "></indicator>
23695 <indicator></indicator>
23696 !! html/php
23697 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23698 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23699 </p>
23700 !! end
23701
23702 !! test
23703 Page status indicators: Weird syntaxes that are okay
23704 !! options
23705 showindicators
23706 !! wikitext
23707 <indicator name="empty" />
23708 <indicator name="name"></indicator>
23709 !! html/php
23710 empty=
23711 name=
23712 <p><br />
23713 </p>
23714 !! end
23715
23716 !! test
23717 Page status indicators: Torture test
23718 !! options
23719 showindicators
23720 !! wikitext
23721 <indicator name="01">hello world</indicator>
23722 <indicator name="02">[[Main Page]]</indicator>
23723 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23724 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23725 <indicator name="05">*foo
23726 *bar</indicator>
23727 <indicator name="06"><nowiki>foo</nowiki></indicator>
23728 <indicator name="07"> Preformatted</indicator>
23729 <indicator name="08"><div>Broken tag</indicator>
23730 <indicator name="09">{| class=wikitable
23731 |cell
23732 |}</indicator>
23733 <indicator name="10">Two
23734
23735 paragraphs</indicator>
23736 !! html/php
23737 01=hello world
23738 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23739 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" />
23740 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>
23741 05=<ul><li>foo</li>
23742 <li>bar</li></ul>
23743
23744 06=foo
23745 07=<pre>Preformatted
23746 </pre>
23747 08=<div>Broken tag</div>
23748
23749 09=<table class="wikitable">
23750 <tr>
23751 <td>cell
23752 </td></tr></table>
23753
23754 10=<p>Two
23755 </p><p>paragraphs
23756 </p>
23757 <p><br />
23758 </p><p><br />
23759 </p><p><br />
23760 </p><p><br />
23761 </p><p><br />
23762 </p>
23763 !! end
23764
23765 !! test
23766 preload: check <noinclude> and <includeonly>
23767 !! options
23768 preload
23769 !! wikitext
23770 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23771 !! html/php
23772 Hello kind world.
23773 !! end
23774
23775 !! test
23776 preload: check <onlyinclude>
23777 !! options
23778 preload
23779 !! wikitext
23780 Goodbye <onlyinclude>Hello world</onlyinclude>
23781 !! html/php
23782 Hello world
23783 !! end
23784
23785 !! test
23786 preload: can pass tags through if we want to
23787 !! options
23788 preload
23789 !! wikitext
23790 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23791 !! html/php
23792 <includeonly>Hello world</includeonly>
23793 !! end
23794
23795 !! test
23796 preload: check that it doesn't try to do tricks
23797 !! options
23798 preload
23799 !! wikitext
23800 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23801 !! html/php
23802 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23803 !! end
23804
23805 !! test
23806 Play a bit with r67090 and T5158
23807 !! wikitext
23808 <div style="width:50% !important">&nbsp;</div>
23809 <div style="width:50%&nbsp;!important">&nbsp;</div>
23810 <div style="width:50%&#160;!important">&nbsp;</div>
23811 <div style="border : solid;">&nbsp;</div>
23812 !! html/php
23813 <div style="width:50% !important">&#160;</div>
23814 <div style="width:50% !important">&#160;</div>
23815 <div style="width:50% !important">&#160;</div>
23816 <div style="border&#160;: solid;">&#160;</div>
23817
23818 !! html/parsoid
23819 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23820 <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>
23821 <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>
23822 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23823
23824 !! end
23825
23826 !! test
23827 HTML5 data attributes
23828 !! wikitext
23829 <span data-foo="bar">Baz</span>
23830 <p data-abc-def_hij="">Quuz</p>
23831 !! html/php
23832 <p><span data-foo="bar">Baz</span>
23833 </p>
23834 <p data-abc-def_hij="">Quuz</p>
23835
23836 !! html/parsoid
23837 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23838 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23839 !! end
23840
23841 !! test
23842 Strip reserved data attributes
23843 !! wikitext
23844 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23845 !! html/php
23846 <div data-ok="fred">d</div>
23847
23848 !! html/parsoid
23849 <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>
23850 !! end
23851
23852 !! test
23853 percent-encoding and + signs in internal links (T28410)
23854 !! wikitext
23855 [[User:+%]] [[Page+title%]]
23856 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23857 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23858 [[%33%45]] [[%33%45+]]
23859 !! html/php
23860 <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>
23861 <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>
23862 <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>
23863 <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>
23864 </p>
23865 !! html/parsoid
23866 <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>
23867 <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>
23868 <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>
23869 <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>
23870 !! end
23871
23872 !! test
23873 Special characters in embedded file links (T29679)
23874 !! wikitext
23875 [[File:Contains & ampersand.jpg]]
23876 [[File:Does not exist.jpg|Title with & ampersand]]
23877 !! html/php
23878 <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>
23879 <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>
23880 </p>
23881 !! html/parsoid
23882 <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>
23883 <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>
23884 !! end
23885
23886 !! test
23887 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23888 !! wikitext
23889 Text&apos;s been normalized?
23890 !! html
23891 <p>Text&#39;s been normalized?
23892 </p>
23893 !! end
23894
23895 !! test
23896 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23897 !! wikitext
23898 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23899 !! html
23900 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23901 </p>
23902 !! end
23903
23904 !! test
23905 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23906 !! wikitext
23907 [http://www.example.org/ ideograms]
23908 !! html
23909 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23910 </p>
23911 !! end
23912
23913 !! test
23914 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23915 !! wikitext
23916 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23917 !! html
23918 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23919 </p>
23920 !! end
23921
23922 !! article
23923 Mediawiki:loop1
23924 !! text
23925 {{Identical|A}}
23926 !! endarticle
23927
23928 !! article
23929 Mediawiki:loop2
23930 !! text
23931 {{Identical|B}}
23932 !! endarticle
23933
23934 !! article
23935 Template:Identical
23936 !! text
23937 {{int:loop1}}
23938 {{int:loop2}}
23939 !! endarticle
23940
23941 !! test
23942 T33098 Template which includes system messages which includes the template
23943 !! wikitext
23944 {{Identical}}
23945 !! html
23946 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23947 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23948 </p>
23949 !! end
23950
23951 !! test
23952 T33490 Turkish: ucfirst 'blah'
23953 !! options
23954 language=tr
23955 !! wikitext
23956 {{ucfirst:blah}}
23957 !! html
23958 <p>Blah
23959 </p>
23960 !! end
23961
23962 !! test
23963 T33490 Turkish: ucfirst 'ix'
23964 !! options
23965 language=tr
23966 !! wikitext
23967 {{ucfirst:ix}}
23968 !! html
23969 <p>İx
23970 </p>
23971 !! end
23972
23973 !! test
23974 T33490 Turkish: lcfirst 'BLAH'
23975 !! options
23976 language=tr
23977 !! wikitext
23978 {{lcfirst:BLAH}}
23979 !! html
23980 <p>bLAH
23981 </p>
23982 !! end
23983
23984 !! test
23985 T33490 Turkish: ucfırst (with a dotless i)
23986 !! options
23987 language=tr
23988 !! wikitext
23989 {{ucfırst:blah}}
23990 !! html
23991 <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>
23992 </p>
23993 !! end
23994
23995 !! test
23996 T33490 ucfırst (with a dotless i) with English language
23997 !! options
23998 language=en
23999 !! wikitext
24000 {{ucfırst:blah}}
24001 !! html
24002 <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>
24003 </p>
24004 !! end
24005
24006 # Note that Parsoid doesn't emit an explicit TOC.
24007 # Note also that the html2wt direction tends to emit an extra newline
24008 # between the __TOC__ magicword and the first heading unless *both*
24009 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24010 # it's "{}").
24011
24012 !! test
24013 T28375: TOC with italics
24014 !! options
24015 title=[[Main Page]]
24016 !! wikitext
24017 __TOC__
24018 ==''Lost'' episodes==
24019 !! html/php
24020 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24021 <ul>
24022 <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>
24023 </ul>
24024 </div>
24025
24026 <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>
24027
24028 !! html/parsoid
24029 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24030 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24031 !! end
24032
24033 !! test
24034 T28375: TOC with bold
24035 !! options
24036 title=[[Main Page]]
24037 !! wikitext
24038 __TOC__
24039 =='''should be bold''' then normal text==
24040 !! html/php
24041 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24042 <ul>
24043 <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>
24044 </ul>
24045 </div>
24046
24047 <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>
24048
24049 !! html/parsoid
24050 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24051 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24052 !! end
24053
24054 !! test
24055 T35845: Headings become cursive in TOC when they contain an image
24056 !! options
24057 title=[[Main Page]]
24058 !! wikitext
24059 __TOC__
24060 ==Image [[Image:foobar.jpg]]==
24061 !! html/php
24062 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24063 <ul>
24064 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24065 </ul>
24066 </div>
24067
24068 <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>
24069
24070 !! html/parsoid
24071 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24072 <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>
24073 !! end
24074
24075 !! test
24076 T35845 (2): Headings become bold in TOC when they contain a blockquote
24077 !! options
24078 title=[[Main Page]]
24079 !! wikitext
24080 __TOC__
24081 ==<blockquote>Quote</blockquote>==
24082 !! html/php
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>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>
24090
24091 !! html/php+tidy
24092 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24093 <ul>
24094 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24095 </ul>
24096 </div>
24097
24098 <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>
24099 !! html/parsoid
24100 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24101 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24102 !! end
24103
24104 !! test
24105 Unclosed tags in TOC
24106 !! config
24107 wgFragmentMode=[ 'html5', 'legacy' ]
24108 !! options
24109 title=[[Main Page]]
24110 !! wikitext
24111 __TOC__
24112 ==Proof: 2 < 3==
24113 <small>Hanc marginis exiguitas non caperet.</small>
24114 QED
24115 !! html/php
24116 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24117 <ul>
24118 <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>
24119 </ul>
24120 </div>
24121
24122 <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>
24123 <p><small>Hanc marginis exiguitas non caperet.</small>
24124 QED
24125 </p>
24126 !! html/parsoid
24127 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24128 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24129 <p><small>Hanc marginis exiguitas non caperet.</small>
24130 QED</p>
24131 !! end
24132
24133 !! test
24134 Multiple tags in TOC
24135 !! wikitext
24136 __TOC__
24137 ==<i>Foo</i> <b>Bar</b>==
24138
24139 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24140 !! html/php
24141 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24142 <ul>
24143 <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>
24144 <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>
24145 </ul>
24146 </div>
24147
24148 <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>
24149 <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>
24150
24151 !! html/php+tidy
24152 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24153 <ul>
24154 <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>
24155 <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>
24156 </ul>
24157 </div>
24158
24159 <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>
24160 <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>
24161 !! html/parsoid
24162 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24163 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24164
24165 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24166 !! end
24167
24168 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24169 # html5 tag parsing.
24170 !! test
24171 Tags with parameters in TOC
24172 !! options
24173 parsoid=wt2html
24174 !! wikitext
24175 __TOC__
24176 ==<sup class="in-h2">Hello</sup>==
24177
24178 ==<sup class="a > b">Evilbye</sup>==
24179 !! html/php
24180 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24181 <ul>
24182 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24183 <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>
24184 </ul>
24185 </div>
24186
24187 <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>
24188 <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>
24189
24190 !! html/parsoid
24191 <meta property="mw:PageProp/toc" />
24192 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24193
24194 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24195 !! end
24196
24197 !! test
24198 span tags with directionality in TOC
24199 !! wikitext
24200 __TOC__
24201 ==<span dir="ltr">C++</span>==
24202
24203 ==<span dir="rtl">זבנג!</span>==
24204
24205 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24206
24207 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24208
24209 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24210 !! html/php
24211 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24212 <ul>
24213 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
24214 <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>
24215 <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>
24216 <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>
24217 <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>
24218 </ul>
24219 </div>
24220
24221 <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>
24222 <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>
24223 <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>
24224 <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>
24225 <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>
24226
24227 !! html/parsoid
24228 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24229 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24230 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24231 <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>
24232 <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>
24233 <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>
24234 !! end
24235
24236 !! test
24237 T74884: bdi element in ToC
24238 !! wikitext
24239 __TOC__
24240 ==<bdi>test</bdi>==
24241 !! html/php
24242 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24243 <ul>
24244 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24245 </ul>
24246 </div>
24247
24248 <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>
24249
24250 !! html/parsoid
24251 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24252 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24253 !! end
24254
24255 !! test
24256 T35715: s/strike element in ToC
24257 !! wikitext
24258 __TOC__
24259 ==<s>test</s> test <strike>test</strike>==
24260 !! html/php
24261 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24262 <ul>
24263 <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>
24264 </ul>
24265 </div>
24266
24267 <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>
24268
24269 !! html/parsoid
24270 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24271 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24272 !! end
24273
24274 !! test
24275 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24276 !! wikitext
24277 __TOC__
24278 ==x==
24279 !! html/php
24280 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24281 <ul>
24282 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24283 </ul>
24284 </div>
24285
24286 <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>
24287
24288 !! html/parsoid
24289 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24290 <h2 id="x" data-parsoid='{}'>x</h2>
24291 !! end
24292
24293 !! article
24294 MediaWiki:T34057
24295 !! text
24296 == {{int:headline_sample}} ==
24297 !! endarticle
24298
24299 !! test
24300 T34057: Title needed when expanding <h> nodes.
24301 !! options
24302 title=[[Main Page]]
24303 !! wikitext
24304 {{int:T34057}}
24305 !! html
24306 <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>
24307
24308 !! end
24309
24310 !! test
24311 Strip marker in urlencode
24312 !! wikitext
24313 {{urlencode:x<nowiki/>y}}
24314 {{urlencode:x<nowiki/>y|wiki}}
24315 {{urlencode:x<nowiki/>y|path}}
24316 {{urlencode:x<pre id="one">two</pre>y}}
24317 !! html/php
24318 <p>xy
24319 xy
24320 xy
24321 xy
24322 </p>
24323 !! end
24324
24325 !! test
24326 Strip marker in lc
24327 !! wikitext
24328 {{lc:x<nowiki/>y}}
24329 !! html
24330 <p>xy
24331 </p>
24332 !! end
24333
24334 !! test
24335 Strip marker in uc
24336 !! wikitext
24337 {{uc:x<nowiki/>y}}
24338 !! html
24339 <p>XY
24340 </p>
24341 !! end
24342
24343 !! test
24344 Strip marker in formatNum
24345 !! wikitext
24346 {{formatnum:1<nowiki/>2}}
24347 {{formatnum:1<nowiki/>2|R}}
24348 !! html
24349 <p>12
24350 12
24351 </p>
24352 !! end
24353
24354 !! test
24355 Check noCommafy in formatNum
24356 !! options
24357 language=be-tarask
24358 !! wikitext
24359 {{formatnum:123456.78}}
24360 {{formatnum:123456.78|NOSEP}}
24361 !! html
24362 <p>123 456,78
24363 123456.78
24364 </p>
24365 !! end
24366
24367 !! test
24368 Wrong option for formatNum (T58199)
24369 !! wikitext
24370 {{formatnum:1,234.56|Random}}
24371 {{formatnum:1,234.56|EVERYTHING}}
24372 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24373 !! html
24374 <p>1,234.56
24375 1,234.56
24376 1,234.56
24377 </p>
24378 !! end
24379
24380 !! test
24381 Strip marker in grammar
24382 !! options
24383 language=fi
24384 !! wikitext
24385 {{grammar:elative|foo<nowiki/>bar}}
24386 !! html
24387 <p>foobarista
24388 </p>
24389 !! end
24390
24391 !! test
24392 Strip marker in padleft
24393 !! wikitext
24394 {{padleft:|2|x<nowiki/>y}}
24395 !! html
24396 <p>xy
24397 </p>
24398 !! end
24399
24400 !! test
24401 Strip marker in padright
24402 !! wikitext
24403 {{padright:|2|x<nowiki/>y}}
24404 !! html
24405 <p>xy
24406 </p>
24407 !! end
24408
24409 !! test
24410 Strip marker in anchorencode
24411 !! wikitext
24412 {{anchorencode:x<nowiki/>y}}
24413 !! html/php
24414 <p>xy
24415 </p>
24416 !! html/parsoid
24417 <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>
24418 !! end
24419
24420 !! test
24421 nowiki inside link inside heading (T20295)
24422 !! wikitext
24423 ==[[foo|x<nowiki>y</nowiki>z]]==
24424 !! html
24425 <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>
24426
24427 !! end
24428
24429 !! test
24430 new support for bdi element (T33817)
24431 !! wikitext
24432 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24433 !! html
24434 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24435
24436 !!end
24437
24438 !! test
24439 Ignore pipe between table row attributes
24440 !! wikitext
24441 {|
24442 |quux
24443 |- id=foo | style='color: red'
24444 |bar
24445 |}
24446 !! html
24447 <table>
24448 <tr>
24449 <td>quux
24450 </td></tr>
24451 <tr id="foo" style="color: red">
24452 <td>bar
24453 </td></tr></table>
24454
24455 !! end
24456
24457 !!test
24458 Language parser function
24459 !! wikitext
24460 {{#language:ar}}
24461 !! html
24462 <p>العربية
24463 </p>
24464 !! end
24465
24466 !!test
24467 Padleft and padright (default 0-padding)
24468 !! wikitext
24469 {{padleft:xyz|5}}
24470 {{padright:xyz|5}}
24471 !! html/php
24472 <p>00xyz
24473 xyz00
24474 </p>
24475 !! html/parsoid
24476 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24477 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24478 !! end
24479
24480 !!test
24481 Padleft and padright (partial fill)
24482 !! wikitext
24483 {{padleft:xyz|6|ab}}
24484 {{padright:xyz|6|ab}}
24485 !! html/php
24486 <p>abaxyz
24487 xyzaba
24488 </p>
24489 !! html/parsoid
24490 <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>
24491 <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>
24492 !! end
24493
24494 !!test
24495 Padleft and padright as substr
24496 !! wikitext
24497 {{padleft:|3|abcde}}
24498 {{padright:|3|abcde}}
24499 !! html/php
24500 <p>abc
24501 abc
24502 </p>
24503 !! html/parsoid
24504 <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>
24505 <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>
24506 !! end
24507
24508 !!test
24509 Special parser function
24510 !! wikitext
24511 {{#special:RandomPage}}
24512 {{#special:BaDtItLe}}
24513 {{#special:Foobar}}
24514 !! html
24515 <p>Special:Random
24516 Special:Badtitle
24517 Special:Foobar
24518 </p>
24519 !! end
24520
24521 !!test
24522 T36939 - Case insensitive link parsing ([HttP://])
24523 !! wikitext
24524 [HttP://MediaWiki.Org/]
24525 !! html/php
24526 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24527 </p>
24528 !! html/parsoid
24529 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24530 !! end
24531
24532 !!test
24533 T36939 - Case insensitive link parsing ([HttP:// title])
24534 !! wikitext
24535 [HttP://MediaWiki.Org/ MediaWiki]
24536 !! html
24537 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24538 </p>
24539 !! end
24540
24541 !!test
24542 T36939 - Case insensitive link parsing (HttP://)
24543 !! wikitext
24544 HttP://MediaWiki.Org/
24545 !! html/php
24546 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24547 </p>
24548 !! html/parsoid
24549 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24550 !! end
24551
24552 !!test
24553 Disable TOC
24554 !! options
24555 notoc
24556 !! wikitext
24557 Lead
24558 ==Section 1==
24559 ==Section 2==
24560 ==Section 3==
24561 ==Section 4==
24562 ==Section 5==
24563 !! html
24564 <p>Lead
24565 </p>
24566
24567 <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>
24568 <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>
24569 <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>
24570 <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>
24571 <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>
24572
24573 !! end
24574
24575
24576 ###
24577 ### Parsoid-specific tests
24578 ### Parsoid-PHP parser incompatibilities
24579 ###
24580 !!test
24581 1. SOL-sensitive wikitext tokens as template-args
24582 !!options
24583 parsoid=wt2html,wt2wt
24584 !! wikitext
24585 {{echo|*a}}
24586 {{echo|#a}}
24587 {{echo|:a}}
24588 !! html
24589 <span about="#mwt1" typeof="mw:Transclusion">
24590 </span><ul about="#mwt1"><li>a</li>
24591 </ul>
24592 <span about="#mwt2" typeof="mw:Transclusion">
24593 </span><ol about="#mwt2"><li>a</li>
24594 </ol>
24595 <span about="#mwt3" typeof="mw:Transclusion">
24596 </span><dl about="#mwt3"><dd>a</dd>
24597 </dl>
24598 !!end
24599
24600 #### -----------------------------------------------------------------
24601 #### Parsoid-specific functionality tests
24602 #### -----------------------------------------------------------------
24603
24604 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24605 # We know wt2wt will fail, but we expect selser to pass.
24606 # Due to the nature of our testing, wt2wt and selser tests will enter the
24607 # blacklist and we'll catch selser regressions based on changes to the
24608 # blacklist entries for selser tests.
24609 !! test
24610 1. Bad treebuilder fixup of formatting elt is cleaned up
24611 !! options
24612 parsoid=wt2html,wt2wt
24613 !! wikitext
24614 {|
24615 |
24616 <small>
24617 [[Image:Foobar.jpg|right|Test]]
24618 </small>
24619 |}
24620 !! html/parsoid
24621 <table>
24622 <tbody><tr><td>
24623 <small>
24624 <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>
24625 </small>
24626 </td></tr>
24627 </tbody></table>
24628 !! end
24629
24630 !! test
24631 2. Bad treebuilder fixup of formatting elt is cleaned up
24632 !! options
24633 parsoid=wt2html,wt2wt
24634 !! wikitext
24635 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24636
24637 <small>[[Image:Foobar.jpg|right|300px]]</small>
24638 !! html/parsoid
24639
24640 <p><b>foo</b></p>
24641 <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>
24642 <p><b>bar</b></p>
24643 <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>
24644 !! end
24645
24646 !! test
24647 3. Bad treebuilder fixup of formatting elt is cleaned up
24648 !! options
24649 parsoid=wt2html,wt2wt
24650 !! wikitext
24651 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24652 !! html/parsoid
24653 <p><small><b>foo</b></small></p>
24654 <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>
24655 <p><small><b>bar</b></small></p>
24656 !! end
24657
24658 !! test
24659 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24660 !! options
24661 parsoid=wt2html,wt2wt
24662 !! wikitext
24663 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24664 !! html/parsoid
24665 <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>
24666 !! end
24667
24668 #### ----------------------------------------------------------------
24669 #### Parsoid-only testing of Parsoid's impl of LST
24670 #### Not implemented yet, see
24671 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24672 #### ----------------------------------------------------------------
24673
24674 ## We still need to support serializing the older format while content is stored.
24675 !! test
24676 LST Sections: Backwards compatibility
24677 !! options
24678 parsoid={
24679 "suppressErrors": true,
24680 "modes": ["html2wt"]
24681 }
24682 !! wikitext
24683 <section begin="2011-05-16" />
24684 <section end="2014-04-10 (MW 1.23wmf22)" />
24685 !! html/parsoid
24686 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24687 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24688 !! end
24689
24690 !! test
24691 LST Sections: Newfangled approach
24692 !! wikitext
24693 <section begin="2011-05-16" />
24694 <section end="2014-04-10 (MW 1.23wmf22)" />
24695 !! html/parsoid
24696 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24697 </span>
24698 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24699 </span></p>
24700 !! end
24701
24702 #--------- Test stripping of empty nodes in template content ----------
24703
24704 !! test
24705 Empty LI and TR nodes should be stripped from template content
24706 !! wikitext
24707 {{EmptyLITest}}
24708 {{EmptyTRTest}}
24709 !! html/parsoid
24710 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24711 <li>a</li>
24712 <li>b</li>
24713 </ul>
24714 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24715 <tbody>
24716 <tr>
24717 <td>foo</td>
24718 </tr>
24719 <tr>
24720 <td>bar</td>
24721 </tr>
24722 </tbody>
24723 </table>
24724 !! end
24725
24726 !! test
24727 Empty LI and TR nodes should not be stripped from top-level content
24728 !! wikitext
24729 * a
24730 *
24731 * b
24732 {|
24733 |-
24734 |-
24735 |foo
24736 |}
24737 !! html/parsoid
24738 <ul>
24739 <li> a</li>
24740 <li class='mw-empty-elt'></li>
24741 <li> b</li>
24742 </ul>
24743 <table>
24744 <tbody>
24745 <tr class='mw-empty-elt'></tr>
24746 <tr>
24747 <td>foo</td>
24748 </tr>
24749 </tbody>
24750 </table>
24751 !! end
24752
24753 !! test
24754 Empty TR nodes should not be stripped if they have any attributes set
24755 !! wikitext
24756 {{EmptyTRWithHTMLAttrTest}}
24757 !! html/parsoid
24758 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24759 <tr align='center'></tr>
24760 <tr><td>foo</td></tr>
24761 <tr align='center'></tr>
24762 <tr><td>bar</td></tr>
24763 </table>
24764 !! end
24765
24766 #### ----------------------------------------------------------------
24767 #### The following section of tests are primarily to test
24768 #### wikitext escaping capabilities of Parsoid. Given that
24769 #### escaping can be done any number of ways, the wikitext (input)
24770 #### is always adjusted to reflect how Parsoid adds nowiki
24771 #### escape tags.
24772 ####
24773 #### We are marking several tests as parsoid-only since the
24774 #### HTML in the result section is different from what the
24775 #### PHP parser generates for it.
24776 #### ----------------------------------------------------------------
24777
24778
24779 #### --------------- Headings ---------------
24780 #### 0. Unnested
24781 #### 1. Nested inside html <h1>=foo=</h1>
24782 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24783 #### 3. Nested inside html with wikitext split by html tags
24784 #### 4. No escape needed
24785 #### 5. Empty headings <h1></h1>
24786 #### 6. Heading chars in SOL context
24787 #### ----------------------------------------
24788 !! test
24789 Headings: 0. Unnested
24790 !! options
24791 parsoid=html2wt
24792 !! html/parsoid
24793 <p>=foo=</p>
24794
24795 <p> =foo=
24796 <!--cmt-->
24797 =foo=</p>
24798
24799 <p>=foo<i>a</i>=</p>
24800 !! wikitext
24801 <nowiki>=foo=</nowiki>
24802
24803 <nowiki> </nowiki>=foo=
24804 <!--cmt-->
24805 <nowiki>=foo=</nowiki>
24806
24807 =foo''a''<nowiki>=</nowiki>
24808 !!end
24809
24810 # New headings and existing headings are handled differently
24811 !! test
24812 Headings: 1. Nested inside html
24813 !! options
24814 parsoid=html2wt
24815 !! html/parsoid
24816 <h1>=foo=</h1>
24817 <h2>=foo=</h2>
24818 <h3>=foo=</h3>
24819
24820 <h1 data-parsoid=''>=foo=</h1>
24821 <h2 data-parsoid=''>=foo=</h2>
24822 <h3 data-parsoid=''>=foo=</h3>
24823 <h4 data-parsoid=''>=foo=</h4>
24824 <h5 data-parsoid=''>=foo=</h5>
24825 <h6 data-parsoid=''>=foo=</h6>
24826 !! wikitext
24827 = =foo= =
24828
24829 == =foo= ==
24830
24831 === =foo= ===
24832
24833 =<nowiki>=foo=</nowiki>=
24834 ==<nowiki>=foo=</nowiki>==
24835 ===<nowiki>=foo=</nowiki>===
24836 ====<nowiki>=foo=</nowiki>====
24837 =====<nowiki>=foo=</nowiki>=====
24838 ======<nowiki>=foo=</nowiki>======
24839
24840 !!end
24841
24842 !! test
24843 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24844 !! options
24845 parsoid=html2wt
24846 !! html/parsoid
24847 <h1>foo</h1>*bar
24848 <h1>foo</h1>=bar
24849 <h1>foo</h1>=bar=
24850 !! wikitext
24851 = foo =
24852 <nowiki>*</nowiki>bar
24853
24854 = foo =
24855 =bar
24856
24857 = foo =
24858 <nowiki>=bar=</nowiki>
24859 !!end
24860
24861 !! test
24862 Headings: 3. Nested inside html with wikitext split by html tags
24863 !! options
24864 parsoid=html2wt
24865 !! html/parsoid
24866 <h1>=<b>bold</b>foo=</h1>
24867 !! wikitext
24868 = ='''bold'''foo= =
24869 !!end
24870
24871 !! test
24872 Headings: 4a. No escaping needed (testing just h1 and h2)
24873 !! options
24874 parsoid=html2wt
24875 !! html/parsoid
24876 <h1>=foo</h1>
24877 <h1>foo=</h1>
24878 <h1> =foo= </h1>
24879 <h1>=foo= bar</h1>
24880 <h2>=foo</h2>
24881 <h2>foo=</h2>
24882 <h1>=</h1>
24883 <h1><i>=</i>foo=</h1>
24884 !! wikitext
24885 = =foo =
24886
24887 = foo= =
24888
24889 = =foo= =
24890
24891 = =foo= bar =
24892
24893 == =foo ==
24894
24895 == foo= ==
24896
24897 = = =
24898
24899 = ''=''foo= =
24900 !!end
24901
24902 !! test
24903 Headings: 4b. No escaping needed (inside p-tags)
24904 !! options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 <p>=foo= x
24908 =foo= <s></s>
24909 </p>
24910 !! wikitext
24911 =foo= x
24912 =foo= <s></s>
24913 !! html/php
24914 <p>=foo= x
24915 =foo= <s></s>
24916 </p>
24917 !!end
24918
24919 !! test
24920 Headings: 4c. Short headings (1)
24921 !! options
24922 parsoid=html2wt
24923 !! html/parsoid
24924 <p>===
24925 </p>
24926 !! wikitext
24927 <nowiki>===</nowiki>
24928 !! html/php
24929 <p>===
24930 </p>
24931 !! end
24932
24933 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24934 !! test
24935 Headings: 4d. Short headings (2)
24936 !! options
24937 parsoid=wt2html,html2html
24938 !! wikitext
24939 =
24940 ==
24941 ===
24942 ====
24943 =====
24944 !! html/php
24945 <p>=
24946 ==
24947 </p>
24948 <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>
24949 <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>
24950 <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>
24951
24952 !! html/parsoid
24953 <p>=
24954 ==</p>
24955 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24956 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24957 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24958 !! end
24959
24960 !! test
24961 Headings: 5. Empty headings
24962 !! options
24963 parsoid=html2wt
24964 !! html/parsoid
24965 <h1 data-parsoid='{}'></h1>
24966
24967 <h2 data-parsoid='{}'></h2>
24968
24969 <h3 data-parsoid='{}'></h3>
24970
24971 <h4 data-parsoid='{}'></h4>
24972
24973 <h5 data-parsoid='{}'></h5>
24974
24975 <h6 data-parsoid='{}'></h6>
24976 !! wikitext
24977 =<nowiki/>=
24978
24979 ==<nowiki/>==
24980
24981 ===<nowiki/>===
24982
24983 ====<nowiki/>====
24984
24985 =====<nowiki/>=====
24986
24987 ======<nowiki/>======
24988 !!end
24989
24990 !! test
24991 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24992 !! options
24993 parsoid=html2wt
24994 !! html/parsoid
24995 <p>=a=</p>
24996
24997 <p>=a=</p>
24998
24999 <p>=a=</p>
25000 !! wikitext
25001 <nowiki>=a=</nowiki>
25002
25003 <nowiki>=a=</nowiki>
25004
25005 <nowiki>=a=</nowiki>
25006 !!end
25007
25008 !! test
25009 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25010 !! options
25011 parsoid=html2wt
25012 !! html/parsoid
25013 <p>=a=
25014 b</p>
25015
25016 <p>=a=
25017 b</p>
25018
25019 <p>=a=
25020 b</p>
25021 !! wikitext
25022 <nowiki>=a=</nowiki>
25023 b
25024
25025 <nowiki>=a=</nowiki>
25026 b
25027
25028 <nowiki>=a=</nowiki>
25029 b
25030 !!end
25031
25032 !! test
25033 Headings: 6c. Heading chars in SOL context (leading newline break)
25034 !! options
25035 parsoid=html2wt
25036 !! html/parsoid
25037 <p>a
25038 =b=</p>
25039 !! wikitext
25040 a
25041 <nowiki>=b=</nowiki>
25042 !!end
25043
25044 !! test
25045 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25046 !! options
25047 parsoid=html2wt
25048 !! html/parsoid
25049 <!--c0--><p>=a=</p>
25050
25051 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25052 !! wikitext
25053 <!--c0--><nowiki>=a=</nowiki>
25054
25055 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25056 !!end
25057
25058 !! test
25059 Headings: 6d. Heading chars in SOL context (No escaping needed)
25060 !! options
25061 parsoid=html2wt
25062 !! html/parsoid
25063 =a=<div>b</div>
25064 !! wikitext
25065 =a=<div>b</div>
25066 !!end
25067
25068 !! test
25069 Headings: 7. Insert a newline between new content and headings
25070 !! options
25071 parsoid=html2wt
25072 !! html/parsoid
25073 <h2>NEW</h2>
25074 <p>new</p>
25075 <h2 data-parsoid='{}'>A</h2>
25076 <p data-parsoid='{}'>a</p>
25077 !! wikitext
25078 == NEW ==
25079 new
25080
25081 ==A==
25082 a
25083
25084 !! end
25085
25086 !! test
25087 Headings: Used as horizontal rule
25088 !! config
25089 wgFragmentMode=[ 'html5', 'legacy' ]
25090 !! options
25091 parsoid=wt2html
25092 !! wikitext
25093 ===============
25094 !! html/php
25095 <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>
25096
25097 !! html/parsoid
25098 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25099 !! end
25100
25101 #### --------------- Lists ---------------
25102 #### 0. Outside nests (*foo, etc.)
25103 #### 1. Nested inside html <ul><li>*foo</li></ul>
25104 #### 2. Inside definition lists
25105 #### 3. Only bullets at start should be escaped
25106 #### 4. No escapes needed
25107 #### 5. No unnecessary escapes
25108 #### 6. Escape bullets in SOL position
25109 #### 7. Escape bullets in a multi-line context
25110 #### ----------------------------------------
25111
25112 !! test
25113 Lists: 0. Outside nests
25114 !! options
25115 parsoid=html2wt
25116 !! html/parsoid
25117 <p>*foo</p>
25118
25119 <p>#foo</p>
25120
25121 <p>;Foo:bar</p>
25122 !! wikitext
25123 <nowiki>*</nowiki>foo
25124
25125 <nowiki>#</nowiki>foo
25126
25127 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25128 !!end
25129
25130 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25131 ## to test wikitext escaping, and insignificant whitespace diffs
25132 ## cause PHP parser tests to barf
25133 !! test
25134 Lists: 1. Nested inside html (No unnecessary escapes)
25135 !! options
25136 parsoid=html2wt
25137 !! html/parsoid
25138 <ul>
25139 <li>*foo</li>
25140 <li>#foo</li>
25141 <li>:foo</li>
25142 <li>;foo</li>
25143 <li data-parsoid='{}'>*foo</li>
25144 <li data-parsoid='{}'>#foo</li>
25145 <li data-parsoid='{}'>:foo</li>
25146 <li data-parsoid='{}'>;foo</li>
25147 </ul>
25148
25149 <ol>
25150 <li>*foo</li>
25151 <li>#foo</li>
25152 <li>:foo</li>
25153 <li>;foo</li>
25154 <li data-parsoid='{}'>*foo</li>
25155 <li data-parsoid='{}'>#foo</li>
25156 <li data-parsoid='{}'>:foo</li>
25157 <li data-parsoid='{}'>;foo</li>
25158 </ol>
25159 !! wikitext
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
25169 # *foo
25170 # #foo
25171 # :foo
25172 # ;foo
25173 #<nowiki>*foo</nowiki>
25174 #<nowiki>#foo</nowiki>
25175 #<nowiki>:foo</nowiki>
25176 #<nowiki>;foo</nowiki>
25177 !!end
25178
25179 !! test
25180 Lists: 2. Inside definition lists
25181 !! options
25182 parsoid=html2wt
25183 !! html/parsoid
25184 <dl><dt>;foo</dt></dl>
25185 <dl><dt>:foo</dt></dl>
25186 <dl><dt>:foo</dt>
25187 <dd>bar</dd></dl>
25188 <dl><dd>:foo</dd></dl>
25189 !! wikitext
25190 ; ;foo
25191
25192 ; <nowiki>:foo</nowiki>
25193
25194 ; <nowiki>:foo</nowiki>
25195 : bar
25196
25197 : :foo
25198 !!end
25199
25200 !! test
25201 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <ul>
25206 <li>*foo*bar</li>
25207 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25208 </ul>
25209 !! wikitext
25210 * *foo*bar
25211 *<nowiki>*foo</nowiki>''it''*bar
25212 !!end
25213
25214 !! test
25215 Lists: 4. No escapes needed
25216 !! options
25217 parsoid=html2wt
25218 !! html/parsoid
25219 <ul>
25220 <li>foo*bar
25221 </li>
25222 </ul>
25223 <ul>
25224 <li><i>foo</i>*bar
25225 </li>
25226 </ul>
25227 <ul>
25228 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25229 </li>
25230 </ul>
25231 <ul>
25232 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25233 </li>
25234 </ul>
25235 !! wikitext
25236 *foo*bar
25237
25238 *''foo''*bar
25239
25240 *[[Foo]]: bar
25241
25242 *[[Foo]]*bar
25243 !!end
25244
25245 !! test
25246 Lists: 5. No unnecessary escapes
25247 !! options
25248 parsoid=html2wt
25249 !! html/parsoid
25250 <ul><li> bar <span>[[foo]]</span></li></ul>
25251 <ul><li> =bar <span>[[foo]]</span></li></ul>
25252 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25253 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25254 <ul><li> =bar <span>foo]]</span>=</li></ul>
25255 <ul><li> <s></s>: a</li></ul>
25256 <ul><li> <i>* foo</i></li></ul>
25257
25258 !! wikitext
25259 * bar <span><nowiki>[[foo]]</nowiki></span>
25260
25261 * =bar <span><nowiki>[[foo]]</nowiki></span>
25262
25263 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25264
25265 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25266
25267 * =bar <span>foo]]</span>=
25268
25269 * <s></s>: a
25270
25271 * ''* foo''
25272 !!end
25273
25274 !! test
25275 Lists: 6. Escape bullets in SOL position
25276 !! options
25277 parsoid=html2wt
25278 !! html/parsoid
25279 <p><!--cmt-->*foo</p>
25280 !! wikitext
25281 <!--cmt--><nowiki>*</nowiki>foo
25282 !!end
25283
25284 !! test
25285 Lists: 7. Escape bullets in a multi-line context
25286 !! options
25287 parsoid=html2wt
25288 !! html/parsoid
25289 <p>a
25290 *b
25291 </p>
25292 !! wikitext
25293 a
25294 <nowiki>*</nowiki>b
25295 !!end
25296
25297 !! test
25298 Lists: 8. Escape colons only if not present in tags
25299 !! options
25300 parsoid=html2wt
25301 !! html/parsoid
25302 <dl><dt>a:b<i>c:d</i></dt></dl>
25303 !! wikitext
25304 ; <nowiki>a:b</nowiki>''c:d''
25305 !! end
25306
25307 #### --------------- HRs ---------------
25308 #### 1. Single line
25309 #### -----------------------------------
25310
25311 !! test
25312 HRs: 1. Single line
25313 !! options
25314 parsoid=html2wt
25315 !! html/parsoid
25316 <hr />----
25317 <hr />=foo=
25318 <hr />*foo
25319 !! wikitext
25320 ----<nowiki>----</nowiki>
25321 ----=foo=
25322 ----*foo
25323 !! end
25324
25325 #### --------------- Tables ---------------
25326 #### 1a. Simple example
25327 #### 1b. No escaping needed (!foo)
25328 #### 1c. No escaping needed (|foo)
25329 #### 1d. No escaping needed (|}foo)
25330 ####
25331 #### 2a. Nested in td (<td>foo|bar</td>)
25332 #### 2b. Nested in td (<td>foo||bar</td>)
25333 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25334 ####
25335 #### 3a. Nested in th (<th>foo!bar</th>)
25336 #### 3b. Nested in th (<th>foo!!bar</th>)
25337 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25338 ####
25339 #### 4a. Escape -
25340 #### 4b. Escape +
25341 #### 4c. No escaping needed
25342 #### --------------------------------------
25343
25344 !! test
25345 Tables: 1a. Simple example
25346 !! options
25347 parsoid=html2wt
25348 !! html/parsoid
25349 <p>{|
25350 |}
25351 </p>
25352 !! wikitext
25353 <nowiki>{|</nowiki>
25354 |}
25355 !! end
25356
25357 !! test
25358 Tables: 1b. No escaping needed
25359 !! options
25360 parsoid=html2wt
25361 !! html/parsoid
25362 <p>!foo
25363 </p>
25364 !! wikitext
25365 !foo
25366 !! end
25367
25368 !! test
25369 Tables: 1c. No escaping needed
25370 !! options
25371 parsoid=html2wt
25372 !! html/parsoid
25373 <p>|foo
25374 </p>
25375 !! wikitext
25376 |foo
25377 !! end
25378
25379 !! test
25380 Tables: 1d. No escaping needed
25381 !! options
25382 parsoid=html2wt
25383 !! html/parsoid
25384 <p>|}foo
25385 </p>
25386 !! wikitext
25387 |}foo
25388 !! end
25389
25390 !! test
25391 Tables: 2a. Nested in td
25392 !! options
25393 parsoid=html2wt
25394 !! html/parsoid
25395 <table><tbody><tr>
25396 <td>foo|bar</td></tr>
25397 <tr><td>x<div>a|b</div></td>
25398 </tbody></table>
25399 !! wikitext
25400 {|
25401 |<nowiki>foo|bar</nowiki>
25402 |-
25403 |x<div><nowiki>a|b</nowiki></div>
25404 |}
25405 !! html/php+tidy
25406 <table>
25407 <tbody><tr>
25408 <td>foo|bar
25409 </td></tr>
25410 <tr>
25411 <td>x<div>a|b</div>
25412 </td></tr></tbody></table>
25413 !! end
25414
25415 !! test
25416 Tables: 2b. Nested in td
25417 !! options
25418 parsoid=html2wt
25419 !! html/parsoid
25420 <table><tbody><tr>
25421 <td>foo||bar</td>
25422 <td>a<i>b||c</i></td>
25423 <td>a<i><div>b||c</div></i></td>
25424 </tr></tbody></table>
25425 !! wikitext
25426 {|
25427 |<nowiki>foo||bar</nowiki>
25428 |a''<nowiki>b||c</nowiki>''
25429 |a''<div><nowiki>b||c</nowiki></div>''
25430 |}
25431 !! html/php
25432 <table>
25433 <tr>
25434 <td>foo||bar
25435 </td>
25436 <td>a<i>b||c</i>
25437 </td>
25438 <td>a<i><div>b||c</div></i>
25439 </td></tr></table>
25440
25441 !! end
25442
25443 !! test
25444 Tables: 2c. Nested in td -- no escaping needed
25445 !! options
25446 parsoid=html2wt
25447 !! html/*
25448 <table>
25449 <tr>
25450 <td>foo!!bar
25451 </td></tr></table>
25452
25453 !! wikitext
25454 {|
25455 |foo!!bar
25456 |}
25457 !! end
25458
25459 !! test
25460 Tables: 3a. Nested in th
25461 !! options
25462 parsoid=html2wt
25463 !! html/*
25464 <table>
25465 <tr>
25466 <th>foo!bar
25467 </th></tr></table>
25468
25469 !! wikitext
25470 {|
25471 !foo!bar
25472 |}
25473 !! end
25474
25475 !! test
25476 Tables: 3b. Nested in th
25477 !! options
25478 parsoid=html2wt
25479 !! html/parsoid
25480 <table><tbody>
25481 <tr><th>foo!!bar</th>
25482 <th><i>foo|bar</i></th>
25483 <th><i>foo!!bar</i></th>
25484 <th><i><span>foo!!bar</span></i></th>
25485 </tr></tbody></table>
25486 !! wikitext
25487 {|
25488 !<nowiki>foo!!bar</nowiki>
25489 !''<nowiki>foo|bar</nowiki>''
25490 !''<nowiki>foo!!bar</nowiki>''
25491 !''<span><nowiki>foo!!bar</nowiki></span>''
25492 |}
25493 !! html/php
25494 <table>
25495 <tr>
25496 <th>foo!!bar
25497 </th>
25498 <th><i>foo|bar</i>
25499 </th>
25500 <th><i>foo!!bar</i>
25501 </th>
25502 <th><i><span>foo!!bar</span></i>
25503 </th></tr></table>
25504
25505 !! end
25506
25507 !! test
25508 Tables: 3c. Nested in th
25509 !! options
25510 parsoid=html2wt
25511 !! html/parsoid
25512 <table><tbody>
25513 <tr><th>foo||bar</th>
25514 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25515 </tr></tbody></table>
25516 !! wikitext
25517 {|
25518 !<nowiki>foo||bar</nowiki>
25519 !<nowiki>foo||bar</nowiki>
25520 |}
25521 !! html/php
25522 <table>
25523 <tr>
25524 <th>foo||bar
25525 </th>
25526 <th>foo||bar
25527 </th></tr></table>
25528
25529 !! end
25530
25531 !! test
25532 Tables: 4a. Escape -
25533 !! options
25534 parsoid=html2wt
25535 !! html/*
25536 <table>
25537 <tr>
25538 <th>-bar
25539 </th></tr>
25540 <tr>
25541 <td>-bar
25542 </td></tr></table>
25543
25544 !! wikitext
25545 {|
25546 !-bar
25547 |-
25548 |<nowiki>-bar</nowiki>
25549 |}
25550 !! end
25551
25552 !! test
25553 Tables: 4b. Escape +
25554 !! options
25555 parsoid=html2wt
25556 !! html/*
25557 <table>
25558 <tr>
25559 <th>+bar
25560 </th></tr>
25561 <tr>
25562 <td>+bar
25563 </td></tr></table>
25564
25565 !! wikitext
25566 {|
25567 !+bar
25568 |-
25569 |<nowiki>+bar</nowiki>
25570 |}
25571 !! end
25572
25573 !! test
25574 Tables: 4c. No escaping needed
25575 !! options
25576 parsoid=html2wt
25577 !! html/parsoid
25578 <table><tbody>
25579 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25580 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25581 <tr><td>foo
25582 <p>bar|baz
25583 +bar
25584 -bar</p></td></tr>
25585 <tr><td>x
25586 <div>a|b</div></td>
25587 </tbody></table>
25588 !! wikitext
25589 {|
25590 |foo-bar
25591 |foo+bar
25592 |-
25593 |''foo''-bar
25594 |''foo''+bar
25595 |-
25596 |foo
25597 bar|baz
25598 +bar
25599 -bar
25600 |-
25601 |x
25602 <div>a|b</div>
25603 |}
25604 !! html/php
25605 <table>
25606 <tr>
25607 <td>foo-bar
25608 </td>
25609 <td>foo+bar
25610 </td></tr>
25611 <tr>
25612 <td><i>foo</i>-bar
25613 </td>
25614 <td><i>foo</i>+bar
25615 </td></tr>
25616 <tr>
25617 <td>foo
25618 <p>bar|baz
25619 +bar
25620 -bar
25621 </p>
25622 </td></tr>
25623 <tr>
25624 <td>x
25625 <div>a|b</div>
25626 </td></tr></table>
25627
25628 !! end
25629
25630 !! test
25631 Tables: 4d. No escaping needed
25632 !! options
25633 parsoid=html2wt
25634 !! html/parsoid
25635 <table>
25636 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25637 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25638 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25639 </tbody></table>
25640 !! wikitext
25641 {|
25642 |[[Foo]]-bar
25643 ||+1
25644 ||-2
25645 |}
25646 !! html/php
25647 <table>
25648 <tr>
25649 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25650 </td>
25651 <td>+1
25652 </td>
25653 <td>-2
25654 </td></tr></table>
25655
25656 !! end
25657
25658 !! test
25659 T97430: Don't emit empty nowiki pairs around marker meta tags
25660 !! options
25661 parsoid=html2wt
25662 !! html/parsoid
25663 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25664 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25665 !! wikitext
25666 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25667 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25668 !! end
25669
25670 !! test
25671 Unclosed xmlish element in table line shouldn't eat end delimiters
25672 !! options
25673 parsoid=html2wt
25674 !! html/parsoid
25675 <table>
25676 <tbody><tr><td> &lt;foo</td>
25677 <td> bar></td></tr>
25678 </tbody></table>
25679 !! wikitext
25680 {|
25681 | <foo
25682 | bar>
25683 |}
25684 !! html/php
25685 <table>
25686 <tr>
25687 <td>&lt;foo
25688 </td>
25689 <td>bar&gt;
25690 </td></tr></table>
25691
25692 !! end
25693
25694 #### --------------- Links ----------------
25695 #### 1. Quote marks in link text
25696 #### 2. Wikilinks: Escapes needed
25697 #### 3. Wikilinks: No escapes needed
25698 #### 4. Extlinks: Escapes needed
25699 #### 5. Extlinks: No escapes needed
25700 #### --------------------------------------
25701 !! test
25702 Links 1. WikiLinks: No escapes needed
25703 !! options
25704 parsoid=html2wt
25705 !! html/parsoid
25706 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25707 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25708 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25709 !! wikitext
25710 [[Foo|Foo''boo'']]
25711 [[Foo|[Foobar]]]
25712 [[Foo|x [Foobar] x]]
25713 !! html/php
25714 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25715 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25716 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25717 </p>
25718 !! end
25719
25720 !! test
25721 Links 2. WikiLinks: Escapes needed
25722 !! options
25723 parsoid=html2wt
25724 !! html/parsoid
25725 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25726 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25727 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25728 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25729 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25730 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25731 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25732 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25733 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25734 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25735 !! wikitext
25736 [[Foo|<nowiki>Foobar]</nowiki>]]
25737 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25738 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25739 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25740 [[Foo|<nowiki>|Bar</nowiki>]]
25741 [[Foo|<nowiki>]]bar</nowiki>]]
25742 [[Foo|<nowiki>[[bar</nowiki>]]
25743 [[Foo|<nowiki>x [[ y</nowiki>]]
25744 [[Foo|<nowiki>x ]] y</nowiki>]]
25745 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25746 !! html/php
25747 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25748 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25749 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25750 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25751 <a href="/wiki/Foo" title="Foo">|Bar</a>
25752 <a href="/wiki/Foo" title="Foo">]]bar</a>
25753 <a href="/wiki/Foo" title="Foo">[[bar</a>
25754 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25755 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25756 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25757 </p>
25758 !! end
25759
25760 !! test
25761 Links 3. WikiLinks: No escapes needed
25762 !! options
25763 parsoid=html2wt
25764 !! html/parsoid
25765 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25766 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25767 !! wikitext
25768 [[Foo|[Foobar]]
25769 [[Foo|foo|bar]]
25770 !! html/php
25771 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25772 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25773 </p>
25774 !! end
25775
25776 !! test
25777 Links 4. ExtLinks: Escapes needed
25778 !! options
25779 parsoid=html2wt
25780 !! html/parsoid
25781 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25782 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25783 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25784 <p>[http://google.com]</p>
25785 <p>[http://google.com google]</p>
25786 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25787 <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>
25788 !! wikitext
25789 [http://google.com <nowiki>[google]</nowiki>]
25790 [http://google.com <nowiki>google]</nowiki>]
25791 [http://google.com <nowiki>goog] le</nowiki>]
25792
25793 <nowiki>[http://google.com]</nowiki>
25794
25795 <nowiki>[http://google.com google]</nowiki>
25796
25797 [http://google.com<nowiki>]</nowiki>
25798
25799 [{{echo|http://google.com}}<nowiki>]</nowiki>
25800 !! html/php
25801 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25802 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25803 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25804 </p><p>[http://google.com]
25805 </p><p>[http://google.com google]
25806 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25807 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25808 </p>
25809 !! end
25810
25811 !! test
25812 Links 5. ExtLinks: No escapes needed
25813 !! options
25814 parsoid=html2wt
25815 !! html/parsoid
25816 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25817 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25818 !! wikitext
25819 [http://google.com [google]
25820
25821 [[http://google.com]]
25822 !! html/php
25823 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25824 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25825 </p>
25826 !! end
25827
25828 !! test
25829 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25830 !! options
25831 parsoid=html2wt
25832 !! html/parsoid
25833 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;x
25836 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25837 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25838 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25839 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25840 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25841 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25842 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25843 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25844 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25845 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25846 </p>
25847 !! wikitext
25848 x<nowiki/>http://example.com<nowiki/>y
25849 http://example.com<nowiki/>?x
25850 http://example.com<nowiki/>&x
25851 http://example.com<nowiki/>'x
25852 http://example.com<nowiki/>,x
25853 http://example.com<nowiki/>.x
25854 http://example.com<nowiki/>;x
25855 http://example.com<nowiki/>:x
25856 http://example.com<nowiki/>;x
25857 http://example.com<nowiki/>!x
25858 http://example.com<nowiki/>=x
25859 http://example.com<nowiki/>(x)
25860 http://example.com(x<nowiki/>)
25861 !! end
25862
25863 !! test
25864 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <p>x
25869 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25870 y
25871 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25872 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25873 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25874 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25875 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25876 </p>
25877 !! wikitext
25878 x
25879 http://example.com
25880 y
25881 "http://example.com"
25882 (http://example.com)
25883 (http://example.com) foo
25884 http://example.com,
25885 http://example.com, foo
25886 !! html/php
25887 <p>x
25888 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25889 y
25890 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25891 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25892 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25893 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25894 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25895 </p>
25896 !! end
25897
25898 !! test
25899 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25900 !! options
25901 parsoid=html2wt
25902 !! html/parsoid
25903 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25904 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25905 !! wikitext
25906 http://example.com.,;:!?\
25907 -http://example.com:
25908 !! html/php
25909 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25910 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25911 </p>
25912 !! end
25913
25914 !! test
25915 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25916 !! options
25917 parsoid=html2wt
25918 !! html/parsoid
25919 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25920 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25921 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25922 !! wikitext
25923 RFC 123<nowiki/>4
25924 RFC 123<nowiki/>y
25925 X<nowiki/>RFC 123<nowiki/>y
25926 !! end
25927
25928 !! test
25929 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25930 !! options
25931 parsoid=html2wt
25932 !! html/parsoid
25933 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25934 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25935 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25936 </p>
25937 !! wikitext
25938 RFC 123?foo
25939 RFC 123&foo
25940 -RFC 123-
25941 !! html/php
25942 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25943 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25944 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25945 </p>
25946 !! end
25947
25948 !! test
25949 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25950 !! options
25951 parsoid=html2wt
25952 !! html/parsoid
25953 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25954 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25955 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25956 !! wikitext
25957 PMID 123<nowiki/>4
25958 PMID 123<nowiki/>y
25959 X<nowiki/>PMID 123<nowiki/>y
25960 !! end
25961
25962 !! test
25963 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25964 !! options
25965 parsoid=html2wt
25966 !! html/parsoid
25967 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25968 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25969 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25970 </p>
25971 !! wikitext
25972 PMID 123?foo
25973 PMID 123&foo
25974 -PMID 123-
25975 !! html/php
25976 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25977 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25978 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25979 </p>
25980 !! end
25981
25982 !! test
25983 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25984 !! options
25985 parsoid=html2wt
25986 !! html/parsoid
25987 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25988 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25989 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25990 </p>
25991 !! wikitext
25992 ISBN 1234567890<nowiki/>1
25993 ISBN 1234567890<nowiki/>x
25994 a<nowiki/>ISBN 1234567890<nowiki/>b
25995 !! end
25996
25997 !! test
25998 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25999 !! options
26000 parsoid=html2wt
26001 !! html/parsoid
26002 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26003 !! wikitext
26004 -ISBN 1234567890's
26005 !! html/php
26006 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26007 </p>
26008 !! end
26009
26010 !! test
26011 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26012 !! options
26013 parsoid=html2wt
26014 !! html/*
26015 <p>this is not a link: http://example.com
26016 </p>
26017 !! wikitext
26018 this is not a link: <nowiki>http://example.com</nowiki>
26019 !! end
26020
26021 !! test
26022 Links 15. Link trails can't become link prefixes.
26023 !! options
26024 language=is
26025 parsoid=html2wt
26026 !! html/parsoid
26027 <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>
26028 !! wikitext
26029 [[Söfnuður]]-[[00]]
26030 !! html/php
26031 <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>
26032 </p>
26033 !! end
26034
26035 #### --------------- Quotes ---------------
26036 #### 1. Quotes inside <b> and <i>
26037 #### 2. Link fragments separated by <i> and <b> tags
26038 #### 3. Link fragments inside <i> and <b>
26039 #### 4. No escaping needed
26040 #### --------------------------------------
26041 !! test
26042 1a. Quotes inside <b> and <i>
26043 !! options
26044 parsoid=html2wt
26045 !! html/*
26046 <p><i>'foo'</i>
26047 <i>''foo''</i>
26048 <i>'''foo'''</i>
26049 <i>foo</i>'s
26050 <b>'foo'</b>
26051 <b>''foo''</b>
26052 <b>'''foo'''</b>
26053 <b>foo'<i>bar'</i>baz</b>
26054 <b>foo</b>'s
26055 '<i>foo</i>
26056 <i>foo</i>'
26057 <i>foo'</i>'
26058 '<i>foo</i>'
26059 '<b>foo</b>
26060 <b>foo</b>'
26061 '<b>foo</b>'
26062 <i>fools'<span> errand</span></i>
26063 <i><span>fool</span>'s errand</i>
26064 '<i>foo</i> bar '<i>baz</i>
26065 a|!*#-:;+-~[]{}b'<i>x</i>
26066 </p>
26067 !! wikitext
26068 ''<nowiki/>'foo'''
26069 ''<nowiki>''foo''</nowiki>''
26070 ''<nowiki>'''foo'''</nowiki>''
26071 ''foo''<nowiki/>'s
26072 '''<nowiki/>'foo''''
26073 '''<nowiki>''foo''</nowiki>'''
26074 '''<nowiki>'''foo'''</nowiki>'''
26075 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26076 '''foo'''<nowiki/>'s
26077 '''foo''
26078 ''foo''<nowiki/>'
26079 ''foo'''<nowiki/>'
26080 '''foo''<nowiki/>'
26081 ''''foo'''
26082 '''foo'''<nowiki/>'
26083 ''''foo'''<nowiki/>'
26084 ''fools'<span> errand</span>''
26085 ''<span>fool</span>'s errand''
26086 '<nowiki/>''foo'' bar '''baz''
26087 a|!*#-:;+-~[]{}b'''x''
26088 !! end
26089
26090 !! test
26091 1b. Quotes inside <b> and <i> with other tags on same line
26092 !! options
26093 parsoid=html2wt
26094 !! html/parsoid
26095 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26096 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26097 <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>
26098 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26099 '<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>
26100 '<i>foo</i> <div title="name">test</div>
26101 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26102 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26103 <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>
26104 </ol>
26105 !! wikitext
26106 '''a'' foo ''[[bar]]''
26107 ''a''' foo ''[[bar]]''
26108 ''a''' foo '''{{echo|[[bar]]}}'''
26109 [[foo]] x'''[[bar]]''
26110 '''foo'' <ref>test</ref>
26111 '''foo'' <div title="name">test</div>
26112 '''foo'' and <br> bar
26113 <references />
26114 !! end
26115
26116 !! test
26117 2. Link fragments separated by <i> and <b> tags
26118 !! options
26119 parsoid=html2wt
26120 !! html/parsoid
26121 <p>[[<i>foo</i>hello]]</p>
26122 <p>[[<b>foo</b>hello]]</p>
26123 !! wikitext
26124 [[''foo''<nowiki>hello]]</nowiki>
26125
26126 [['''foo'''<nowiki>hello]]</nowiki>
26127 !! end
26128
26129 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26130 # this is one of the shortcomings of this format
26131 !! test
26132 3. Link fragments inside <i> and <b>
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <p><i>[[foo</i>]]</p>
26137 <p><b>[[foo</b>]]</p>
26138 !! wikitext
26139 ''[[foo''<nowiki>]]</nowiki>
26140
26141 '''[[foo'''<nowiki>]]</nowiki>
26142 !! end
26143
26144 !! test
26145 4. No escaping needed
26146 !! options
26147 parsoid=html2wt
26148 !! html/parsoid
26149 <p>'<span><i>bar</i></span>'
26150 '<span><b>bar</b></span>'
26151 'a:b'foo
26152 </p>
26153 !! wikitext
26154 '<span>''bar''</span>'
26155 '<span>'''bar'''</span>'
26156 'a:b'foo
26157 !! end
26158
26159 #### ----------- Paragraphs ---------------
26160 #### 1. No unnecessary escapes
26161 #### --------------------------------------
26162
26163 !! test
26164 1. No unnecessary escapes
26165 !! options
26166 parsoid=html2wt
26167 !! html/parsoid
26168 <p>bar <span>[[foo]]</span>
26169 </p><p>=bar <span>[[foo]]</span>
26170 </p><p>[[bar <span>[[foo]]</span>
26171 </p><p>]]bar <span>[[foo]]</span>
26172 </p><p>=bar <span>foo]]</span>=
26173 </p>
26174 !! wikitext
26175 bar <span><nowiki>[[foo]]</nowiki></span>
26176
26177 =bar <span><nowiki>[[foo]]</nowiki></span>
26178
26179 [[bar <span><nowiki>[[foo]]</nowiki></span>
26180
26181 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26182
26183 =bar <span>foo]]</span><nowiki>=</nowiki>
26184 !!end
26185
26186 #### ----------------------- PRE --------------------------
26187 #### 1. Leading whitespace in SOL context should be escaped
26188 #### ------------------------------------------------------
26189 !! test
26190 1. Leading whitespace in SOL context should be escaped
26191 !! options
26192 parsoid=html2wt
26193 !! html/parsoid
26194 <p> a</p>
26195
26196 <p> a</p>
26197
26198 <p> a(tab)</p>
26199
26200 <p> a
26201 <!--cmt-->
26202 a</p>
26203
26204 <p>a
26205 b</p>
26206
26207 <p>a
26208 b</p>
26209
26210 <p>a
26211 b</p>
26212 !! wikitext
26213 <nowiki> </nowiki>a
26214
26215 <nowiki> </nowiki> a
26216
26217 a(tab)
26218
26219 <nowiki> </nowiki> a
26220 <!--cmt-->
26221 <nowiki> </nowiki>a
26222
26223 a
26224 <nowiki> </nowiki>b
26225
26226 a
26227 b
26228
26229 a
26230 b
26231 !! html/php
26232 <p> a
26233 </p><p> a
26234 </p><p> a(tab)
26235 </p><p> a
26236 a
26237 </p><p>a
26238 b
26239 </p><p>a
26240 b
26241 </p><p>a
26242 b
26243 </p>
26244 !! end
26245
26246 !! test
26247 2. Leading whitespace in non-indent-pre contexts should not be escaped
26248 !! options
26249 parsoid=html2wt
26250 !! html/parsoid
26251 <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>
26252 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26253 <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>
26254 b</span></li>
26255 </ol>
26256 !! wikitext
26257 foo <ref>''a''
26258 b</ref>
26259 <references />
26260 !! end
26261
26262 !! test
26263 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26264 !! options
26265 parsoid=html2wt
26266 !! html/parsoid
26267 <blockquote>
26268 <p>
26269 a
26270 <span>b</span>
26271 c</p>
26272 </blockquote>
26273 !! wikitext
26274 <blockquote>
26275 a
26276 <span>b</span>
26277 c
26278 </blockquote>
26279 !! end
26280
26281 !! test
26282 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26283 !! options
26284 parsoid=html2wt
26285 !! html/parsoid
26286 <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>
26287 !! wikitext
26288 [[File:Foobar.jpg|thumb|caption]]
26289 !! end
26290
26291 !! test
26292 5. Nowiki escaping should account for indent-pres
26293 !! options
26294 parsoid=html2wt
26295 !! html/parsoid
26296 <pre>==foo==</pre>
26297 !! wikitext
26298 ==foo==
26299 !! end
26300
26301 !!test
26302 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26303 !! options
26304 parsoid=html2wt
26305 !! html/parsoid
26306 <pre>
26307 * foo
26308 * bar
26309 </pre>
26310 !! wikitext
26311 * foo
26312 * bar
26313 !! end
26314
26315 #### --------------- Behavior Switches --------------------
26316
26317 !! test
26318 1. Valid behavior switches should be escaped
26319 !! options
26320 parsoid=html2wt
26321 !! html/parsoid
26322 __TOC__
26323 <i>__TOC__</i>
26324 !! wikitext
26325 <nowiki>__TOC__</nowiki>
26326 ''<nowiki>__TOC__</nowiki>''
26327 !! end
26328
26329 !! test
26330 2. Invalid behavior switches should not be escaped
26331 !! options
26332 parsoid=html2wt
26333 !! html/parsoid
26334 __TOO__
26335 __|__
26336 !! wikitext
26337 __TOO__
26338 __|__
26339 !! end
26340
26341 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26342 !! test
26343 Behavior switches should be SOL-transparent
26344 !! options
26345 parsoid=html2wt
26346 !! html/parsoid
26347 <meta property="mw:PageProp/toc" />
26348
26349 <!-- this one's bogus -->
26350 <pre>__TOO__</pre>
26351
26352 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26353
26354 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26355 !! wikitext
26356 __TOC__
26357
26358 <!-- this one's bogus -->
26359 __TOO__
26360
26361 __TOC__ foo
26362
26363 __TOC__
26364 bar
26365 !! end
26366
26367 #### --------------- HTML tags ---------------
26368 #### 1. a tags
26369 #### 2. other tags
26370 #### 3. multi-line html tag
26371 #### 4. extension tags
26372 #### -----------------------------------------
26373 !! test
26374 1. a tags
26375 !! options
26376 parsoid=html2wt
26377 !! html/parsoid
26378 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26379 !! wikitext
26380 <a href="http://google.com">google</a>
26381 !! end
26382
26383 !! test
26384 2. other tags
26385 !! options
26386 parsoid=html2wt
26387 !! html/parsoid
26388 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26389 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26390 <li> &lt;td&gt;</li></ul>
26391
26392 !! wikitext
26393 * <nowiki><div>foo</div></nowiki>
26394 * <nowiki><div style="color:red">foo</div></nowiki>
26395 * <nowiki><td></nowiki>
26396 !! end
26397
26398 !! test
26399 3. multi-line html tag
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 <p>&lt;div
26404 &gt;foo&lt;/div
26405 &gt;
26406 </p>
26407 !! wikitext
26408 <nowiki><div
26409 >foo</div
26410 ></nowiki>
26411 !! end
26412
26413 !! test
26414 4. extension tags
26415 !! options
26416 parsoid=html2wt
26417 !! html/parsoid
26418 <p>&lt;ref&gt;foo&lt;/ref&gt;
26419 </p><p>&lt;ref&gt;bar
26420 </p><p>baz&lt;/ref&gt;
26421 </p>
26422 !! wikitext
26423 <nowiki><ref>foo</ref></nowiki>
26424
26425 <nowiki><ref>bar</nowiki>
26426
26427 baz<nowiki></ref></nowiki>
26428 !! end
26429
26430 #### --------------- Others ---------------
26431 !! test
26432 Escaping nowikis
26433 !! options
26434 parsoid=html2wt
26435 !! html/parsoid
26436 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26437 </p>
26438 !! wikitext
26439 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26440 !! end
26441
26442 ## The quote-char in the input is necessary for triggering the bug
26443 !! test
26444 (T54035) Nowiki-escaping should not get tripped by " :" in text
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <p>foo's bar :</p>
26449 !! wikitext
26450 foo's bar :
26451 !! end
26452
26453 #----------- End of wikitext escaping tests --------------
26454
26455 !! test
26456
26457 Tag-like HTML structures are passed through as text
26458 !! wikitext
26459 <x y>
26460
26461 <x.y>
26462
26463 <x-y>
26464
26465 1>2
26466
26467 x<y
26468
26469 a>b
26470
26471 1<d e>f
26472 !! html
26473 <p>&lt;x y&gt;
26474 </p><p>&lt;x.y&gt;
26475 </p><p>&lt;x-y&gt;
26476 </p><p>1&gt;2
26477 </p><p>x&lt;y
26478 </p><p>a&gt;b
26479 </p><p>1&lt;d e&gt;f
26480 </p>
26481 !! end
26482
26483 !! test
26484 HTML tag with necessary entities in attributes
26485 !! wikitext
26486 <span title="&amp;amp;">foo</span>
26487 !! html
26488 <p><span title="&amp;amp;">foo</span>
26489 </p>
26490 !! end
26491
26492 !! test
26493 HTML tag with 'unnecessary' entity encoding in attributes
26494 !! wikitext
26495 <span title="&amp;">foo</span>
26496 !! html
26497 <p><span title="&amp;">foo</span>
26498 </p>
26499 !! end
26500
26501 !! test
26502 HTML tag with broken attribute value quoting
26503 !! options
26504 parsoid=wt2html,html2html
26505 !! wikitext
26506 <span title="Hello world>Foo</span>
26507 !! html/php
26508 <p><span title="Hello world">Foo</span>
26509 </p>
26510 !! html/parsoid
26511 <p><span title="Hello world">Foo</span></p>
26512 !! end
26513
26514 !! test
26515 Self-closed tag with broken attribute value quoting
26516 !! options
26517 parsoid=wt2html,html2html
26518 !! wikitext
26519 <div title="Hello world />Foo
26520 !! html/php+tidy
26521 <div title="Hello world"></div><p>Foo
26522 </p>
26523 !! html/parsoid
26524 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26525 !! end
26526
26527 !! test
26528 Table with broken attribute value quoting
26529 !! options
26530 parsoid=wt2html,html2html
26531 !! wikitext
26532 {|
26533 | title="Hello world|Foo
26534 |}
26535 !! html/php
26536 <table>
26537 <tr>
26538 <td title="Hello world">Foo
26539 </td></tr></table>
26540
26541 !! html/parsoid
26542 <table>
26543 <tr>
26544 <td title="Hello world">Foo
26545 </td></tr></table>
26546
26547 !! end
26548
26549 !! test
26550 Table with broken attribute value quoting on consecutive lines
26551 !! options
26552 parsoid=wt2html,html2html
26553 !! wikitext
26554 {|
26555 | title="Hello world|Foo
26556 | style="color:red|Bar
26557 |}
26558 !! html/php
26559 <table>
26560 <tr>
26561 <td title="Hello world">Foo
26562 </td>
26563 <td style="color:red">Bar
26564 </td></tr></table>
26565
26566 !! html/parsoid
26567 <table><tbody>
26568 <tr>
26569 <td title="Hello world">Foo
26570 </td><td style="color: red">Bar
26571 </td></tr></tbody></table>
26572
26573 !! end
26574
26575 !!test
26576 Accept empty td cell attribute
26577 !! wikitext
26578 {|
26579 | align="center" |foo|| |
26580 |}
26581 !! html
26582 <table>
26583 <tr>
26584 <td align="center">foo</td>
26585 <td>
26586 </td></tr></table>
26587
26588 !!end
26589
26590 !!test
26591 Non-empty attributes in th-cells
26592 !! wikitext
26593 {|
26594 !Foo!! style="color: red" |Bar
26595 |}
26596 !! html
26597 <table>
26598 <tr>
26599 <th>Foo</th>
26600 <th style="color: red">Bar
26601 </th></tr></table>
26602
26603 !!end
26604
26605 !!test
26606 Accept empty attributes in th-cells
26607 !! wikitext
26608 {|
26609 !|foo!!|bar
26610 |}
26611 !! html
26612 <table>
26613 <tr>
26614 <th>foo</th>
26615 <th>bar
26616 </th></tr></table>
26617
26618 !!end
26619
26620 !!test
26621 Empty table rows go away
26622 !! wikitext
26623 {|
26624 |Hello
26625 |there
26626 |- class="foo"
26627 |-
26628 |}
26629 !! html
26630 <table>
26631 <tr>
26632 <td>Hello
26633 </td>
26634 <td>there
26635 </td></tr>
26636
26637 </table>
26638
26639 !! end
26640
26641 ###
26642 ### Parsoid-centric tests for testing RTing of inter-element separators
26643 ### Edge cases not tested by existing parser tests and specific to
26644 ### Parsoid-specific serialization strategies.
26645 ###
26646
26647 !!test
26648 RT-ed inter-element separators should be valid separators
26649 !! wikitext
26650 {|
26651 |- [[foo]]
26652 |}
26653 !! html/php
26654 <table>
26655
26656 </table>
26657
26658 !! html/parsoid
26659 <table>
26660 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26661 </tbody></table>
26662 !!end
26663
26664 # Parsoid-only test of a DOM pass
26665 !!test
26666 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26667 !! wikitext
26668 {|
26669 |<small>foo
26670 bar
26671 |}
26672
26673 {|
26674 |<small>foo<small>
26675 |}
26676 !! html/parsoid
26677 <table>
26678 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26679 <p>bar</p></small></td></tr>
26680 </tbody></table>
26681
26682 <table>
26683 <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>
26684 </tbody></table>
26685 !!end
26686
26687 # Note that the "style" attribute is really a template parameter here.
26688 # The = would have to be {{=}} if you wanted the literal.
26689 !!test
26690 Empty TD followed by TD with tpl-generated attribute
26691 !! wikitext
26692 {|
26693 |-
26694 |
26695 |{{echo|style='color:red'}}|foo
26696 |}
26697 !! html
26698 <table>
26699
26700 <tr>
26701 <td>
26702 </td>
26703 <td>foo
26704 </td></tr></table>
26705
26706 !!end
26707
26708 !!test
26709 Indented table with an empty td
26710 !! wikitext
26711 {|
26712 |-
26713 |
26714 |foo
26715 |}
26716 !! html
26717 <table>
26718
26719 <tr>
26720 <td>
26721 </td>
26722 <td>foo
26723 </td></tr></table>
26724
26725 !!end
26726
26727 ## We have some newline diffs RT-ing this edge case
26728 ## and it is not important enough -- we seem to be emitting
26729 ## at most 2 newlines after a </tr> and this is unrelated to
26730 ## the issue from T85627 that this is testing.
26731 !!test
26732 Indented table with blank lines in between (T85627)
26733 !! options
26734 parsoid=wt2html
26735 !! wikitext
26736 {|
26737 |foo
26738
26739
26740 |}
26741 !! html
26742 <table>
26743
26744 <tr>
26745 <td>foo
26746 </td></tr></table>
26747
26748 !!end
26749
26750 !!test
26751 Indented block & table
26752 !! wikitext
26753 <div>foo</div>
26754 {|
26755 |foo
26756 |}
26757 !! html/php
26758 <div>foo</div>
26759 <table>
26760 <tr>
26761 <td>foo
26762 </td></tr></table>
26763
26764 !! html/parsoid
26765 <div data-parsoid='{"stx":"html"}'>foo</div>
26766 <table><tbody>
26767 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26768 </tbody></table>
26769 !!end
26770
26771 !! test
26772 Indent and comment before table row
26773 !! wikitext
26774 {|
26775 <!--hi-->|-
26776 |there
26777 |}
26778 !! html/php
26779 <table>
26780
26781 <tr>
26782 <td>there
26783 </td></tr></table>
26784
26785 !! html/parsoid
26786 <table>
26787 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26788 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26789 </tbody></table>
26790 !! end
26791
26792 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26793 !!test
26794 Empty TR followed by a template-generated TR
26795 !!options
26796 parsoid
26797 !! wikitext
26798 {|
26799 |-
26800 {{echo|<tr><td>foo</td></tr>}}
26801 |}
26802 !! html
26803 <table>
26804 <tbody>
26805 <tr class='mw-empty-elt'></tr>
26806 <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}}]}'>
26807 <td>foo</td></tr>
26808 </tbody></table>
26809 !!end
26810
26811 ## PHP and parsoid output differ for this, and since this is primarily
26812 ## for testing Parsoid's serializer, marking this Parsoid only
26813 !!test
26814 Empty TR followed by mixed-ws-comment line should RT correctly
26815 !!options
26816 parsoid
26817 !! wikitext
26818 {|
26819 |-
26820 <!--c-->
26821 |-
26822 <!--c--> <!--d-->
26823 |}
26824 !! html
26825 <table>
26826 <tbody>
26827 <tr class='mw-empty-elt'></tr>
26828 <!--c-->
26829 <tr>
26830 <!--c--> </tr><!--d-->
26831 </tbody></table>
26832
26833 !!end
26834
26835 !!test
26836 Multi-line image caption generated by templates with/without trailing newlines
26837 !! wikitext
26838 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26839 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26840 !! html/parsoid
26841 <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>
26842 <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>
26843 !!end
26844
26845 !! test
26846 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26847 !! options
26848 parsoid=html2wt
26849 !! html/parsoid
26850 <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>
26851
26852 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26853 !! wikitext
26854 <includeonly>foo</includeonly>
26855 new para
26856
26857 [[Category:Foo]]
26858
26859 = new heading =
26860 !! end
26861
26862 ## PHP emits broken html for this, and since this is primarily
26863 ## a Parsoid serializer test, marking this Parsoid only
26864 !!test
26865 Improperly nested inline or quotes tags with whitespace in between
26866 !! wikitext
26867 <span> <s>x</span> </s>
26868 ''' ''x''' ''
26869 !! html/parsoid
26870 <p><span> <s>x</s></span><s> </s>
26871 <b> <i>x</i></b><i> </i>
26872 </p>
26873 !!end
26874
26875 !!test
26876 Encapsulate protected attributes from wt
26877 !! wikitext
26878 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26879
26880 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26881 | ok
26882 |}
26883 !! html/parsoid
26884 <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>
26885
26886 <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">
26887 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26888 </tbody></table>
26889 !!end
26890
26891 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26892 ## Having nested or stray pre tags results in the attempt to add duplicates,
26893 ## causing an assertion fail. This test tries to prevent that situation.
26894 !!test
26895 Ensure ParagraphWrapper can deal with stray closing pre tags
26896 !!options
26897 parsoid=wt2html
26898 !! wikitext
26899 plain text</pre>
26900 !! html/parsoid
26901 plain text
26902 !!end
26903
26904 !!test
26905 1. Ensure fostered text content is wrapped in element nodes
26906 !!options
26907 parsoid=wt2html
26908 !! wikitext
26909 <table>hi</table><table>ho</table>
26910 !! html/parsoid
26911 <p>hi</p>
26912 <table></table>
26913 <p>ho</p>
26914 <table></table>
26915 !!end
26916
26917 !!test
26918 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26919 !!options
26920 parsoid=wt2html,wt2wt
26921 !! wikitext
26922 <table>
26923 <tr> || ||
26924 <td> a
26925 </table>
26926 !! html/parsoid
26927 <p> || ||
26928 </p><table>
26929 <tbody><tr><td> a</td></tr>
26930 </tbody></table>
26931 !!end
26932
26933 !!test
26934 Encapsulation properly handles null DSR information from foster box
26935 !!options
26936 parsoid=wt2html,wt2wt
26937 !! wikitext
26938 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26939 !! html/parsoid
26940 <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>
26941 !!end
26942
26943 !!test
26944 1. Encapsulate foster-parented transclusion content
26945 !!options
26946 parsoid=wt2wt,wt2html
26947 !! wikitext
26948 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26949 !! html/parsoid
26950 <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>
26951 <tbody>
26952 <tr>
26953 <td>bar</td>
26954 </tr>
26955 </tbody>
26956 </table>
26957 !!end
26958
26959 !!test
26960 2. Encapsulate foster-parented transclusion content
26961 !!options
26962 parsoid=wt2wt,wt2html
26963 !! wikitext
26964 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26965 !! html/parsoid
26966 <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>
26967 <table>
26968 <tbody>
26969 <tr>
26970 <td>bar</td>
26971 </tr>
26972 </tbody>
26973 </table>
26974 !!end
26975
26976 !!test
26977 3. Encapsulate foster-parented transclusion content
26978 !!options
26979 parsoid=wt2wt,wt2html
26980 !! wikitext
26981 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26982 !! html/parsoid
26983 <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;]}">
26984 <p>foo</p>
26985 </div>
26986 <table>
26987 <tbody>
26988 <tr>
26989 <td>bar</td>
26990 </tr>
26991 </tbody>
26992 </table>
26993 !!end
26994
26995 !!test
26996 4. Encapsulate foster-parented transclusion content
26997 !!options
26998 parsoid=wt2wt,wt2html
26999 !! wikitext
27000 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27001 !! html/parsoid
27002 <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;]}">
27003 <p>foo</p>
27004 </div>
27005 <table>
27006 <tbody>
27007 <tr>
27008 <td>bar</td>
27009 </tr>
27010 </tbody>
27011 </table>
27012 !!end
27013
27014 !!test
27015 5. Encapsulate foster-parented transclusion content
27016 !!options
27017 parsoid=wt2wt,wt2html
27018 !! wikitext
27019 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27020 !! html/parsoid
27021 <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>
27022 <table>
27023 <tbody>
27024 <tr>
27025 <td>
27026 <div>
27027 <p>foo</p>
27028 </div>
27029 </td>
27030 </tr>
27031 </tbody>
27032 </table>
27033 !!end
27034
27035 !!test
27036 6. Encapsulate foster-parented transclusion content
27037 !!options
27038 parsoid=wt2wt,wt2html
27039 !! wikitext
27040 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27041 !! html/parsoid
27042 <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>
27043 <table>
27044 <tbody>
27045 <tr>
27046 <td>
27047 <div>
27048 <p>foo</p>
27049 </div>
27050 </td>
27051 </tr>
27052 </tbody>
27053 </table>
27054 <p>ok</p>
27055 !!end
27056
27057 !!test
27058 7. Encapsulate foster-parented transclusion content
27059 !!options
27060 parsoid=wt2wt,wt2html
27061 !! wikitext
27062 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27063 !! html/parsoid
27064 <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>
27065 <table>
27066 <tbody>
27067 <tr>
27068 <td>bar</td>
27069 </tr>
27070 </tbody>
27071 </table>
27072 !!end
27073
27074 # Note that the wt is broken on purpose: the = should be {{=}} if you
27075 # don't want it to be a template parameter key.
27076 !!test
27077 8. Encapsulate foster-parented transclusion content
27078 !!options
27079 parsoid=wt2wt,wt2html
27080 !! wikitext
27081 {{echo|a
27082 }}{|{{echo|style='color:red'}}
27083 |-
27084 |b
27085 |}
27086 !! html/parsoid
27087 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27088 <span> </span>
27089 <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>
27090 <table>
27091 <tbody>
27092 <tr>
27093 <td>b</td>
27094 </tr>
27095 </tbody>
27096 </table>
27097 !!end
27098
27099 !!test
27100 9. Encapsulate foster-parented transclusion content
27101 !!options
27102 parsoid=wt2wt,wt2html
27103 !! wikitext
27104 <table>{{echo|hi</table>hello}}
27105 !! html/parsoid
27106 <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>
27107 !!end
27108
27109 !!test
27110 Table in fosterable position
27111 !!options
27112 parsoid=wt2html
27113 !! wikitext
27114 {{OpenTable}}
27115 <div>
27116 {|
27117 |}
27118 </div>
27119 |}
27120 !! html/parsoid
27121 <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">
27122 </span>
27123 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27124
27125 <table>
27126 </table>
27127 !!end
27128
27129 # Parsoid only for T66747
27130 !! test
27131 Properly encapsulate empty-content transclusions in fosterable positions
27132 !! wikitext
27133 <table>
27134 {{#if:|
27135 <td>foo</td>
27136 }}
27137 </table>
27138 !! html/parsoid
27139 <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"}]]}'>
27140
27141 </table>
27142 !! end
27143
27144 !! test
27145 Always encapsulate foster box when template range is expanded to table
27146 !! options
27147 parsoid=wt2wt
27148 !! wikitext
27149 {|
27150 hello
27151 {{OpenTable}}
27152 |}
27153 !! html/parsoid
27154
27155 !! end
27156
27157 !! test
27158 T115289: Unclosed table
27159 !! wikitext
27160 {{echo|<table>}}<!--c-->[[Category:Two]]
27161 !! html/parsoid
27162 <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>
27163 !! end
27164
27165 !! test
27166 T115289: Don't migrate newlines out of tables with fostered content
27167 !! wikitext
27168 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27169 !! html/parsoid
27170 <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>
27171 !! end
27172
27173 !! test
27174 T73074: More fostering fun
27175 !! wikitext
27176 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27177 !! html/parsoid
27178 <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>
27179 !! end
27180
27181 !!test
27182 Support <object> element with .data attribute
27183 !!options
27184 parsoid=html2wt
27185 !! html/parsoid
27186 <object data="test.swf"></object>
27187 !! wikitext
27188 <object data="test.swf"></object>
27189 !!end
27190
27191 !! test
27192 Don't block XML namespace declaration
27193 !! wikitext
27194 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27195 !! html/php
27196 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27197 </p>
27198 !! html/parsoid
27199 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27200 !! end
27201
27202 # -----------------------------------------------------------------
27203 # The following section of tests are primarily to spec requirements
27204 # around Parsoid's serialization (old, new, edited content)
27205 #
27206 # All these tests are marked Parsoid html2wt and html2html only
27207 # ----------------------------------------------------------------
27208
27209 !! test
27210 Ignore rel attribute in a-tags during serialization to url-links
27211 !! options
27212 parsoid=html2wt
27213 !! html/parsoid
27214 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27215 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27216 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27217 !! wikitext
27218 http://en.wikipedia.org/wiki/Foobar
27219 http://en.wikipedia.org/wiki/Foobar
27220 http://en.wikipedia.org/wiki/Foobar
27221 !! end
27222
27223 # 'mi' is a localinterwiki prefix as well as a language
27224 !! test
27225 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27226 !! options
27227 parsoid=html2wt
27228 !! html/parsoid
27229 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27230 !! wikitext
27231 [[Foo]]
27232 !! end
27233
27234 !! test
27235 Parsoid should accept interwiki shortcuts
27236 !! options
27237 parsoid=html2wt
27238 !! html/parsoid
27239 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27240 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27241 <a href='./fr:Foo'>Foo</a></p>
27242 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27243 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27244 <a href='fr%3AFoo'>Foo</a></p>
27245 <p><a href='FR%3AFoo'>Foo</a>
27246 <a href='./FR:Foo'>Foo</a></p>
27247 !! wikitext
27248 [[:fr:Foo|Foo]]
27249 [[:fr:Foo|Foo]]
27250 [[:fr:Foo|Foo]]
27251
27252 [[:fr:Foo|Foo]]
27253 [[:fr:Foo|Foo]]
27254 [[:fr:Foo|Foo]]
27255
27256 [[:fr:Foo|Foo]]
27257 [[:fr:Foo|Foo]]
27258 !! end
27259
27260 !! test
27261 Parsoid should not accept invalid interwiki shortcuts
27262 !! options
27263 parsoid=html2wt
27264 !! html/parsoid
27265 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27266 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27267 <a href='news:Foo'>Foo</a></p>
27268 !! wikitext
27269 [news:Foo Foo]
27270 [news:Foo Foo]
27271 [news:Foo Foo]
27272 !! end
27273
27274 # See T93839
27275 !! test
27276 New wikilinks should be serialized properly
27277 !! options
27278 parsoid=html2wt
27279 !! html/parsoid
27280 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27281 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27282 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27283 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27284 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27285 !! wikitext
27286 [[Foo]]
27287 [[Foo]]
27288 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27289 http://en.wikipedia.org/wiki/Foo
27290 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27291 !! end
27292
27293 !! test
27294 New wiki links (href variations)
27295 !! options
27296 parsoid=html2wt
27297 !! html/parsoid
27298 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27299 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27300 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27301 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27302 !! wikitext
27303 [[Foo_bar]]
27304 [[Foo_bar]]
27305 [[Foo_bar]]
27306 [[Toxine bactérienne]]
27307 !! end
27308
27309 !! test
27310 New wiki links (content string variations)
27311 !! options
27312 parsoid=html2wt
27313 !! html/parsoid
27314 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27315 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27316 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27317 !! wikitext
27318 [[Foo_bar]]
27319 [[Foo bar]]
27320 [[Foo_bar|./Foo_bar]]
27321 !! end
27322
27323 !! test
27324 New category links (href variations)
27325 !! options
27326 parsoid=html2wt
27327 !! html/parsoid
27328 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27329 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27330 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27331 !! wikitext
27332 [[Category:Toxine bactérienne]]
27333 [[Category:Toxine bactérienne]]
27334 [[Category:Toxine bactérienne]]
27335 !! end
27336
27337 !! test
27338 New sol transparent links don't need indent-pre nowiki protection
27339 !! options
27340 parsoid=html2wt
27341 language=de
27342 !! html/parsoid
27343 <link rel="mw:PageProp/redirect" href="./Main_Page">
27344 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27345 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27346 !! wikitext
27347 #WEITERLEITUNG [[Main Page]]
27348 <!-- this is good --> [[Category:Good]]
27349 <!-- this is great --> [[Kategorie:Great]]
27350 !! end
27351
27352 !! test
27353 New interlanguage links (href variations)
27354 !! options
27355 parsoid=html2wt
27356 !! html/parsoid
27357 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27358 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27359 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27360 !! wikitext
27361 [[es:Toxine bactérienne]]
27362 [[es:Toxine_bactérienne]]
27363 [[es:Toxine_bactérienne]]
27364 !! end
27365
27366 !! test
27367 Image: Modifying size of an image (1)
27368 !! options
27369 parsoid={
27370 "modes": ["wt2wt"],
27371 "changes": [
27372 ["img[height]", "attr", "height", "22"],
27373 ["img[width]", "attr", "width", "200"]
27374 ]
27375 }
27376 !! wikitext
27377 [[Image:Foobar.jpg|230x230px]]
27378 !! wikitext/edited
27379 [[Image:Foobar.jpg|200x200px]]
27380 !!end
27381
27382 !! test
27383 Image: Modifying size of an image (2)
27384 !! options
27385 parsoid={
27386 "modes": ["wt2wt"],
27387 "changes": [
27388 ["img[height]", "attr", "height", "100"],
27389 ["img[width]", "attr", "width", "500"]
27390 ]
27391 }
27392 !! wikitext
27393 [[Image:Foobar.jpg|230x230px]]
27394 !! wikitext/edited
27395 [[Image:Foobar.jpg|500x500px]]
27396 !!end
27397
27398 # Change in size is ignored so long as class='mw-default-size'
27399 !! test
27400 Image: Modifying size of an image (3)
27401 !! options
27402 parsoid={
27403 "modes": ["wt2wt"],
27404 "changes": [
27405 ["figure[class]", "removeClass", "mw-default-size"],
27406 ["figure img", "attr", "height", "19"],
27407 ["figure img", "attr", "width", "170"]
27408 ]
27409 }
27410 !! wikitext
27411 [[Image:Foobar.jpg|thumb]]
27412 !! wikitext/edited
27413 [[Image:Foobar.jpg|thumb|170x170px]]
27414 !!end
27415
27416 !! test
27417 Image: Modifying alignment of an image (T50665)
27418 !! options
27419 parsoid={
27420 "modes": ["wt2wt"],
27421 "changes": [
27422 ["figure[class]", "removeClass", "mw-halign-right"],
27423 ["figure[class]", "addClass", "mw-halign-left"]
27424 ]
27425 }
27426 !! wikitext
27427 [[Image:Foobar.jpg|thumb|caption|right]]
27428 !! wikitext/edited
27429 [[Image:Foobar.jpg|thumb|caption|left]]
27430 !! end
27431
27432 !! test
27433 Image: Modifying mw-default-size of an frameless image (T64805)
27434 !! options
27435 parsoid={
27436 "modes": ["wt2wt"],
27437 "changes": [
27438 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27439 ]
27440 }
27441 !! wikitext
27442 [[Image:Foobar.jpg|frameless|right]]
27443 !! wikitext/edited
27444 [[Image:Foobar.jpg|frameless|right|220x220px]]
27445 !! end
27446
27447 !! test
27448 Image: Modifying valign of an image (T51221)
27449 !! options
27450 parsoid={
27451 "modes": ["wt2wt"],
27452 "changes": [
27453 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27454 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27455 ]
27456 }
27457 !! wikitext
27458 [[File:Foobar.jpg|20px|middle]]
27459 !! wikitext/edited
27460 [[File:Foobar.jpg|20px|text-top]]
27461 !! end
27462
27463 !! test
27464 Image: Modifying alt attribute of an image (T58400)
27465 !! options
27466 parsoid={
27467 "modes": ["wt2wt"],
27468 "changes": [
27469 ["img[alt]", "attr", "alt", "some alternate edited text"]
27470 ]
27471 }
27472 !! wikitext
27473 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27474 !! wikitext/edited
27475 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27476 !!end
27477
27478 !! test
27479 Image: Modifying caption of an image
27480 !! options
27481 parsoid={
27482 "modes": ["wt2wt"],
27483 "changes": [
27484 ["figcaption", "text", "new caption"]
27485 ]
27486 }
27487 !! wikitext
27488 [[Image:Foobar.jpg|thumb|original caption]]
27489 !! wikitext/edited
27490 [[Image:Foobar.jpg|thumb|new caption]]
27491 !!end
27492
27493 !! test
27494 Image: empty alt attribute (T50924)
27495 !! options
27496 parsoid
27497 !! wikitext
27498 [[File:Foobar.jpg|thumb|alt=|bar]]
27499 !! html
27500 <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>
27501 !! end
27502
27503 !! test
27504 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27505 !! options
27506 parsoid=html2wt
27507 language=ar
27508 disabled
27509 !! html/parsoid
27510 <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>
27511 !! wikitext
27512 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27513 !! end
27514
27515 !! test
27516 Image: Block level image should have \n before and after
27517 !! wikitext
27518 123
27519 [[File:Foobar.jpg|right|thumb|150x150px]]
27520 456
27521 !! html/parsoid
27522 <p>123</p>
27523 <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>
27524 <p>456</p>
27525 !! end
27526
27527 !! test
27528 Image: New block level image should have \n before and after (existing content)
27529 !! wikitext
27530 123
27531 [[File:Foobar.jpg|right|thumb|150x150px]]
27532 456
27533 !! html/parsoid
27534 <p>123</p>
27535 <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>
27536 <p>456</p>
27537 !! end
27538
27539 !! test
27540 Image: upright option (parsoid)
27541 !! wikitext
27542 [[File:Foobar.jpg|thumb|upright|caption]]
27543 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27544 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27545 !! html/parsoid
27546 <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>
27547 <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>
27548 <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>
27549 !! end
27550
27551 !! test
27552 Image: upright option is ignored on inline and frame images (parsoid)
27553 !! wikitext
27554 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27555 !! html/parsoid
27556 <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>
27557 !! end
27558
27559 !! test
27560 Image: in template parameter with empty parameter
27561 !! wikitext
27562 {{echo|[[File:Foobar.jpg|link=]]}}
27563 !! html/parsoid
27564 <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>
27565 !! end
27566
27567 !! test
27568 Image: from basic HTML (1)
27569 !! options
27570 parsoid=html2wt
27571 !! html/parsoid
27572 <span typeof="mw:Image">
27573 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27574 </span>
27575 !! wikitext
27576 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27577 !! end
27578
27579 !! test
27580 Image: from basic HTML (2)
27581 !! options
27582 parsoid=html2wt
27583 !! html/parsoid
27584 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27585 !! wikitext
27586 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27587 !! end
27588
27589 !! test
27590 Image: from basic HTML (3)
27591 !! options
27592 parsoid=html2wt
27593 !! html/parsoid
27594 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27595 !! wikitext
27596 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27597 !! end
27598
27599 !! test
27600 Image: from basic HTML (4)
27601 !! options
27602 parsoid=html2wt
27603 !! html/parsoid
27604 <img src="./File:Foobar.jpg">
27605 !! wikitext
27606 [[File:Foobar.jpg|link=]]
27607 !! end
27608
27609 !! test
27610 Image: Invalid title as link
27611 !! wikitext
27612 [[File:Foobar.jpg|link=<]]
27613 !! html/php
27614 <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>
27615 </p>
27616 !! html/parsoid
27617 <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>
27618 !! end
27619
27620 !! test
27621 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27622 !! options
27623 parsoid=html2wt
27624 !! html/parsoid
27625 <ul>
27626 <li><p>foo</p></li>
27627 </ul>
27628 !! wikitext
27629 * foo
27630 !! end
27631
27632 !! test
27633 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27634 !! options
27635 parsoid=html2wt
27636 !! html/parsoid
27637 <ul> <li>foo</li></ul>
27638 !! wikitext
27639 * foo
27640 !! end
27641
27642 !! test
27643 Don't strip leading whitespace when handling indent-pre suppressing tags
27644 !! options
27645 parsoid=html2wt
27646 !! html/parsoid
27647 <table>
27648 <tr><td> indented row</td></tr>
27649 </table>
27650 <blockquote><p>
27651 <b>This is very bold of you!</b>
27652 </p>
27653 <table><tr><td>
27654 indented cell (no pre-wrapping!)
27655 </td></tr></table>
27656 </blockquote>
27657 <p>foo</p>
27658 <div>bar</div>
27659 !! wikitext
27660 {|
27661 | indented row
27662 |}
27663 <blockquote>
27664 '''This is very bold of you!'''
27665
27666 {|
27667 |
27668 indented cell (no pre-wrapping!)
27669 |}
27670 </blockquote>
27671 foo
27672 <div>bar</div>
27673 !! end
27674
27675 !! test
27676 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27677 !! options
27678 parsoid=html2wt
27679 !! html/parsoid
27680 <p>foo</p>
27681 <span>bar</span>
27682
27683 <span>foo2
27684 </span>bar2
27685
27686 <div>foo</div>
27687 <span>bar</span>
27688
27689 <div>
27690 <span>foo</span>
27691 </div>
27692 !! wikitext
27693 foo
27694
27695 <span>bar</span>
27696
27697 <span>foo2
27698 <nowiki> </nowiki></span>bar2
27699
27700 <div>foo</div>
27701 <nowiki> </nowiki><span>bar</span>
27702
27703 <div>
27704 <nowiki> </nowiki><span>foo</span>
27705 </div>
27706 !! end
27707
27708 !! test
27709 Lists: Dont insert newlines in a serialized list item.
27710 !! options
27711 parsoid=html2wt
27712 !! html/parsoid
27713 <ul><li>a<br>b</li><li>c</li></ul>
27714 !! wikitext
27715 * a<br />b
27716 * c
27717 !! end
27718
27719 !! test
27720 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27721 !! options
27722 parsoid={
27723 "modes": ["html2wt"],
27724 "scrubWikitext": false
27725 }
27726 !! html/parsoid
27727 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27728 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27729
27730 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27731 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27732
27733 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27734
27735 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27736 !! wikitext
27737 == hello there [[Category:A1]] ==
27738
27739 == [[Category:A2]] hi pal ==
27740
27741 == <!--foo--> [[Category:A3]] how goes it ==
27742
27743 == it goes well [[Category:A4]] <!--bar--> ==
27744
27745 ==howdy [[Category:A5]]==
27746
27747 == __TOC__ ok ==
27748 !! end
27749
27750 !! test
27751 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27752 !! options
27753 parsoid={
27754 "modes": ["html2wt"],
27755 "scrubWikitext": true
27756 }
27757 !! html/parsoid
27758 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27759 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27760
27761 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27762 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27763
27764 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27765 !! wikitext
27766 == hello there ==
27767 [[Category:A1]]
27768 [[Category:A2]]
27769
27770 == hi pal ==
27771
27772 <!--foo--> [[Category:A3]]
27773
27774 == how goes it ==
27775
27776 == it goes well ==
27777 [[Category:A4]] <!--bar-->
27778
27779 __TOC__
27780
27781 == ok ==
27782 !! end
27783
27784 !! test
27785 Headings: Don't hoist metas that come from templates
27786 !! options
27787 parsoid={
27788 "modes": ["html2wt"],
27789 "scrubWikitext": true
27790 }
27791 !! html/parsoid
27792 <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>
27793 !! wikitext
27794 == {{echo|foo [[Category:Foo]]}} ==
27795 !! end
27796
27797 !! test
27798 Headings: Category in ref isn't hoisted
27799 !! options
27800 parsoid={
27801 "modes": ["html2wt"],
27802 "scrubWikitext": true
27803 }
27804 !! html/parsoid
27805 <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>
27806
27807 <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>
27808 !! wikitext
27809 == foo <ref>bar
27810 [[Category:Baz]] </ref> ==
27811
27812 <references />
27813 !! end
27814
27815 !! test
27816 Parsoid: Serialize positional parameters with = in them as named parameter
27817 !! options
27818 parsoid=html2wt
27819 !! html/parsoid
27820 <p about="#mwt1" typeof="mw:Transclusion"
27821 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27822
27823 <p about="#mwt1" typeof="mw:Transclusion"
27824 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27825
27826 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27827 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27828 <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>
27829 !! wikitext
27830 {{echo|1=f=oo}}
27831
27832 {{echo|1=f=oo|2=bar}}
27833
27834 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27835 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27836 {{echo|<nowiki>f=oo</nowiki>|bar}}
27837 !! end
27838
27839 !! test
27840 Parsoid: Serialize positional parameters with = in extlink as named parameter
27841 !! options
27842 parsoid=html2wt
27843 !! html/parsoid
27844 <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>
27845 !! wikitext
27846 {{echo|1=http://stuff?is=ok}}
27847 !! end
27848
27849 !! test
27850 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27851 !! options
27852 parsoid=html2wt
27853 !! html/parsoid
27854 <div>a<p>b</p></div>
27855 <div>a
27856 <p>b</p></div>
27857 <div>
27858 a
27859 <p>b</p></div>
27860 !! wikitext
27861 <div>a
27862 b
27863 </div>
27864 <div>a
27865 b
27866 </div>
27867 <div>
27868 a
27869
27870 b
27871 </div>
27872 !! end
27873
27874 !! test
27875 Substrings resembling wikitext in hrefs should not get nowiki escapes
27876 !! options
27877 parsoid=html2wt
27878 !! html/parsoid
27879 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27880 !! wikitext
27881 [[Foo''bar''baz]]
27882 !! end
27883
27884 !! test
27885 Enforce single-line context in the serializer
27886 !! options
27887 parsoid=html2wt
27888 !! html/parsoid
27889 <h2>testing
27890 123</h2>
27891
27892 <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">
27893 </span><span about="#mwt1">you</span> </h2>
27894
27895 <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>
27896
27897 <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
27898 there</span></li></ol>
27899
27900 <ul><li>asd
27901 sdf</li></ul>
27902
27903 <ul><li>foo
27904 bar
27905 baz</li>
27906 <li>foo <b>bar</b>
27907 baz</li></ul>
27908
27909 <dl><dt>hi
27910 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27911 ho</dd></dl>
27912
27913 <dl><dd> <table>
27914 <tbody><tr><td> ha
27915 ha
27916 ha</td></tr>
27917 </tbody></table></dd></dl>
27918 !! wikitext
27919 == testing 123 ==
27920
27921 == hi {{bogus|there
27922 you}} ==
27923
27924 == foo <ref>hello
27925 there</ref> ==
27926
27927 <references />
27928
27929 * asd sdf
27930
27931 * foo bar baz
27932 * foo '''bar''' baz
27933
27934 ; hi ho : hi ho
27935
27936 : {|
27937 | ha
27938 ha
27939 ha
27940 |}
27941 !! end
27942
27943 !! test
27944 Serialize new placeholder space without spans
27945 !! options
27946 parsoid=html2wt
27947 !! html/parsoid
27948 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27949
27950 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27951
27952 <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>
27953 !! wikitext
27954 foo : bar
27955
27956 foo : bar
27957
27958 <ref>foo : bar</ref>ok
27959 !! end
27960
27961
27962 #-----------------------
27963 # Tag minimization tests
27964 #-----------------------
27965
27966 !! test
27967 1. I/B quote minimization: wikitext-only tags should be combined
27968 !! options
27969 parsoid=html2wt
27970 !! html/parsoid
27971 <p><i>A</i><i>B</i></p>
27972 <p><b>A</b><b>B</b></p>
27973 <p><i>A</i><b><i>B</i></b></p>
27974 <p><b>A</b><i><b>B</b></i></p>
27975 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27976 <p><i><b>A</b></i><i><b>B</b></i></p>
27977 <p><i><b>A</b></i><b><i>B</i></b></p>
27978 <p><b><i>A</i></b><i><b>B</b></i></p>
27979 !! wikitext
27980 ''AB''
27981
27982 '''AB'''
27983
27984 ''A'''B'''''
27985
27986 '''A''B'''''
27987
27988 '''A''BC''D'''
27989
27990 '''''AB'''''
27991
27992 '''''AB'''''
27993
27994 '''''AB'''''
27995 !! end
27996
27997 !! test
27998 2. I/B quote minimization: wikitext and html tags should not be combined
27999 !! options
28000 parsoid=html2wt
28001 !! html/parsoid
28002 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28003 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28004 !! wikitext
28005 ''A''<i>B</i>
28006
28007 ''A''<nowiki/>'''<i>B</i>'''
28008 !! end
28009
28010 !! test
28011 3. I/B quote minimization: templated content stops minimization
28012 !! options
28013 parsoid=html2wt
28014 !! html/parsoid
28015 <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>
28016 <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>
28017 !! wikitext
28018 ''A''{{echo|''B''}}
28019
28020 ''A''{{echo|'''''B'''''}}
28021 !! end
28022
28023 !! test
28024 4. I/B quote minimization: new content should be mimimized with adjacent old content
28025 !! options
28026 parsoid=html2wt
28027 !! html/parsoid
28028 <p><i>A</i><i>B</i></p>
28029 <p><b>A</b><b>B</b></p>
28030 <p><i>A</i><b><i>B</i></b></p>
28031 !! wikitext
28032 ''AB''
28033
28034 '''AB'''
28035
28036 ''A'''B'''''
28037 !! end
28038
28039 !! test
28040 5a. Merge adjacent quote nodes if they've been edited
28041 !! options
28042 parsoid={
28043 "modes": ["wt2wt", "selser"],
28044 "changes": [
28045 ["p", "contents", "remove", ":contains('b')"]
28046 ]
28047 }
28048 !! wikitext
28049 ''a''b''c''
28050 !! wikitext/edited
28051 ''ac''
28052 !! end
28053
28054 !! test
28055 5b. Merge adjacent quote nodes if they've been edited
28056 !! options
28057 parsoid={
28058 "modes": ["wt2wt", "selser"],
28059 "changes": [
28060 ["#x", "remove"]
28061 ]
28062 }
28063 !! wikitext
28064 ''a''<span id="x">b</span>''c''
28065 !! wikitext/edited
28066 ''ac''
28067 !! end
28068
28069 !! test
28070 1. Merge adjacent link nodes as long as at least one element is new
28071 !! options
28072 parsoid={
28073 "modes": ["html2wt"],
28074 "scrubWikitext": true
28075 }
28076 !! html/parsoid
28077 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28078 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28079 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28080 !! wikitext
28081 [[Football]]
28082 [[Football]]
28083 [[Football|Foot]][[Football|ball]]
28084 !! end
28085
28086 !! test
28087 2. Merge adjacent link nodes and enable additional normalizations
28088 !! options
28089 parsoid={
28090 "modes": ["html2wt"],
28091 "scrubWikitext": true
28092 }
28093 !! html/parsoid
28094 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28095 !! wikitext
28096 [[Football|''Football'']]
28097 !! end
28098
28099 !! test
28100 3. Don't merge adjacent link nodes if scrubWikitext is false
28101 !! options
28102 parsoid={
28103 "modes": ["html2wt"],
28104 "scrubWikitext": false
28105 }
28106 !! html/parsoid
28107 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28108 !! wikitext
28109 [[Football|Foot]][[Football|ball]]
28110 !! end
28111
28112 #------------------------------
28113 # End of tag minimization tests
28114 #------------------------------
28115
28116 !!test
28117 T56262: New entities
28118 !! options
28119 parsoid=html2wt
28120 !! html/parsoid
28121 <span typeof="mw:Entity">&nbsp;</span>
28122 !! wikitext
28123 &nbsp;
28124 !! end
28125
28126 ## Note that there is no wikitext output for 'unknownproperty' ##
28127 ## Unknown magic words are silently dropped ##
28128
28129 !! test
28130 Magic words
28131 !! options
28132 parsoid=html2wt
28133 !! html/parsoid
28134 <meta property='mw:PageProp/toc' />
28135 <meta property='mw:PageProp/notoc' />
28136 <meta property='mw:PageProp/forcetoc' />
28137 <meta property='mw:PageProp/index' />
28138 <meta property='mw:PageProp/noindex' />
28139 <meta property='mw:PageProp/nogallery' />
28140 <meta property='mw:PageProp/noeditsection' />
28141 <meta property='mw:PageProp/notitleconvert' />
28142 <meta property='mw:PageProp/nocontentconvert' />
28143 <meta property='mw:PageProp/unknownproperty' />
28144 !! wikitext
28145 __TOC__
28146 __NOTOC__
28147 __FORCETOC__
28148 __INDEX__
28149 __NOINDEX__
28150 __NOGALLERY__
28151 __NOEDITSECTION__
28152 __NOTITLECONVERT__
28153 __NOCONTENTCONVERT__
28154 !! end
28155
28156 !! test
28157 Consecutive <pre>s should not get merged
28158 !! options
28159 parsoid=html2wt,html2html
28160 !! html/parsoid
28161 <pre>a</pre><pre>b</pre>
28162
28163 <pre>c
28164 </pre><pre>
28165 d</pre>
28166
28167 <pre>e
28168
28169 </pre><pre>
28170
28171 f</pre>
28172 !! wikitext
28173 a
28174
28175 b
28176
28177 c
28178
28179 d
28180
28181 e
28182
28183
28184
28185 f
28186 !! end
28187
28188 !! test
28189 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28190 !! options
28191 parsoid=html2wt
28192 !! html/parsoid
28193 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28194 !! wikitext
28195 [[Special:BookSources/1234567890|ISBN 1234567895]]
28196 !! end
28197
28198 !! test
28199 Edited RFC links not serializable as RFC links should serialize as extlinks
28200 !! options
28201 parsoid=html2wt
28202 !! html/parsoid
28203 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28204 !! wikitext
28205 [https://tools.ietf.org/html/rfc123 New RFC]
28206 !! end
28207
28208 !! test
28209 Edited PMID links not serializable as PMID links should serialize as extlinks
28210 !! options
28211 parsoid=html2wt
28212 !! html/parsoid
28213 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28214 !! wikitext
28215 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28216 !! end
28217
28218 !! test
28219 WTS of autolinks with trailing/surrounding context
28220 !! options
28221 parsoid=html2wt
28222 !! html/parsoid
28223 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28224 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28225 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28226 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28227 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28228 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28229 !! wikitext
28230 http://cscott.net'''foo'''
28231
28232 http://cscott.net<b>foo</b>
28233
28234 '''http://cscott.net'''
28235
28236 '''http://cscott.net '''
28237
28238 '''http://cscott.net<nowiki/>x'''
28239
28240 http://cscott.net<nowiki/>x
28241 !! end
28242
28243 !! test
28244 WTS of autolinks with nowikis (round-trip)
28245 !! wikitext
28246 x<nowiki/>http://cscott.net<nowiki/>x
28247 !! html/parsoid
28248 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28249 !! end
28250
28251 # this is the "easy" test because it leaves in place all the
28252 # data-parsoid information indicating this is an autolink
28253 !! test
28254 WTS of autolinks with escapes (editing)
28255 !! options
28256 parsoid={
28257 "modes": ["wt2wt"],
28258 "changes": [
28259 [ "span", "remove" ]
28260 ]
28261 }
28262 !! wikitext
28263 x<nowiki/>http://cscott.net<nowiki/>x
28264 !! wikitext/edited
28265 x<nowiki/>http://cscott.net<nowiki/>x
28266 !! end
28267
28268 !! test
28269 WTS of edited autolink-like text (T103364)
28270 !! options
28271 parsoid={
28272 "modes": ["wt2wt"],
28273 "changes": [
28274 [ "span[typeof]", "removeAttr", "typeof" ]
28275 ]
28276 }
28277 !! wikitext
28278 Not a link: <nowiki>http://example.com</nowiki>.
28279 !! wikitext/edited
28280 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28281 !! end
28282
28283 !! test
28284 WTS of newly-authored autolink-like text (T103364)
28285 !! options
28286 parsoid=html2wt
28287 !! html/parsoid
28288 <p>http://example.com is not a link.</p>
28289 !! wikitext
28290 <nowiki>http://example.com</nowiki> is not a link.
28291 !! end
28292
28293 !! test
28294 WTS of autolink-like text after an autolink (T108563)
28295 !! options
28296 parsoid=html2wt
28297 !! html/parsoid
28298 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28299 !! wikitext
28300 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28301 !! end
28302
28303 !! test
28304 Magic links inside links (not autolinked)
28305 !! wikitext
28306 [[Foo|http://example.com]]
28307 [[Foo|RFC 1234]]
28308 [[Foo|PMID 1234]]
28309 [[Foo|ISBN 123456789x]]
28310
28311 [http://foo.com http://example.com]
28312 [http://foo.com RFC 1234]
28313 [http://foo.com PMID 1234]
28314 [http://foo.com ISBN 123456789x]
28315 !! html+tidy
28316 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28317 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28318 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28319 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28320 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28321 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28322 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28323 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28324 </p>
28325 !! html/parsoid
28326 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28327 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28328 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28329 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28330
28331 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28332 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28333 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28334 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28335 !! end
28336
28337 !! test
28338 Magic links inside image captions (autolinked)
28339 !! wikitext
28340 [[File:Foobar.jpg|thumb|http://example.com]]
28341 [[File:Foobar.jpg|thumb|RFC 1234]]
28342 [[File:Foobar.jpg|thumb|PMID 1234]]
28343 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28344 !! html+tidy
28345 <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>
28346 <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>
28347 <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>
28348 <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>
28349 !! html/parsoid
28350 <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>
28351 <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>
28352 <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>
28353 <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>
28354 !! end
28355
28356 !! test
28357 WTS of magic word text (T109371)
28358 !! options
28359 parsoid=html2wt
28360 !! html/parsoid
28361 <p>RFC 1234</p>
28362 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28363 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28364 !! wikitext
28365 <nowiki>RFC 1234</nowiki>
28366
28367 [http://foo.com RFC 1234]
28368
28369 [[Foo|RFC 1234]]
28370 !! end
28371
28372 !! test
28373 Edited Redirect link should emit a non-piped wikitext link
28374 !! options
28375 parsoid=html2wt
28376 !! html/parsoid
28377 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28378 !! wikitext
28379 #REDIRECT [[Bar]]
28380 !! end
28381
28382 !! test
28383 T75121: Infer extension name from typeOf if data-mw is not present
28384 !! options
28385 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28386 !! html/parsoid
28387 <div typeOf="mw:Extension/foo"></div>
28388 !! wikitext
28389 <foo />
28390 !! end
28391
28392 # Note that the <p> wrapping isn't present in PHP parser output
28393 # The important thing for this test is that P-wrapping doesn't
28394 # interfere with the <nowiki> protection for leading - in <td>
28395 # (which isn't necessary for <th>).
28396 !! test
28397 T88318: p-wrapped dash in table.
28398 !! options
28399 parsoid=html2wt,wt2wt
28400 !! html/parsoid
28401 <table><tbody>
28402 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28403 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28404 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28405 </tbody></table>
28406 !! wikitext
28407 {|
28408 !-
28409 !-
28410 |-
28411 |<nowiki>-</nowiki>
28412 |<nowiki>- </nowiki>
28413 |-
28414 |<small>-</small>
28415 |<br />
28416 -
28417 |<br />
28418 -
28419 |}
28420 !! html/php+tidy
28421 <table>
28422 <tbody><tr>
28423 <th>-
28424 </th>
28425 <th>-
28426 </th></tr>
28427 <tr>
28428 <td>-
28429 </td>
28430 <td>-
28431 </td></tr>
28432 <tr>
28433 <td><small>-</small>
28434 </td>
28435 <td><br />
28436 <p>-
28437 </p>
28438 </td>
28439 <td><br />
28440 <p>-
28441 </p>
28442 </td></tr></tbody></table>
28443 !! end
28444
28445 !! test
28446 T149209: WTS: Handle newlines in table cells properly
28447 !! options
28448 parsoid=html2wt
28449 !! html/parsoid
28450 <table>
28451 <tbody>
28452 <tr><td>a
28453 b
28454 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28455 <tr><td><p>x</p>
28456 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28457 </tbody></table>
28458 <table>
28459 <tbody>
28460 <tr><th>a
28461 b
28462 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28463 <tr><th><p>x</h>
28464 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28465 </tbody></table>
28466 !! wikitext
28467 {|
28468 |a
28469 b
28470 |c
28471 |-
28472 |x
28473 {{!}}y
28474 |}
28475 {|
28476 !a
28477 b
28478 !c
28479 |-
28480 !x
28481 !y
28482 |}
28483 !! end
28484
28485 !! test
28486 T149209: Selser: Handle newlines in table cells properly
28487 !! options
28488 parsoid={
28489 "modes": ["selser"],
28490 "changes": [
28491 [ "#h1", "html", "a\nb\n" ],
28492 [ "#h2", "html", "a\nb\n" ],
28493 [ "#c1", "html", "a\nb\n" ],
28494 [ "#c2", "html", "<p>a</p>" ],
28495 [ "#c3", "html", "<p>a</p>" ],
28496 [ "#c4", "html", "edit-me<p>a</p>" ]
28497 ]
28498 }
28499 !! wikitext
28500 {|
28501 ! id="h1" |edit-me!!1
28502 |-
28503 ! id="h2" |edit-me||2
28504 |-
28505 | id="c1" |edit-me||3
28506 |-
28507 | id="c2" |edit-me||4
28508 |-
28509 | id="c3" |edit-me||p||q||r
28510 |-
28511 | id="c4" |edit-me||p||q||r
28512 |}
28513 !! wikitext/edited
28514 {|
28515 ! id="h1" |a
28516 b
28517 !1
28518 |-
28519 ! id="h2" |a
28520 b
28521 !2
28522 |-
28523 | id="c1" |a
28524 b
28525 |3
28526 |-
28527 | id="c2" |a
28528 |4
28529 |-
28530 | id="c3" |a
28531 |p||q||r
28532 |-
28533 | id="c4" |edit-me
28534 a
28535 |p||q||r
28536 |}
28537 !! end
28538
28539 !! test
28540 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28541 !! options
28542 parsoid=html2wt
28543 !! html/parsoid
28544 <table id='mwAb'>
28545 <td id='mwAc'>foo</td>
28546 <td id='serialize-this'>bar</td>
28547 </table>
28548 !! wikitext
28549 {|
28550 |foo
28551 | id="serialize-this" |bar
28552 |}
28553 !! end
28554
28555 !! test
28556 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28557 !! options
28558 parsoid=html2wt
28559 !! html/parsoid
28560 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28561 !! wikitext
28562 <div id="hello">ok</div>
28563 !! end
28564
28565 !! test
28566 WTS change modes
28567 !! options
28568 parsoid={
28569 "modes": ["wt2wt"],
28570 "changes": [
28571 [ "#xyz", "before", "<b>before</b> stuff " ],
28572 [ "#xyz", "after", " stuff <i>after</i>" ],
28573 [ "#xyz", "html", "x <b>y</b> z" ]
28574 ]
28575 }
28576 !! wikitext
28577 <span id="xyz">hello</span>
28578 !! wikitext/edited
28579 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28580 !! end
28581
28582 !! test
28583 Never serialize a-tag as html, regardless of what data-parsoid has to say
28584 !! options
28585 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28586 !! html/parsoid
28587 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28588 !! wikitext
28589 [[Foo]]
28590 !! end
28591
28592 ## SSS FIXME: This is broken output nevertheless.
28593 ## What might be a reasonable non-broken output for this?
28594 ## This is an edge case unlikely to be seen in production
28595 ## that I am not wasting more time on this right now.
28596 !! test
28597 Never serialize a-tag as html, no matter what attributes it has
28598 !! options
28599 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28600 !! html/parsoid
28601 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28602 !! wikitext
28603 [http://boo.org http://boohoo.org]
28604 !! end
28605
28606 # Misnested is an indication that selser can reuse the source but these have
28607 # shown to sneak through on occasion. See T101768.
28608 # The original wikitext here is: [http://test.com [[one]] two three]
28609 !! test
28610 Strip span tags added to mark misnested links
28611 !! options
28612 parsoid=html2wt
28613 !! html/parsoid
28614 <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>
28615 !! wikitext
28616 [http://test.com][[one]] two three
28617 !! end
28618
28619 !! test
28620 Catch regression when unpacking misnested links
28621 !! options
28622 parsoid=wt2html
28623 !! wikitext
28624 {{echo|hi}}[http://example.com [[ho]]]
28625 !! html/parsoid
28626 <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>
28627 !! end
28628
28629 !! test
28630 Catch regression when unpacking with trailing content
28631 !! wikitext
28632 {{echo|Foo <references/> bar}}
28633 !! html/parsoid
28634 <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>
28635 !! end
28636
28637 !! test
28638 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28639 !! options
28640 parsoid=html2wt
28641 !! html/parsoid
28642 <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|}"]}'>
28643 <tbody><tr><td>d
28644 </td></tr>
28645 </tbody></table>
28646 !! wikitext
28647 {{echo|a}}
28648 {|{{echo|c
28649 {{!}}d
28650 }}
28651 |}
28652 !! end
28653
28654 ## This test verifies the presence and computation of this attribute indirectly
28655 ## by making an edit and ensuring that the serialization is correct (which it would be
28656 ## only if firstWikitextNode is properly set).
28657 !! test
28658 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28659 !! options
28660 parsoid= {
28661 "modes": ["wt2wt"],
28662 "changes": [
28663 [ "div#x", "remove" ],
28664 [ "div", "before", "<div>new</div>" ]
28665 ]
28666 }
28667 !! wikitext
28668 <div id="x">foo</div>
28669 {|
28670 {{echo|<div>boo</div>
28671 {{!}}b}}
28672 |c
28673 |}
28674 !! wikitext/edited
28675
28676 <div>new</div>
28677 {|
28678 {{echo|<div>boo</div>
28679 {{!}}b}}
28680 |c
28681 |}
28682 !! end
28683
28684 # --------------------------------------------
28685 # Tests spec'ing wikitext serialization norms |
28686 # --------------------------------------------
28687
28688 !! test
28689 Serialize multi-line indent-pre starting with wikitext syntax
28690 !! options
28691 parsoid=html2wt
28692 !! html/parsoid
28693 <pre>* 1
28694 ** 2
28695 * 3</pre>
28696 !! wikitext
28697 * 1
28698 ** 2
28699 * 3
28700 !! end
28701
28702 !! test
28703 1. Categories should always be serialized on their own line
28704 !! options
28705 parsoid=html2wt
28706 !! html/parsoid
28707 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28708 !! wikitext
28709 foo
28710 [[Category:Foo]]
28711 bar
28712 !! end
28713
28714 !! test
28715 2. Categories that are part of templates should not introduce a line break
28716 !! wikitext
28717 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28718 !! html/parsoid
28719 <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>
28720 !! end
28721
28722 # Careful while editing these next 2 tests. There are \u200f characters
28723 # before and after the <link> tags in the HTML and following some
28724 # of the categories in wikitext
28725 # Do not remove these characters in edits.
28726 #
28727 # As part of the serialization, these bidi characters will get stripped.
28728 !! test
28729 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28730 !! options
28731 parsoid={
28732 "modes": ["html2wt"],
28733 "scrubWikitext": true
28734 }
28735 !! html/parsoid
28736 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28737 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28738 !! wikitext
28739 [[קטגוריה:טקסים]]
28740 [[קטגוריה: שיטות משפט]]
28741 !! end
28742
28743 !! test
28744 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28745 !! options
28746 parsoid={
28747 "modes": ["html2wt"],
28748 "scrubWikitext": true
28749 }
28750 !! html/parsoid
28751 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28752 !! wikitext
28753 [[קטגוריה:טקסים]]
28754 ‏y
28755 !! end
28756
28757 !! test
28758 Lists: Add space after bullets
28759 !! options
28760 parsoid=html2wt
28761 !! html/parsoid
28762 <ul>
28763 <li>foo</li>
28764 <li> bar</li>
28765 <li><span> baz</span></li>
28766 </ul>
28767 !! wikitext
28768 * foo
28769 * bar
28770 * <span> baz</span>
28771 !! end
28772
28773 !! test
28774 1. Headings: Add space before/after == (T53744)
28775 !! options
28776 parsoid=html2wt
28777 !! html/parsoid
28778 <h2>foo</h2>
28779 <h2> bar</h2>
28780 <h2>baz </h2>
28781 <h2><span> baz</span></h2>
28782 !! wikitext
28783 == foo ==
28784
28785 == bar ==
28786
28787 == baz ==
28788
28789 == <span> baz</span> ==
28790 !! end
28791
28792 !! test
28793 2. Headings: Add space before/after == even after hoisted content
28794 !! options
28795 parsoid={
28796 "modes": ["html2wt"],
28797 "scrubWikitext": true
28798 }
28799 !! html/parsoid
28800 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28801 !! wikitext
28802 [[Category:A2]]
28803
28804 == ok ==
28805 !! end
28806
28807 !! test
28808 1. Headings: suppress newly created empty headings
28809 !! options
28810 parsoid={
28811 "modes": ["html2wt"],
28812 "scrubWikitext": true
28813 }
28814 !! html/parsoid
28815 <h2></h2>
28816 !! wikitext
28817 !! end
28818
28819 !! test
28820 2. Headings: don't suppress empty headings if scrubWikitext is false
28821 !! options
28822 parsoid=html2wt
28823 !! html/parsoid
28824 <h2></h2>
28825 !! wikitext
28826 ==<nowiki/>==
28827 !! end
28828
28829 !! test
28830 3. Headings: suppress empty headings on edits
28831 !! options
28832 parsoid={
28833 "modes": ["selser"],
28834 "scrubWikitext": true,
28835 "changes": [
28836 [ "#x", "remove"]
28837 ]
28838 }
28839 !! wikitext
28840 ==<span id="x">foo</span>==
28841 !! wikitext/edited
28842 !! end
28843
28844 !! test
28845 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28846 !! options
28847 parsoid={
28848 "modes": ["html2wt"],
28849 "scrubWikitext": true
28850 }
28851 !! html/parsoid
28852 <h2>foo<br/>bar</h2>
28853 <h2>foo <span><br/>bar</span> baz</h2>
28854 !! wikitext
28855 == foo bar ==
28856
28857 == foo <span> bar</span> baz ==
28858 !! end
28859
28860 !! test
28861 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28862 !! options
28863 parsoid={
28864 "modes": ["html2wt"],
28865 "scrubWikitext": false
28866 }
28867 !! html/parsoid
28868 <h2>foo<br/>bar</h2>
28869 !! wikitext
28870 == foo<br /> bar ==
28871 !! end
28872
28873 !! test
28874 1. WT Quote Tags: suppress newly created empty style tags
28875 !! options
28876 parsoid={
28877 "modes": ["html2wt"],
28878 "scrubWikitext": true
28879 }
28880 !! html/parsoid
28881 <i></i><b></b>
28882 !! wikitext
28883 !! end
28884
28885 !! test
28886 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28887 !! options
28888 parsoid=html2wt
28889 !! html/parsoid
28890 <i></i><b></b>
28891 !! wikitext
28892 ''<nowiki/>'''''<nowiki/>'''
28893 !! end
28894
28895 !! test
28896 3. WT Quote Tags: suppress empty style tags on edits
28897 !! options
28898 parsoid={
28899 "modes": ["selser"],
28900 "scrubWikitext": true,
28901 "changes": [
28902 [ "#x", "remove"]
28903 ]
28904 }
28905 !! wikitext
28906 '''<span id="x">foo</span>'''
28907 !! wikitext/edited
28908 !! end
28909
28910 !! test
28911 1. Anchors: suppress newly created empty anchors
28912 !! options
28913 parsoid={
28914 "modes": ["html2wt"],
28915 "scrubWikitext": true
28916 }
28917 !! html/parsoid
28918 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28919 !! wikitext
28920 !! end
28921
28922 !! test
28923 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28924 !! options
28925 parsoid={
28926 "modes": ["html2wt"],
28927 "scrubWikitext": false
28928 }
28929 !! html/parsoid
28930 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28931 !! wikitext
28932 [[Test|<nowiki/>]]
28933 !! end
28934
28935 !! test
28936 3. Anchors: suppress empty anchors on edits
28937 !! options
28938 parsoid={
28939 "modes": ["selser"],
28940 "scrubWikitext": true,
28941 "changes": [
28942 [ "#x", "remove"]
28943 ]
28944 }
28945 !! wikitext
28946 [[Test|<span id="x">foo</span>]]
28947 !! wikitext/edited
28948 !! end
28949
28950 !! test
28951 3a. Anchors: do not suppress numbered extlinks
28952 !! options
28953 parsoid={
28954 "modes": ["wt2wt"],
28955 "scrubWikitext": true
28956 }
28957 !! wikitext
28958 [http://foo.com]
28959 !! html/parsoid
28960 <a rel="mw:ExtLink" href="http://foo.com"></a>
28961 !! end
28962
28963 !! test
28964 3b. Anchors: do not suppress numbered extlinks
28965 !! options
28966 parsoid={
28967 "modes": ["wt2wt"],
28968 "scrubWikitext": true,
28969 "changes": [
28970 [ "#x", "remove"]
28971 ]
28972 }
28973 !! wikitext
28974 [http://foo.com <span id="x">foo</span>]
28975 !! wikitext/edited
28976 [http://foo.com]
28977 !! end
28978
28979 !!test
28980 Normalizations should be restricted to edited content
28981 !!options
28982 parsoid={
28983 "modes": ["selser"],
28984 "scrubWikitext": true,
28985 "changes": [
28986 [ "h1", "before", "<i></i>"]
28987 ]
28988 }
28989 !!wikitext
28990 a
28991 = =
28992 b
28993 !!wikitext/edited
28994 a
28995 = =
28996 b
28997 !!end
28998
28999 !! test
29000 1. Multiple normalizations (html2wt)
29001 !! options
29002 parsoid={
29003 "modes": ["html2wt"],
29004 "scrubWikitext": true
29005 }
29006 !! html
29007 <h2><i></i></h2>
29008 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29009 </a><b><i></i></b>x</p>
29010 !! wikitext
29011
29012 [[foo]]
29013 x
29014
29015 !! end
29016
29017 !! test
29018 2. Multiple normalizations (selser)
29019 !! options
29020 parsoid={
29021 "modes": ["selser"],
29022 "scrubWikitext": true,
29023 "changes": [
29024 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29025 ]
29026 }
29027 !! wikitext
29028 <span id="x">foo</span>
29029 !! wikitext/edited
29030 <span id="x">foo</span>
29031
29032 x
29033 !! end
29034
29035 !! test
29036 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29037 !! options
29038 parsoid={
29039 "modes": ["html2wt"],
29040 "scrubWikitext": true
29041 }
29042 !! html/parsoid
29043 <p> hi</p>
29044 <p> hello</p>
29045 !! wikitext
29046 hi
29047
29048 hello
29049 !! end
29050
29051 !! test
29052 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29053 !! options
29054 parsoid=html2wt
29055 !! html/parsoid
29056 <p> hi</p>
29057 <p> hello</p>
29058 !! wikitext
29059 <nowiki> </nowiki>hi
29060
29061 <nowiki> </nowiki> hello
29062 !! end
29063
29064 !! test
29065 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29066 !! options
29067 parsoid={
29068 "modes": ["html2wt"],
29069 "scrubWikitext": true
29070 }
29071 !! html/parsoid
29072 <p>Foo
29073 bar
29074 baz</p>
29075
29076 <table><tr><td>Foo
29077 bar
29078 baz bang</td></tr></table>
29079
29080 <p><!--boo--> foo
29081 bar</p>
29082
29083 <p> foo
29084 bar<span>boo</span></p>
29085 !! wikitext
29086 Foo
29087 bar
29088 baz
29089
29090 {|
29091 |Foo
29092 bar
29093 baz bang
29094 |}
29095
29096 <!--boo-->foo
29097 bar
29098
29099 foo
29100 bar<span>boo</span>
29101 !! end
29102
29103 !! test
29104 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29105 !! options
29106 parsoid={
29107 "modes": ["selser"],
29108 "scrubWikitext": true,
29109 "changes": [
29110 [ "p", "html", " a\n b" ]
29111 ]
29112 }
29113 !! wikitext
29114 xyz
29115 !! wikitext/edited
29116 a
29117 b
29118 !! end
29119
29120 !! test
29121 1. New links that end in spaces
29122 !! options
29123 parsoid={
29124 "modes": ["html2wt"],
29125 "scrubWikitext": false
29126 }
29127 !! html/parsoid
29128 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29129 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29130 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29131 !! wikitext
29132 [[Berlin ]]<nowiki/>is the capital of Germany.
29133
29134 [[Foo ]]'''bar'''
29135
29136 [[Boston ]] is a city.
29137 !! end
29138
29139 !! test
29140 2. New links that end in spaces
29141 !! options
29142 parsoid={
29143 "modes": ["html2wt"],
29144 "scrubWikitext": true
29145 }
29146 !! html/parsoid
29147 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29148 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29149 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29150 !! wikitext
29151 [[Berlin]] is the capital of Germany.
29152
29153 [[Foo]] '''bar'''
29154
29155 [[Boston]] is a city.
29156 !! end
29157
29158 !! test
29159 1. Table cells with escapable prefixes
29160 !! options
29161 parsoid={
29162 "modes": ["html2wt"],
29163 "scrubWikitext": false
29164 }
29165 !! html
29166 <table>
29167 <tr><td>a</td></tr>
29168 <tr><td>-</td></tr>
29169 <tr><td>+</td></tr>
29170 </table>
29171 !! wikitext
29172 {|
29173 |a
29174 |-
29175 |<nowiki>-</nowiki>
29176 |-
29177 |<nowiki>+</nowiki>
29178 |}
29179 !! end
29180
29181 !! test
29182 2. Table cells with escapable prefixes
29183 !! options
29184 parsoid={
29185 "modes": ["html2wt"],
29186 "scrubWikitext": true
29187 }
29188 !! html
29189 <table>
29190 <tr><td>a</td></tr>
29191 <tr><td>-</td></tr>
29192 <tr><td>+</td></tr>
29193 </table>
29194 !! wikitext
29195 {|
29196 |a
29197 |-
29198 | -
29199 |-
29200 | +
29201 |}
29202 !! end
29203
29204 !! test
29205 3a. Table cells with escapable prefixes after edits
29206 !! options
29207 parsoid={
29208 "modes": ["selser"],
29209 "scrubWikitext": true,
29210 "changes": [
29211 [ "table tbody tr:first-child td:first-child", "remove"]
29212 ]
29213 }
29214 !! wikitext
29215 {|
29216 |a||-
29217 |}
29218 !! wikitext/edited
29219 {|
29220 | -
29221 |}
29222 !! end
29223
29224 !! test
29225 3b. Table cells with escapable prefixes after edits
29226 !! options
29227 parsoid={
29228 "modes": ["selser"],
29229 "scrubWikitext": true,
29230 "changes": [
29231 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29232 [ "#x", "remove" ]
29233 ]
29234 }
29235 !! wikitext
29236 {|
29237 |pqr
29238 |<span id="x">foo</span>+
29239 |}
29240 !! wikitext/edited
29241 {|
29242 | -
29243 | +
29244 |}
29245 !! end
29246
29247 # FIXME: This test will fail because
29248 # normalization doesn't realize that the id attribute
29249 # will eliminate the escapable scenario
29250 !! test
29251 4a. Table cells without escapable prefixes after edits
29252 !! options
29253 parsoid={
29254 "modes": ["selser"],
29255 "scrubWikitext": true,
29256 "changes": [
29257 [ "#x", "html", "-" ]
29258 ]
29259 }
29260 !! wikitext
29261 {|
29262 | id="x" |abcd
29263 |}
29264 !! wikitext/edited
29265 {|
29266 | id="x" |-
29267 |}
29268 !! end
29269
29270 ## This tests normalizer's ability to discriminate between
29271 ## cells having identical content.
29272 !! test
29273 4b. Table cells without escapable prefixes after edits
29274 !! options
29275 parsoid={
29276 "modes": ["selser"],
29277 "scrubWikitext": true,
29278 "changes": [
29279 [ "td", "html", "-" ]
29280 ]
29281 }
29282 !! wikitext
29283 {|
29284 |a||b
29285 |}
29286 !! wikitext/edited
29287 {|
29288 | -||-
29289 |}
29290 !! end
29291
29292 ## This tests normalizer's ability to not be tripped by
29293 ## comments (and whitespace)
29294 !! test
29295 4c. Table cells without escapable prefixes after edits
29296 !! options
29297 parsoid={
29298 "modes": ["selser"],
29299 "scrubWikitext": true,
29300 "changes": [
29301 [ "table tbody tr td:first-child", "remove" ]
29302 ]
29303 }
29304 !! wikitext
29305 {|
29306 |-
29307 <!--foo--> |a||-
29308 |}
29309 !! wikitext/edited
29310 {|
29311 |-
29312 <!--foo--> | -
29313 |}
29314 !! end
29315
29316 ## This tests normalizer's ability to handle HTML cells
29317 !! test
29318 4d. Table cells without escapable prefixes after edits
29319 !! options
29320 parsoid={
29321 "modes": ["selser"],
29322 "scrubWikitext": true,
29323 "changes": [
29324 [ "td", "html", "-" ]
29325 ]
29326 }
29327 !! wikitext
29328 <table>
29329 <tr><td>a</td></tr>
29330 </table>
29331 !! wikitext/edited
29332 <table>
29333 <tr><td>-</td></tr>
29334 </table>
29335 !! end
29336
29337 ## T111151 Remove font elements without attributes
29338 !! test
29339 5a. font tags without attributes should be dropped in scrubWikitext mode
29340 !! options
29341 parsoid={
29342 "modes": ["html2wt"],
29343 "scrubWikitext": true
29344 }
29345 !! html
29346 <font>foo</font>
29347 <font><font>bar</font></font>
29348 <font class="x">boo</font>
29349 !! wikitext
29350 foo
29351 bar
29352 <font class="x">boo</font>
29353 !! end
29354
29355 !! test
29356 5b. font tags should not be dropped without scrubWikitext being enabled
29357 !! options
29358 parsoid={
29359 "modes": ["html2wt"],
29360 "scrubWikitext": false
29361 }
29362 !! html
29363 <font>foo</font>
29364 !! wikitext
29365 <font>foo</font>
29366 !! end
29367
29368 !! test
29369 Escape nowiki DOM elements
29370 !! options
29371 parsoid=html2wt
29372 !! html/parsoid
29373 <nowiki><i>foo</i></nowiki>
29374 !! wikitext
29375 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29376 !! end
29377
29378 # This is meant to be an interim fix while we go about figuring out
29379 # how to not introduce these trailing <nowiki/>s in the first place.
29380 !! test
29381 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29382 !! options
29383 parsoid=html2wt
29384 !! html/parsoid
29385 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29386 y</p>
29387 <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>
29388 <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>
29389 !! wikitext
29390 x
29391 y
29392
29393 {{echo|
29394 1 = <nowiki/>}}
29395
29396 {{echo|
29397 1 = <nowiki/>
29398 }}
29399 !! end
29400
29401 # ---------------------------------------------------
29402 # End of tests spec'ing wikitext serialization norms |
29403 # ---------------------------------------------------
29404
29405 # T104032
29406 !! test
29407 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29408 !! options
29409 parsoid=html2wt
29410 !! html/parsoid
29411 a<p>b</p>
29412 <b>c</b><p>d</p>
29413 <table><tr>
29414 <td>a<p>b</p></td>
29415 <td><b>c</b><p>d</p></td>
29416 </tr></table>
29417 !! wikitext
29418 a
29419
29420 b
29421
29422 '''c'''
29423
29424 d
29425 {|
29426 |a
29427 b
29428 |'''c'''
29429 d
29430 |}
29431 !! end
29432
29433 !! test
29434 Anchor without href scenarios
29435 !! options
29436 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29437 !! html/parsoid
29438 <a class="bc"></a>
29439 <a class="no">dice</a>
29440 <a name="foo"></a>
29441 !! wikitext
29442
29443 dice
29444 <span name="foo"></span>
29445 !! end
29446
29447 !! test
29448 New transclusion added after a list should be serialized after the list
29449 !! options
29450 parsoid=html2wt
29451 !! html/parsoid
29452 <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>
29453 !! wikitext
29454 * a
29455 {{echo|foo}}
29456 !! end
29457
29458 # -----------------------------------------------------------------
29459 # End of section for Parsoid-only html2wt tests for serialization
29460 # of new content
29461 # -----------------------------------------------------------------
29462
29463 # -----------------------------------------------------------------
29464 # The following section of tests are primarily to spec behavior of
29465 # the selective serializer. All these tests have manual selser
29466 # changes. The automated selser changes for all tests handle the
29467 # wide variation of changes, but these tests here capture specs
29468 # deterministically.
29469 # ----------------------------------------------------------------
29470
29471 ## T90517
29472 !! test
29473 Selser: New comments should not be lost
29474 !! options
29475 parsoid={
29476 "modes": ["selser"],
29477 "changes": [
29478 [ "#a", "after", "<!--c1-->" ],
29479 [ "#b", "before", "<!--c2-->" ]
29480 ]
29481 }
29482 !! wikitext
29483 <span id="a">a</span>
29484
29485 <span id="b">b</span>
29486 !! wikitext/edited
29487 <span id="a">a</span><!--c1-->
29488
29489 <!--c2--><span id="b">b</span>
29490 !! end
29491
29492 ## T89383
29493 !! test
29494 Selser: Check for validity of DSR before using it
29495 !! options
29496 parsoid={
29497 "modes": ["selser"],
29498 "changes": [
29499 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29500 ]
29501 }
29502 !! wikitext
29503 <span id="a">a</span>
29504 !! wikitext/edited
29505 {{DISPLAYTITLE:foo}}
29506 <span id="a">a</span>
29507 !! end
29508
29509 !! test
29510 1. DOMDiff: Changes to <ref> content should be looked up using id
29511 !! options
29512 parsoid={
29513 "modes": ["selser"],
29514 "changes": [
29515 ["#X", "after", "bar"],
29516 ["#Y", "after", "baz"]
29517 ]
29518 }
29519 !! wikitext
29520 X <ref><span id="X">foo</span></ref>
29521 Y <ref name="a" />
29522 <references>
29523 <ref name="a"><span id="Y">foo</span></ref>
29524 </references>
29525 !! wikitext/edited
29526 X <ref><span id="X">foo</span>bar</ref>
29527 Y <ref name="a" />
29528 <references>
29529 <ref name="a"><span id="Y">foo</span>baz</ref>
29530 </references>
29531 !! end
29532
29533 !! test
29534 2. DOMDiff: Changes to <ref> content should be looked up using id
29535 !! options
29536 parsoid={
29537 "modes": ["selser"],
29538 "changes": [
29539 ["#Z", "after", "bar"]
29540 ]
29541 }
29542 !! wikitext
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></ref>
29550 </references>
29551 !! wikitext/edited
29552 A <ref>foo bar for a</ref>
29553 B <ref group="X" name="b" />
29554
29555 <references />
29556
29557 <references group="X">
29558 <ref name="b"><span id="Z">foo</span>bar</ref>
29559 </references>
29560 !! end
29561
29562 !! test
29563 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29564 !! options
29565 parsoid={
29566 "modes": ["selser"],
29567 "changes": [
29568 [ "div:first-child", "text", "bar" ]
29569 ]
29570 }
29571 !! wikitext
29572 <div style="{{1x|color:red;}}%">foo</div>
29573 !! wikitext/edited
29574 <div style="{{1x|color:red;}}%">bar</div>
29575 !! end
29576
29577 !! test
29578 Empty LI (T49673)
29579 !! wikitext
29580 *a
29581 *
29582 *
29583 *b
29584 !! html+tidy
29585 <ul><li>a</li>
29586 <li class="mw-empty-elt"></li>
29587 <li class="mw-empty-elt"></li>
29588 <li>b</li></ul>
29589 !! end
29590
29591 !! test
29592 Thumbnail output
29593 !! wikitext
29594 [[File:Thumb.png|thumb]]
29595 !! html/php+tidy
29596 <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>
29597 !! html/parsoid
29598 <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>
29599 !! end
29600
29601 !! test
29602 unclosed internal link XSS (T137264)
29603 !! wikitext
29604 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29605 !! html/php
29606 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29607 </p>
29608 !! html/parsoid
29609 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29610 !! end
29611
29612 !! test
29613 Validating that <style> isn't eaten by tidy (T167349)
29614 !! options
29615 styletag=1
29616 !! wikitext
29617 <div class="foo">
29618 <style>.foo::before { content: "<foo>"; }</style>
29619 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29620 </div>
29621 !! html/php+tidy
29622 <div class="foo">
29623 <style>.foo::before { content: "<foo>"; }</style>
29624 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29625 </div>
29626 !! end
29627
29628 !! test
29629 Validating that <style> isn't wrapped in a paragraph (T186965)
29630 !! options
29631 styletag=1
29632 !! wikitext
29633 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29634
29635 <style>.foo::before { content: "<foo>"; }</style>
29636
29637 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29638
29639 But if it's on a line with other content, let it be wrapped.
29640
29641 <style>.foo::before { content: "<foo>"; }</style> bar
29642
29643 foo <style>.foo::before { content: "<foo>"; }</style>
29644
29645 foo <style>.foo::before { content: "<foo>"; }</style> bar
29646
29647 And the same if we have non-paragraph-breaking whitespace
29648
29649 foo
29650 <style>.foo::before { content: "<foo>"; }</style>
29651 bar
29652 !! html/php
29653 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29654 </p>
29655 <style>.foo::before { content: "<foo>"; }</style>
29656 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29657 <p>But if it's on a line with other content, let it be wrapped.
29658 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29659 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29660 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29661 </p><p>And the same if we have non-paragraph-breaking whitespace
29662 </p><p>foo
29663 <style>.foo::before { content: "<foo>"; }</style>
29664 bar
29665 </p>
29666 !! end
29667
29668 !! test
29669 Validating that <link> isn't wrapped in a paragraph (T186965)
29670 !! options
29671 styletag=1
29672 !! wikitext
29673 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29674
29675 <link rel="foo" href="bar"/>
29676
29677 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29678
29679 But if it's on a line with other content, let it be wrapped.
29680
29681 <link rel="foo" href="bar"/> bar
29682
29683 foo <link rel="foo" href="bar"/>
29684
29685 foo <link rel="foo" href="bar"/> bar
29686
29687 And the same if we have non-paragraph-breaking whitespace
29688
29689 foo
29690 <link rel="foo" href="bar"/>
29691 bar
29692 !! html/php
29693 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29694 </p>
29695 <link rel="foo" href="bar"/>
29696 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29697 <p>But if it's on a line with other content, let it be wrapped.
29698 </p><p><link rel="foo" href="bar"/> bar
29699 </p><p>foo <link rel="foo" href="bar"/>
29700 </p><p>foo <link rel="foo" href="bar"/> bar
29701 </p><p>And the same if we have non-paragraph-breaking whitespace
29702 </p><p>foo
29703 <link rel="foo" href="bar"/>
29704 bar
29705 </p>
29706 !! end
29707
29708 !! test
29709 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29710 !! config
29711 wgFragmentMode=[ 'html5', 'legacy' ]
29712 !! wikitext
29713 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29714 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29715 !! html/php
29716 <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>
29717 <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>
29718 </p>
29719 !! html/parsoid
29720 <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>
29721 <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>
29722 !! end
29723
29724 !! test
29725 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29726 !! config
29727 wgFragmentMode=[ 'legacy' ]
29728 !! wikitext
29729 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29730 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29731 !! html/php
29732 <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>
29733 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29734 </p>
29735 !! end
29736
29737 !! test
29738 Decoding of HTML entities in embedded HTML tags
29739 !! wikitext
29740 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29741 !! html/php
29742 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29743
29744 !! html/parsoid
29745 <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>
29746 !! end
29747
29748 !! test
29749 Decoding of HTML entities in indicator names for IDs (T104196)
29750 !! options
29751 parsoid=wt2html,html2html
29752 showindicators
29753 !! wikitext
29754 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29755 !! html/php
29756 1&2&3&amp;4&amp;amp;5=Indicator
29757
29758 !! html/parsoid
29759 <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>
29760 !! end
29761
29762 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29763 !! test
29764 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29765 !! options
29766 showindicators
29767 !! wikitext
29768 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29769 !! html/php
29770 1&2&3&amp;4&amp;amp;5=Indicator
29771
29772 !! html/parsoid
29773 <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>
29774 !! end
29775
29776 # This fragment mode is what Parsoid supports.
29777 !! test
29778 HTML5 ids: fallback to legacy
29779 !! config
29780 wgFragmentMode=[ 'html5', 'legacy' ]
29781 !! wikitext
29782 ==Foo bar==
29783
29784 ==foo Bar==
29785
29786 ==Тест==
29787
29788 ==Тест==
29789
29790 ==тест==
29791
29792 ==Hey < # " > % : '==
29793 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29794
29795 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29796
29797 <!-- These two links should produce identical HTML -->
29798 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29799
29800 !! html/php
29801 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29802 <ul>
29803 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29804 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29805 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29806 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29807 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29808 <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>
29809 </ul>
29810 </div>
29811
29812 <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>
29813 <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>
29814 <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>
29815 <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>
29816 <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>
29817 <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>
29818 <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>
29819 </p><p>💩 <span id="💩"></span>
29820 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29821 </p>
29822 !! html/parsoid
29823 <h2 id="Foo_bar">Foo bar</h2>
29824
29825 <h2 id="foo_Bar_2">foo Bar</h2>
29826
29827 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29828
29829 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29830
29831 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29832
29833 <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>
29834 <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>
29835
29836 <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>
29837
29838 <!-- These two links should produce identical HTML -->
29839 <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>
29840 !! end
29841
29842 # Parsoid doesn't support this mode
29843 !! test
29844 HTML5 ids: legacy with a fallback to modern
29845 !! config
29846 wgFragmentMode=[ 'legacy', 'html5' ]
29847 !! wikitext
29848 ==Foo bar==
29849
29850 ==foo Bar==
29851
29852 ==Тест==
29853
29854 ==Тест==
29855
29856 ==тест==
29857
29858 ==Hey < # " > % : '==
29859 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29860
29861 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29862
29863 <!-- These two links should produce identical HTML -->
29864 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29865
29866 !! html/php
29867 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29868 <ul>
29869 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29870 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29871 <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>
29872 <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>
29873 <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>
29874 <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>
29875 </ul>
29876 </div>
29877
29878 <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>
29879 <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>
29880 <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>
29881 <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>
29882 <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>
29883 <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>
29884 <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>
29885 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29886 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29887 </p>
29888 !! end
29889
29890 # Parsoid doesn't support this mode.
29891 !! test
29892 HTML5 ids: no legacy
29893 !! config
29894 wgFragmentMode=[ 'html5' ]
29895 !! wikitext
29896 ==Foo bar==
29897
29898 ==foo Bar==
29899
29900 ==Тест==
29901
29902 ==Тест==
29903
29904 ==тест==
29905
29906 ==Hey < # " > % : '==
29907 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29908
29909 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29910
29911 <!-- These two links should produce identical HTML -->
29912 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29913
29914 !! html/php
29915 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29916 <ul>
29917 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29918 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29919 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29920 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29921 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29922 <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>
29923 </ul>
29924 </div>
29925
29926 <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>
29927 <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>
29928 <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>
29929 <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>
29930 <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>
29931 <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>
29932 <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>
29933 </p><p>💩 <span id="💩"></span>
29934 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29935 </p>
29936 !! end
29937
29938 !! test
29939 T90902: Normalize weird characters in section IDs
29940 !! config
29941 wgFragmentMode=[ 'html5', 'legacy' ]
29942 !! wikitext
29943 ==Foo&nbsp;bar==
29944 [[#Foo&nbsp;bar]]
29945
29946 !! html/php
29947 <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>
29948 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29949 </p>
29950 !! html/parsoid
29951 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
29952 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
29953 !! end
29954
29955 !! test
29956 T51672: Test for brackets in attributes of elements in external link texts
29957 !! wikitext
29958 [http://example.com/ link <span title="title with [brackets]">span</span>]
29959 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29960
29961 !! html/php
29962 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29963 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29964 </p>
29965 !! html/parsoid
29966 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29967 <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>
29968 !! end
29969
29970 !! test
29971 T72875: Test for brackets in attributes of elements in internal link texts
29972 !! wikitext
29973 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29974 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29975
29976 !! html/php
29977 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29978 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29979 </p>
29980 !! html/parsoid
29981 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
29982 <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>
29983 !! end
29984
29985 !! test
29986 T179544: {{anchorencode:}} output should be always usable in links
29987 !! config
29988 wgFragmentMode=[ 'html5' ]
29989 !! wikitext
29990 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
29991 !! html/php
29992 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
29993 </p>
29994 !! html/parsoid
29995 <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>
29996 !! end
29997
29998 ## ------------------------------
29999 ## Parsoid section-wrapping tests
30000 ## ------------------------------
30001 !! test
30002 Section wrapping for well-nested sections (no leading content)
30003 !! options
30004 parsoid={
30005 "wrapSections": true
30006 }
30007 !! wikitext
30008 =1=
30009 a
30010
30011 =2=
30012 b
30013
30014 ==2.1==
30015 c
30016
30017 ==2.2==
30018 d
30019
30020 ===2.2.1===
30021 e
30022
30023 =3=
30024 f
30025 !! html/parsoid
30026 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30027 <p>a</p>
30028
30029 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30030 <p>b</p>
30031
30032 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30033 <p>c</p>
30034
30035 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30036 <p>d</p>
30037
30038 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30039 <p>e</p>
30040
30041 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30042 <p>f</p>
30043
30044 </section>
30045 !! end
30046
30047 !! test
30048 Section wrapping for well-nested sections (with leading content)
30049 !! options
30050 parsoid={
30051 "wrapSections": true
30052 }
30053 !! wikitext
30054 Para 1.
30055
30056 Para 2 with a <div>nested in it</div>
30057
30058 Para 3.
30059
30060 =1=
30061 a
30062
30063 =2=
30064 b
30065
30066 ==2.1==
30067 c
30068 !! html/parsoid
30069 <section data-mw-section-id="0"><p>Para 1.</p>
30070
30071 <p>Para 2 with a </p><div>nested in it</div>
30072
30073 <p>Para 3.</p>
30074
30075 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30076 <p>a</p>
30077
30078 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30079 <p>b</p>
30080
30081 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30082 <p>c</p>
30083
30084 </section></section>
30085 !! end
30086
30087 !! test
30088 Section wrapping with template-generated sections (good nesting 1)
30089 !! options
30090 parsoid={
30091 "wrapSections": true
30092 }
30093 !! wikitext
30094 =1=
30095 a
30096
30097 {{echo|1=
30098 ==1.1==
30099 b
30100 }}
30101
30102 ==1.2==
30103 c
30104
30105 =2=
30106 d
30107 !! html/parsoid
30108 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30109 <p>a</p>
30110
30111 <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">
30112 </span><p about="#mwt1">b</p>
30113 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30114 <p>c</p>
30115
30116 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30117 <p>d</p></section>
30118 !! end
30119
30120 # In this example, the template scope is mildly expanded to incorporate the
30121 # trailing newline after the transclusion since that is part of section 1.1.1
30122 !! test
30123 Section wrapping with template-generated sections (good nesting 2)
30124 !! options
30125 parsoid={
30126 "wrapSections": true,
30127 "modes": ["wt2html", "wt2wt"]
30128 }
30129 !! wikitext
30130 =1=
30131 a
30132
30133 {{echo|1=
30134 ==1.1==
30135 b
30136 ===1.1.1===
30137 d
30138 }}
30139 =2=
30140 e
30141 !! html/parsoid
30142 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30143 <p>a</p>
30144
30145 <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">
30146 </span><p about="#mwt1">b</p><span about="#mwt1">
30147 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30148 </span><p about="#mwt1">d</p><span about="#mwt1">
30149 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30150 <p>e</p></section>
30151 !! end
30152
30153 # In this example, the template scope is mildly expanded to incorporate the
30154 # trailing newline after the transclusion since that is part of section 1.2.1
30155 !! test
30156 Section wrapping with template-generated sections (good nesting 3)
30157 !! options
30158 parsoid={
30159 "wrapSections": true,
30160 "modes": ["wt2html", "wt2wt"]
30161 }
30162 !! wikitext
30163 =1=
30164 a
30165
30166 {{echo|1=
30167 x
30168 ==1.1==
30169 b
30170 ==1.2==
30171 c
30172 ===1.2.1===
30173 d
30174 }}
30175 =2=
30176 e
30177 !! html/parsoid
30178 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30179 <p>a</p>
30180
30181 <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">
30182 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30183 </span><p about="#mwt1">b</p><span about="#mwt1">
30184 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30185 </span><p about="#mwt1">c</p><span about="#mwt1">
30186 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30187 </span><p about="#mwt1">d</p><span about="#mwt1">
30188 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30189 <p>e</p></section>
30190 !! end
30191
30192 # Because of section-wrapping and template-wrapping interactions,
30193 # the scope of the template is expanded so that the template markup
30194 # is valid in the presence of <section> tags.
30195 # This exercises the s1 is null scenario in the wrapSections code
30196 !! test
30197 Section wrapping with template-generated sections (bad nesting 1)
30198 !! options
30199 parsoid={
30200 "wrapSections": true
30201 }
30202 !! wikitext
30203 <div>
30204 a
30205
30206 {{echo|
30207 =1=
30208 b
30209 }}
30210
30211 c
30212 </div>
30213 !! html/parsoid
30214 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30215 <p>a</p>
30216
30217 <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"]}'>
30218 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30219 </span><p about="#mwt1">b
30220 </p><span about="#mwt1">
30221
30222 </span><p about="#mwt1">c</p><span about="#mwt1">
30223 </span></section></div></section>
30224 !! end
30225
30226 # Because of section-wrapping and template-wrapping interactions,
30227 # the scope of the template is expanded so that the template markup
30228 # is valid in the presence of <section> tags.
30229 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30230 !! test
30231 Section wrapping with template-generated sections (bad nesting 2)
30232 !! options
30233 parsoid={
30234 "wrapSections": true
30235 }
30236 !! wikitext
30237 =1=
30238 a
30239
30240 {{echo|1=
30241 =2=
30242 b
30243 ==2.1==
30244 c
30245 }}
30246
30247 d
30248
30249 =3=
30250 e
30251 !! html/parsoid
30252 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30253 <p>a</p>
30254
30255 </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">
30256 </span><p about="#mwt1">b</p><span about="#mwt1">
30257 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30258 </span><p about="#mwt1">c</p><span about="#mwt1">
30259
30260 </span><p about="#mwt1">d</p><span about="#mwt1">
30261
30262 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30263 <p>e</p></section>
30264 !! end
30265
30266 # Because of section-wrapping and template-wrapping interactions,
30267 # additional template wrappers are added to <section> tags
30268 # so that template wrapping semantics are valid whether section
30269 # tags are retained or stripped. But, the template scope can expand
30270 # greatly when accounting for section tags.
30271 # This exercises the s1 and s2 are in different subtrees scenario
30272 !! test
30273 Section wrapping with template-generated sections (bad nesting 3)
30274 !! options
30275 parsoid={
30276 "wrapSections": true,
30277 "modes": ["wt2html", "wt2wt"]
30278 }
30279 !! wikitext
30280 =1=
30281 a
30282
30283 {{echo|1=
30284 ==1.2==
30285 b
30286 =2=
30287 c
30288 }}
30289
30290 d
30291
30292 =3=
30293 e
30294 !! html/parsoid
30295 <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>
30296 <p>a</p>
30297
30298 <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">
30299 </span><p about="#mwt1">b</p><span about="#mwt1">
30300 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30301 </span><p about="#mwt1">c</p>
30302
30303 <p>d</p>
30304 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30305 <p>e</p></section>
30306 !! end
30307
30308 !! test
30309 Section wrapping with uneditable lead section + div wrapping multiple sections
30310 !! options
30311 parsoid={
30312 "wrapSections": true
30313 }
30314 !! wikitext
30315 foo
30316
30317 <div style="border:1px solid red;">
30318 =1=
30319 a
30320
30321 ==1.1==
30322 b
30323
30324 =2=
30325 c
30326 </div>
30327
30328 =3=
30329 d
30330
30331 ==3.1==
30332 e
30333 !! html/parsoid
30334 <section data-mw-section-id="-1"><p>foo</p>
30335
30336 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30337 <section data-mw-section-id="1"><h1 id="1">1</h1>
30338 <p>a</p>
30339
30340 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30341 <p>b</p>
30342
30343 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30344 <p>c</p>
30345 </section></div>
30346
30347 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30348 <p>d</p>
30349
30350 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30351 <p>e</p>
30352 </section></section>
30353 !! end
30354
30355 !! test
30356 Section wrapping with editable lead section + div overlapping multiple sections
30357 !! options
30358 parsoid={
30359 "wrapSections": true
30360 }
30361 !! wikitext
30362 foo
30363
30364 =1=
30365 a
30366 <div style="border:1px solid red;">
30367 b
30368
30369 ==1.1==
30370 c
30371
30372 =2=
30373 d
30374 </div>
30375 e
30376
30377 =3=
30378 f
30379
30380 ==3.1==
30381 g
30382 !! html/parsoid
30383 <section data-mw-section-id="0"><p>foo</p>
30384
30385 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30386 <p>a</p>
30387 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30388 <p>b</p>
30389
30390 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30391 <p>c</p>
30392
30393 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30394 <p>d</p>
30395 </section></div>
30396 <p>e</p>
30397
30398 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30399 <p>f</p>
30400
30401 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30402 <p>g</p>
30403 </section></section>
30404 !! end
30405
30406 !! test
30407 HTML header tags should not be wrapped in section tags
30408 !! options
30409 parsoid={
30410 "wrapSections": true
30411 }
30412 !! wikitext
30413 foo
30414
30415 <h1>a</h1>
30416
30417 =b=
30418
30419 <h1>c</h1>
30420
30421 =d=
30422 !! html/parsoid
30423 <section data-mw-section-id="0"><p>foo</p>
30424
30425 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30426
30427 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30428
30429 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30430
30431 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30432 !! end
30433
30434 !! test
30435 Lead section containing only whitespace and comments.
30436 !! options
30437 parsoid={
30438 "wrapSections": true
30439 }
30440 !! wikitext
30441
30442 <!-- this is a comment, presumably significant to editors -->
30443 =1=
30444 a
30445
30446 =2=
30447 b
30448 !! html/parsoid
30449 <section data-mw-section-id="0" data-parsoid="{}">
30450 <!-- this is a comment, presumably significant to editors -->
30451 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30452 <p>a</p>
30453
30454 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30455 <p>b</p></section>
30456 !! end
30457
30458 !! test
30459 Pseudo-sections emitted by templates should have id -2
30460 !! options
30461 parsoid={
30462 "wrapSections": true
30463 }
30464 !! wikitext
30465 foo
30466 {{echo|<div>
30467 ==a==
30468 ==b==
30469 </div>
30470 }}
30471 !! html/parsoid
30472 <section data-mw-section-id="-1"><p>foo</p>
30473 </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}}]}'>
30474 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30475 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30476 </section></div><span about="#mwt1">
30477 </span></section>
30478 !! end
30479
30480 ##########################################################################
30481 Tests demonstrating white-space insensitivity in input wikitext
30482 for wikitext headings, wikitext list items, and wikitext table captions,
30483 headings, and cells. HTML versions of the same should preserve whitespace.
30484 ##########################################################################
30485 !! test
30486 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30487 !! wikitext
30488 __NOTOC__
30489 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
30490 == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
30491 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30492 ; <!--term to define--> term : <!--term's definition--> definition
30493 {|
30494 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30495 |-
30496 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30497 |-
30498 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30499 |-
30500 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30501 |-
30502 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30503 |}
30504 : {|
30505 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30506 |} foo <!--c1-->
30507 !! html/php+tidy
30508 <h2><span class="mw-headline" id="Spaces">Spaces</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
30509 <h2><span class="mw-headline" id="Tabs">Tabs</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
30510 <ul><li>List item</li></ul>
30511 <dl><dt>term&#160;</dt>
30512 <dd>definition</dd></dl>
30513 <table>
30514 <caption>Table Caption
30515 </caption>
30516 <tbody><tr>
30517 <th>Table Heading 1</th>
30518 <th>Table Heading 2
30519 </th></tr>
30520 <tr>
30521 <td>Table Cell 1</td>
30522 <td>Table Cell 2
30523 </td></tr>
30524 <tr>
30525 <td>class="foo"</td>
30526 <td>Table Cell 3
30527 </td></tr>
30528 <tr>
30529 <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
30530 </td></tr></tbody></table>
30531 <dl><dd><table>
30532 <tbody><tr>
30533 <td>Table Cell 1</td>
30534 <td>Table Cell 2
30535 </td></tr></tbody></table> foo</dd></dl>
30536 !! end
30537
30538 # Looks like <caption> is not accepted in HTML
30539 !! test
30540 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30541 !! wikitext
30542 __NOTOC__
30543 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
30544 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30545 <table>
30546 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30547 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30548 </table>
30549 !! html/php+tidy
30550 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
30551 <ul><li> List item </li></ul>
30552 <table>
30553 <tbody><tr><th> Table Heading </th><th></th></tr>
30554 <tr><td> Table Cell </td><th></th></tr>
30555 </tbody></table>
30556 !! end
30557
30558 !! test
30559 Do not trim whitespace in links and quotes
30560 !! wikitext
30561 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30562 [[Foo| some text ]]
30563 !! html/php+tidy
30564 <p>foo <i> italic </i> and <b> bold </b>
30565 <a href="/wiki/Foo" title="Foo"> some text </a>
30566 </p>
30567 !! end