Clarify -{ => {{ transition
[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></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 !! test
9718 List items from template
9719 !! wikitext
9720
9721 {{inner list}}
9722 * item 2
9723
9724 * item 0
9725 {{inner list}}
9726 * item 2
9727
9728 * item 0
9729 * notSOL{{inner list}}
9730 * item 2
9731 !! html
9732 <ul><li> item 1</li>
9733 <li> item 2</li></ul>
9734 <ul><li> item 0</li>
9735 <li> item 1</li>
9736 <li> item 2</li></ul>
9737 <ul><li> item 0</li>
9738 <li> notSOL</li>
9739 <li> item 1</li>
9740 <li> item 2</li></ul>
9741
9742 !! end
9743
9744 !! test
9745 List interrupted by empty line or heading
9746 !! wikitext
9747 * foo
9748
9749 ** bar
9750 == A heading ==
9751 * Another list item
9752 !! html
9753 <ul><li> foo</li></ul>
9754 <ul><li><ul><li> bar</li></ul></li></ul>
9755 <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>
9756 <ul><li> Another list item</li></ul>
9757
9758 !!end
9759
9760 !!test
9761 Multiple list tags generated by templates
9762 !! wikitext
9763 {{echo|<li>}}a
9764 {{echo|<li>}}b
9765 {{echo|<li>}}c
9766 !! html
9767 <li>a
9768 <li>b
9769 <li>c</li>
9770 </li>
9771 </li>
9772
9773 !! html+tidy
9774 <li>a
9775 </li><li>b
9776 </li><li>c
9777 </li>
9778 !!end
9779
9780 !!test
9781 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9782 !! wikitext
9783 *a
9784 <!--This line will NOT split the list-->
9785 *b
9786 <!--This line will NOT split the list either-->
9787 *c
9788 <!--foo--> <!----> <!--This line NOT split the list either-->
9789 *d
9790 !! html
9791 <ul><li>a</li>
9792 <li>b</li>
9793 <li>c</li>
9794 <li>d</li></ul>
9795
9796 !!end
9797
9798 !!test
9799 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9800 !! wikitext
9801 *a
9802 <!--This line will NOT split the list-->
9803 *b
9804 <!--This line will NOT split the list either-->
9805 *c
9806 <!--foo--> <!----> <!--This line NOT split the list
9807 either-->
9808 *d
9809 !! html
9810 <ul><li>a</li>
9811 <li>b</li>
9812 <li>c</li>
9813 <li>d</li></ul>
9814
9815 !!end
9816
9817 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9818 # That pass could possibly be removed.
9819 !!test
9820 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9821 !!options
9822 parsoid=wt2html,wt2wt
9823 !! wikitext
9824 * foo
9825 * <li>li-hack
9826 * {{echo|<li>templated li-hack}}
9827 * <!--foo--> <li> unsupported li-hack with preceding comments
9828
9829 <ul>
9830 <li><li>not a li-hack
9831 </li>
9832 </ul>
9833 !! html+tidy
9834 <ul><li> foo</li>
9835 <li class="mw-empty-elt"> </li><li>li-hack</li>
9836 <li class="mw-empty-elt"> </li><li>templated li-hack</li>
9837 <li class="mw-empty-elt"> </li><li> unsupported li-hack with preceding comments</li></ul>
9838 <ul>
9839 <li class="mw-empty-elt"></li><li>not a li-hack
9840 </li>
9841 </ul>
9842 !! html/parsoid
9843 <ul><li> foo</li>
9844 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"* "}'>li-hack</li>
9845 <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>
9846 <li data-parsoid='{"autoInsertedEnd":true}'> <!--foo--> </li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
9847
9848 <ul data-parsoid='{"stx":"html"}'>
9849 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9850 </li>
9851 </ul>
9852
9853 !!end
9854
9855 !! test
9856 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9857 !! options
9858 parsoid
9859 !! wikitext
9860 # foo
9861 ## bar
9862 * foo
9863 ** bar
9864 : foo
9865 :: bar
9866 !! html
9867 <ol>
9868 <li> foo<ol>
9869 <li> bar</li>
9870 </ol></li>
9871 </ol><ul>
9872 <li> foo<ul>
9873 <li> bar</li>
9874 </ul></li>
9875 </ul><dl>
9876 <dd> foo<dl>
9877 <dd> bar</dd>
9878 </dl></dd>
9879 </dl>
9880 !! end
9881
9882 !! test
9883 Parsoid: Test of whitespace serialization with Templated bullets
9884 !! options
9885 parsoid
9886 !! wikitext
9887 * {{bullet}}
9888 !! html/parsoid
9889 <ul>
9890 <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>
9891 </ul>
9892 !! end
9893
9894 # ------------------------------------------------------------------------
9895 # The next set of tests are about Parsoid's ability to handle badly nested
9896 # tags (parse, minimize scope of fixup, and roundtrip back)
9897 # ------------------------------------------------------------------------
9898
9899 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9900 # Parsoid's list handling is more aware of block structure.
9901 !! test
9902 Unbalanced closing block tags break a list
9903 !! wikitext
9904 <div>
9905 *a</div><div>
9906 *b</div>
9907 !! html+tidy
9908 <div>
9909 <ul><li>a</li></ul></div><div>
9910 <li>b</li></div>
9911 !! html+parsoid
9912 <div><ul>
9913 <li>a</li>
9914 </ul></div>
9915 <div><ul>
9916 <li>b</li>
9917 </ul></div>
9918 !! end
9919
9920 !! test
9921 Unbalanced closing non-block tags don't break a list
9922 !! wikitext
9923 <span>
9924 *a</span><span>
9925 *b</span>
9926 !! html/php+tidy
9927 <p><span>
9928 </span></p>
9929 <ul><li>a<span></span></li>
9930 <li>b</li></ul>
9931 !! html/parsoid
9932 <span>
9933 <ul>
9934 <li>a<span></span></li>
9935 <li>b</li>
9936 </ul>
9937 </span>
9938 !! end
9939
9940 # Parsoid does some post-dom-building cleanup
9941 # which is why its output differs from Remex.
9942 !! test
9943 Unclosed formatting tags that straddle lists are closed and reopened
9944 !! options
9945 parsoid=wt2html,wt2wt,html2html
9946 !! wikitext
9947 # <s> a
9948 # b </s>
9949 !! html/php+tidy
9950 <ol><li> <s> a</s></li><s>
9951 </s><li><s> b </s></li></ol>
9952 !! html/parsoid
9953 <ol><li> <s> a</s><s></s></li>
9954 <li><s> b </s></li></ol>
9955 !! end
9956
9957 # Output is ugly because of all the misnested tag fixups.
9958 # Remex is wrapping p-tags around empty elements.
9959 # Parsoid has special-case handling of this pattern of
9960 # wrapping lists in formatting tags.
9961 # FIXME: Should we remove this code from Parsoid? Or add
9962 # special support in Remex? If the latter, maybe just wait
9963 # for Parsoid to become the default parser.
9964 # See T70395.
9965 !!test
9966 1. List embedded in a formatting tag
9967 !! wikitext
9968 <small>
9969 * foo
9970 </small>
9971 !! html/php+tidy
9972 <p><small>
9973 </small></p><small><ul><li> foo</li></ul></small><small></small><p><small></small>
9974 </p>
9975 !! html/parsoid
9976 <small>
9977 <ul>
9978 <li> foo</li>
9979 </ul>
9980 </small>
9981 !!end
9982
9983 # Output is ugly because of all the misnested tag fixups
9984 # Remex is wrapping p-tags around empty elements.
9985 # Parsoid has code that strips useless p-tags.
9986 !!test
9987 2. List embedded in a formatting tag in a misnested way
9988 !! wikitext
9989 <small>
9990 *a
9991 *b</small>
9992 !! html/php+tidy
9993 <p><small>
9994 </small></p><small></small><ul><small><li>a</li>
9995 </small><li><small>b</small></li></ul>
9996 !! html/parsoid
9997 <small></small>
9998 <ul><small>
9999 <li>a</li>
10000 </small>
10001 <li><small>b</small></li>
10002 </ul>
10003 !!end
10004
10005 !! test
10006 Table with missing opening <tr> tag
10007 !! options
10008 parsoid=wt2html,wt2wt
10009 !! wikitext
10010 <table>
10011 <td>foo</td>
10012 </tr>
10013 </table>
10014 !! html+tidy
10015 <table>
10016 <tbody><tr><td>foo</td>
10017 </tr>
10018 </tbody></table>
10019 !! end
10020
10021 ###
10022 ### Magic Words
10023 ###
10024
10025 # Note that the current date is hard-coded as
10026 # 1970-01-01T00:02:03Z (a Thursday)
10027 # when running parser tests. The timezone is also fixed to GMT, so
10028 # local date will be identical to current date.
10029
10030 !! test
10031 Magic Word: {{CURRENTDAY}}
10032 !! wikitext
10033 {{CURRENTDAY}}
10034 !! html
10035 <p>1
10036 </p>
10037 !! end
10038
10039 !! test
10040 Magic Word: {{CURRENTDAY2}}
10041 !! wikitext
10042 {{CURRENTDAY2}}
10043 !! html
10044 <p>01
10045 </p>
10046 !! end
10047
10048 !! test
10049 Magic Word: {{CURRENTDAYNAME}}
10050 !! wikitext
10051 {{CURRENTDAYNAME}}
10052 !! html
10053 <p>Thursday
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{CURRENTDOW}}
10059 !! wikitext
10060 {{CURRENTDOW}}
10061 !! html
10062 <p>4
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{CURRENTMONTH}}
10068 !! wikitext
10069 {{CURRENTMONTH}}
10070 !! html
10071 <p>01
10072 </p>
10073 !! end
10074
10075 !! test
10076 Magic Word: {{CURRENTMONTH1}}
10077 !! wikitext
10078 {{CURRENTMONTH1}}
10079 !! html
10080 <p>1
10081 </p>
10082 !! end
10083
10084 !! test
10085 Magic Word: {{CURRENTMONTHABBREV}}
10086 !! wikitext
10087 {{CURRENTMONTHABBREV}}
10088 !! html
10089 <p>Jan
10090 </p>
10091 !! end
10092
10093 !! test
10094 Magic Word: {{CURRENTMONTHNAME}}
10095 !! wikitext
10096 {{CURRENTMONTHNAME}}
10097 !! html
10098 <p>January
10099 </p>
10100 !! end
10101
10102 !! test
10103 Magic Word: {{CURRENTMONTHNAMEGEN}}
10104 !! wikitext
10105 {{CURRENTMONTHNAMEGEN}}
10106 !! html
10107 <p>January
10108 </p>
10109 !! end
10110
10111 !! test
10112 Magic Word: {{CURRENTTIME}}
10113 !! wikitext
10114 {{CURRENTTIME}}
10115 !! html
10116 <p>00:02
10117 </p>
10118 !! end
10119
10120 !! test
10121 Magic Word: {{CURRENTHOUR}}
10122 !! wikitext
10123 {{CURRENTHOUR}}
10124 !! html
10125 <p>00
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{CURRENTWEEK}} (T6594)
10131 !! wikitext
10132 {{CURRENTWEEK}}
10133 !! html
10134 <p>1
10135 </p>
10136 !! end
10137
10138 !! test
10139 Magic Word: {{CURRENTYEAR}}
10140 !! wikitext
10141 {{CURRENTYEAR}}
10142 !! html
10143 <p>1970
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{CURRENTTIMESTAMP}}
10149 !! wikitext
10150 {{CURRENTTIMESTAMP}}
10151 !! html
10152 <p>19700101000203
10153 </p>
10154 !! end
10155
10156 !! test
10157 Magic Words LOCAL (UTC)
10158 !! wikitext
10159 * {{LOCALMONTH}}
10160 * {{LOCALMONTH1}}
10161 * {{LOCALMONTHNAME}}
10162 * {{LOCALMONTHNAMEGEN}}
10163 * {{LOCALMONTHABBREV}}
10164 * {{LOCALDAY}}
10165 * {{LOCALDAY2}}
10166 * {{LOCALDAYNAME}}
10167 * {{LOCALYEAR}}
10168 * {{LOCALTIME}}
10169 * {{LOCALHOUR}}
10170 * {{LOCALWEEK}}
10171 * {{LOCALDOW}}
10172 * {{LOCALTIMESTAMP}}
10173 !! html
10174 <ul><li> 01</li>
10175 <li> 1</li>
10176 <li> January</li>
10177 <li> January</li>
10178 <li> Jan</li>
10179 <li> 1</li>
10180 <li> 01</li>
10181 <li> Thursday</li>
10182 <li> 1970</li>
10183 <li> 00:02</li>
10184 <li> 00</li>
10185 <li> 1</li>
10186 <li> 4</li>
10187 <li> 19700101000203</li></ul>
10188
10189 !! end
10190
10191 !! test
10192 Magic Word: {{FULLPAGENAME}}
10193 !! options
10194 title=[[User:Ævar Arnfjörð Bjarmason]]
10195 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10196 !! wikitext
10197 {{FULLPAGENAME}}
10198 !! html/*
10199 <p>User:Ævar Arnfjörð Bjarmason
10200 </p>
10201 !! end
10202
10203 !! test
10204 Magic Word: {{FULLPAGENAMEE}}
10205 !! options
10206 title=[[User:Ævar Arnfjörð Bjarmason]]
10207 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10208 !! wikitext
10209 {{FULLPAGENAMEE}}
10210 !! html/*
10211 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10212 </p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{TALKSPACE}}
10217 !! options
10218 title=[[User:Ævar Arnfjörð Bjarmason]]
10219 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10220 !! wikitext
10221 {{TALKSPACE}}
10222 !! html/*
10223 <p>User talk
10224 </p>
10225 !! end
10226
10227 !! test
10228 Magic Word: {{TALKSPACE}}, same namespace
10229 !! options
10230 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10231 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10232 !! wikitext
10233 {{TALKSPACE}}
10234 !! html/*
10235 <p>User talk
10236 </p>
10237 !! end
10238
10239 !! test
10240 Magic Word: {{TALKSPACE}}, main namespace
10241 !! options
10242 title=[[Parser Test]]
10243 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10244 !! wikitext
10245 {{TALKSPACE}}
10246 !! html/*
10247 <p>Talk
10248 </p>
10249 !! end
10250
10251 !! test
10252 Magic Word: {{TALKSPACEE}}
10253 !! options
10254 title=[[User:Ævar Arnfjörð Bjarmason]]
10255 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10256 !! wikitext
10257 {{TALKSPACEE}}
10258 !! html/*
10259 <p>User_talk
10260 </p>
10261 !! end
10262
10263 !! test
10264 Magic Word: {{SUBJECTSPACE}}
10265 !! options
10266 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10267 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10268 !! wikitext
10269 {{SUBJECTSPACE}}
10270 !! html/*
10271 <p>User
10272 </p>
10273 !! end
10274
10275 !! test
10276 Magic Word: {{SUBJECTSPACE}}, same namespace
10277 !! options
10278 title=[[User:Ævar Arnfjörð Bjarmason]]
10279 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10280 !! wikitext
10281 {{SUBJECTSPACE}}
10282 !! html/*
10283 <p>User
10284 </p>
10285 !! end
10286
10287 !! test
10288 Magic Word: {{SUBJECTSPACE}}, main namespace
10289 !! options
10290 title=[[Parser Test]]
10291 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10292 !! wikitext
10293 {{SUBJECTSPACE}}
10294 !! html/*
10295
10296 !! end
10297
10298 !! test
10299 Magic Word: {{SUBJECTSPACEE}}
10300 !! options
10301 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10302 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10303 !! wikitext
10304 {{SUBJECTSPACEE}}
10305 !! html/*
10306 <p>User
10307 </p>
10308 !! end
10309
10310 !! test
10311 Magic Word: {{NAMESPACE}}
10312 !! options
10313 title=[[User:Ævar Arnfjörð Bjarmason]]
10314 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10315 !! wikitext
10316 {{NAMESPACE}}
10317 !! html/*
10318 <p>User
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{NAMESPACEE}}
10324 !! options
10325 title=[[User:Ævar Arnfjörð Bjarmason]]
10326 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10327 !! wikitext
10328 {{NAMESPACEE}}
10329 !! html/*
10330 <p>User
10331 </p>
10332 !! end
10333
10334 !! test
10335 Magic Word: {{NAMESPACENUMBER}}
10336 !! options
10337 title=[[User:Ævar Arnfjörð Bjarmason]]
10338 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10339 !! wikitext
10340 {{NAMESPACENUMBER}}
10341 !! html/*
10342 <p>2
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{SUBPAGENAME}}
10348 !! options
10349 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10350 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10351 !! wikitext
10352 {{SUBPAGENAME}}
10353 !! html/*
10354 <p>sub ö
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{SUBPAGENAMEE}}
10360 !! options
10361 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10362 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10363 !! wikitext
10364 {{SUBPAGENAMEE}}
10365 !! html/*
10366 <p>sub_%C3%B6
10367 </p>
10368 !! end
10369
10370 !! test
10371 Magic Word: {{ROOTPAGENAME}}
10372 !! options
10373 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10374 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10375 !! wikitext
10376 {{ROOTPAGENAME}}
10377 !! html/*
10378 <p>Ævar Arnfjörð Bjarmason
10379 </p>
10380 !! end
10381
10382 !! test
10383 Magic Word: {{ROOTPAGENAMEE}}
10384 !! options
10385 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10386 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10387 !! wikitext
10388 {{ROOTPAGENAMEE}}
10389 !! html/*
10390 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10391 </p>
10392 !! end
10393
10394 !! test
10395 Magic Word: {{BASEPAGENAME}}
10396 !! options
10397 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10398 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10399 !! wikitext
10400 {{BASEPAGENAME}}
10401 !! html/*
10402 <p>Ævar Arnfjörð Bjarmason
10403 </p>
10404 !! end
10405
10406 !! test
10407 Magic Word: {{BASEPAGENAMEE}}
10408 !! options
10409 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10410 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10411 !! wikitext
10412 {{BASEPAGENAMEE}}
10413 !! html/*
10414 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{TALKPAGENAME}}
10420 !! options
10421 title=[[User:Ævar Arnfjörð Bjarmason]]
10422 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10423 !! wikitext
10424 {{TALKPAGENAME}}
10425 !! html/*
10426 <p>User talk:Ævar Arnfjörð Bjarmason
10427 </p>
10428 !! end
10429
10430 !! test
10431 Magic Word: {{TALKPAGENAMEE}}
10432 !! options
10433 title=[[User:Ævar Arnfjörð Bjarmason]]
10434 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10435 !! wikitext
10436 {{TALKPAGENAMEE}}
10437 !! html/*
10438 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{SUBJECTPAGENAME}}
10444 !! options
10445 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10446 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10447 !! wikitext
10448 {{SUBJECTPAGENAME}}
10449 !! html/*
10450 <p>User:Ævar Arnfjörð Bjarmason
10451 </p>
10452 !! end
10453
10454 !! test
10455 Magic Word: {{SUBJECTPAGENAMEE}}
10456 !! options
10457 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10458 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10459 !! wikitext
10460 {{SUBJECTPAGENAMEE}}
10461 !! html/*
10462 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10463 </p>
10464 !! end
10465
10466 !! test
10467 Magic Word: {{NUMBEROFFILES}}
10468 !! options
10469 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10470 !! wikitext
10471 {{NUMBEROFFILES}}
10472 !! html/*
10473 <p>7
10474 </p>
10475 !! end
10476
10477 !! test
10478 Magic Word: {{PAGENAME}}
10479 !! options
10480 title=[[User:Ævar Arnfjörð Bjarmason]]
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{PAGENAME}}
10484 !! html/*
10485 <p>Ævar Arnfjörð Bjarmason
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{PAGENAME}} with metacharacters
10491 !! options
10492 title=[['foo & bar = baz']]
10493 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10494 !! wikitext
10495 ''{{PAGENAME}}''
10496 !! html+tidy
10497 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10498 </p>
10499 !! end
10500
10501 !! test
10502 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10503 !! options
10504 title=[[*RFC 1234 http://example.com/]]
10505 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10506 !! wikitext
10507 {{PAGENAME}}
10508 !! html+tidy
10509 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10510 </p>
10511 !! end
10512
10513 !! test
10514 Magic Word: {{PAGENAMEE}}
10515 !! options
10516 title=[[User:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{PAGENAMEE}}
10520 !! html/*
10521 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10527 !! options
10528 title=[[*RFC 1234 http://example.com/]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{PAGENAMEE}}
10532 !! html+tidy
10533 <p>&#42;RFC_1234_http&#58;//example.com/
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{REVISIONID}}
10539 !! options
10540 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10541 showflags
10542 !! wikitext
10543 {{REVISIONID}}
10544 !! html/*
10545 <p>1337
10546 </p>
10547 flags=vary-revision-id
10548 !! end
10549
10550 !! test
10551 Magic Word: {{SCRIPTPATH}}
10552 !! options
10553 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10554 !! wikitext
10555 {{SCRIPTPATH}}
10556 !! html/*
10557
10558 !! end
10559
10560 !! test
10561 Magic Word: {{STYLEPATH}}
10562 !! options
10563 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10564 !! wikitext
10565 {{STYLEPATH}}
10566 !! html/*
10567 <p>/skins
10568 </p>
10569 !! end
10570
10571 !! test
10572 Magic Word: {{SERVER}}
10573 !! options
10574 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10575 !! wikitext
10576 {{SERVER}}
10577 !! html/*
10578 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10579 </p>
10580 !! end
10581
10582 !! test
10583 Magic Word: {{SERVERNAME}}
10584 !! options
10585 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10586 !! wikitext
10587 {{SERVERNAME}}
10588 !! html/*
10589 <p>example.org
10590 </p>
10591 !! end
10592
10593 !! test
10594 Magic Word: {{SITENAME}}
10595 !! options
10596 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10597 !! wikitext
10598 {{SITENAME}}
10599 !! html/*
10600 <p>MediaWiki
10601 </p>
10602 !! end
10603
10604 !! test
10605 Magic Word: {{PAGELANGUAGE}}
10606 !! options
10607 language=fr
10608 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10609 !! wikitext
10610 {{PAGELANGUAGE}}
10611 !! html/*
10612 <p>fr
10613 </p>
10614 !! end
10615
10616 !! test
10617 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10618 !! options
10619 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10620 !! wikitext
10621 {{PAGELANGUAGE}}
10622 !! html/*
10623 <p>en
10624 </p>
10625 !! end
10626
10627 !! test
10628 Case-sensitive magic words, when cased differently, should just be template transclusions
10629 !! wikitext
10630 {{CurrentMonth}}
10631 {{currentday}}
10632 {{cURreNTweEK}}
10633 {{currentHour}}
10634 !! html
10635 <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>
10636 <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>
10637 <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>
10638 <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>
10639 </p>
10640 !! end
10641
10642 !! test
10643 Case-insensitive magic words should still work with weird casing.
10644 !! wikitext
10645 {{sErVeRNaMe}}
10646 {{LCFirst:AOEU}}
10647 {{ucFIRST:aoeu}}
10648 {{SERver}}
10649 !! html
10650 <p>example.org
10651 aOEU
10652 Aoeu
10653 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10654 </p>
10655 !! end
10656
10657 # From plwiki:PLOS_ONE
10658 !! test
10659 Parsoid: Page property magic word with magic word contents
10660 !! wikitext
10661 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10662 !! html/parsoid
10663 <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>"}]]}'/>
10664 !! end
10665
10666 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10667 # But, this is a limitation of our representation and is documented in
10668 # TemplateHandler.js in processSpecialMagicWord
10669 !! test
10670 Parsoid: Template-generated DISPLAYTITLE
10671 !! wikitext
10672 {{{{echo|DISPLAYTITLE}}:Foo}}
10673 !! options
10674 showtitle
10675 !! config
10676 wgAllowDisplayTitle=true
10677 wgRestrictDisplayTitle=false
10678 !! html/php
10679 Foo
10680
10681 !! html/parsoid
10682 <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"}]]}'/>
10683 !! end
10684
10685 !! test
10686 Namespace 1 {{ns:1}}
10687 !! wikitext
10688 {{ns:1}}
10689 !! html
10690 <p>Talk
10691 </p>
10692 !! end
10693
10694 !! test
10695 Namespace 1 {{ns:01}}
10696 !! wikitext
10697 {{ns:01}}
10698 !! html
10699 <p>Talk
10700 </p>
10701 !! end
10702
10703 !! test
10704 Namespace 0 {{ns:0}} (T6783)
10705 !! wikitext
10706 {{ns:0}}
10707 !! html
10708
10709 !! end
10710
10711 !! test
10712 Namespace 0 {{ns:00}} (T6783)
10713 !! wikitext
10714 {{ns:00}}
10715 !! html
10716
10717 !! end
10718
10719 !! test
10720 Namespace -1 {{ns:-1}}
10721 !! wikitext
10722 {{ns:-1}}
10723 !! html
10724 <p>Special
10725 </p>
10726 !! end
10727
10728 !! test
10729 Namespace User {{ns:User}}
10730 !! wikitext
10731 {{ns:User}}
10732 !! html
10733 <p>User
10734 </p>
10735 !! end
10736
10737 !! test
10738 Namespace User talk {{ns:User_talk}}
10739 !! wikitext
10740 {{ns:User_talk}}
10741 !! html
10742 <p>User talk
10743 </p>
10744 !! end
10745
10746 !! test
10747 Namespace User talk {{ns:uSeR tAlK}}
10748 !! wikitext
10749 {{ns:uSeR tAlK}}
10750 !! html
10751 <p>User talk
10752 </p>
10753 !! end
10754
10755 !! test
10756 Namespace File {{ns:File}}
10757 !! wikitext
10758 {{ns:File}}
10759 !! html
10760 <p>File
10761 </p>
10762 !! end
10763
10764 !! test
10765 Namespace File {{ns:Image}}
10766 !! wikitext
10767 {{ns:Image}}
10768 !! html
10769 <p>File
10770 </p>
10771 !! end
10772
10773 !! test
10774 Namespace (lang=de) Benutzer {{ns:User}}
10775 !! options
10776 language=de
10777 !! wikitext
10778 {{ns:User}}
10779 !! html
10780 <p>Benutzer
10781 </p>
10782 !! end
10783
10784 !! test
10785 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10786 !! options
10787 language=de
10788 !! wikitext
10789 {{ns:3}}
10790 !! html
10791 <p>Benutzer Diskussion
10792 </p>
10793 !! end
10794
10795 !! test
10796 Urlencode
10797 !! wikitext
10798 {{urlencode:hi world?!}}
10799 {{urlencode:hi world?!|WIKI}}
10800 {{urlencode:hi world?!|PATH}}
10801 {{urlencode:hi world?!|QUERY}}
10802 !! html/php
10803 <p>hi+world%3F%21
10804 hi_world%3F!
10805 hi%20world%3F%21
10806 hi+world%3F%21
10807 </p>
10808 !! end
10809
10810 !! test
10811 Magic Word: prioritize type info over data-parsoid
10812 !! options
10813 parsoid=html2wt
10814 !! html/parsoid
10815 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10816 !! wikitext
10817 __FORCETOC__
10818 !! end
10819
10820 !! test
10821 Magic Word: serialize on separate line (parsoid)
10822 !! options
10823 parsoid=wt2wt,html2wt
10824 !! wikitext
10825 foo
10826 __NOTOC__
10827 bar
10828 !! html/parsoid
10829 foo<meta property="mw:PageProp/notoc"/>bar
10830 !! end
10831
10832 !! test
10833 Magic Word: rt non-english wikis
10834 !! options
10835 parsoid=wt2wt
10836 language=de
10837 !! wikitext
10838 __NOEDITSECTION__
10839 !! html/parsoid
10840 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10841 !! end
10842
10843 !!test
10844 __proto__ is treated as normal wikitext (T105997)
10845 !!wikitext
10846 __proto__
10847 !!html
10848 <p>__proto__
10849 </p>
10850 !!end
10851
10852 ###
10853 ### Magic links
10854 ###
10855 !! test
10856 Magic links: internal link to RFC (T2479)
10857 !! wikitext
10858 [[RFC 123]]
10859 !! html/php
10860 <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>
10861 </p>
10862 !! html/parsoid
10863 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10864 !! end
10865
10866 !! test
10867 Magic links: RFC (T2479)
10868 !! wikitext
10869 RFC 822
10870 !! html/php
10871 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10872 </p>
10873 !! html/parsoid
10874 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10875 !! end
10876
10877 !! test
10878 Magic links: RFC (T67278)
10879 !! wikitext
10880 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10881 !! html/php
10882 <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.
10883 </p>
10884 !! html/parsoid
10885 <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>
10886 !! end
10887
10888 !! test
10889 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10890 !! wikitext
10891 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10892 RFC
10893 822
10894 !! html/php
10895 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10896 RFC
10897 822
10898 </p>
10899 !! html/parsoid
10900 <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>
10901 RFC
10902 822</p>
10903 !! end
10904
10905 !! test
10906 Magic links: ISBN (T3937)
10907 !! wikitext
10908 ISBN 0-306-40615-2
10909 !! html/php
10910 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10911 </p>
10912 !! html/parsoid
10913 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10914 !! end
10915
10916 !! test
10917 Magic links: ISBN (T67278)
10918 !! wikitext
10919 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10920 !! html/php
10921 <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.
10922 </p>
10923 !! html/parsoid
10924 <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>
10925 !! end
10926
10927 !! test
10928 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10929 !! wikitext
10930 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10931 ISBN
10932 9780316098113
10933 ISBN 978
10934 0316098113
10935 !! html/php
10936 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10937 ISBN
10938 9780316098113
10939 ISBN 978
10940 0316098113
10941 </p>
10942 !! html/parsoid
10943 <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>
10944 ISBN
10945 9780316098113
10946 ISBN 978
10947 0316098113</p>
10948 !! end
10949
10950 !! test
10951 Magic links: PMID incorrectly converts space to underscore
10952 !! wikitext
10953 PMID 1234
10954 !! html/php
10955 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10956 </p>
10957 !! html/parsoid
10958 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10959 !! end
10960
10961 !! test
10962 Magic links: PMID (T67278)
10963 !! wikitext
10964 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10965 !! html/php
10966 <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.
10967 </p>
10968 !! html/parsoid
10969 <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>
10970 !! end
10971
10972 !! test
10973 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10974 !! wikitext
10975 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10976 PMID
10977 1234
10978 !! html/php
10979 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10980 PMID
10981 1234
10982 </p>
10983 !! html/parsoid
10984 <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>
10985 PMID
10986 1234</p>
10987 !! end
10988
10989 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10990 # since these are ExtLinkText, not MagicLinkText
10991 !! test
10992 Magic links: use appropriate serialization for "almost" magic links.
10993 !! wikitext
10994 X[[Special:BookSources/0978739256|foo]]
10995
10996 X[https://tools.ietf.org/html/rfc1234 foo]
10997 !! html/php
10998 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10999 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11000 </p>
11001 !! html/parsoid
11002 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11003 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11004 !! end
11005
11006 !! test
11007 Magic links: All disabled (T47942)
11008 !! options
11009 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11010 !! wikitext
11011 ISBN 0-306-40615-2
11012 PMID 1234
11013 RFC 4321
11014 !! html/php
11015 <p>ISBN 0-306-40615-2
11016 PMID 1234
11017 RFC 4321
11018 </p>
11019 !! end
11020
11021 ###
11022 ### Templates
11023 ####
11024
11025 !! test
11026 Nonexistent template
11027 !! wikitext
11028 {{thistemplatedoesnotexist}}
11029 !! html
11030 <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>
11031 </p>
11032 !! end
11033
11034 !! test
11035 Template with invalid target containing tags
11036 !! wikitext
11037 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11038 !! html
11039 <p>{{a<b>b</b>|foo|a=b|a = b}}
11040 </p>
11041 !! end
11042
11043 !! test
11044 Template with invalid target containing unclosed tag
11045 !! wikitext
11046 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11047 !! html
11048 <p>{{a<b>|foo|a=b|a = b}}</b>
11049 </p>
11050 !! end
11051
11052 !! test
11053 Template with invalid target containing wikilink
11054 !! wikitext
11055 {{[[Main Page]]}}
11056 !! html/php
11057 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11058 </p>
11059 !! html/parsoid
11060 <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>
11061 !! end
11062
11063 !! test
11064 Template with just whitespace in it, T70421
11065 !! wikitext
11066 {{echo|{{ }}}}
11067 !! html/parsoid
11068 <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>
11069 !! end
11070
11071 !! article
11072 Template:test
11073 !! text
11074 This is a test template
11075 !! endarticle
11076
11077 !! test
11078 Simple template
11079 !! wikitext
11080 {{test}}
11081 !! html
11082 <p>This is a test template
11083 </p>
11084 !! end
11085
11086 !! test
11087 Template with explicit namespace
11088 !! wikitext
11089 {{Template:test}}
11090 !! html
11091 <p>This is a test template
11092 </p>
11093 !! end
11094
11095
11096 !! article
11097 Template:paramtest
11098 !! text
11099 This is a test template with parameter {{{param}}}
11100 !! endarticle
11101
11102 !! test
11103 Template parameter
11104 !! wikitext
11105 {{paramtest|param=foo}}
11106 !! html
11107 <p>This is a test template with parameter foo
11108 </p>
11109 !! end
11110
11111 !! article
11112 Template:paramtestnum
11113 !! text
11114 [[{{{1}}}|{{{2}}}]]
11115 !! endarticle
11116
11117 !! test
11118 Template unnamed parameter
11119 !! wikitext
11120 {{paramtestnum|Main Page|the main page}}
11121 !! html
11122 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11123 </p>
11124 !! end
11125
11126 !! article
11127 Template:templatesimple
11128 !! text
11129 (test)
11130 !! endarticle
11131
11132 !! article
11133 Template:templateredirect
11134 !! text
11135 #redirect [[Template:templatesimple]]
11136 !! endarticle
11137
11138 !! article
11139 Template:templateasargtestnum
11140 !! text
11141 {{{{{1}}}}}
11142 !! endarticle
11143
11144 !! article
11145 Template:templateasargtest
11146 !! text
11147 {{template{{{templ}}}}}
11148 !! endarticle
11149
11150 !! article
11151 Template:templateasargtest2
11152 !! text
11153 {{{{{templ}}}}}
11154 !! endarticle
11155
11156 !! test
11157 Template with template name as unnamed argument
11158 !! wikitext
11159 {{templateasargtestnum|templatesimple}}
11160 !! html
11161 <p>(test)
11162 </p>
11163 !! end
11164
11165 !! test
11166 Template with template name as argument
11167 !! wikitext
11168 {{templateasargtest|templ=simple}}
11169 !! html
11170 <p>(test)
11171 </p>
11172 !! end
11173
11174 !! test
11175 Template with template name as argument (2)
11176 !! wikitext
11177 {{templateasargtest2|templ=templatesimple}}
11178 !! html
11179 <p>(test)
11180 </p>
11181 !! end
11182
11183 !! article
11184 Template:templateasargtestdefault
11185 !! text
11186 {{{{{templ|templatesimple}}}}}
11187 !! endarticle
11188
11189 !! article
11190 Template:templa
11191 !! text
11192 '''templ'''
11193 !! endarticle
11194
11195 !! test
11196 Template with default value
11197 !! wikitext
11198 {{templateasargtestdefault}}
11199 !! html
11200 <p>(test)
11201 </p>
11202 !! end
11203
11204 !! test
11205 Template with default value (value set)
11206 !! wikitext
11207 {{templateasargtestdefault|templ=templa}}
11208 !! html
11209 <p><b>templ</b>
11210 </p>
11211 !! end
11212
11213 !! test
11214 Template redirect
11215 !! wikitext
11216 {{templateredirect}}
11217 !! html/php
11218 <p>(test)
11219 </p>
11220 !! html/parsoid
11221 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11222 !! end
11223
11224 !! test
11225 Template with argument in separate line
11226 !! wikitext
11227 {{ templateasargtest |
11228 templ = simple }}
11229 !! html
11230 <p>(test)
11231 </p>
11232 !! end
11233
11234 !! test
11235 Template with complex template as argument
11236 !! wikitext
11237 {{paramtest|
11238 param ={{ templateasargtest |
11239 templ = simple }}}}
11240 !! html
11241 <p>This is a test template with parameter (test)
11242 </p>
11243 !! end
11244
11245 !! test
11246 Templates with templated name
11247 !! wikitext
11248 {{{{echo|echo}}|foo}}
11249 {{{{echo|inner list}} }}
11250 !! html
11251 <p>foo
11252 </p>
11253 <ul><li> item 1</li></ul>
11254
11255 !! html/parsoid
11256 <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>
11257 <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>
11258 !! end
11259
11260 ## Regression test; the output here isn't really that interesting.
11261 !! test
11262 Templates with templated name and top level template args
11263 !! wikitext
11264 {{1{{2{{{3}}}|4=5}}}}
11265 !! html/parsoid
11266 <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>
11267 !! end
11268
11269 # Parsoid markup is deliberate "broken". This is an edge case.
11270 # See long comment in TemplateHandler.js:convertAttribsToString.
11271 !! test
11272 Templates with invalid templated targets
11273 !! wikitext
11274 {{echo
11275 {{echo|foo}}
11276 }}
11277 !! html/php
11278 <p>{{echo
11279 foo
11280 }}
11281 </p>
11282 !! html/parsoid
11283 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11284 foo }}</p>
11285 !! end
11286
11287 !! test
11288 Template with thumb image (with link in description)
11289 !! wikitext
11290 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11291 !! html/php
11292 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>
11293
11294 !! html+tidy
11295 <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>
11296 !! html/parsoid
11297 <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>
11298 !! end
11299
11300 !! article
11301 Template:complextemplate
11302 !! text
11303 {{{1}}} {{paramtest|
11304 param ={{{param}}}}}
11305 !! endarticle
11306
11307 !! test
11308 Template with complex arguments
11309 !! wikitext
11310 {{complextemplate|
11311 param ={{ templateasargtest |
11312 templ = simple }}|[[Template:complextemplate|link]]}}
11313 !! html
11314 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11315 </p>
11316 !! end
11317
11318 !! test
11319 T2553: link with two variables in a piped link
11320 !! wikitext
11321 {|
11322 |[[{{{1}}}|{{{2}}}]]
11323 |}
11324 !! html/php
11325 <table>
11326 <tr>
11327 <td>[[{{{1}}}|{{{2}}}]]
11328 </td></tr></table>
11329
11330 !! html/parsoid
11331 <table>
11332 <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>
11333 </tbody></table>
11334 !! end
11335
11336 # See: T2553
11337 !! test
11338 Abort table cell attribute parsing on wikilink
11339 !! wikitext
11340 {|
11341 | testing [[one|two]] | three || four
11342 | testing one two | three || four
11343 | testing="[[one|two]]" | three || four
11344 |}
11345 !! html/php
11346 <table>
11347 <tr>
11348 <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>
11349 <td> four
11350 </td>
11351 <td> three </td>
11352 <td> four
11353 </td>
11354 <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>
11355 <td> four
11356 </td></tr></table>
11357
11358 !! html/parsoid
11359 <table>
11360 <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>
11361 <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>
11362 <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>
11363 </tbody></table>
11364 !! end
11365
11366 !! test
11367 Don't abort table cell attribute parsing if wikilink is found in template arg
11368 !! wikitext
11369 {|
11370 | Test {{#tag:ref|One two "[[three]]" four}}
11371 |}
11372 !! html/parsoid
11373 <table>
11374 <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>
11375 </tbody></table>
11376 !! end
11377
11378 !! test
11379 Magic variable as template parameter
11380 !! wikitext
11381 {{paramtest|param={{SITENAME}}}}
11382 !! html
11383 <p>This is a test template with parameter MediaWiki
11384 </p>
11385 !! end
11386
11387 !! article
11388 Template:linktest
11389 !! text
11390 [[{{{param}}}|link]]
11391 !! endarticle
11392
11393 !! test
11394 Template parameter as link source
11395 !! wikitext
11396 {{linktest|param=Main Page}}
11397 !! html
11398 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11399 </p>
11400 !! end
11401
11402 !!article
11403 Template:paramtest2
11404 !! text
11405 including another template, {{paramtest|param={{{arg}}}}}
11406 !! endarticle
11407
11408 !! test
11409 Template passing argument to another template
11410 !! wikitext
11411 {{paramtest2|arg='hmm'}}
11412 !! html
11413 <p>including another template, This is a test template with parameter 'hmm'
11414 </p>
11415 !! end
11416
11417 !! article
11418 Template:Linktest2
11419 !! text
11420 Main Page
11421 !! endarticle
11422
11423 !! test
11424 Template as link source
11425 !! wikitext
11426 [[{{linktest2}}]]
11427
11428 [[{{linktest2}}|Main Page]]
11429
11430 [[{{linktest2}}]]Page
11431 !! html
11432 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11433 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11434 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11435 </p>
11436 !! end
11437
11438
11439 !! article
11440 Template:loop1
11441 !! text
11442 {{loop2}}
11443 !! endarticle
11444
11445 !! article
11446 Template:loop2
11447 !! text
11448 {{loop1}}
11449 !! endarticle
11450
11451 !! test
11452 Template infinite loop
11453 !! wikitext
11454 {{loop1}}
11455 !! html
11456 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11457 </p>
11458 !! end
11459
11460 !! test
11461 Template from main namespace
11462 !! wikitext
11463 {{:Main Page}}
11464 !! html
11465 <p>blah blah
11466 </p>
11467 !! end
11468
11469 !! article
11470 Template:table
11471 !! text
11472 {|
11473 | 1 || 2
11474 |-
11475 | 3 || 4
11476 |}
11477 !! endarticle
11478
11479 !! test
11480 T2529: Template with table, not included at beginning of line
11481 !! wikitext
11482 foo {{table}}
11483 !! html
11484 <p>foo
11485 </p>
11486 <table>
11487 <tr>
11488 <td> 1 </td>
11489 <td> 2
11490 </td></tr>
11491 <tr>
11492 <td> 3 </td>
11493 <td> 4
11494 </td></tr></table>
11495
11496 !! end
11497
11498 !! test
11499 T2523: Template shouldn't eat newline (or add an extra one before table)
11500 !! wikitext
11501 foo
11502 {{table}}
11503 !! html
11504 <p>foo
11505 </p>
11506 <table>
11507 <tr>
11508 <td> 1 </td>
11509 <td> 2
11510 </td></tr>
11511 <tr>
11512 <td> 3 </td>
11513 <td> 4
11514 </td></tr></table>
11515
11516 !! end
11517
11518 !! test
11519 T2041: Template parameters shown as broken links
11520 !! wikitext
11521 {{{parameter}}}
11522 !! html
11523 <p>{{{parameter}}}
11524 </p>
11525 !! end
11526
11527 !! test
11528 Template with targets containing wikilinks
11529 !! options
11530 parsoid=wt2html
11531 !! wikitext
11532 {{[[foo]]}}
11533
11534 {{[[{{echo|foo}}]]}}
11535
11536 {{{{echo|[[foo}}]]}}
11537 !! html/php
11538 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11539 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11540 </p><p>{{[[foo}}]]
11541 </p>
11542 !! html/parsoid
11543 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11544 <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>
11545 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11546 !! end
11547
11548 !! article
11549 Template:''
11550 !! text
11551 bar
11552 !! endarticle
11553
11554 !! test
11555 Templates: Double quotes as template target
11556 !! wikitext
11557 foo {{''}} baz
11558 !! html/php
11559 <p>foo bar baz
11560 </p>
11561 !! html/parsoid
11562 <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
11563 </p>
11564 !! end
11565
11566 ## This test is about making sure Parsoid's data-mw is well formed in the
11567 ## face of multiple templates with intersecting and overlapping ranges. The
11568 ## wikitext itself is wretched.
11569 !! test
11570 Templates with intersecting and overlapping ranges
11571 !! wikitext
11572 {|{{echo|
11573 <p>ha</p>}}
11574 {|{{echo|
11575 <p>ho</p>}}
11576 {{echo|{{!}}hi}}
11577 |}
11578 !! html/php+tidy
11579 <p>ha</p><table>
11580
11581 </table><p>ho</p><table>
11582
11583 <tbody><tr>
11584 <td>hi
11585 </td></tr></tbody></table>
11586 !! html/parsoid
11587 <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":""}]]}'>
11588
11589 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11590
11591 <tbody><tr><td>hi</td></tr>
11592 </tbody></table>
11593 !! end
11594
11595 !! article
11596 Template:MSGNW test
11597 !! text
11598 ''None'' of '''this''' should be
11599 * interpreted
11600 but rather passed unmodified
11601 {{test}}
11602 <gallery>
11603 File:Foobar.jpg
11604 </gallery>
11605 <!-- comment -->
11606 !! endarticle
11607
11608 # hmm, fix this or just deprecate msgnw and document its behavior?
11609 !! test
11610 msgnw keyword
11611 !! wikitext
11612 {{msgnw:MSGNW test}}
11613 !! html/php
11614 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11615 &#42; interpreted
11616 &#32;but rather passed unmodified
11617 &#123;&#123;test&#125;&#125;
11618 &#60;gallery&#62;
11619 File:Foobar.jpg
11620 &#60;/gallery&#62;
11621 &#60;!-- comment --&#62;
11622 </p>
11623 !! end
11624
11625 !! test
11626 int keyword
11627 !! wikitext
11628 {{int:youhavenewmessages|lots of money|not!}}
11629 !! html
11630 <p>You have lots of money (not!).
11631 </p>
11632 !! end
11633
11634 !! test
11635 int keyword - non-existing message
11636 !! wikitext
11637 {{int:var}}
11638 !! html
11639 <p>⧼var⧽
11640 </p>
11641 !! end
11642
11643 !! article
11644 Template:Includes
11645 !! text
11646 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11647 !! endarticle
11648
11649 !! test
11650 <includeonly> and <noinclude> being included
11651 !! wikitext
11652 {{Includes}}
11653 !! html
11654 <p>Foobar
11655 </p>
11656 !! end
11657
11658 !! article
11659 Template:Includes2
11660 !! text
11661 <onlyinclude>Foo</onlyinclude>bar
11662 !! endarticle
11663
11664 !! test
11665 <onlyinclude> being included
11666 !! wikitext
11667 {{Includes2}}
11668 !! html
11669 <p>Foo
11670 </p>
11671 !! end
11672
11673
11674 !! article
11675 Template:Includes3
11676 !! text
11677 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11678 !! endarticle
11679
11680 !! test
11681 <onlyinclude> and <includeonly> being included
11682 !! wikitext
11683 {{Includes3}}
11684 !! html
11685 <p>Foo
11686 </p>
11687 !! end
11688
11689 !! test
11690 <includeonly> and <noinclude> on a page
11691 !! wikitext
11692 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11693 !! html
11694 <p>Foozar
11695 </p>
11696 !! end
11697
11698 !! test
11699 Un-closed <noinclude>
11700 !! wikitext
11701 <noinclude>
11702 !! html
11703 !! end
11704
11705 !! test
11706 <onlyinclude> on a page
11707 !! wikitext
11708 <onlyinclude>Foo</onlyinclude>bar
11709 !! html
11710 <p>Foobar
11711 </p>
11712 !! end
11713
11714 !! test
11715 Un-closed <onlyinclude>
11716 !! wikitext
11717 <onlyinclude>
11718 !! html
11719 !! end
11720
11721 !!test
11722 Self-closed noinclude, includeonly, onlyinclude tags
11723 !! wikitext
11724 <noinclude />
11725 <includeonly />
11726 <onlyinclude />
11727 !! html
11728 <p><br />
11729 </p>
11730 !!end
11731
11732 !!test
11733 Unbalanced includeonly and noinclude tags
11734 !! wikitext
11735 {|
11736 |a</noinclude>
11737 |b</noinclude></noinclude>
11738 |c</noinclude></includeonly>
11739 |d</includeonly></includeonly>
11740 |}
11741 !! html
11742 <table>
11743 <tr>
11744 <td>a
11745 </td>
11746 <td>b
11747 </td>
11748 <td>c&lt;/includeonly&gt;
11749 </td>
11750 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11751 </td></tr></table>
11752
11753 !!end
11754
11755 !! article
11756 Template:Includeonly section
11757 !! text
11758 <includeonly>
11759 ==Includeonly section==
11760 </includeonly>
11761 ==Section T-1==
11762 !!endarticle
11763
11764 !! test
11765 T8563: Edit link generation for section shown by <includeonly>
11766 !! wikitext
11767 {{includeonly section}}
11768 !! html
11769 <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>
11770 <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>
11771
11772 !! end
11773
11774 # Uses same input as the contents of [[Template:Includeonly section]]
11775 !! test
11776 T8563: Section extraction for section shown by <includeonly>
11777 !! options
11778 section=T-2
11779 !! wikitext
11780 <includeonly>
11781 ==Includeonly section==
11782 </includeonly>
11783 ==Section T-2==
11784 !! html
11785 ==Section T-2==
11786 !! end
11787
11788 !! test
11789 T8563: Edit link generation for section suppressed by <includeonly>
11790 !! wikitext
11791 <includeonly>
11792 ==Includeonly section==
11793 </includeonly>
11794 ==Section 1==
11795 !! html
11796 <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>
11797
11798 !! end
11799
11800 !! test
11801 T8563: Section extraction for section suppressed by <includeonly>
11802 !! options
11803 section=1
11804 !! wikitext
11805 <includeonly>
11806 ==Includeonly section==
11807 </includeonly>
11808 ==Section 1==
11809 !! html
11810 ==Section 1==
11811 !! end
11812
11813 !! test
11814 Un-closed <includeonly>
11815 !! wikitext
11816 <includeonly>
11817 !! html/php
11818 !! html/parsoid
11819 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11820 !! end
11821
11822 ## We used to, but no longer wt2wt this test since the default serializer
11823 ## will normalize the include directives to serialize on their own line.
11824 ## Selser will take care of preserving formatting in scenarios where they
11825 ## intermingled with other wikitext.
11826 !! test
11827 Includes and comments at SOL
11828 !! options
11829 parsoid=wt2html,html2html
11830 !! wikitext
11831 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11832
11833 <noinclude>
11834 some
11835 </noinclude>* stuff
11836 * here
11837
11838 <includeonly>can have stuff</includeonly>=== here ===
11839
11840 !! html/php
11841 <h2><span class="mw-headline" id="hu">hu</span></h2>
11842 <p>some
11843 </p>
11844 <ul><li> stuff</li>
11845 <li> here</li></ul>
11846 <h3><span class="mw-headline" id="here">here</span></h3>
11847
11848 !! html/parsoid
11849 <!-- 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>
11850
11851 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11852 <p>some</p>
11853 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11854 <li> here</li></ul>
11855
11856 <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>
11857
11858 !! end
11859
11860 # TODO: test with DOM fragment reuse!
11861 !! test
11862 Parsoid: DOM fragment reuse
11863 !! options
11864 parsoid=wt2wt,wt2html
11865 !! wikitext
11866 a{{echo|b<table></table>c}}d
11867
11868 a{{echo|b
11869 <table></table>
11870 c}}d
11871
11872 {{echo|a
11873
11874 <table></table>
11875
11876 b}}
11877 !! html
11878 <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>
11879
11880 <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">
11881 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11882 </span><p about="#mwt2">cd</p>
11883
11884 <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">
11885
11886 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11887
11888 </span><p about="#mwt3">b</p>
11889 !! end
11890
11891 !! test
11892 Parsoid: Merge double tds (T52603)
11893 !! options
11894 parsoid
11895 !! wikitext
11896 {|
11897 |{{echo|{{!}} foo}}
11898 |}
11899 !! html
11900 <table><tbody>
11901 <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>
11902 </tbody></table>
11903 !! end
11904
11905 !! test
11906 Parsoid: Merge double tds in nested transclusion content (T52603)
11907 !! options
11908 parsoid
11909 !! wikitext
11910 {{echo|<div>}}
11911 {|
11912 |{{echo|{{!}} foo}}
11913 |}
11914 {{echo|</div>}}
11915 !! html
11916 <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}}]}'>
11917 <table><tbody>
11918 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11919 </tbody></table>
11920 </div>
11921 !! end
11922
11923 ###
11924 ### <includeonly> and <noinclude> in attributes
11925 ###
11926 !!test
11927 0. includeonly around the entire attribute
11928 !! wikitext
11929 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11930 !! html
11931 <p><span id="v2">bar</span>
11932 </p>
11933 !!end
11934
11935 !!test
11936 1. includeonly in html attr key
11937 !! wikitext
11938 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11939 !! html
11940 <p><span id="foo">bar</span>
11941 </p>
11942 !!end
11943
11944 !!test
11945 2. includeonly in html attr value
11946 !! wikitext
11947 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11948 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11949 !! html
11950 <p><span id="v1">bar</span>
11951 <span id="v1">bar</span>
11952 </p>
11953 !!end
11954
11955 !!test
11956 3. includeonly in part of an attr value
11957 !! wikitext
11958 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11959 !! html
11960 <p><span style="color:red;">bar</span>
11961 </p>
11962 !!end
11963
11964 !!test
11965 4. includeonly in table attributes
11966 !! wikitext
11967 {|
11968 |- <noinclude>
11969 |-
11970 |a
11971 </noinclude>
11972 |- <includeonly>
11973 |-
11974 |b
11975 </includeonly>
11976 |}
11977 !! html
11978 <table>
11979
11980
11981 <tr>
11982 <td>a
11983 </td></tr>
11984 </table>
11985
11986 !!end
11987
11988 ###
11989 ### Preprocessor precedence tests
11990 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11991 ###
11992 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11993 !! test
11994 Preprocessor precedence 1: link is rightmost opening
11995 !! options
11996 parsoid=wt2html
11997 !! wikitext
11998 {{[[Foo|bar}}]]
11999
12000 But close-brace is not a valid character in a link title:
12001 {{[[Foo}}|bar]]
12002
12003 However, we can still tell this was handled as a link in the preprocessor:
12004 {{echo|[[Foo}}|bar]]|bat}}
12005 !! html/php
12006 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12007 </p><p>But close-brace is not a valid character in a link title:
12008 {{[[Foo}}|bar]]
12009 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12010 [[Foo}}|bar]]
12011 </p>
12012 !! html/parsoid
12013 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12014 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12015 <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>
12016 !! end
12017
12018 !! test
12019 Preprocessor precedence 2: template is rightmost opening
12020 !! options
12021 language=zh
12022 !! wikitext
12023 -{{echo|foo}-}}-
12024 !! html/php
12025 <p>-foo}--
12026 </p>
12027 !! html/parsoid
12028 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12029 !! end
12030
12031 !! test
12032 Preprocessor precedence 3: language converter is rightmost opening
12033 !! options
12034 language=zh
12035 parsoid=wt2html
12036 !! wikitext
12037 {{echo|hi}}
12038
12039 {{-{R|echo|hi}}}-
12040
12041 [[-{R|raw]]}-
12042 !! html/php
12043 <p>hi
12044 </p><p>{{echo|hi}}
12045 </p><p>[[raw]]
12046 </p>
12047 !! html/parsoid
12048 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12049 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12050 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12051 !! end
12052
12053 !! test
12054 Preprocessor precedence 4: left-most angle bracket
12055 !! options
12056 language=zh
12057 !! wikitext
12058 <!--{raw}-->
12059 !! html/php
12060 !! html/parsoid
12061 <!--{raw}-->
12062 !! end
12063
12064 !! article
12065 Template:Precedence5
12066 !! text
12067 {{{{{1}}}}}
12068 !! endarticle
12069
12070 !! test
12071 Preprocessor precedence 5: tplarg takes precedence over template
12072 !! wikitext
12073 {{Precedence5|Bullet}}
12074 !! html/php
12075 <ul><li> Bar</li></ul>
12076
12077 !! html/parsoid
12078 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12079 !! end
12080
12081 !! test
12082 Preprocessor precedence 6: broken link is rightmost opening
12083 !! options
12084 parsoid=wt2html
12085 !! wikitext
12086 {{echo|[[Foo}}
12087
12088 {{echo|[[Foo|bar|bat=baz}}
12089 !! html/php
12090 <p>{{echo|[[Foo}}
12091 </p><p>{{echo|[[Foo|bar|bat=baz}}
12092 </p>
12093 !! html/parsoid
12094 <p>{{echo|[[Foo}}</p>
12095 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12096 !! end
12097
12098 # This next test exposes a difference between PHP and Parsoid:
12099 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12100 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12101 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12102 # outer `[[Foo` extends until the `y]]`
12103 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12104 # intermediate result (after template expansion), and link processing
12105 # happens on this intermediate result, which moves the wikilink
12106 # boundary leftward to `[[Foo|Bar]]`
12107 # 2b) Parsoid works in a single step, so it's going to keep the
12108 # wikilink as extending to the `y]]`
12109 # 3a) Then PHP does linktrail processing which slurps up the trailing
12110 # `xy` inside the link.
12111 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12112 # `z` inside the link.
12113 # This is "correct" behavior. Parsoid's basic worldview is that the
12114 # `]]` inside the template shouldn't be allowed to leak out to affect
12115 # the surrounding wikilink. PHP may match Parsoid (in the future)
12116 # if you use {{#balance}} (T114445).
12117
12118 !! test
12119 Preprocessor precedence 7: broken template is rightmost opening
12120 !! options
12121 parsoid=wt2html
12122 !! wikitext
12123 [[Foo|{{echo|Bar]]
12124
12125 [[Foo|{{echo|Bar]]-x}}-y]]-z
12126
12127 Careful: linktrails can move the end of the wikilink:
12128 [[Foo|{{echo|y']]a}}l]]l
12129 !! html/php
12130 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12131 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12132 </p><p>Careful: linktrails can move the end of the wikilink:
12133 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12134 </p>
12135 !! html/parsoid
12136 <p>[[Foo|{{echo|Bar]]</p>
12137 <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>
12138 <p>Careful: linktrails can move the end of the wikilink:
12139 <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>
12140 !! end
12141
12142 !! test
12143 Preprocessor precedence 8: broken language converter is rightmost opening
12144 !! options
12145 language=zh
12146 !! wikitext
12147 [[Foo-{R|raw]]
12148 !! html
12149 <p>[[Foo-{R|raw]]
12150 </p>
12151 !! end
12152
12153 !! article
12154 Template:Preprocessor_precedence_9
12155 !! text
12156 ;4: {{{{1}}}}
12157 ;5: {{{{{2}}}}}
12158 ;6: {{{{{{3}}}}}}
12159 ;7: {{{{{{{4}}}}}}}
12160 !! endarticle
12161
12162 !! test
12163 Preprocessor precedence 9: groups of braces
12164 !! wikitext
12165 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12166 !! html/php
12167 <dl><dt>4</dt>
12168 <dd> {Four}</dd>
12169 <dt>5</dt>
12170 <dd> </dd></dl>
12171 <ul><li> Bar</li></ul>
12172 <dl><dt>6</dt>
12173 <dd> Four</dd>
12174 <dt>7</dt>
12175 <dd> {Bullet}</dd></dl>
12176
12177 !! html/parsoid
12178 <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}}]}'>
12179 <dt>4</dt>
12180 <dd>{Four}</dd>
12181 <dt>5</dt>
12182 <dd></dd>
12183 </dl><ul about="#mwt1">
12184 <li>Bar</li>
12185 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12186 <dt>6</dt>
12187 <dd>Four</dd>
12188 <dt>7</dt>
12189 <dd>{Bullet}</dd>
12190 </dl>
12191 !! end
12192
12193 !! article
12194 Template:Preprocessor_precedence_10
12195 !! text
12196 ;1: -{R|raw}-
12197 ;2: -{{Bullet}}-
12198 ;3: -{{{1}}}-
12199 ;4: -{{{{2}}}}-
12200 ;5: -{{{{{3}}}}}-
12201 ;6: -{{{{{{4}}}}}}-
12202 ;7: -{{{{{{{5}}}}}}}-
12203 !! endarticle
12204
12205 !! test
12206 Preprocessor precedence 10: groups of braces with leading dash
12207 !! options
12208 language=zh
12209 !! wikitext
12210 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12211 !! html/php
12212 <dl><dt>1</dt>
12213 <dd> raw</dd>
12214 <dt>2</dt>
12215 <dd> -</dd></dl>
12216 <ul><li> Bar-</li></ul>
12217 <dl><dt>3</dt>
12218 <dd> -Three-</dd>
12219 <dt>4</dt>
12220 <dd> raw2</dd>
12221 <dt>5</dt>
12222 <dd> -</dd></dl>
12223 <ul><li> Bar-</li></ul>
12224 <dl><dt>6</dt>
12225 <dd> -Three-</dd>
12226 <dt>7</dt>
12227 <dd> raw2</dd></dl>
12228
12229 !! html/parsoid
12230 <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}}]}'>
12231 <dt>1</dt>
12232 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12233 <dt>2</dt>
12234 <dd>-</dd>
12235 </dl><ul about="#mwt1">
12236 <li>Bar-</li>
12237 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12238 <dt>3</dt>
12239 <dd>-Three-</dd>
12240 <dt>4</dt>
12241 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12242 <dt>5</dt>
12243 <dd>-</dd>
12244 </dl><ul about="#mwt1">
12245 <li>Bar-</li>
12246 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12247 <dt>6</dt>
12248 <dd>-Three-</dd>
12249 <dt>7</dt>
12250 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12251 </dl>
12252 !! end
12253
12254 !! test
12255 Preprocessor precedence 11: found during visual diff testing
12256 !! wikitext
12257 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12258
12259 {{echo|-{{echo|-{{echo|x}}}}}}
12260
12261 {{echo|-{{echo|x}}}}
12262 !! html/php
12263 <p><span>-<span>-x</span></span>
12264 </p><p>--x
12265 </p><p>-x
12266 </p>
12267 !! html/parsoid
12268 <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>
12269
12270 <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>
12271
12272 <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>
12273 !! end
12274
12275 !! test
12276 Preprocessor precedence 12: broken language converter closed by brace.
12277 !! options
12278 parsoid=wt2html
12279 !! wikitext
12280 This form breaks the template, which is unfortunate:
12281 * {{echo|foo-{bar}bat}}
12282
12283 But if the broken language converter markup is inside an extension
12284 tag, nothing bad happens:
12285 * <nowiki>foo-{bar}bat</nowiki>
12286 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12287 * <pre>foo-{bar}bat</pre>
12288 * {{echo|<pre>foo-{bar}bat</pre>}}
12289
12290 <tag>foo-{bar}bat</tag>
12291 {{echo|<tag>foo-{bar}bat</tag>}}
12292
12293 !! html/php+tidy
12294 <p>This form breaks the template, which is unfortunate:
12295 </p>
12296 <ul><li> {{echo|foo-{bar}bat}}</li></ul>
12297 <p>But if the broken language converter markup is inside an extension
12298 tag, nothing bad happens:
12299 </p>
12300 <ul><li> foo-&#123;bar}bat</li>
12301 <li> foo-&#123;bar}bat</li>
12302 <li> <pre>foo-{bar}bat</pre></li>
12303 <li> <pre>foo-{bar}bat</pre></li></ul>
12304 <pre>'foo-{bar}bat'
12305 array (
12306 )
12307 </pre>
12308 <pre>'foo-{bar}bat'
12309 array (
12310 )
12311 </pre>
12312 !! html/parsoid
12313 <p>This form breaks the template, which is unfortunate:</p>
12314 <ul>
12315 <li>{{echo|foo-{bar}bat}}</li>
12316 </ul>
12317 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12318 <ul>
12319 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12320 <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>
12321 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12322 <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>
12323 </ul>
12324 <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>
12325 !! end
12326
12327 !! test
12328 Preprocessor precedence 13: broken language converter in external link
12329 !! options
12330 parsoid=wt2html
12331 !! wikitext
12332 * [http://example.com/-{foo Example in URL]
12333 * [http://example.com Example in -{link} description]
12334 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12335 !! html/php+tidy
12336 <ul><li> <a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12337 <li> <a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12338 <li> {{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12339 !! html/parsoid
12340 <ul>
12341 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12342 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12343 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12344 </ul>
12345 !! end
12346
12347 !! test
12348 Preprocessor precedence 14: broken language converter in comment
12349 !! wikitext
12350 * <!--{{foo}}--> ...should be ok
12351 * <!---{{foo}}--> ...extra dashes
12352 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12353 !! html/php+tidy
12354 <ul><li> ...should be ok</li>
12355 <li> ...extra dashes</li>
12356 <li> foobat ...should be ok</li></ul>
12357 !! html/parsoid
12358 <ul>
12359 <li><!--{{foo}}--> ...should be ok</li>
12360 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12361 <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>
12362 </ul>
12363 !! end
12364
12365 !! test
12366 Preprocessor precedence 15: broken brace markup in headings
12367 !! config
12368 wgFragmentMode=[ 'html5', 'legacy' ]
12369 !! options
12370 parsoid=wt2html
12371 !! wikitext
12372 __NOTOC__ __NOEDITSECTION__
12373 ===1 foo[bar 1===
12374 1
12375 ===2 foo[[bar 2===
12376 2
12377 ===3 foo{bar 3===
12378 3
12379 ===4 foo{{bar 4===
12380 4
12381 ===5 foo{{{bar 5===
12382 5
12383 ===6 foo-{bar 6===
12384 6
12385 !! html/php+tidy
12386 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12387 <p>1
12388 </p>
12389 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12390 <p>2
12391 </p>
12392 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12393 <p>3
12394 </p>
12395 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12396 <p>4
12397 </p>
12398 <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>
12399 <p>5
12400 </p>
12401 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12402 <p>6
12403 </p>
12404 !! html/parsoid
12405 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12406 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12407 <p>1</p>
12408 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12409 <p>2</p>
12410 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12411 <p>3</p>
12412 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12413 <p>4</p>
12414 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12415 <p>5</p>
12416 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12417 <p>6</p>
12418 !! end
12419
12420 !! test
12421 Preprocessor precedence 16: matching closing braces to opening braces
12422 !! options
12423 language=zh
12424 parsoid=wt2html
12425 !! wikitext
12426 -{{{echo|foo}}bar}-
12427 !! html/php
12428 <p>foobar
12429 </p>
12430 !! html/parsoid
12431 <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>
12432 !! end
12433
12434 !! test
12435 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12436 !! options
12437 parsoid=wt2html
12438 !! wikitext
12439 {{echo|hi {{}}}}
12440 !! html/php
12441 <p>hi {{}}
12442 </p>
12443 !! html/parsoid
12444 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12445 !! end
12446
12447 !! test
12448 Preprocessor precedence 18: another rightmost wins scenario
12449 !! options
12450 parsoid=wt2html
12451 !! wikitext
12452 {{ -{{{{1|tplarg}}} }} }-
12453 !! html/php
12454 <p>{{ -{tplarg }} }-
12455 </p>
12456 !! html/parsoid
12457 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12458 !! end
12459
12460 !! test
12461 Preprocessor precedence 19: break syntax
12462 !! options
12463 parsoid=wt2html
12464 !! wikitext
12465 -{{
12466 !! html/php
12467 <p>-{{
12468 </p>
12469 !! html/parsoid
12470 <p>-{{</p>
12471 !! end
12472
12473 ###
12474 ### Token Stream Patcher tests
12475 ###
12476 ### These tests won't always pass wt2wt and other modes because
12477 ### on serialization, the table will be output on a new line.
12478 ### For now, we are blacklisting them, and using this to test selser.
12479 ###
12480
12481 !!test
12482 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12483 !!options
12484 parsoid=wt2html,wt2wt
12485 !!wikitext
12486 {{echo|}}{| width = '100%'
12487 |foo
12488 |}
12489 !!html/parsoid
12490 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12491 <tbody><tr><td>foo</td></tr>
12492 </tbody></table>
12493 !!end
12494
12495 ## We used to, but no longer wt2wt this test since the default serializer
12496 ## will normalize the include directives to serialize on their own line.
12497 ## Selser will take care of preserving formatting in scenarios where they
12498 ## intermingled with other wikitext.
12499 !!test
12500 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12501 !!options
12502 parsoid=wt2html
12503 !!wikitext
12504 <includeonly>a</includeonly>{| {{{b}}}
12505 |c
12506 |}
12507 !!html/parsoid
12508 <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":""}]]}'>
12509 <tbody><tr><td>c</td></tr>
12510 </tbody></table>
12511 !!end
12512
12513 !! test
12514 Table wikitext syntax outside wiki-tables
12515 !! wikitext
12516 a
12517 |+ not a caption
12518 ! not a table heading
12519 |- not a table row
12520 | not a table cell
12521 | class="foo bar" | baz
12522 b
12523 |}
12524 |-
12525 c
12526 !! html
12527 <p>a
12528 |+ not a caption
12529 ! not a table heading
12530 |- not a table row
12531 | not a table cell
12532 | class="foo bar" | baz
12533 b
12534 |}
12535 |-
12536 c
12537 </p>
12538 !! end
12539
12540 ###
12541 ### Testing parsing of templates where a template arg
12542 ### has the same name as the template itself.
12543 ###
12544
12545 !! article
12546 Template:quote
12547 !! text
12548 {{{quote|{{{1}}}}}}
12549 !! endarticle
12550
12551 !!test
12552 Templates: Template Name/Arg clash: 1. Use of positional param
12553 !! wikitext
12554 {{quote|foo}}
12555 !! html
12556 <p>foo
12557 </p>
12558 !!end
12559
12560 !!test
12561 Templates: Template Name/Arg clash: 2. Use of named param
12562 !! wikitext
12563 {{quote|quote=foo}}
12564 !! html
12565 <p>foo
12566 </p>
12567 !!end
12568
12569 !!test
12570 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12571 !! wikitext
12572 {{quote|quote}}
12573 !! html
12574 <p>quote
12575 </p>
12576 !!end
12577
12578 ###
12579 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12580 ###
12581
12582 !!test
12583 Templates: 1. Simple use
12584 !! wikitext
12585 {{echo|Foo}}
12586 !! html
12587 <p>Foo
12588 </p>
12589 !!end
12590
12591 !!test
12592 Templates: 2. Inside a block tag
12593 !! wikitext
12594 <div>{{echo|Foo}}</div>
12595 <blockquote>{{echo|Foo}}</blockquote>
12596 !! html
12597 <div>Foo</div>
12598 <blockquote>Foo</blockquote>
12599
12600 !! html+tidy
12601 <div>Foo</div>
12602 <blockquote><p>Foo</p></blockquote>
12603 !!end
12604
12605 !!test
12606 Templates: P-wrapping: 1a. Templates on consecutive lines
12607 !! wikitext
12608 {{echo|Foo}}
12609 {{echo|bar}}
12610 !! html
12611 <p>Foo
12612 bar
12613 </p>
12614 !!end
12615
12616 !!test
12617 Templates: P-wrapping: 1b. Templates on consecutive lines
12618 !! wikitext
12619 Foo
12620
12621 {{echo|bar}}
12622 {{echo|baz}}
12623 !! html
12624 <p>Foo
12625 </p><p>bar
12626 baz
12627 </p>
12628 !!end
12629
12630 !!test
12631 Templates: P-wrapping: 1c. Templates on consecutive lines
12632 !! wikitext
12633 {{echo|Foo}}
12634 {{echo|bar}} <div>baz</div>
12635 !! html
12636 <p>Foo
12637 </p>
12638 bar <div>baz</div>
12639
12640 !! html+tidy
12641 <p>Foo
12642 </p><p>
12643 bar </p><div>baz</div>
12644 !! end
12645
12646 !!test
12647 Templates: P-wrapping: 1d. Template preceded by comment-only line
12648 !!options
12649 parsoid
12650 !! wikitext
12651 <!-- foo -->
12652 {{echo|Bar}}
12653 !! html
12654 <!-- foo -->
12655
12656 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12657 !!end
12658
12659 !!test
12660 Templates: Inline Text: 1. Multiple template uses
12661 !! wikitext
12662 {{echo|Foo}}bar{{echo|baz}}
12663 !! html
12664 <p>Foobarbaz
12665 </p>
12666 !!end
12667
12668 !!test
12669 Templates: Inline Text: 2. Back-to-back template uses
12670 !! wikitext
12671 {{echo|Foo}}{{echo|bar}}
12672 !! html
12673 <p>Foobar
12674 </p>
12675 !!end
12676
12677 !!test
12678 Templates: Block Tags: 1. Multiple template uses
12679 !! wikitext
12680 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12681 !! html
12682 <div>Foo</div><div>bar</div><div>baz</div>
12683
12684 !!end
12685
12686 !!test
12687 Templates: Block Tags: 2. Back-to-back template uses
12688 !! wikitext
12689 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12690 !! html
12691 <div>Foo</div><div>bar</div>
12692
12693 !!end
12694
12695 # This is an edge case relating to paragraph wrapping.
12696 !!test
12697 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12698 !! wikitext
12699 {{echo|a
12700 b</p>}}
12701 !! html/parsoid
12702 <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
12703 b</p>
12704 !!end
12705
12706 !!test
12707 Templates: Links: 1. Simple example
12708 !! wikitext
12709 {{echo|[[Foo|bar]]}}
12710 !! html
12711 <p><a href="/wiki/Foo" title="Foo">bar</a>
12712 </p>
12713 !!end
12714
12715 !!test
12716 Templates: Links: 2. Generation of link href
12717 !! wikitext
12718 [[{{echo|Foo}}|bar]]
12719 !! html
12720 <p><a href="/wiki/Foo" title="Foo">bar</a>
12721 </p>
12722 !!end
12723
12724 !!test
12725 Templates: Links: 3. Generation of part of a link href
12726 !! wikitext
12727 [[Fo{{echo|o}}|bar]]
12728
12729 [[Foo{{echo|bar}}]]
12730
12731 [[Foo{{echo|bar}}baz]]
12732
12733 [[Foo{{echo|bar}}|bar]]
12734
12735 [[:Foo{{echo|bar}}]]
12736
12737 [[:Foo{{echo|bar}}|bar]]
12738 !! html
12739 <p><a href="/wiki/Foo" title="Foo">bar</a>
12740 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12741 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12742 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12743 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12744 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12745 </p>
12746 !!end
12747
12748 !!test
12749 Templates: Links: 4. Multiple templates generating link href
12750 !! wikitext
12751 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12752 !! html
12753 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12754 </p>
12755 !!end
12756
12757 !!test
12758 Templates: Links: 5. Generation of link text
12759 !! wikitext
12760 [[Foo|{{echo|bar}}]]
12761 !! html
12762 <p><a href="/wiki/Foo" title="Foo">bar</a>
12763 </p>
12764 !!end
12765
12766 !!test
12767 Templates: Links: 5. Nested templates (only outermost template should be marked)
12768 !! wikitext
12769 {{echo|[[{{echo|Foo}}|bar]]}}
12770 !! html
12771 <p><a href="/wiki/Foo" title="Foo">bar</a>
12772 </p>
12773 !!end
12774
12775 !!test
12776 Templates: HTML Tag: 1. Generation of HTML attr. key
12777 !! wikitext
12778 <div {{echo|style}}="color:red;">foo</div>
12779 !! html
12780 <div style="color:red;">foo</div>
12781
12782 !!end
12783
12784 !!test
12785 Templates: HTML Tag: 2. Generation of HTML attr. value
12786 !! wikitext
12787 <div style={{echo|'color:red;'}}>foo</div>
12788 !! html
12789 <div style="color:red;">foo</div>
12790
12791 !!end
12792
12793 !!test
12794 Templates: HTML Tag: 3. Generation of HTML attr key and value
12795 !! wikitext
12796 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12797 !! html
12798 <div style="color:red;">foo</div>
12799
12800 !!end
12801
12802 !!test
12803 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12804 !! wikitext
12805 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12806 !! html
12807 <div title="This is a long title with just one piece templated">foo</div>
12808
12809 !!end
12810
12811 !!test
12812 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12813 !! wikitext
12814 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12815 !! html
12816 <div title="This is a long title with just one piece templated">foo</div>
12817
12818 !!end
12819
12820 !!test
12821 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12822 !! wikitext
12823 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12824 !! html
12825 <div title="This is a long title with just one piece templated">foo</div>
12826
12827 !!end
12828
12829 # SSS FIXME: While it is great we added support for all this,
12830 # do we want to make this part of the spec? Maybe we want to
12831 # deprecate this kind of usage in the future?
12832 !!test
12833 Templates: HTML Tag: 7. Generation of partial attribute key string
12834 !! wikitext
12835 <div st{{echo|yle}}="color:red;">foo</div>
12836 !! html
12837 <div style="color:red;">foo</div>
12838
12839 !!end
12840
12841 !! test
12842 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12843 !! wikitext
12844 <div {{echo|1=id="v1"}}>bar</div>
12845 !! html
12846 <div id="v1">bar</div>
12847
12848 !!end
12849
12850 !! test
12851 Templates: HTML Tag: 9. Multiple template-generated attributes
12852 !! wikitext
12853 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12854 !! html
12855 <div id="v1" title="foo">bar</div>
12856
12857 !!end
12858
12859 !! test
12860 Templates: Support for templates generating attributes and content
12861 !! wikitext
12862 {| {{mixed_attr_content_template}}
12863 |-
12864 |bar
12865 |}
12866 !! html/php
12867 <table style="color:red;" title="T48811">
12868
12869 <tr>
12870 <td>foo
12871 </td></tr>
12872 <tr>
12873 <td>bar
12874 </td></tr></table>
12875
12876 !! html/parsoid
12877 <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|}"]}'>
12878 <tbody><tr>
12879 <td>foo</td></tr>
12880 <tr>
12881 <td>bar</td></tr>
12882 </tbody></table>
12883 !!end
12884
12885 !! test
12886 1. Entities and nowikis inside templated attributes should be handled correctly
12887 !! wikitext
12888 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12889 !! html/php
12890 <div style="background:#f9f9f9;">foo</div>
12891
12892 !! html/parsoid
12893 <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>
12894 !! end
12895
12896 !! test
12897 2. Entities and nowikis inside templated attributes should be handled correctly
12898 !! wikitext
12899 {|
12900 |{{table_attribs_3}}
12901 |}
12902 !! html/php
12903 <table>
12904 <tr>
12905 <td style="background:#f9f9f9;">Foo
12906 </td></tr></table>
12907
12908 !! html/parsoid
12909 <table>
12910 <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>
12911 </tbody></table>
12912 !! end
12913
12914 !! test
12915 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12916 !! wikitext
12917 {{tbl-start}}
12918 |{{table_attribs_3}}
12919 {{tbl-end}}
12920 !! html/php
12921 <table>
12922 <tr>
12923 <td style="background:#f9f9f9;">Foo
12924 </td></tr></table>
12925
12926 !! html/parsoid
12927 <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}}]}'>
12928 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12929 </tbody></table>
12930 !! end
12931
12932 # T107622
12933 !! test
12934 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12935 !! wikitext
12936 {|
12937 | {{table_attribs_6}} hi
12938 |}
12939 !! html/php
12940 <table>
12941 <tr>
12942 <td style="background: red;"> hi
12943 </td></tr></table>
12944
12945 !! html/parsoid
12946 <table>
12947 <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>
12948 </tbody></table>
12949 !! end
12950
12951 !!test
12952 Templates: HTML Tables: 1. Generating start of a HTML table
12953 !! wikitext
12954 {{echo|<table><tr><td>foo</td>}}</tr></table>
12955 !! html
12956 <table><tr><td>foo</td></tr></table>
12957
12958 !!end
12959
12960 !!test
12961 Templates: HTML Tables: 2a. Generating middle of a HTML table
12962 !! wikitext
12963 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12964 !! html
12965 <table><tr><td>foo</td></tr></table>
12966
12967 !!end
12968
12969 !!test
12970 Templates: HTML Tables: 2b. Generating middle of a HTML table
12971 !! wikitext
12972 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12973 !! html
12974 <table><tr><td>foo</td></tr></table>
12975
12976 !!end
12977
12978 !!test
12979 Templates: HTML Tables: 3. Generating end of a HTML table
12980 !! wikitext
12981 <table><tr>{{echo|<td>foo</td></tr></table>}}
12982 !! html
12983 <table><tr><td>foo</td></tr></table>
12984
12985 !!end
12986
12987 !!test
12988 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12989 !! wikitext
12990 {{echo|<table>}}<tr><td>foo</td></tr></table>
12991 !! html
12992 <table><tr><td>foo</td></tr></table>
12993
12994 !!end
12995
12996 !!test
12997 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12998 !! wikitext
12999 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13000 !! html
13001 <table><tr><td>foo</td></tr></table>
13002
13003 !!end
13004
13005 !!test
13006 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13007 !! wikitext
13008 <table><tr>{{echo|<td>}}foo</td></tr></table>
13009 !! html
13010 <table><tr><td>foo</td></tr></table>
13011
13012 !!end
13013
13014 !!test
13015 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13016 !! wikitext
13017 <table><tr><td>foo{{echo|</td>}}</tr></table>
13018 !! html
13019 <table><tr><td>foo</td></tr></table>
13020
13021 !!end
13022
13023 !!test
13024 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13025 !! wikitext
13026 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13027 !! html
13028 <table><tr><td>foo</td></tr></table>
13029
13030 !!end
13031
13032 !!test
13033 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13034 !! wikitext
13035 <table><tr><td>foo</td></tr>{{echo|</table>}}
13036 !! html
13037 <table><tr><td>foo</td></tr></table>
13038
13039 !!end
13040
13041 !!test
13042 Templates: HTML Tables: 5. Proper fostering of categories from inside
13043 !!options
13044 parsoid=wt2html,wt2wt
13045 !! wikitext
13046 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13047 <!--Two categories (T52330)-->
13048 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13049 !! html
13050 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13051 <!--Two categories (T52330)-->
13052 <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>
13053 !!end
13054
13055 !!test
13056 Templates: Wiki Tables: 1a. Fostering of entire template content
13057 !! wikitext
13058 {|
13059 {{echo|a}}
13060 |}
13061 !! html
13062 <table>
13063 a
13064 <tr><td></td></tr></table>
13065
13066 !! html+tidy
13067
13068 a
13069 <table><tbody><tr><td></td></tr></tbody></table>
13070 !! end
13071
13072 !!test
13073 Templates: Wiki Tables: 1b. Fostering of entire template content
13074 !! wikitext
13075 {|
13076 {{echo|<div>}}
13077 foo
13078 {{echo|</div>}}
13079 |}
13080 !! html
13081 <table>
13082 <div>
13083 <p>foo
13084 </p>
13085 </div>
13086 <tr><td></td></tr></table>
13087
13088 !! html/php+tidy
13089 <div>
13090 <p>foo
13091 </p>
13092 </div><table>
13093
13094 <tbody><tr><td></td></tr></tbody></table>
13095 !! html/parsoid
13096 <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|}"]}'>
13097 <p>foo</p>
13098 </div><table about="#mwt3">
13099
13100 </table>
13101 !! end
13102
13103 !!test
13104 Templates: Wiki Tables: 2. Fostering of partial template content
13105 !! wikitext
13106 {|
13107 {{echo|a
13108 <div>b</div>}}
13109 |}
13110 !! html
13111 <table>
13112 a
13113 <div>b</div>
13114 <tr><td></td></tr></table>
13115
13116 !! html/php+tidy
13117
13118 a
13119 <div>b</div><table>
13120 <tbody><tr><td></td></tr></tbody></table>
13121 !! html/parsoid
13122 <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">
13123
13124
13125 </table>
13126 !! end
13127
13128 !!test
13129 Templates: Wiki Tables: 3. td-content via multiple templates
13130 !! wikitext
13131 {|
13132 {{echo|{{pipe}}a}}{{echo|b}}
13133 |}
13134 !! html
13135 <table>
13136 <tr>
13137 <td>ab
13138 </td></tr></table>
13139
13140 !!end
13141
13142 !!test
13143 Templates: Wiki Tables: 4. Templated tags, no content
13144 !! wikitext
13145 {{tbl-start}}
13146 {{tbl-end}}
13147 !! html
13148 <table>
13149 <tr><td></td></tr></table>
13150
13151 !!end
13152
13153 !!test
13154 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13155 !! wikitext
13156 {{tbl-start}}
13157 |foo
13158 {{tbl-end}}
13159 !! html
13160 <table>
13161 <tr>
13162 <td>foo
13163 </td></tr></table>
13164
13165 !!end
13166
13167 !!test
13168 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13169 !! wikitext
13170 {{tbl-start}}
13171 {{!}}foo
13172 {{tbl-end}}
13173 !! html
13174 <table>
13175 <tr>
13176 <td>foo
13177 </td></tr></table>
13178
13179 !!end
13180
13181 ## This test case is very specific to Parsoid's internals
13182 ## and is hence only tested for Parsoid's code. Parsoid uses
13183 ## a <meta> marker tag for <ref> tags and they are expanded
13184 ## much later. We are verifying that this <meta> tag usage
13185 ## doesn't prevent foster parenting.
13186 !!test
13187 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13188 !!wikitext
13189 {{PartialTable}}<ref>foo</ref>
13190 |}
13191
13192 <references />
13193 !!html/parsoid
13194 <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">
13195 <tbody>
13196 </tbody></table>
13197
13198 <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>
13199 !!end
13200
13201 !! test
13202 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13203 !! wikitext
13204 {{echo|
13205 {{{!}}
13206 {{!}}-}}
13207 <onlyinclude>
13208 |foo
13209 </onlyinclude>
13210 {{!}}}
13211 !! html/parsoid
13212 <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{{!}}}"]}'>
13213 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13214 <tbody><tr>
13215
13216 <td>foo
13217 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13218 </tbody></table>
13219 !! end
13220
13221 !!test
13222 Templates: Lists: Multi-line list-items via templates
13223 !! wikitext
13224 *{{echo|a {{nonexistent|
13225 unused}}}}
13226 *{{echo|b {{nonexistent|
13227 unused}}}}
13228 !! html
13229 <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>
13230 <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>
13231
13232 !!end
13233
13234 !!test
13235 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13236 !! wikitext
13237 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13238 !! html
13239 <p><i>ab</i>c<i>d</i>e
13240 </p>
13241 !!end
13242
13243 !!test
13244 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13245 (PHP parser generates misnested html)
13246 !! wikitext
13247 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13248 !! html/parsoid
13249 <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>
13250 !!end
13251
13252 !!test
13253 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13254 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13255 !! options
13256 parsoid=wt2html,wt2wt
13257 !! wikitext
13258 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13259 !! html
13260 <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>
13261 <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>
13262 <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>
13263 !!end
13264
13265 !!test
13266 Templates: Ugly nesting: 4. Divs opened/closed across templates
13267 !! wikitext
13268 a<div>b{{echo|c</div>d}}e
13269 !! html
13270 a<div>bc</div>de
13271
13272 !! html+tidy
13273 <p>a</p><div>bc</div><p>de
13274 </p>
13275 !! end
13276
13277 !! test
13278 Templates: Ugly templates: 3. newline-only template parameter
13279 !! wikitext
13280 foo {{echo|
13281 }}
13282 !! html
13283 <p>foo
13284 </p>
13285 !! end
13286
13287 # This looks like a bug: a single newline triggers p/br for some reason.
13288 !! test
13289 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13290 !! wikitext
13291 {{echo|
13292 }}
13293 !! html
13294 <p><br />
13295 </p>
13296 !! end
13297
13298 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13299 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13300 !! test
13301 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13302 !! wikitext
13303 {{echo|<table>}}
13304 {{echo|<div>foo}}
13305 {{echo|</table>}}
13306 !! html/parsoid
13307 <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
13308 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13309 </table>
13310 !! end
13311
13312 # T66017 -- ugly wikitext with fostered content generates two template ranges
13313 # that are "identical" and generate nesting cycles in the algorithm
13314 !! test
13315 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13316 !! wikitext
13317 {{echo|<table><tr><td><table>}}
13318 {{echo|<div>}}
13319 {{echo|</div>}}
13320 !! html/parsoid
13321 <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"}'>
13322 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13323 </table></td></tr></tbody></table>
13324 !! end
13325
13326 !! test
13327 Templates: Parameters substituted at the top-level
13328 !! wikitext
13329 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13330
13331 {{{foo|bar|baz}}}
13332 !! html/php
13333 <p><i>who</i> me? <b>never!</b>
13334 </p><p>bar
13335 </p>
13336 !! html/parsoid
13337 <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>
13338
13339 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13340 !! end
13341
13342 !! test
13343 Templates: Param with empty arg in the final position
13344 !! wikitext
13345 {{{hi|}}}
13346 !! html/parsoid
13347 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13348 !! end
13349
13350 !!test
13351 Parser Functions: 1. Simple example
13352 !! wikitext
13353 {{uc:foo}}
13354 !! html
13355 <p>FOO
13356 </p>
13357 !!end
13358
13359 !!test
13360 Parser Functions: 2. Nested use (only outermost should be marked up)
13361 !! wikitext
13362 {{uc:{{lc:FOO}}}}
13363 !! html
13364 <p>FOO
13365 </p>
13366 !!end
13367
13368 ###
13369 ### Pre-save transform tests
13370 ###
13371 !! test
13372 pre-save transform: subst:
13373 !! options
13374 pst
13375 !! wikitext
13376 {{subst:test}}
13377 !! html/php
13378 This is a test template
13379 !! end
13380
13381 !! test
13382 pre-save transform: normal template
13383 !! options
13384 pst
13385 !! wikitext
13386 {{test}}
13387 !! html/php
13388 {{test}}
13389 !! end
13390
13391 !! test
13392 pre-save transform: nonexistent template
13393 !! options
13394 pst
13395 !! wikitext
13396 {{thistemplatedoesnotexist}}
13397 !! html/php
13398 {{thistemplatedoesnotexist}}
13399 !! end
13400
13401 !! test
13402 pre-save transform: subst magic variables
13403 !! options
13404 pst
13405 !! wikitext
13406 {{subst:SITENAME}}
13407 !! html/php
13408 MediaWiki
13409 !! end
13410
13411 # This is T2089, which I fixed. -- wtm
13412 !! test
13413 pre-save transform: subst: templates with parameters
13414 !! options
13415 pst
13416 !! wikitext
13417 {{subst:paramtest|param="something else"}}
13418 !! html/php
13419 This is a test template with parameter "something else"
13420 !! end
13421
13422 !! article
13423 Template:nowikitest
13424 !! text
13425 <nowiki>'''not wiki'''</nowiki>
13426 !! endarticle
13427
13428 !! test
13429 pre-save transform: nowiki in subst (T3188)
13430 !! options
13431 pst
13432 !! wikitext
13433 {{subst:nowikitest}}
13434 !! html/php
13435 <nowiki>'''not wiki'''</nowiki>
13436 !! end
13437
13438 !! article
13439 Template:commenttest
13440 !! text
13441 This template has <!-- a comment --> in it.
13442 !! endarticle
13443
13444 !! test
13445 pre-save transform: comment in subst (T3936)
13446 !! options
13447 pst
13448 !! wikitext
13449 {{subst:commenttest}}
13450 !! html/php
13451 This template has <!-- a comment --> in it.
13452 !! end
13453
13454 !! test
13455 pre-save transform: unclosed tag
13456 !! options
13457 pst
13458 !! wikitext
13459 <nowiki>'''not wiki'''
13460 !! html/php
13461 <nowiki>'''not wiki'''
13462 !! end
13463
13464 !! test
13465 pre-save transform: mixed tag case
13466 !! options
13467 pst
13468 !! wikitext
13469 <NOwiki>'''not wiki'''</noWIKI>
13470 !! html/php
13471 <NOwiki>'''not wiki'''</noWIKI>
13472 !! end
13473
13474 !! test
13475 pre-save transform: unclosed comment in <nowiki>
13476 !! options
13477 pst
13478 !! wikitext
13479 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13480 !! html/php
13481 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13482 !!end
13483
13484 # Leading @ in this template definition works around a limitation
13485 # in parsoid's parserTests which otherwise strips the <span> from the
13486 # result (confusing it for a template wrapper)
13487 !! article
13488 Template:dangerous
13489 !!text
13490 @<span onmouseover="alert('crap')">Oh no</span>
13491 !!endarticle
13492
13493 !!test
13494 (confirming safety of fix for subst T3936)
13495 !! wikitext
13496 {{Template:dangerous}}
13497 !! html
13498 <p>@<span>Oh no</span>
13499 </p>
13500 !! end
13501
13502 !! test
13503 pre-save transform: comment containing gallery (T7024)
13504 !! options
13505 pst
13506 !! wikitext
13507 <!-- <gallery>data</gallery> -->
13508 !! html/php
13509 <!-- <gallery>data</gallery> -->
13510 !!end
13511
13512 !! test
13513 pre-save transform: comment containing extension
13514 !! options
13515 pst
13516 !! wikitext
13517 <!-- <tag>data</tag> -->
13518 !! html/php
13519 <!-- <tag>data</tag> -->
13520 !!end
13521
13522 !! test
13523 pre-save transform: comment containing nowiki
13524 !! options
13525 pst
13526 !! wikitext
13527 <!-- <nowiki>data</nowiki> -->
13528 !! html/php
13529 <!-- <nowiki>data</nowiki> -->
13530 !!end
13531
13532 !! test
13533 pre-save transform: <noinclude> in subst (T5298)
13534 !! options
13535 pst
13536 !! wikitext
13537 {{subst:Includes}}
13538 !! html/php
13539 Foobar
13540 !! end
13541
13542 !! test
13543 pre-save transform: <onlyinclude> in subst (T5298)
13544 !! options
13545 pst
13546 !! wikitext
13547 {{subst:Includes2}}
13548 !! html/php
13549 Foo
13550 !! end
13551
13552 !! article
13553 Template:SubstTest
13554 !!text
13555 {{<includeonly>subst:</includeonly>Includes}}
13556 !! endarticle
13557
13558 !! article
13559 Template:SafeSubstTest
13560 !! text
13561 {{<includeonly>safesubst:</includeonly>Includes}}
13562 !! endarticle
13563
13564 !! test
13565 T24297: safesubst: works during PST
13566 !! options
13567 pst
13568 !! wikitext
13569 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13570 !! html/php
13571 FoobarFoobar
13572 !! end
13573
13574 !! test
13575 T24297: safesubst: works during normal parse
13576 !! wikitext
13577 {{SafeSubstTest}}
13578 !! html
13579 <p>Foobar
13580 </p>
13581 !! end
13582
13583 !! test
13584 subst: does not work during normal parse
13585 !! wikitext
13586 {{SubstTest}}
13587 !! html
13588 <p>{{subst:Includes}}
13589 </p>
13590 !! end
13591
13592 !! test
13593 pre-save transform: context links ("pipe trick")
13594 !! options
13595 pst
13596 !! wikitext
13597 [[Article (context)|]]
13598 [[Bar:Article|]]
13599 [[:Bar:Article|]]
13600 [[Bar:Article (context)|]]
13601 [[:Bar:Article (context)|]]
13602 [[|Article]]
13603 [[|Article (context)]]
13604 [[Bar:X (Y) Z|]]
13605 [[:Bar:X (Y) Z|]]
13606 !! html/php
13607 [[Article (context)|Article]]
13608 [[Bar:Article|Article]]
13609 [[:Bar:Article|Article]]
13610 [[Bar:Article (context)|Article]]
13611 [[:Bar:Article (context)|Article]]
13612 [[Article]]
13613 [[Article (context)]]
13614 [[Bar:X (Y) Z|X (Y) Z]]
13615 [[:Bar:X (Y) Z|X (Y) Z]]
13616 !! end
13617
13618 !! test
13619 pre-save transform: context links ("pipe trick") with interwiki prefix
13620 !! options
13621 pst
13622 !! wikitext
13623 [[interwiki:Article|]]
13624 [[:interwiki:Article|]]
13625 [[interwiki:Bar:Article|]]
13626 [[:interwiki:Bar:Article|]]
13627 !! html/php
13628 [[interwiki:Article|Article]]
13629 [[:interwiki:Article|Article]]
13630 [[interwiki:Bar:Article|Bar:Article]]
13631 [[:interwiki:Bar:Article|Bar:Article]]
13632 !! end
13633
13634 !! test
13635 pre-save transform: context links ("pipe trick") with parens in title
13636 !! options
13637 pst title=[[Somearticle (context)]]
13638 !! wikitext
13639 [[|Article]]
13640 !! html/php
13641 [[Article (context)|Article]]
13642 !! end
13643
13644 !! test
13645 pre-save transform: context links ("pipe trick") with comma in title
13646 !! options
13647 pst title=[[Someplace, Somewhere]]
13648 !! wikitext
13649 [[|Otherplace]]
13650 [[Otherplace, Elsewhere|]]
13651 [[Otherplace, Elsewhere, Anywhere|]]
13652 !! html/php
13653 [[Otherplace, Somewhere|Otherplace]]
13654 [[Otherplace, Elsewhere|Otherplace]]
13655 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13656 !! end
13657
13658 !! test
13659 pre-save transform: context links ("pipe trick") with parens and comma
13660 !! options
13661 pst title=[[Someplace (IGNORED), Somewhere]]
13662 !! wikitext
13663 [[|Otherplace]]
13664 [[Otherplace (place), Elsewhere|]]
13665 !! html/php
13666 [[Otherplace, Somewhere|Otherplace]]
13667 [[Otherplace (place), Elsewhere|Otherplace]]
13668 !! end
13669
13670 !! test
13671 pre-save transform: context links ("pipe trick") with comma and parens
13672 !! options
13673 pst title=[[Who, me? (context)]]
13674 !! wikitext
13675 [[|Yes, you.]]
13676 [[Me, Myself, and I (1937 song)|]]
13677 !! html/php
13678 [[Yes, you. (context)|Yes, you.]]
13679 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13680 !! end
13681
13682 !! test
13683 pre-save transform: context links ("pipe trick") with namespace
13684 !! options
13685 pst title=[[Ns:Somearticle]]
13686 !! wikitext
13687 [[|Article]]
13688 !! html/php
13689 [[Ns:Article|Article]]
13690 !! end
13691
13692 !! test
13693 pre-save transform: context links ("pipe trick") with namespace and parens
13694 !! options
13695 pst title=[[Ns:Somearticle (context)]]
13696 !! wikitext
13697 [[|Article]]
13698 !! html/php
13699 [[Ns:Article (context)|Article]]
13700 !! end
13701
13702 !! test
13703 pre-save transform: context links ("pipe trick") with namespace and comma
13704 !! options
13705 pst title=[[Ns:Somearticle, Context, Whatever]]
13706 !! wikitext
13707 [[|Article]]
13708 !! html/php
13709 [[Ns:Article, Context, Whatever|Article]]
13710 !! end
13711
13712 !! test
13713 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13714 !! options
13715 pst title=[[Ns:Somearticle, Context (context)]]
13716 !! wikitext
13717 [[|Article]]
13718 !! html/php
13719 [[Ns:Article (context)|Article]]
13720 !! end
13721
13722 !! test
13723 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13724 !! options
13725 pst title=[[Ns:Somearticle (IGNORED), Context]]
13726 !! wikitext
13727 [[|Article]]
13728 !! html/php
13729 [[Ns:Article, Context|Article]]
13730 !! end
13731
13732 !! test
13733 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13734 !! options
13735 pst
13736 !! wikitext
13737 [[Article(context)|]]
13738 [[Bar:Article(context)|]]
13739 [[:Bar:Article(context)|]]
13740 [[|Article(context)]]
13741 [[Bar:X(Y)Z|]]
13742 [[:Bar:X(Y)Z|]]
13743 !! html/php
13744 [[Article(context)|Article]]
13745 [[Bar:Article(context)|Article]]
13746 [[:Bar:Article(context)|Article]]
13747 [[Article(context)]]
13748 [[Bar:X(Y)Z|X(Y)Z]]
13749 [[:Bar:X(Y)Z|X(Y)Z]]
13750 !! end
13751
13752 !! test
13753 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13754 !! options
13755 pst
13756 !! wikitext
13757 [[Article (context)|]]
13758 [[Bar:Article (context)|]]
13759 [[:Bar:Article (context)|]]
13760 [[|Article (context)]]
13761 [[Bar:X (Y) Z|]]
13762 [[:Bar:X (Y) Z|]]
13763 !! html/php
13764 [[Article (context)|Article]]
13765 [[Bar:Article (context)|Article]]
13766 [[:Bar:Article (context)|Article]]
13767 [[Article (context)]]
13768 [[Bar:X (Y) Z|X (Y) Z]]
13769 [[:Bar:X (Y) Z|X (Y) Z]]
13770 !! end
13771
13772 !! test
13773 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13774 !! options
13775 pst
13776 !! wikitext
13777 [[Article(context)|]]
13778 [[Bar:Article(context)|]]
13779 [[:Bar:Article(context)|]]
13780 [[|Article(context)]]
13781 [[Bar:X(Y)Z|]]
13782 [[:Bar:X(Y)Z|]]
13783 !! html/php
13784 [[Article(context)|Article]]
13785 [[Bar:Article(context)|Article]]
13786 [[:Bar:Article(context)|Article]]
13787 [[Article(context)]]
13788 [[Bar:X(Y)Z|X(Y)Z]]
13789 [[:Bar:X(Y)Z|X(Y)Z]]
13790 !! end
13791
13792 !! test
13793 pre-save transform: context links ("pipe trick") with commas (T23660)
13794 !! options
13795 pst
13796 !! wikitext
13797 [[Article (context), context|]]
13798 [[Article (context),context|]]
13799 [[Bar:Article (context), context|]]
13800 [[Bar:Article (context),context|]]
13801 [[:Bar:Article (context), context|]]
13802 [[:Bar:Article (context),context|]]
13803 !! html/php
13804 [[Article (context), context|Article]]
13805 [[Article (context),context|Article]]
13806 [[Bar:Article (context), context|Article]]
13807 [[Bar:Article (context),context|Article]]
13808 [[:Bar:Article (context), context|Article]]
13809 [[:Bar:Article (context),context|Article]]
13810 !! end
13811
13812 !! test
13813 Parsoid: backwards pipe trick
13814 !! wikitext
13815 [[|'''bar''']]
13816 !! html/php
13817 <p>[[|<b>bar</b>]]
13818 </p>
13819 !! html/parsoid
13820 <p>[[|<b>bar</b>]]</p>
13821 !! end
13822
13823 !! test
13824 pre-save transform: trim trailing empty lines
13825 !! options
13826 pst
13827 !! wikitext
13828 Empty lines are trimmed
13829
13830
13831
13832
13833 !! html/php
13834 Empty lines are trimmed
13835 !! end
13836
13837 !! test
13838 pre-save transform: Signature expansion
13839 !! options
13840 pst
13841 !! wikitext
13842 * ~~~
13843 * ~~~~
13844 * ~~~~~
13845 * <noinclude>~~~</noinclude>
13846 * <includeonly>~~~</includeonly>
13847 * <onlyinclude>~~~</onlyinclude>
13848 !! html/php
13849 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13850 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13851 * 00:02, 1 January 1970 (UTC)
13852 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13853 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13854 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13855 !! end
13856
13857
13858 !! test
13859 ParserOutput flags from signature expansion (T84843)
13860 !! options
13861 pst
13862 showflags
13863 !! wikitext
13864 ~~~~
13865 !! html/php
13866 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13867 flags=user-signature
13868 !! end
13869
13870
13871 !! test
13872 pre-save transform: Signature expansion in nowiki tags (T2093)
13873 !! options
13874 pst disabled
13875 !! wikitext
13876 Shall not expand:
13877
13878 <nowiki>~~~~</nowiki>
13879
13880 <includeonly><nowiki>~~~~</nowiki></includeonly>
13881
13882 <noinclude><nowiki>~~~~</nowiki></noinclude>
13883
13884 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13885
13886 {{subst:Foo}} shall be converted to FOO
13887
13888 As well as inside noinclude/onlyinclude
13889 <noinclude>{{subst:Foo}}</noinclude>
13890 <onlyinclude>{{subst:Foo}}</onlyinclude>
13891
13892 But not inside includeonly
13893 <includeonly>{{subst:Foo}}</includeonly>
13894 !! html/php
13895 Shall not expand:
13896
13897 <nowiki>~~~~</nowiki>
13898
13899 <includeonly><nowiki>~~~~</nowiki></includeonly>
13900
13901 <noinclude><nowiki>~~~~</nowiki></noinclude>
13902
13903 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13904
13905 FOO shall be converted to FOO
13906
13907 As well as inside noinclude/onlyinclude
13908 <noinclude>FOO</noinclude>
13909 <onlyinclude>FOO</onlyinclude>
13910
13911 But not inside includeonly
13912 <includeonly>{{subst:Foo}}</includeonly>
13913 !! end
13914
13915 !! test
13916 Parsoid: Recognize nowiki with trailing space in tags
13917 !! options
13918 parsoid=wt2html
13919 !! wikitext
13920 <nowiki ><div>[[foo]]</nowiki >
13921
13922 a<nowiki / >b
13923
13924 c<nowiki />d
13925
13926 e<nowiki/ >f
13927 !! html
13928 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13929 <p>ab</p>
13930 <p>cd</p>
13931 <p>ef</p>
13932 !! end
13933
13934 !! test
13935 Parsoid: Recognize nowiki with odd capitalization
13936 !! options
13937 parsoid=wt2html
13938 !! wikitext
13939 <noWikI ><div>[[foo]]</Nowiki >
13940 !! html
13941 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13942 !! end
13943
13944
13945 !! test
13946 Parsoid: Escape nowiki with trailing space in tags
13947 !! options
13948 parsoid=html2wt
13949 !! html/parsoid
13950 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13951 <p>a&lt;nowiki /&gt;b</p>
13952 <p>c&lt;nowiki/ &gt;d</p>
13953 !! wikitext
13954 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13955
13956 a&lt;nowiki /&gt;b
13957
13958 c&lt;nowiki/ &gt;d
13959 !! end
13960
13961 !! test
13962 Parsoid: Escape weird noWikI capitalizations
13963 !! options
13964 parsoid=html2wt
13965 !! html/parsoid
13966 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13967 !! wikitext
13968 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13969 !! end
13970
13971 ###
13972 ### Message transform tests
13973 ###
13974 !! test
13975 message transform: magic variables
13976 !! options
13977 msg
13978 !! wikitext
13979 {{SITENAME}}
13980 !! html
13981 MediaWiki
13982 !! end
13983
13984 !! test
13985 message transform: should not transform wiki markup
13986 !! options
13987 msg
13988 !! wikitext
13989 ''test''
13990 !! html
13991 ''test''
13992 !! end
13993
13994 !! test
13995 message transform: <noinclude> in transcluded template (T6926)
13996 !! options
13997 msg
13998 !! wikitext
13999 {{Includes}}
14000 !! html
14001 Foobar
14002 !! end
14003
14004 !! test
14005 message transform: <onlyinclude> in transcluded template (T6926)
14006 !! options
14007 msg
14008 !! wikitext
14009 {{Includes2}}
14010 !! html
14011 Foo
14012 !! end
14013
14014 !! test
14015 {{#special:}} page name, known
14016 !! options
14017 msg
14018 !! wikitext
14019 {{#special:Recentchanges}}
14020 !! html
14021 Special:RecentChanges
14022 !! end
14023
14024 !! test
14025 {{#special:}} page name with subpage, known
14026 !! options
14027 msg
14028 !! wikitext
14029 {{#special:Recentchanges/param}}
14030 !! html
14031 Special:RecentChanges/param
14032 !! end
14033
14034 !! test
14035 {{#special:}} page name, unknown
14036 !! options
14037 msg
14038 !! wikitext
14039 {{#special:foobar nonexistent}}
14040 !! html
14041 Special:Foobar nonexistent
14042 !! end
14043
14044 !! test
14045 {{#speciale:}} page name, known
14046 !! options
14047 msg
14048 !! wikitext
14049 {{#speciale:Recentchanges}}
14050 !! html
14051 Special:RecentChanges
14052 !! end
14053
14054 !! test
14055 {{#speciale:}} page name with subpage, known
14056 !! options
14057 msg
14058 !! wikitext
14059 {{#speciale:Recentchanges/param}}
14060 !! html
14061 Special:RecentChanges/param
14062 !! end
14063
14064 !! test
14065 {{#speciale:}} page name, unknown
14066 !! options
14067 msg
14068 !! wikitext
14069 {{#speciale:foobar nonexistent}}
14070 !! html
14071 Special:Foobar_nonexistent
14072 !! end
14073
14074 ###
14075 ### Images
14076 ###
14077 ### For Parsoid-specific tests, see
14078 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14079
14080 !! test
14081 Simple image
14082 !! options
14083 parsoid=wt2html,wt2wt,html2html
14084 !! wikitext
14085 [[Image:foobar.jpg]]
14086 !! html/php
14087 <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>
14088 </p>
14089 !! html/parsoid
14090 <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>
14091 !! end
14092
14093 !! test
14094 Serialize simple image with span wrapper
14095 !! options
14096 parsoid=html2wt
14097 !! html/parsoid
14098 <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>
14099 !! wikitext
14100 [[File:Foobar.jpg]]
14101 !! end
14102
14103 !! test
14104 Simple image (using File: namespace, now canonical)
14105 !! wikitext
14106 [[File:Foobar.jpg]]
14107 !! html/php
14108 <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>
14109 </p>
14110 !! html/parsoid
14111 <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>
14112 !! end
14113
14114 !! test
14115 Right-aligned image
14116 !! wikitext
14117 [[File:Foobar.jpg|right]]
14118 !! html/php
14119 <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>
14120
14121 !! html/parsoid
14122 <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>
14123 !! end
14124
14125 !! test
14126 Image with caption
14127 !! wikitext
14128 [[File:Foobar.jpg|right|Caption text]]
14129 !! html/php
14130 <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>
14131
14132 !! html/parsoid
14133 <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>
14134 !! end
14135
14136 !! test
14137 Image with caption, T55312 #1
14138 !! wikitext
14139 [[File:Foobar.jpg|right|Caption page stuff]]
14140 !! html/php
14141 <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>
14142
14143 !! html/parsoid
14144 <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>
14145 !! end
14146
14147 !! test
14148 Image with caption, T55312 #2
14149 !! wikitext
14150 [[File:Foobar.jpg|right|Caption page=]]
14151 !! html/php
14152 <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>
14153
14154 !! html/parsoid
14155 <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>
14156 !! end
14157
14158 !! test
14159 Image with caption, T55312 #3
14160 !! wikitext
14161 [[File:Foobar.jpg|right|Caption page=stuff]]
14162 !! html/php
14163 <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>
14164
14165 !! html/parsoid
14166 <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>
14167 !! end
14168
14169 !! test
14170 Image caption with pipe entity
14171 !! wikitext
14172 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14173 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14174 !! html/php
14175 <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>
14176 <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>
14177
14178 !! html/parsoid
14179 <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>
14180 <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>
14181 !! end
14182
14183 !! test
14184 Allow empty links in image captions (T62753)
14185 !! options
14186 thumbsize=220
14187 !! wikitext
14188 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14189 [[]]
14190 [[Link2]]
14191 ]]
14192 !! html/php
14193 <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>
14194
14195 !! html/parsoid
14196 <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>
14197 [[]]
14198 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14199 </figcaption></figure>
14200 !! end
14201
14202 !! test
14203 Titles in unlinked images (T23454)
14204 !! wikitext
14205 [[File:Foobar.jpg|link=|stuff]]
14206 !! html/php
14207 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14208 </p>
14209 !! html/parsoid
14210 <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>
14211 !! end
14212
14213 !! test
14214 Link with empty target
14215 !! wikitext
14216 [[]]
14217 !! html
14218 <p>[[]]
14219 </p>
14220 !! end
14221
14222 !! test
14223 Image with link trail
14224 !! wikitext
14225 Linktrails should not work for images: [[File:Foobar.jpg]]s
14226 !! html/php
14227 <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
14228 </p>
14229 !! html/parsoid
14230 <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>
14231 !! end
14232
14233 !! test
14234 Image with empty attribute
14235 !! options
14236 parsoid=wt2html,wt2wt,html2html
14237 !! wikitext
14238 [[File:Foobar.jpg|right||Caption text]]
14239 !! html/php
14240 <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>
14241
14242 !! html/parsoid
14243 <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>
14244 !! end
14245
14246 !! test
14247 1. Block image with individual attributes from templates
14248 !! wikitext
14249 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14250 !! html/php
14251 <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>
14252
14253 !! html/parsoid
14254 <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>
14255 !! end
14256
14257 !! test
14258 2. Block Image with individual attributes from templates
14259 !! wikitext
14260 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14261 !! html/php
14262 <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>
14263
14264 !! html/parsoid
14265 <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>
14266 !! end
14267
14268 !! test
14269 3. Inline image with individual attributes from templates
14270 !! wikitext
14271 [[File:Foobar.jpg|{{echo|50px}}]]
14272 !! html/php
14273 <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>
14274 </p>
14275 !! html/parsoid
14276 <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>
14277 !! end
14278
14279 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14280 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14281 !! test
14282 Image with multiple attributes from the same template
14283 !! wikitext
14284 [[File:Foobar.jpg|{{image_attribs}}]]
14285 !! html/php
14286 <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>
14287
14288 !! html/parsoid
14289 <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>
14290 !! end
14291
14292 !! test
14293 Image with link tails
14294 !! options
14295 thumbsize=220
14296 !! wikitext
14297 123[[File:Foobar.jpg]]456
14298 123[[File:Foobar.jpg|right]]456
14299 123[[File:Foobar.jpg|thumb]]456
14300 !! html/php
14301 <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
14302 </p>
14303 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
14304 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
14305
14306 !! html/php+tidy
14307 <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
14308 </p><p>
14309 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
14310 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
14311 </p>
14312 !! html/parsoid
14313 <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>
14314 <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>
14315 <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>
14316 !! end
14317
14318 !! test
14319 Image with multiple captions -- only last one is accepted
14320 !! wikitext
14321 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14322 !! html/php
14323 <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>
14324
14325 !! html/parsoid
14326 <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>
14327 !! end
14328
14329 !! test
14330 Image with multiple widths -- use last
14331 !! wikitext
14332 [[File:Foobar.jpg|200px|300px|caption]]
14333 !! html/php
14334 <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>
14335 </p>
14336 !! html/parsoid
14337 <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>
14338 !! end
14339
14340 !! test
14341 Image with multiple alignments -- use first (T50664)
14342 !! options
14343 thumbsize=220
14344 !! wikitext
14345 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14346
14347 [[File:Foobar.jpg|middle|text-top|caption]]
14348 !! html/php
14349 <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>
14350 <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>
14351 </p>
14352 !! html/parsoid
14353 <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>
14354 <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>
14355 !! end
14356
14357 !! test
14358 Image with width attribute at different positions
14359 !! wikitext
14360 [[File:Foobar.jpg|200px|right|Caption]]
14361 [[File:Foobar.jpg|right|200px|Caption]]
14362 [[File:Foobar.jpg|right|Caption|200px]]
14363 !! html/php
14364 <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>
14365 <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>
14366 <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>
14367
14368 !! html/parsoid
14369 <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>
14370 <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>
14371 <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>
14372 !! end
14373
14374 # a sad bit of backward-compatibility
14375 !! test
14376 Image with size specified with pxpx (T15500, T53628)
14377 !! options
14378 parsoid=wt2html,wt2wt,html2html
14379 !! wikitext
14380 [[File:Foobar.jpg|20pxpx]]
14381 [[File:Foobar.jpg|200x20pxpx]]
14382 !! html/php
14383 <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>
14384 <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>
14385 </p>
14386 !! html/parsoid
14387 <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>
14388 !! end
14389
14390 !! test
14391 Image with link parameter, wiki target
14392 !! wikitext
14393 [[File:Foobar.jpg|link=Main Page]]
14394 !! html/php
14395 <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>
14396 </p>
14397 !! html/parsoid
14398 <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>
14399 !! end
14400
14401 # parsoid T51293 (part 1)
14402 !! test
14403 Image with link parameter, URL target
14404 !! wikitext
14405 [[File:Foobar.jpg|link=http://example.com/]]
14406 !! html/php
14407 <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>
14408 </p>
14409 !! html/parsoid
14410 <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>
14411 !! end
14412
14413 # parsoid T51293 (part 2)
14414 !! test
14415 Image with link parameter, protocol-less URL target
14416 !! wikitext
14417 [[File:Foobar.jpg|link=//example.com/]]
14418 !! html/php
14419 <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>
14420 </p>
14421 !! html/parsoid
14422 <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>
14423 !! end
14424
14425 !! test
14426 Escaping non-block captions (T107435)
14427 !! options
14428 parsoid={
14429 "modes": ["wt2wt"],
14430 "changes": [
14431 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14432 ]
14433 }
14434 !! wikitext
14435 [[Image:Foobar.jpg|caption]]
14436 !! wikitext/edited
14437 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14438 !! end
14439
14440 # wgExternalLinkTarget not supported by Parsoid
14441 !! test
14442 Image with link parameter, wgExternalLinkTarget
14443 !! wikitext
14444 [[Image:foobar.jpg|link=http://example.com/]]
14445 !! config
14446 wgExternalLinkTarget='foobar'
14447 !! html/php
14448 <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>
14449 </p>
14450 !! end
14451
14452 !! test
14453 Image with link parameter, wgNoFollowLinks set to false
14454 !! wikitext
14455 [[Image:foobar.jpg|link=http://example.com/]]
14456 !! config
14457 wgNoFollowLinks=false
14458 !! html/php
14459 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14460 </p>
14461 !! end
14462
14463 !! test
14464 Image with link parameter, wgNoFollowDomainExceptions
14465 !! wikitext
14466 [[Image:foobar.jpg|link=http://example.com/]]
14467 !! config
14468 wgNoFollowDomainExceptions='example.com'
14469 !! html/php
14470 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14471 </p>
14472 !! end
14473
14474 # wgExternalLinkTarget not supported by Parsoid
14475 !! test
14476 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14477 !! wikitext
14478 [[Image:foobar.jpg|link=http://example.com/|Title]]
14479 !! config
14480 wgExternalLinkTarget='foobar'
14481 !! html/php
14482 <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>
14483 </p>
14484 !! end
14485
14486 !! test
14487 Image with empty link parameter
14488 !! wikitext
14489 [[File:Foobar.jpg|link=]]
14490 !! html/php
14491 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14492 </p>
14493 !! html/parsoid
14494 <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>
14495 !! end
14496
14497 !! test
14498 Image with link parameter (wiki target) and unnamed parameter
14499 !! wikitext
14500 [[File:Foobar.jpg|link=Main_Page|Title]]
14501 !! html/php
14502 <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>
14503 </p>
14504 !! html/parsoid
14505 <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>
14506 !! end
14507
14508 !! test
14509 Image with link parameter (URL target) and unnamed parameter
14510 !! wikitext
14511 [[File:Foobar.jpg|link=http://example.com/|Title]]
14512 !! html/php
14513 <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>
14514 </p>
14515 !! html/parsoid
14516 <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>
14517 !! end
14518
14519 !! test
14520 Thumbnail image with link parameter
14521 !! options
14522 thumbsize=220
14523 parsoid=wt2html,wt2wt,html2html
14524 !! wikitext
14525 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14526 !! html/php
14527 <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>
14528
14529 !! html/parsoid
14530 <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>
14531 !! end
14532
14533 !! test
14534 Manually-specified thumbnail image
14535 !! options
14536 thumbsize=220
14537 !! wikitext
14538 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14539 !! html/php
14540 <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>
14541
14542 !! html/parsoid
14543 <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>
14544 !! end
14545
14546 !! test
14547 Manually-specified thumbnail image with explicit link to wiki page
14548 !! options
14549 thumbsize=220
14550 parsoid=wt2html,wt2wt,html2html
14551 !! wikitext
14552 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14553 !! html/php
14554 <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>
14555
14556 !! html/parsoid
14557 <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>
14558 !! end
14559
14560 !! test
14561 Manually-specified thumbnail image with explicit link to url
14562 !! options
14563 thumbsize=220
14564 parsoid=wt2html,wt2wt,html2html
14565 !! wikitext
14566 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14567 !! html/php
14568 <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>
14569
14570 !! html/parsoid
14571 <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>
14572 !! end
14573
14574 !! test
14575 Manually-specified thumbnail image with explicit no link
14576 !! options
14577 thumbsize=220
14578 parsoid=wt2html,wt2wt,html2html
14579 !! wikitext
14580 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14581 !! html/php
14582 <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>
14583
14584 !! html/parsoid
14585 <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>
14586 !! end
14587
14588 !! test
14589 Manually-specified thumbnail image with explicit link and alt text
14590 !! options
14591 thumbsize=220
14592 parsoid=wt2html,wt2wt,html2html
14593 !! wikitext
14594 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14595 !! html/php
14596 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="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>
14597
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Image with frame and link
14604 !! options
14605 parsoid=wt2html,wt2wt,html2html
14606 !! wikitext
14607 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14608 !! html/php
14609 <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>
14610
14611 !! html/parsoid
14612 <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>
14613 !! end
14614
14615 !! test
14616 Image with frame and link and explicit alt
14617 !! options
14618 parsoid=wt2html,wt2wt,html2html
14619 !! wikitext
14620 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14621 !! html/php
14622 <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>
14623
14624 !! html/parsoid
14625 <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>
14626 !! end
14627
14628 !! test
14629 Image with wiki markup in implicit alt
14630 !! wikitext
14631 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14632
14633 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14634 !! html/php
14635 <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>
14636 </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>
14637 </p>
14638 !! html/parsoid
14639 <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>
14640
14641 <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>
14642 !! end
14643
14644 !! test
14645 Alt image option should handle most kinds of wikitext without barfing
14646 !! wikitext
14647 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14648 !! html/php
14649 <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>
14650
14651 !! html/parsoid
14652 <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>
14653 !! end
14654
14655 !! test
14656 Image with table with attributes in caption
14657 !! options
14658 parsoid=wt2html,html2html
14659 !! wikitext
14660 [[File:Foobar.jpg|thumb|
14661 {| class="123" |
14662 |- class="456" |
14663 | ha
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{| 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>
14668 <table class="123">
14669 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14670 <td> ha</td></tr>
14671 </tbody></table>
14672 </figcaption></figure>
14673 !! end
14674
14675 !! test
14676 Image with table with rows from templates in caption
14677 !! wikitext
14678 [[File:Foobar.jpg|thumb|
14679 {|
14680 {{echo|{{!}} hi}}
14681 |}
14682 ]]
14683 !! html/parsoid
14684 <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>
14685 <table>
14686 <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>
14687 </tbody></table>
14688 </figcaption></figure>
14689 !! end
14690
14691 !! test
14692 Image with nested tables in caption
14693 !! wikitext
14694 [[File:Foobar.jpg|thumb|Foo<br />
14695 {|
14696 |
14697 {|
14698 |z
14699 |}
14700 |}
14701 ]]
14702 !! html/parsoid
14703 <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}'/>
14704 <table>
14705 <tbody><tr><td>
14706 <table>
14707 <tbody><tr><td>z</td></tr>
14708 </tbody></table></td></tr>
14709 </tbody></table>
14710 </figcaption></figure>
14711 !! end
14712
14713 ###################
14714 # Conflicting image format options.
14715 # First option specified should 'win'.
14716 # All three cases in each test should be identical.
14717
14718 !! test
14719 Image with 'frameless' first.
14720 !! options
14721 parsoid=wt2html,wt2wt,html2html
14722 !! wikitext
14723 [[File:Foobar.jpg|frameless|caption]]
14724
14725 [[File:Foobar.jpg|frameless|frame|caption]]
14726
14727 [[File:Foobar.jpg|frameless|thumb|caption]]
14728 !! html/php
14729 <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>
14730 </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>
14731 </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>
14732 </p>
14733 !! html/parsoid
14734 <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>
14735 <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>
14736 <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>
14737 !! end
14738
14739 !! test
14740 Image with 'frame' first.
14741 !! options
14742 parsoid=wt2html,wt2wt,html2html
14743 !! wikitext
14744 [[File:Foobar.jpg|frame|caption]]
14745 [[File:Foobar.jpg|frame|frameless|caption]]
14746 [[File:Foobar.jpg|frame|thumb|caption]]
14747 !! html/php
14748 <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>
14749 <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>
14750 <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>
14751
14752 !! html/parsoid
14753 <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>
14754 <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>
14755 <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>
14756 !! end
14757
14758 !! test
14759 Image with 'thumb' first.
14760 !! options
14761 parsoid=wt2html,wt2wt,html2html
14762 !! wikitext
14763 [[File:Foobar.jpg|thumb|caption]]
14764 [[File:Foobar.jpg|thumb|frameless|caption]]
14765 [[File:Foobar.jpg|thumb|frame|caption]]
14766 !! html/php
14767 <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>
14768 <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>
14769 <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>
14770
14771 !! html/parsoid
14772 <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>
14773 <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>
14774 <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>
14775 !! end
14776
14777 ###################
14778 # Image sizing.
14779 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14780 # and https://phabricator.wikimedia.org/T64258
14781 # Foobar has actual size of 1941x220
14782 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14783 # a scalable format.
14784 # 2. Framed images always ignore size options; always render at default size.
14785 # 3. "Unspecified format" and border are the only types which can be
14786 # enlarged.
14787
14788 !! test
14789 Image: unspecified format and border enlarge
14790 !! options
14791 parsoid=wt2html,wt2wt,html2html
14792 !! wikitext
14793 [[File:Foobar.jpg|2000px]]
14794
14795 [[File:Foobar.jpg|border|2000px]]
14796 !! html/php
14797 <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>
14798 </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>
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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
14803 !! end
14804
14805 !! test
14806 Image: "unspecified format" and border reduce
14807 !! options
14808 parsoid=wt2html,wt2wt,html2html
14809 !! wikitext
14810 [[File:Foobar.jpg|1000px]]
14811
14812 [[File:Foobar.jpg|border|1000px]]
14813 !! html/php
14814 <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>
14815 </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>
14816 </p>
14817 !! html/parsoid
14818 <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>
14819 <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>
14820 !! end
14821
14822 !! test
14823 Image: thumbs reduce
14824 !! options
14825 parsoid=wt2html,wt2wt,html2html
14826 !! wikitext
14827 [[File:Foobar.jpg|thumb|50px]]
14828 !! html/php
14829 <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>
14830
14831 !! html/parsoid
14832 <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>
14833 !! end
14834
14835 !! test
14836 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14837 !! options
14838 parsoid=wt2html,wt2wt,html2html
14839 !! wikitext
14840 [[File:Foobar.jpg|thumb|2000px]]
14841
14842 [[File:Foobar.svg|thumb|2000px]]
14843 !! html/php
14844 <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>
14845 <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>
14846
14847 !! html/parsoid
14848 <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>
14849 <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>
14850 !! end
14851
14852 !! test
14853 Image: frameless can reduce in size
14854 !! options
14855 parsoid=wt2html,wt2wt,html2html
14856 !! wikitext
14857 [[File:Foobar.jpg|frameless|50px]]
14858 !! html/php
14859 <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>
14860 </p>
14861 !! html/parsoid
14862 <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>
14863 !! end
14864
14865 !! test
14866 Image: bitmap frameless can't be enlarged past original size, but vector can
14867 !! options
14868 parsoid=wt2html,wt2wt,html2html
14869 !! wikitext
14870 [[File:Foobar.jpg|frameless|2000px]]
14871
14872 [[File:Foobar.svg|frameless|2000px]]
14873 !! html/php
14874 <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>
14875 </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>
14876 </p>
14877 !! html/parsoid
14878 <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>
14879 <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>
14880 !! end
14881
14882 !! test
14883 Image: framed images are always unscaled.
14884 !! options
14885 parsoid=wt2html,wt2wt,html2html
14886 !! wikitext
14887 [[File:Foobar.jpg|frame]]
14888
14889 [[File:Foobar.jpg|frame|50px]]
14890
14891 [[File:Foobar.jpg|frame|50x50px]]
14892
14893 [[File:Foobar.jpg|frame|2000px]]
14894 !! html/php
14895 <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>
14896 <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>
14897 <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>
14898 <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>
14899
14900 !! html/parsoid
14901 <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>
14902 <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>
14903 <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>
14904 <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>
14905 !! end
14906
14907 ###################
14908
14909 !! test
14910 Link to image page- image page normally doesn't exists, hence edit link
14911 Add test with existing image page
14912 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14913 !! wikitext
14914 [[:Image:test]]
14915 !! html
14916 <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>
14917 </p>
14918 !! end
14919
14920 !! test
14921 T20784 Link to non-existent image page with caption should use caption as link text
14922 !! wikitext
14923 [[:Image:test|caption]]
14924 !! html
14925 <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>
14926 </p>
14927 !! end
14928
14929 !! test
14930 Frameless image caption with a free URL
14931 !! wikitext
14932 [[File:Foobar.jpg|http://example.com]]
14933 !! html/php
14934 <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>
14935 </p>
14936 !! html/parsoid
14937 <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>
14938 !! end
14939
14940 !! test
14941 Thumbnail image caption with a free URL
14942 !! options
14943 thumbsize=220
14944 !! wikitext
14945 [[File:Foobar.jpg|thumb|http://example.com]]
14946 !! html/php
14947 <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>
14948
14949 !! html/parsoid
14950 <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>
14951 !! end
14952
14953 !! test
14954 Thumbnail image caption with a free URL and explicit alt
14955 !! options
14956 thumbsize=220
14957 parsoid=wt2html,wt2wt,html2html
14958 !! wikitext
14959 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14960 !! html/php
14961 <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>
14962
14963 !! html/parsoid
14964 <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>
14965 !! end
14966
14967 !! test
14968 SVG thumbnails with no language set
14969 !! options
14970 !! wikitext
14971 [[File:Foobar.svg|thumb|caption]]
14972 !! html/php
14973 <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>
14974
14975 !! html/parsoid
14976 <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>
14977 !! end
14978
14979 !! test
14980 SVG thumbnails with language de
14981 !! options
14982 parsoid=wt2html,wt2wt,html2html
14983 !! wikitext
14984 [[File:Foobar.svg|thumb|caption|lang=de]]
14985 !! html/php
14986 <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>
14987
14988 !! html/parsoid
14989 <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>
14990 !! end
14991
14992 !! test
14993 SVG thumbnails with invalid language code
14994 !! options
14995 parsoid=wt2html,wt2wt,html2html
14996 !! wikitext
14997 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
14998 !! html/php
14999 <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>
15000
15001 !! html/parsoid
15002 <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>
15003 !! end
15004
15005 !! test
15006 T3887: A ISBN with a thumbnail
15007 !! wikitext
15008 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15009 !! html/php
15010 <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>
15011
15012 !! html/parsoid
15013 <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>
15014 !! end
15015
15016 !! test
15017 T3887: A RFC with a thumbnail
15018 !! wikitext
15019 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15020 !! html/php
15021 <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>
15022
15023 !! html/parsoid
15024 <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>
15025 !! end
15026
15027 !! test
15028 T3887: A mailto link with a thumbnail
15029 !! wikitext
15030 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15031 !! html/php
15032 <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>
15033
15034 !! html/parsoid
15035 <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>
15036 !! end
15037
15038 # Pending resolution to T2368
15039 !! test
15040 T2648: Frameless image caption with a link
15041 !! wikitext
15042 [[File:Foobar.jpg|text with a [[link]] in it]]
15043 !! html/php
15044 <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>
15045 </p>
15046 !! html/parsoid
15047 <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>
15048 !! end
15049
15050 !! test
15051 T2648: Frameless image caption with a link (suffix)
15052 !! wikitext
15053 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15054 !! html/php
15055 <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>
15056 </p>
15057 !! html/parsoid
15058 <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>
15059 !! end
15060
15061 !! test
15062 T2648: Frameless image caption with an interwiki link
15063 !! wikitext
15064 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15065 !! html/php
15066 <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>
15067 </p>
15068 !! html/parsoid
15069 <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>
15070 !! end
15071
15072 !! test
15073 T2648: Frameless image caption with a piped interwiki link
15074 !! wikitext
15075 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15076 !! html/php
15077 <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>
15078 </p>
15079 !! html/parsoid
15080 <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>
15081 !! end
15082
15083 !! test
15084 T107474: Frameless image caption with <nowiki>
15085 !! wikitext
15086 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15087 !! html/parsoid
15088 <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>
15089 !! end
15090
15091 !! test
15092 Escape HTML special chars in image alt text
15093 !! wikitext
15094 [[File:Foobar.jpg|& < > "]]
15095 !! html/php
15096 <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>
15097 </p>
15098 !! html/parsoid
15099 <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>
15100 !! end
15101
15102 !! test
15103 Escape HTML special chars in image alt text with LanguageConverter
15104 !! options
15105 language=zh
15106 !! wikitext
15107 [[File:Foobar.jpg|& < > "]]
15108 !! html/php
15109 <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>
15110 </p>
15111 !! html/parsoid
15112 <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>
15113 !! end
15114
15115 !! test
15116 Entities in file name and attributes
15117 !! wikitext
15118 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15119 !! html/php
15120 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15121 </p>
15122 !! html/parsoid
15123 <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>
15124 !! end
15125
15126 !! test
15127 T2499: Alt text should have &#1234;, not &amp;1234;
15128 !! wikitext
15129 [[File:Foobar.jpg|&#9792;]]
15130 !! html/php
15131 <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>
15132 </p>
15133 !! html/parsoid
15134 <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>
15135 !! end
15136
15137 !! test
15138 Broken image caption with link
15139 !! options
15140 parsoid=wt2html,wt2wt,html2html
15141 !! wikitext
15142 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15143 !! html/php
15144 <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.
15145 </p>
15146 !! html/parsoid
15147 <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>
15148 !! end
15149
15150 !! test
15151 Image caption containing another image
15152 !! wikitext
15153 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15154 !! html/php
15155 <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>
15156
15157 !! html/parsoid
15158 <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>
15159 !! end
15160
15161 !! test
15162 Image: caption containing a newline
15163 !! wikitext
15164 [[File:Foobar.jpg|This
15165 *is some text]]
15166 !! html/php
15167 <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>
15168 </p>
15169 !! html/parsoid
15170 <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>
15171 !!end
15172
15173 !!test
15174 Image: caption containing leading space
15175 (The leading space should not trigger nowiki escaping in wt2wt mode)
15176 !! wikitext
15177 [[File:Foobar.jpg|thumb| bar]]
15178 !! html/php
15179 <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>
15180
15181 !! html/parsoid
15182 <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>
15183 !!end
15184
15185 !! test
15186 Image: caption containing a table
15187 !! options
15188 parsoid=wt2html,wt2wt,html2html
15189 !! wikitext
15190 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15191 {|
15192 ! Foo !! Bar
15193 |-
15194 | Foo1 || Bar1
15195 |}
15196 and some more text.]]
15197 !! html/php
15198 <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>
15199
15200 !! html/parsoid
15201 <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
15202 <table>
15203 <tbody>
15204 <tr><th>Foo </th><th>Bar</th></tr>
15205 <tr>
15206 <td>Foo1 </td>
15207 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15208 !! end
15209
15210 !! test
15211 T5090: External links other than http: in image captions
15212 !! wikitext
15213 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15214 !! html/php
15215 <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>
15216
15217 !! html/parsoid
15218 <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>
15219 !! end
15220
15221 !! test
15222 Custom class
15223 !! options
15224 parsoid=wt2html,wt2wt,html2html
15225 !! wikitext
15226 [[Image:foobar.jpg|a|class=b]]
15227 !! html/php
15228 <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>
15229 </p>
15230 !! html/parsoid
15231 <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>
15232 !! end
15233
15234 !! test
15235 Localized image handling (1).
15236 !! options
15237 parsoid=wt2html,wt2wt,html2html
15238 language=es
15239 !! wikitext
15240 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15241 !! html/php
15242 <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>
15243
15244 !! html/parsoid
15245 <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>
15246 !! end
15247
15248 !! test
15249 Localized image handling (2).
15250 !! options
15251 thumbsize=220
15252 parsoid=wt2html,wt2wt,html2html
15253 language=es
15254 !! wikitext
15255 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15256 !! html/php
15257 <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>
15258
15259 !! html/parsoid
15260 <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>
15261 !! end
15262
15263 !! test
15264 Localized image handling (3).
15265 !! options
15266 language=fa
15267 parsoid=html2wt
15268 !! html/parsoid
15269 <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>
15270 !! wikitext
15271 [[File:Foobar.jpg|بندانگشتی]]
15272 !! end
15273
15274 !! test
15275 "border", "frameless" and "class" attributes on an image.
15276 !! options
15277 thumbsize=220
15278 parsoid=wt2html,wt2wt,html2html
15279 !! wikitext
15280 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15281 !! html/php
15282 <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>
15283 </p>
15284 !! html/parsoid
15285 <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>
15286 !! end
15287
15288 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15289 !! test
15290 Invalid image attributes (T64500)
15291 !! options
15292 thumbsize=220
15293 parsoid=wt2html,wt2wt,html2html
15294 !! wikitext
15295 [[File:Foobar.jpg|thumb|float|left|caption]]
15296
15297 [[File:Foobar.jpg|thumb|righ|caption]]
15298
15299 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15300 !! html/php
15301 <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>
15302 <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>
15303 <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>
15304
15305 !! html/parsoid
15306 <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>
15307 <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>
15308 <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>
15309 !! end
15310
15311 !! article
15312 File:Barfoo.jpg
15313 !! text
15314 #REDIRECT [[File:Barfoo.jpg]]
15315 !! endarticle
15316
15317 # FIXME: Parsoid should run this test -- but we'd need to teach the
15318 # mockAPI about the redirected Barfoo.jpg image.
15319 !! test
15320 Redirected image
15321 !! wikitext
15322 [[Image:Barfoo.jpg]]
15323 !! html/php
15324 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15325 </p>
15326 !! end
15327
15328 !! test
15329 Missing image with uploads disabled
15330 !! options
15331 wgEnableUploads=0
15332 !! wikitext
15333 [[File:Foobaz.jpg]]
15334 !! html/php
15335 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15336 </p>
15337 !! html/parsoid
15338 <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>
15339 !! end
15340
15341 # Parsoid-specific testing for images
15342 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15343 # Currently imperfect due to a flaw in the Parsoid testrunner
15344 # Work in progress
15345 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15346 # image tests.
15347
15348 !! test
15349 Parsoid-specific image handling - simple image with size and middle alignment
15350 !! wikitext
15351 [[File:Foobar.jpg|middle|50px]]
15352 !! html/parsoid
15353 <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>
15354 !! end
15355
15356 !! test
15357 Parsoid-specific image handling - simple image with size, middle alignment,
15358 non-standard namespace alias
15359 !! options
15360 parsoid=wt2wt,wt2html,html2html
15361 !! wikitext
15362 [[Image:Foobar.jpg|middle|50px]]
15363 !! html/parsoid
15364 <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>
15365 !! end
15366
15367 !! test
15368 Parsoid-specific image handling - simple image with size and middle alignment
15369 (existing content)
15370 !! wikitext
15371 [[File:Foobar.jpg|50px|middle]]
15372 !! html/parsoid
15373 <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>
15374 !! end
15375
15376 !! test
15377 Parsoid-specific image handling - simple image with size and middle alignment
15378 and non-standard namespace name
15379 !! options
15380 parsoid=wt2html,wt2wt,html2html
15381 !! wikitext
15382 [[Image:Foobar.jpg|50px|middle]]
15383 !! html/parsoid
15384 <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>
15385 !! end
15386
15387 !! test
15388 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15389 !! wikitext
15390 [[File:Foobar.jpg|500x10px|baseline|caption]]
15391 !! html/parsoid
15392 <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>
15393 !! end
15394
15395 !! test
15396 Parsoid-specific image handling - simple image with border and size spec
15397 !! wikitext
15398 [[File:Foobar.jpg|50px|border|caption]]
15399 !! html/parsoid
15400 <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>
15401 !! end
15402
15403 !! test
15404 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15405 !! wikitext
15406 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15407 !! html/parsoid
15408 <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>
15409 !! end
15410
15411 !! test
15412 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15413 (existing content)
15414 !! wikitext
15415 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15416 !! html/parsoid
15417 <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>
15418 !! end
15419
15420 !! test
15421 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15422 !! wikitext
15423 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15424 !! html/parsoid
15425 <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>
15426 !! end
15427
15428 !! test
15429 Parsoid-specific image handling - thumbnail with specific size, halign,
15430 valign, and caption (existing content)
15431 !! wikitext
15432 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15433 !! html/parsoid
15434 <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>
15435 !! end
15436
15437 !! test
15438 Parsoid-specific image handling - framed image with specific size and caption
15439 (size is ignored)
15440 !! options
15441 parsoid=wt2html,wt2wt,html2html
15442 !! wikitext
15443 [[File:Foobar.jpg|frame|500x50px|caption]]
15444 !! html/parsoid
15445 <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>
15446 !! end
15447
15448 !! test
15449 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15450 (size is ignored)
15451 !! options
15452 parsoid=wt2html,wt2wt,html2html
15453 !! wikitext
15454 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15455 !! html/parsoid
15456 <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>
15457 !! end
15458
15459 !! test
15460 Parsoid-specific image handling - frameless image with specific size, border, and caption
15461 !! wikitext
15462 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15463 !! html/parsoid
15464 <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>
15465 !! end
15466
15467 !! test
15468 Parsoid-specific image handling - simple image with a formatted caption
15469 !! wikitext
15470 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15471 !! html/parsoid
15472 <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>
15473 !! end
15474
15475 !! test
15476 Parsoid-specific image handling - caption with a template in it
15477 !! wikitext
15478 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15479 !! html/parsoid
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 <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>
15481 !! end
15482
15483 !! test
15484 Parsoid-specific image handling - caption with unbalanced tags in it
15485 !! options
15486 parsoid=wt2html,wt2wt,html2html
15487 !! wikitext
15488 foo
15489 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15490 bar
15491 !! html/parsoid
15492 <p>foo</p>
15493 <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>
15494 <p>bar</p>
15495 !! end
15496
15497 !! test
15498 Parsoid-specific image handling - empty caption (1)
15499 !! options
15500 parsoid=wt2html,wt2wt
15501 !! wikitext
15502 [[File:Foobar.jpg|thumb|]]
15503 !! html/parsoid
15504 <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>
15505 !! end
15506
15507 # empty captions don't get serialized unless we're in the "round trip" case
15508 !! test
15509 Parsoid-specific image handling - empty caption (2)
15510 !! options
15511 parsoid=html2wt
15512 !! html/parsoid
15513 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15514 <a href="./File:Foobar.jpg">
15515 <img resource="./File:Foobar.jpg"
15516 src="//example.com/images/3/3a/Foobar.jpg"
15517 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15518 height="25" width="220"/>
15519 </a>
15520 <figcaption></figcaption>
15521 </figure>
15522 !! wikitext
15523 [[File:Foobar.jpg|thumb]]
15524 !! end
15525
15526 !! test
15527 Parsoid-specific image handling - whitespace caption
15528 !! wikitext
15529 [[File:Foobar.jpg|thumb| ]]
15530 !! html/parsoid
15531 <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>
15532 !! end
15533
15534 !! test
15535 Parsoid-specific image handling - lang option
15536 !! wikitext
15537 foo
15538 [[File:Foobar.svg|lang=de|caption]]
15539 bar
15540 !! html/parsoid
15541 <p>foo
15542 <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>
15543 bar</p>
15544 !! end
15545
15546 ## Edge case bugs in Parsoid from T93580
15547 !! test
15548 T93580: 1. Templated <ref> inside block images
15549 !! wikitext
15550 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15551
15552 <references />
15553 !! html/parsoid
15554 <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>
15555
15556 <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>
15557 !! end
15558
15559 !! test
15560 T93580: 2. <ref> inside inline images
15561 !! wikitext
15562 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15563
15564 <references />
15565 !! html/parsoid
15566 <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>
15567
15568 <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>
15569 !! end
15570
15571 !! test
15572 T93580: 3. Templated <ref> inside inline images
15573 !! wikitext
15574 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15575
15576 <references />
15577 !! html/parsoid
15578 <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>
15579
15580 <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>
15581 !! end
15582
15583 ###
15584 ### Subpages
15585 ###
15586 !! article
15587 Subpage test/subpage
15588 !! text
15589 foo
15590 !! endarticle
15591
15592 !! test
15593 Subpage link
15594 !! options
15595 subpage title=[[Subpage test]]
15596 !! wikitext
15597 [[/subpage]]
15598 !! html
15599 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15600 </p>
15601 !! end
15602
15603 !! test
15604 Subpage noslash link
15605 !! options
15606 subpage title=[[Subpage test]]
15607 !! wikitext
15608 [[/subpage/]]
15609 !! html
15610 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15611 </p>
15612 !! end
15613
15614 !! article
15615 Subpage test/1/2/subpage
15616 !! text
15617 blah
15618 !! endarticle
15619
15620 !! test
15621 Relative subpage noslash link
15622 !! options
15623 parsoid=wt2wt,wt2html,html2html
15624 subpage title=[[Subpage test/1/2/3/4]]
15625 !! wikitext
15626 [[../../subpage/]]
15627
15628 [[../../subpage]]
15629 !! html/php
15630 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15631 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15632 </p>
15633 !! html/parsoid
15634 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15635 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15636 !! end
15637
15638 !! test
15639 Parsoid: dot-slash prefixed wikilinks
15640 !! wikitext
15641 [[./foo]]
15642
15643 [[././bar]]
15644
15645 [[././baz/]]
15646 !! html/php
15647 <p>[[./foo]]
15648 </p><p>[[././bar]]
15649 </p><p>[[././baz/]]
15650 </p>
15651 !! html/parsoid
15652 <p>[[./foo]]
15653 </p><p>[[././bar]]
15654 </p><p>[[././baz/]]
15655 </p>
15656 !! end
15657
15658 !! test
15659 Render invalid page names as plain text (T53090)
15660 !! wikitext
15661 [[./../foo|bar]]
15662 [[foo�|bar]]
15663 [[foo/.|bar]]
15664 [[foo/..|bar]]
15665 [[foo~~~bar]]
15666 [[foo>bar]]
15667 [[foo[bar]]
15668 [[.]]
15669 [[..]]
15670 [[foo././bar]]
15671 [[foo[http://example.com]xyz]]
15672
15673 [[{{echo|./../foo}}|bar]]
15674 [[{{echo|foo/.}}|bar]]
15675 [[{{echo|foo/..}}|bar]]
15676 [[{{echo|foo~~~~bar}}]]
15677 [[{{echo|foo>bar}}]]
15678 [[{{echo|foo././bar}}]]
15679 [[{{echo|foo{bar}}]]
15680 [[{{echo|foo}bar}}]]
15681 [[{{echo|foo[bar}}]]
15682 [[{{echo|foo]bar}}]]
15683 [[{{echo|foo<bar}}]]
15684 !!html/php
15685 <p>[[./../foo|bar]]
15686 [[foo�|bar]]
15687 [[foo/.|bar]]
15688 [[foo/..|bar]]
15689 [[foo~~~bar]]
15690 [[foo&gt;bar]]
15691 [[foo[bar]]
15692 [[.]]
15693 [[..]]
15694 [[foo././bar]]
15695 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15696 </p><p>[[./../foo|bar]]
15697 [[foo/.|bar]]
15698 [[foo/..|bar]]
15699 [[foo~~~~bar]]
15700 [[foo&gt;bar]]
15701 [[foo././bar]]
15702 [[foo{bar]]
15703 [[foo}bar]]
15704 [[foo[bar]]
15705 [[foo]bar]]
15706 [[foo&lt;bar]]
15707 </p>
15708 !!html/parsoid
15709 <p>[[./../foo|bar]]
15710 [[foo�|bar]]
15711 [[foo/.|bar]]
15712 [[foo/..|bar]]
15713 [[foo~~~bar]]
15714 [[foo>bar]]
15715 [[foo[bar]]
15716 [[.]]
15717 [[..]]
15718 [[foo././bar]]
15719 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15720
15721 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15722 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15723 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15724 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15725 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15726 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15727 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15728 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15729 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15730 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15731 [[<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>
15732 !!end
15733
15734 !! test
15735 Disabled subpages
15736 !! wikitext
15737 [[/subpage]]
15738 !! html
15739 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15740 </p>
15741 !! end
15742
15743 !! test
15744 T2561: {{/Subpage}}
15745 !! options
15746 subpage title=[[Page]]
15747 !! wikitext
15748 {{/Subpage}}
15749 !! html
15750 <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>
15751 </p>
15752 !! end
15753
15754 ###
15755 ### Categories
15756 ###
15757 !! article
15758 Category:MediaWiki User's Guide
15759 !! text
15760 blah
15761 !! endarticle
15762
15763 !! test
15764 Link to category
15765 !! wikitext
15766 [[:Category:MediaWiki User's Guide]]
15767 !! html
15768 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15769 </p>
15770 !! end
15771
15772 !! test
15773 Simple category
15774 !! options
15775 cat
15776 !! wikitext
15777 [[Category:MediaWiki User's Guide]]
15778 !! html/php
15779 cat=MediaWiki_User's_Guide sort=
15780 !! html/parsoid
15781 <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"}}'/>
15782 !! end
15783
15784 !! test
15785 PAGESINCATEGORY invalid title fatal (r33546 fix)
15786 !! wikitext
15787 {{PAGESINCATEGORY:<bogus>}}
15788 !! html
15789 <p>0
15790 </p>
15791 !! end
15792
15793 !! test
15794 Category with different sort key
15795 !! options
15796 cat
15797 !! wikitext
15798 [[Category:MediaWiki User's Guide|Foo]]
15799 !! html/php
15800 cat=MediaWiki_User's_Guide sort=Foo
15801 !! html/parsoid
15802 <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"}}'/>
15803 !! end
15804
15805 !! test
15806 Category with identical sort key
15807 !! options
15808 cat
15809 !! wikitext
15810 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15811 !! html/php
15812 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15813 !! html/parsoid
15814 <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"}}'/>
15815 !! end
15816
15817 !! test
15818 Category with empty sort key
15819 !! options
15820 cat
15821 pst
15822 !! wikitext
15823 [[Category:MediaWiki User's Guide|]]
15824 !! html/php
15825 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15826 !! end
15827
15828 !! test
15829 Category with empty sort key and parentheses
15830 !! options
15831 cat
15832 pst
15833 !! wikitext
15834 [[Category:Foo (bar)|]]
15835 !! html/php
15836 [[Category:Foo (bar)|Foo]]
15837 !! end
15838
15839 !! test
15840 Category with link tail
15841 !! options
15842 cat
15843 pst
15844 !! wikitext
15845 123[[Category:Foo]]456
15846 !! html/php
15847 123[[Category:Foo]]456
15848 !! end
15849
15850 !! test
15851 Category with template
15852 !! options
15853 cat
15854 pst
15855 !! wikitext
15856 [[Category:{{echo|Foo}}]]
15857 !! html/php
15858 [[Category:{{echo|Foo}}]]
15859 !! end
15860
15861 !! test
15862 Category with template in sort key
15863 !! options
15864 cat
15865 pst
15866 !! wikitext
15867 [[Category:Foo|{{echo|Bar}}]]
15868 !! html/php
15869 [[Category:Foo|{{echo|Bar}}]]
15870 !! end
15871
15872 !! test
15873 Category with template in sort key and title
15874 !! options
15875 cat
15876 pst
15877 !! wikitext
15878 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15879 !! html/php
15880 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15881 !! end
15882
15883 ## We used to, but no longer wt2wt this test since the default serializer
15884 ## will normalize all categories to serialize on their own line.
15885 ## This wikitext usage is going to be fairly uncommon in production and
15886 ## selser will take care of preserving formatting in those scenarios.
15887 !! test
15888 Category / paragraph interactions
15889 !! options
15890 parsoid=wt2html
15891 !! wikitext
15892 Foo [[Category:Baz]] Bar
15893
15894 Foo [[Category:Baz]]
15895 Bar
15896
15897 Foo
15898 [[Category:Baz]]
15899 Bar
15900
15901 Foo
15902 [[Category:Baz]] Bar
15903
15904 Foo
15905 [[Category:Baz]]
15906 [[Category:Baz]]
15907 [[Category:Baz]]
15908 Bar
15909
15910 [[Category:Baz]]
15911 [[Category:Baz]]
15912 [[Category:Baz]]
15913
15914 [[Category:Baz]]
15915 {{echo|[[Category:Baz]]}}
15916 [[Category:Baz]]
15917 !! html/php
15918 <p>Foo Bar
15919 </p><p>Foo
15920 Bar
15921 </p><p>Foo
15922 Bar
15923 </p><p>Foo Bar
15924 </p><p>Foo
15925 Bar
15926 </p>
15927 !! html/parsoid
15928 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15929 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15930 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15931 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15932 <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>
15933 <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}}]}'/>
15934 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15935 !! end
15936
15937 ## We used to, but no longer wt2wt this test since the default serializer
15938 ## will normalize all categories to serialize on their own line.
15939 ## This wikitext usage is going to be fairly uncommon in production and
15940 ## selser will take care of preserving formatting in those scenarios.
15941 ##
15942 ## The whitespace on the empty line is part of the test. Please do not delete
15943 !! test
15944 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15945 !! options
15946 parsoid=wt2html
15947 !! wikitext
15948 This
15949
15950 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15951
15952 {{echo|[[Category:Foo]] and so should this!}}
15953 !! html/php
15954 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15955 </p>
15956 !! html/parsoid
15957 <p>This
15958
15959 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15960
15961 <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>
15962 !! end
15963
15964 ## Parsoid will not try to wt2wt this while preserving newlines because
15965 ## it suppresses excess newlines within list items -- and we don't want to
15966 ## introduce a special case just for categories, which is, in reality somewhat
15967 ## odd behavior -- categories are unlikely to be used in list items like this
15968 ## in top-level pages and are only likely to show up in template-generated
15969 ## list items where this RT-ing is a non-issue.
15970 ##
15971 ## The whitespace on the empty line is part of the test. Please do not delete
15972 !! test
15973 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15974 !! options
15975 parsoid=wt2html
15976 !! wikitext
15977 * This
15978
15979 [[Category:Foo]] and this should be part of the same list item
15980 * So should this
15981
15982 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15983 !! html
15984 <ul><li>This and this should be part of the same list item</li>
15985 <li>So should this and this should be part of the same list item</li></ul>
15986 !! html/parsoid
15987 <ul>
15988 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15989 <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>
15990 </ul>
15991 !! end
15992
15993 ## Newlines and categories that follow the last item of a list
15994 ## are treated differently because this (list followed by categories)
15995 ## is an extremely common pattern on wikis.
15996 !! test
15997 3. Categories and newlines: newline suppression for last list item should RT properly
15998 !! wikitext
15999 * a
16000 * b
16001
16002 [[Category:Foo]]
16003
16004 [[Category:Bar]]
16005 [[Category:Baz]]
16006 !! html/parsoid
16007 <ul><li> a</li>
16008 <li> b</li></ul>
16009
16010 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16011
16012 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16013 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16014 !! end
16015
16016 !! test
16017 4. Categories and newlines: newline suppression for last list item should RT properly
16018 !! wikitext
16019 * a
16020 **** b
16021
16022 [[Category:Foo]]
16023 !! html/parsoid
16024 <ul><li> a
16025 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16026
16027 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16028 !! end
16029
16030 ## only wt2html for this to make sure the algo only applies to the rightmost path
16031 !! test
16032 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16033 !! options
16034 parsoid=wt2html
16035 !! wikitext
16036 * a
16037 ** b
16038 [[Category:Foo]]
16039 * c
16040 ** d
16041 [[Category:Foo]]
16042 !! html/parsoid
16043 <ul><li> a
16044 <ul><li> b
16045 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16046 <li> c
16047 <ul><li> d</li></ul></li></ul>
16048 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16049 !! end
16050
16051 ## We used to, but no longer wt2wt this test since the default serializer
16052 ## will normalize all categories to serialize on their own line.
16053 ## This wikitext usage is going to be fairly uncommon in production and
16054 ## selser will take care of preserving formatting in those scenarios.
16055 !! test
16056 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16057 !! options
16058 parsoid=wt2html
16059 !! wikitext
16060 * a [[Category:Foo]]
16061 !! html/parsoid
16062 <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>
16063 !! end
16064
16065 # This test also demonstrates because of newline+category tunneling
16066 # through the list hander, template wrapping doesn't expand to the
16067 # containing list when the list item swallows the category.
16068 !! test
16069 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16070 !! wikitext
16071 * {{echo|a
16072 [[Category:Foo]]}}
16073 !! html/parsoid
16074 <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
16075 </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>
16076 !! end
16077
16078 !! test
16079 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16080 !! wikitext
16081 * a
16082
16083 {{echo|[[Category:Foo]]
16084 [[Category:Bar]]}}
16085 [[Category:Baz]]
16086 !! html/parsoid
16087 <ul><li> a</li></ul>
16088
16089 <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">
16090 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16091 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16092 !! end
16093
16094 !! test
16095 9. Categories and newlines: should behave properly with linkprefix (T87753)
16096 !! options
16097 language=ar
16098 !! wikitext
16099 foo bar
16100 foo bar
16101 [[تصنيف:Foo]]
16102 [[تصنيف:Bar]]
16103 !! html/php
16104 <p>foo bar
16105 foo bar
16106 </p>
16107 !! html/parsoid
16108 <p>foo bar
16109 foo bar</p>
16110 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16111 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16112 !! end
16113
16114 !! test
16115 10. No regressions on internal links following category (T174639)
16116 !! options
16117 parsoid=wt2html,html2html
16118 !! wikitext
16119 [[Category:Foo]]<div>a
16120
16121 [[Foo]]</div>
16122 !! html/php
16123 <div>a
16124 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16125
16126 !! html/parsoid
16127 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16128
16129 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16130 !! end
16131
16132 # Note that Parsoid differs slightly from PHP due to T175421
16133 !! test
16134 11. Special case where only newlines separate links (T175416)
16135 !! options
16136 parsoid=wt2html,html2html
16137 !! wikitext
16138 [[Category:Foo]]
16139
16140 [[Foo]][[es:Alimento]]
16141
16142 [[Foo]]
16143 !! html/php
16144 <p><br />
16145 <a href="/wiki/Foo" title="Foo">Foo</a>
16146 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16147 </p>
16148 !! html/parsoid
16149 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16150
16151 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16152
16153 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16154 !! end
16155
16156 !! test
16157 Category links with multiple namespaces
16158 !! wikitext
16159 [[Category:Project:Foo]]
16160 !! html/parsoid
16161 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16162 !! end
16163
16164 !! test
16165 Parsoid: Serialize link to category page with colon escape
16166 !! options
16167 parsoid
16168 !! wikitext
16169
16170 [[:Category:Foo]]
16171 [[:Category:Foo|Bar]]
16172 !! html
16173 <p>
16174 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16175 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16176 </p>
16177 !! end
16178
16179 # We used to, but no longer wt2wt this test since the default serializer
16180 # will normalize all categories to serialize on their own line.
16181 # This wikitext usage is going to be fairly uncommon in production and
16182 # selser will take care of preventing whitespace insertion if this
16183 # occurs in an article.
16184 #
16185 # html2html disabled for the same reason (whitespace insertion between
16186 # x and y).
16187 #
16188 # html2wt disabled because it localizes the "Category" namespace.
16189 !! test
16190 Link prefix/suffixes aren't applied to category links
16191 !! options
16192 parsoid=wt2html
16193 language=is
16194 !! wikitext
16195 x[[Category:Foo]]y
16196 !! html/php
16197 <p>xy
16198 </p>
16199 !! html/parsoid
16200 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16201 !! end
16202
16203 !! test
16204 Link prefix/suffixes aren't applied to language links
16205 !! options
16206 parsoid=wt2html
16207 language=is
16208 !! wikitext
16209 x[[es:Foo]]y
16210 !! html/php
16211 <p>xy
16212 </p>
16213 !! html/parsoid
16214 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16215 !! end
16216
16217 !! test
16218 Parsoid: Serialize link to file page with colon escape
16219 !! options
16220 parsoid
16221 !! wikitext
16222
16223 [[:File:Foo.png]]
16224 [[:File:Foo.png|Bar]]
16225 !! html
16226 <p>
16227 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16228 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16229 </p>
16230 !! end
16231
16232 !! test
16233 Parsoid: Serialize a genuine category link without colon escape
16234 !! options
16235 parsoid
16236 !! wikitext
16237 [[Category:Foo]]
16238 [[Category:Foo|Bar]]
16239 !! html
16240 <link rel="mw:PageProp/Category" href="./Category:Foo">
16241 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16242 !! end
16243
16244 !! test
16245 Normalize hrefs properly before testing for invalid link targets (T72894)
16246 !! options
16247 parsoid=html2wt
16248 !! html/parsoid
16249 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16250 !! wikitext
16251 [[Category:Toxine bactérienne]]
16252 !! end
16253
16254 !! test
16255 Parsoid: Defaultsort
16256 !! wikitext
16257 {{DEFAULTSORT:Foo}}
16258 !! html/parsoid
16259 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16260 !! end
16261
16262 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16263 # But, this is a limitation of our representation and is documented in
16264 # TemplateHandler.js in processSpecialMagicWord
16265 !! test
16266 Parsoid: Defaultsort (template-generated)
16267 !! wikitext
16268 {{{{echo|DEFAULTSORT}}:Foo}}
16269 !! html/parsoid
16270 <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"}]]}'/>
16271 !! end
16272
16273 ###
16274 ### Inter-language links
16275 ###
16276 !! test
16277 Interlanguage links
16278 !! options
16279 ill
16280 !! wikitext
16281 [[es:Alimento]]
16282 [[fr:Nourriture]]
16283 [[zh:食品]]
16284 !! html/php
16285 es:Alimento fr:Nourriture zh:食品
16286 !! html/parsoid
16287 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16288 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16289 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16290 !! end
16291
16292 !! test
16293 Duplicate interlanguage links (T26502)
16294 !! options
16295 ill
16296 !! wikitext
16297 [[es:1]]
16298 [[es:2]]
16299 [[fr:1]]
16300 [[fr:2]]
16301 !! html/php
16302 es:1 fr:1
16303 !! html/parsoid
16304 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16305 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16306 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16307 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16308 !! end
16309
16310 ###
16311 ### Sections
16312 ###
16313 !! test
16314 Basic section headings
16315 !! wikitext
16316 == Headline 1 ==
16317 Some text
16318
16319 ==Headline 2==
16320 More
16321 ===Smaller headline===
16322 Blah blah
16323 !! html
16324 <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>
16325 <p>Some text
16326 </p>
16327 <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>
16328 <p>More
16329 </p>
16330 <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>
16331 <p>Blah blah
16332 </p>
16333 !! end
16334
16335 !! test
16336 Section headings with TOC
16337 !! wikitext
16338 == Headline 1 ==
16339 === Subheadline 1 ===
16340 ===== Skipping a level =====
16341 ====== Skipping a level ======
16342
16343 == Headline 2 ==
16344 Some text
16345 ===Another headline===
16346 !! html
16347 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16348 <ul>
16349 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16350 <ul>
16351 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16352 <ul>
16353 <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>
16354 <ul>
16355 <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>
16356 </ul>
16357 </li>
16358 </ul>
16359 </li>
16360 </ul>
16361 </li>
16362 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16363 <ul>
16364 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16365 </ul>
16366 </li>
16367 </ul>
16368 </div>
16369
16370 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16371 <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>
16372 <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>
16373 <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>
16374 <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>
16375 <p>Some text
16376 </p>
16377 <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>
16378
16379 !! end
16380
16381 !! test
16382 TOC anchors don't collide
16383 !! wikitext
16384 __FORCETOC__
16385 == Headline 2 ==
16386 == Headline ==
16387 == Headline 2 ==
16388 == Headline ==
16389 !! html/php
16390 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16391 <ul>
16392 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16393 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16394 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16395 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16396 </ul>
16397 </div>
16398
16399 <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>
16400 <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>
16401 <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>
16402 <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>
16403
16404 !! end
16405
16406 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16407 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16408 !! test
16409 Handling of sections up to level 6 and beyond
16410 !! options
16411 parsoid=wt2html
16412 !! wikitext
16413 = Level 1 Heading=
16414 == Level 2 Heading==
16415 === Level 3 Heading===
16416 ==== Level 4 Heading====
16417 ===== Level 5 Heading=====
16418 ====== Level 6 Heading======
16419 ======= Level 7 Heading=======
16420 ======== Level 8 Heading========
16421 ========= Level 9 Heading=========
16422 ========== Level 10 Heading==========
16423 !! html/php
16424 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16425 <ul>
16426 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16427 <ul>
16428 <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>
16429 <ul>
16430 <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>
16431 <ul>
16432 <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>
16433 <ul>
16434 <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>
16435 <ul>
16436 <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>
16437 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
16438 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
16439 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
16440 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_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>
16441 </ul>
16442 </li>
16443 </ul>
16444 </li>
16445 </ul>
16446 </li>
16447 </ul>
16448 </li>
16449 </ul>
16450 </li>
16451 </ul>
16452 </div>
16453
16454 <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>
16455 <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>
16456 <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>
16457 <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>
16458 <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>
16459 <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>
16460 <h6><span class="mw-headline" id=".3D_Level_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>
16461 <h6><span class="mw-headline" id=".3D.3D_Level_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>
16462 <h6><span class="mw-headline" id=".3D.3D.3D_Level_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>
16463 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_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>
16464
16465 !! html/parsoid
16466 <h1 id="Level_1_Heading" data-parsoid='{}'> Level 1 Heading</h1>
16467 <h2 id="Level_2_Heading" data-parsoid='{}'> Level 2 Heading</h2>
16468 <h3 id="Level_3_Heading" data-parsoid='{}'> Level 3 Heading</h3>
16469 <h4 id="Level_4_Heading" data-parsoid='{}'> Level 4 Heading</h4>
16470 <h5 id="Level_5_Heading" data-parsoid='{}'> Level 5 Heading</h5>
16471 <h6 id="Level_6_Heading" data-parsoid='{}'> Level 6 Heading</h6>
16472 <h6 id="=_Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>= Level 7 Heading=</h6>
16473 <h6 id="==_Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>== Level 8 Heading==</h6>
16474 <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>
16475 <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>
16476 !! end
16477
16478 !! test
16479 TOC regression (T11764)
16480 !! wikitext
16481 == title 1 ==
16482 === title 1.1 ===
16483 ==== title 1.1.1 ====
16484 === title 1.2 ===
16485 == title 2 ==
16486 === title 2.1 ===
16487 !! html
16488 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16489 <ul>
16490 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16491 <ul>
16492 <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>
16493 <ul>
16494 <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>
16495 </ul>
16496 </li>
16497 <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>
16498 </ul>
16499 </li>
16500 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16501 <ul>
16502 <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>
16503 </ul>
16504 </li>
16505 </ul>
16506 </div>
16507
16508 <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>
16509 <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>
16510 <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>
16511 <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>
16512 <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>
16513 <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>
16514
16515 !! end
16516
16517 !! test
16518 TOC for heading containing <span id="..."></span> (T96153)
16519 !! wikitext
16520 __FORCETOC__
16521 ==<span id="old-anchor"></span>New title==
16522 !! html/php
16523 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16524 <ul>
16525 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16526 </ul>
16527 </div>
16528
16529 <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>
16530
16531 !! end
16532
16533 !! test
16534 TOC with wgMaxTocLevel=3 (T8204)
16535 !! options
16536 wgMaxTocLevel=3
16537 !! wikitext
16538 == title 1 ==
16539 === title 1.1 ===
16540 ==== title 1.1.1 ====
16541 === title 1.2 ===
16542 == title 2 ==
16543 === title 2.1 ===
16544 !! html
16545 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16546 <ul>
16547 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16548 <ul>
16549 <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>
16550 <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>
16551 </ul>
16552 </li>
16553 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16554 <ul>
16555 <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>
16556 </ul>
16557 </li>
16558 </ul>
16559 </div>
16560
16561 <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>
16562 <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>
16563 <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>
16564 <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>
16565 <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>
16566 <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>
16567
16568 !! end
16569
16570 !! test
16571 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16572 !! options
16573 wgMaxTocLevel=3
16574 !! wikitext
16575 ==Section 1==
16576 ===Section 1.1===
16577 ====Section 1.1.1====
16578 ====Section 1.1.1.1====
16579 ==Section 2==
16580 !! html
16581 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16582 <ul>
16583 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16584 <ul>
16585 <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>
16586 </ul>
16587 </li>
16588 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16589 </ul>
16590 </div>
16591
16592 <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>
16593 <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>
16594 <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>
16595 <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>
16596 <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>
16597
16598 !! end
16599
16600
16601 !! test
16602 Resolving duplicate section names
16603 !! wikitext
16604 == Foo bar ==
16605 == Foo bar ==
16606 !! html
16607 <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>
16608 <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>
16609
16610 !! end
16611
16612 !! test
16613 Resolving duplicate section names with differing case (T12721)
16614 !! wikitext
16615 == Foo bar ==
16616 == Foo Bar ==
16617 !! html
16618 <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>
16619 <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>
16620
16621 !! end
16622
16623 !! article
16624 Template:sections
16625 !! text
16626 ===Section 1===
16627 ==Section 2==
16628 !! endarticle
16629
16630 !! test
16631 Template with sections, __NOTOC__
16632 !! wikitext
16633 __NOTOC__
16634 ==Section 0==
16635 {{sections}}
16636 ==Section 4==
16637 !! html
16638 <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>
16639 <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>
16640 <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>
16641 <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>
16642
16643 !! end
16644
16645 !! test
16646 __NOEDITSECTION__ keyword
16647 !! wikitext
16648 __NOEDITSECTION__
16649 ==Section 1==
16650 ==Section 2==
16651 !! html
16652 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16653 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16654
16655 !! end
16656
16657 !! test
16658 Link inside a section heading
16659 !! wikitext
16660 ==Section with a [[Main Page|link]] in it==
16661 !! html
16662 <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>
16663
16664 !! end
16665
16666 !! test
16667 TOC regression (T14077)
16668 !! wikitext
16669 __TOC__
16670 == title 1 ==
16671 === title 1.1 ===
16672 == title 2 ==
16673 !! html
16674 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16675 <ul>
16676 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16677 <ul>
16678 <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>
16679 </ul>
16680 </li>
16681 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16682 </ul>
16683 </div>
16684
16685 <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>
16686 <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>
16687 <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>
16688
16689 !! end
16690
16691 !! test
16692 T3219 URL next to image (good)
16693 !! wikitext
16694 http://example.com [[File:Foobar.jpg]]
16695 !! html/php
16696 <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>
16697 </p>
16698 !! html/parsoid
16699 <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>
16700 !!end
16701
16702 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16703 !! test
16704 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16705 !! options
16706 parsoid=wt2html,html2html
16707 !! wikitext
16708 ===
16709 The line above must have a trailing space!
16710 === <!--
16711 --> <!-- -->
16712 But just in case it doesn't...
16713 !! html/php
16714 <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>
16715 <p>The line above must have a trailing space!
16716 </p>
16717 <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>
16718 <p>But just in case it doesn't...
16719 </p>
16720 !! html/parsoid
16721 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16722 <p>The line above must have a trailing space!</p>
16723 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16724 --> <!-- -->
16725 <p>But just in case it doesn't...</p>
16726 !! end
16727
16728 !! test
16729 Header with special characters (T27462)
16730 !! wikitext
16731 The tooltips shall not show entities to the user (ie. be double escaped)
16732
16733 == text > text ==
16734 section 1
16735
16736 == text < text ==
16737 section 2
16738
16739 == text & text ==
16740 section 3
16741
16742 == text ' text ==
16743 section 4
16744
16745 == text " text ==
16746 section 5
16747 !! html/php
16748 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16749 </p>
16750 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16751 <ul>
16752 <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>
16753 <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>
16754 <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>
16755 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16756 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16757 </ul>
16758 </div>
16759
16760 <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>
16761 <p>section 1
16762 </p>
16763 <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>
16764 <p>section 2
16765 </p>
16766 <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>
16767 <p>section 3
16768 </p>
16769 <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>
16770 <p>section 4
16771 </p>
16772 <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>
16773 <p>section 5
16774 </p>
16775 !! html/parsoid
16776 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16777
16778 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span> text > text </h2>
16779 <p>section 1</p>
16780
16781 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span> text &lt; text </h2>
16782 <p>section 2</p>
16783
16784 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span> text &amp; text </h2>
16785 <p>section 3</p>
16786
16787 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span> text ' text </h2>
16788 <p>section 4</p>
16789
16790 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span> text " text </h2>
16791 <p>section 5</p>
16792 !! end
16793
16794 !! test
16795 Header with space, plus and underscore as entity
16796 !! wikitext
16797 Id should not contain + for spaces
16798
16799 == Space between Text ==
16800 section 1
16801
16802 == Space-Entity&#32;between&#32;Text ==
16803 section 2
16804
16805 == Plus+between+Text ==
16806 section 3
16807
16808 == Plus-Entity&#43;between&#43;Text ==
16809 section 4
16810
16811 == Underscore_between_Text ==
16812 section 5
16813
16814 == Underscore-Entity&#95;between&#95;Text ==
16815 section 6
16816
16817 [[#Space between Text]]
16818 [[#Space-Entity&#32;between&#32;Text]]
16819 [[#Plus+between+Text]]
16820 [[#Plus-Entity&#43;between&#43;Text]]
16821 [[#Underscore_between_Text]]
16822 [[#Underscore-Entity&#95;between&#95;Text]]
16823 !! html/php
16824 <p>Id should not contain + for spaces
16825 </p>
16826 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16827 <ul>
16828 <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>
16829 <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>
16830 <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>
16831 <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>
16832 <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>
16833 <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>
16834 </ul>
16835 </div>
16836
16837 <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>
16838 <p>section 1
16839 </p>
16840 <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>
16841 <p>section 2
16842 </p>
16843 <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>
16844 <p>section 3
16845 </p>
16846 <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>
16847 <p>section 4
16848 </p>
16849 <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>
16850 <p>section 5
16851 </p>
16852 <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>
16853 <p>section 6
16854 </p><p><a href="#Space_between_Text">#Space between Text</a>
16855 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16856 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16857 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16858 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16859 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16860 </p>
16861 !! html/parsoid
16862 <p>Id should not contain + for spaces</p>
16863
16864 <h2 id="Space_between_Text"> Space between Text </h2>
16865 <p>section 1</p>
16866
16867 <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>
16868 <p>section 2</p>
16869
16870 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span> Plus+between+Text </h2>
16871 <p>section 3</p>
16872
16873 <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>
16874 <p>section 4</p>
16875
16876 <h2 id="Underscore_between_Text"> Underscore_between_Text </h2>
16877 <p>section 5</p>
16878
16879 <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>
16880 <p>section 6</p>
16881
16882 <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>
16883 <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>
16884 <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>
16885 <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>
16886 <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>
16887 <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>
16888 !! end
16889
16890 # Parsoid html2wt disabled because it adds padding spaces around =
16891 !! test
16892 Headers with excess '=' characters
16893 (Are similar tests necessary beyond the 1st level?)
16894 !! options
16895 parsoid=wt2html,wt2wt,html2html
16896 !! wikitext
16897 =foo==
16898 ==foo=
16899 =''italic'' heading==
16900 ==''italic'' heading=
16901 !! html/php
16902 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16903 <ul>
16904 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16905 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16906 <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>
16907 <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>
16908 </ul>
16909 </div>
16910
16911 <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>
16912 <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>
16913 <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>
16914 <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>
16915
16916 !! html/parsoid
16917 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16918 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16919 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16920 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16921 !! end
16922
16923 !! test
16924 HTML headers vs TOC (T25393)
16925 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16926 !! wikitext
16927 <h1>Header 1</h1>
16928 == Header 1.1 ==
16929 == Header 1.2 ==
16930
16931 <h1>Header 2
16932 </h1>
16933 == Header 2.1 ==
16934 == Header 2.2 ==
16935 __NOEDITSECTION__
16936 !! html/php
16937 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16938 <ul>
16939 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16940 <ul>
16941 <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>
16942 <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>
16943 </ul>
16944 </li>
16945 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16946 <ul>
16947 <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>
16948 <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>
16949 </ul>
16950 </li>
16951 </ul>
16952 </div>
16953
16954 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16955 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16956 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16957 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16958 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16959 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16960
16961 !! html/parsoid
16962 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16963 <h2 id="Header_1.1" data-parsoid='{}'> Header 1.1 </h2>
16964 <h2 id="Header_1.2" data-parsoid='{}'> Header 1.2 </h2>
16965
16966 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16967 </h1>
16968 <h2 id="Header_2.1" data-parsoid='{}'> Header 2.1 </h2>
16969 <h2 id="Header_2.2" data-parsoid='{}'> Header 2.2 </h2>
16970 <meta property="mw:PageProp/noeditsection"/>
16971 !! end
16972
16973 !! test
16974 Single-line or multiline-comments can follow headings
16975 !! options
16976 parsoid=wt2html,wt2wt
16977 !! wikitext
16978 ==foo==<!---->
16979 ==bar==<!--c1-->
16980 ==baz==<!--
16981 c2
16982 c3-->
16983 !! html/php
16984 <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>
16985 <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>
16986 <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>
16987
16988 !! html/parsoid
16989 <h2 id="foo">foo</h2><!---->
16990 <h2 id="bar">bar</h2><!--c1-->
16991 <h2 id="baz">baz</h2><!--
16992 c2
16993 c3-->
16994 !! end
16995
16996 !! test
16997 T3219 URL next to image (broken)
16998 !! wikitext
16999 http://example.com[[File:Foobar.jpg]]
17000 !! html/php
17001 <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>
17002 </p>
17003 !! html/parsoid
17004 <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>
17005 !!end
17006
17007 !! test
17008 T3186 news: in the middle of text
17009 !! wikitext
17010 http://en.wikinews.org/wiki/Wikinews:Workplace
17011 !! html
17012 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17013 </p>
17014 !!end
17015
17016
17017 !! test
17018 Namespaced link must have a title
17019 !! wikitext
17020 [[Project:]]
17021 !! html
17022 <p>[[Project:]]
17023 </p>
17024 !!end
17025
17026 !! test
17027 Namespaced link must have a title (bad fragment version)
17028 !! wikitext
17029 [[Project:#fragment]]
17030 !! html
17031 <p>[[Project:#fragment]]
17032 </p>
17033 !!end
17034
17035
17036 ###
17037 ### HTML tags and HTML attributes
17038 ###
17039
17040 !! test
17041 div with no attributes
17042 !! wikitext
17043 <div>HTML rocks</div>
17044 !! html
17045 <div>HTML rocks</div>
17046
17047 !! end
17048
17049 !! test
17050 div with double-quoted attribute
17051 !! wikitext
17052 <div id="rock">HTML rocks</div>
17053 !! html
17054 <div id="rock">HTML rocks</div>
17055
17056 !! end
17057
17058 !! test
17059 div with single-quoted attribute
17060 !! wikitext
17061 <div id='rock'>HTML rocks</div>
17062 !! html
17063 <div id="rock">HTML rocks</div>
17064
17065 !! end
17066
17067 !! test
17068 div with unquoted attribute
17069 !! wikitext
17070 <div id=rock>HTML rocks</div>
17071 !! html
17072 <div id="rock">HTML rocks</div>
17073
17074 !! end
17075
17076 !! test
17077 div with illegal double attributes
17078 !! wikitext
17079 <div id="a" id="b">HTML rocks</div>
17080 !! html
17081 <div id="b">HTML rocks</div>
17082
17083 !!end
17084
17085 !! test
17086 div with empty attribute value, space before equals
17087 !! options
17088 parsoid=wt2html,html2html
17089 !! wikitext
17090 <div class =>HTML rocks</div>
17091 !! html/php
17092 <div class="">HTML rocks</div>
17093
17094 !! html/parsoid
17095 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17096 !! end
17097
17098 !! test
17099 div with multiple empty attribute values
17100 !! config
17101 wgFragmentMode=[ 'html5', 'legacy' ]
17102 !! options
17103 parsoid=wt2html,html2html
17104 !! wikitext
17105 <div id= title=>HTML rocks</div>
17106 !! html/php
17107 <div id="title=">HTML rocks</div>
17108
17109 !! html/parsoid
17110 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17111 !! end
17112
17113 # FIXME Parsoid doesn't actually match PHP here.
17114 # Probably we should use the synthetic <foo /> or <indicator>
17115 # extensions for this test, which are enabled when running parser tests.
17116 !! test
17117 Extension tag in attribute value
17118 !! wikitext
17119 <span title="<translate>123</translate>">ok</span>
17120 !! html/php+disabled
17121 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17122 </p>
17123 !! html/parsoid
17124 <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>
17125 !! end
17126
17127 !! test
17128 table with multiple empty attribute values
17129 !! options
17130 parsoid=wt2html,html2html
17131 !! wikitext
17132 {| title= id=
17133 | hi
17134 |}
17135 !! html/php
17136 <table title="id=">
17137 <tr>
17138 <td> hi
17139 </td></tr></table>
17140
17141 !! html/parsoid
17142 <table title="id=">
17143 <tbody><tr><td> hi</td></tr>
17144 </tbody></table>
17145 !! end
17146
17147 !! test
17148 div with braces in attribute value
17149 !! wikitext
17150 <div title="{}">Foo</div>
17151 !! html/php
17152 <div title="&#123;&#125;">Foo</div>
17153
17154 !! html/parsoid
17155 <div title="{}">Foo</div>
17156 !! end
17157
17158 !! test
17159 div with empty attribute value, no space before equals
17160 !! options
17161 parsoid=wt2html,html2html
17162 !! wikitext
17163 <div class=>HTML rocks</div>
17164 !! html/php
17165 <div class="">HTML rocks</div>
17166
17167 !! html/parsoid
17168 <div class="">HTML rocks</div>
17169 !! end
17170
17171 !! test
17172 HTML multiple attributes correction
17173 !! wikitext
17174 <p class="error" class="awesome">Awesome!</p>
17175 !! html
17176 <p class="awesome">Awesome!</p>
17177
17178 !!end
17179
17180 !! test
17181 Table multiple attributes correction
17182 !! wikitext
17183 {|
17184 !+ class="error" class="awesome"| status
17185 |}
17186 !! html
17187 <table>
17188 <tr>
17189 <th class="awesome"> status
17190 </th></tr></table>
17191
17192 !!end
17193
17194 !! test
17195 DIV IN UPPERCASE
17196 !! wikitext
17197 <DIV ID="x">HTML ROCKS</DIV>
17198 !! html
17199 <div id="x">HTML ROCKS</div>
17200
17201 !!end
17202
17203 !! test
17204 Non-ASCII pseudo-tags are rendered as text
17205 !! wikitext
17206 <khyô>
17207 !! html
17208 <p>&lt;khyô&gt;
17209 </p>
17210 !! end
17211
17212 !! test
17213 Pseudo-tag with URL 'name' renders as url link
17214 !! wikitext
17215 <http://example.com/>
17216 !! html
17217 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17218 </p>
17219 !! end
17220
17221 !! test
17222 text with amp in the middle of nowhere
17223 !! wikitext
17224 Remember AT&T?
17225 !! html
17226 <p>Remember AT&amp;T?
17227 </p>
17228 !! end
17229
17230 !! test
17231 text with character entity: eacute
17232 !! wikitext
17233 I always thought &eacute; was a cute letter.
17234 !! html+tidy
17235 <p>I always thought &#233; was a cute letter.
17236 </p>
17237 !! end
17238
17239 !! test
17240 text with entity-escaped character entity-like string: eacute
17241 !! wikitext
17242 I always thought &amp;eacute; was a cute letter.
17243 !! html
17244 <p>I always thought &amp;eacute; was a cute letter.
17245 </p>
17246 !! end
17247
17248 !! test
17249 text with undefined character entity: xacute
17250 !! wikitext
17251 I always thought &xacute; was a cute letter.
17252 !! html
17253 <p>I always thought &amp;xacute; was a cute letter.
17254 </p>
17255 !! end
17256
17257 !! test
17258 HTML5 tags
17259 !! wikitext
17260 <data value="5">five</data>
17261 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17262 <mark>This highlighted text</mark>
17263 !! html
17264 <p><data value="5">five</data>
17265 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17266 <mark>This highlighted text</mark>
17267 </p>
17268 !! end
17269
17270 !! test
17271 HTML tag with leading space is parsed as text
17272 !! wikitext
17273 < div>foo< /div>
17274 !! html
17275 <p>&lt; div&gt;foo&lt; /div&gt;
17276 </p>
17277 !! end
17278
17279 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17280 ## the HTML5 parsing spec.
17281 !! test
17282 Element with broken attribute syntax
17283 !! options
17284 parsoid=wt2html
17285 !! wikitext
17286 <div style=" style="123">hi</div>
17287 <div =>ho</div>
17288 !! html/php
17289 <div style="123">hi</div>
17290 <div>ho</div>
17291
17292 !! html/parsoid
17293 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17294 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17295 !! end
17296
17297 ###
17298 ### Nesting tests (see T43545, T52604, T53081)
17299 ###
17300
17301 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17302 # Note that html2wt is considerably more difficult if we use <b> in
17303 # the test case, instead of <small>
17304 !! test
17305 Ensure that HTML adoption agency algorithm is properly implemented.
17306 !! wikitext
17307 <small>X<small>Y</small>Z</small>
17308 !! html
17309 <p><small>X<small>Y</small>Z</small>
17310 </p>
17311 !! end
17312
17313 # This was T43545 in the PHP parser.
17314 !! test
17315 Nesting of <kbd>
17316 !! wikitext
17317 <kbd>X<kbd>Y</kbd>Z</kbd>
17318 !! html+tidy
17319 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17320 </p>
17321 !! end
17322
17323 # The following cases were T53081 in the PHP parser.
17324 # Note that there are some other nestable tags (b, i, etc) which are
17325 # not covered; see T53081 for discussion.
17326
17327 !! test
17328 Nesting of <em>
17329 !! wikitext
17330 <em>X<em>Y</em>Z</em>
17331 !! html+tidy
17332 <p><em>X<em>Y</em>Z</em>
17333 </p>
17334 !! end
17335
17336 !! test
17337 Nesting of <strong>
17338 !! wikitext
17339 <strong>X<strong>Y</strong>Z</strong>
17340 !! html+tidy
17341 <p><strong>X<strong>Y</strong>Z</strong>
17342 </p>
17343 !! end
17344
17345 !! test
17346 Nesting of <q>
17347 !! wikitext
17348 <q>X<q>Y</q>Z</q>
17349 !! html+tidy
17350 <p><q>X<q>Y</q>Z</q>
17351 </p>
17352 !! end
17353
17354 !! test
17355 Nesting of <ruby>
17356 !! wikitext
17357 <ruby>X<ruby>Y</ruby>Z</ruby>
17358 !! html
17359 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17360 </p>
17361 !! end
17362
17363 !! test
17364 Nesting of <bdo>
17365 !! wikitext
17366 <bdo>X<bdo>Y</bdo>Z</bdo>
17367 !! html
17368 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17369 </p>
17370 !! end
17371
17372
17373 ###
17374 ### Media links
17375 ###
17376
17377 !! test
17378 Media link
17379 !! wikitext
17380 [[Media:Foobar.jpg]]
17381 [[Media:Video.ogv]]
17382 [[:Media:Video.ogv]]
17383 !! html/php
17384 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17385 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17386 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17387 </p>
17388 !! html/parsoid
17389 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17390 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17391 <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>
17392 !! end
17393
17394 !! test
17395 Media link with text
17396 !! wikitext
17397 [[Media:Foobar.jpg|A neat file to look at]]
17398 !! html/php
17399 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17400 </p>
17401 !! html/parsoid
17402 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17403 !! end
17404
17405 # FIXME: this is still bad HTML tag nesting
17406 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17407 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17408 !! test
17409 Media link with nasty text
17410 !! wikitext
17411 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17412 !! html/php
17413 <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>
17414
17415 !! html+php/tidy
17416 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17417 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17418 !! html/parsoid
17419 <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>
17420
17421 !! end
17422
17423 !! test
17424 Media link to nonexistent file (T3702)
17425 !! wikitext
17426 [[Media:No such.jpg]]
17427 [[Media:No_such file.jpg]]
17428 !! html/php
17429 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17430 <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>
17431 </p>
17432 !! html/parsoid
17433 <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>
17434 <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>
17435 !! end
17436
17437 !! test
17438 Image link to nonexistent file (T3850 - good)
17439 !! wikitext
17440 [[File:No_such.jpg]]
17441 !! html/php
17442 <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>
17443 </p>
17444 !! html/parsoid
17445 <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>
17446 !! end
17447
17448 !! test
17449 :Image link to nonexistent file (T3850 - bad)
17450 !! wikitext
17451 [[:Image:No such.jpg]]
17452 !! html/php
17453 <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>
17454 </p>
17455 !! html/parsoid
17456 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17457 !! end
17458
17459 !! test
17460 Character reference normalization in link text (T3938)
17461 !! wikitext
17462 [[Main Page|this&that]]
17463 !! html
17464 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17465 </p>
17466 !!end
17467
17468 !! article
17469 אַ
17470 !! text
17471 Test for unicode normalization
17472
17473 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17474 !! endarticle
17475
17476 !! test
17477 (T21451) Links should refer to the normalized form.
17478 !! wikitext
17479 [[&#xFB2E;]]
17480 [[&#x5d0;&#x5b7;]]
17481 [[&#x5d0;ַ]]
17482 [[א&#x5b7;]]
17483 [[אַ]]
17484 !! html
17485 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17486 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17487 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17488 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17489 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17490 </p>
17491 !! end
17492
17493 !! test
17494 Empty attribute crash test (T4067)
17495 !! wikitext
17496 <font color="">foo</font>
17497 !! html
17498 <p><font color="">foo</font>
17499 </p>
17500 !! end
17501
17502 !! test
17503 Empty attribute crash test single-quotes (T4067)
17504 !! wikitext
17505 <font color=''>foo</font>
17506 !! html
17507 <p><font color="">foo</font>
17508 </p>
17509 !! end
17510
17511 !! test
17512 Attribute test: equals, then nothing
17513 !! options
17514 parsoid=wt2html,html2html
17515 !! wikitext
17516 <font color=>foo</font>
17517 !! html/php
17518 <p><font color="">foo</font>
17519 </p>
17520 !! html/parsoid
17521 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17522 !! end
17523
17524 !! test
17525 Attribute test: unquoted value
17526 !! options
17527 parsoid=wt2html,html2html
17528 !! wikitext
17529 <font color=x>foo</font>
17530 !! html/php
17531 <p><font color="x">foo</font>
17532 </p>
17533 !! html/parsoid
17534 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17535 !! end
17536
17537 !! test
17538 Attribute test: unquoted but illegal value (hash)
17539 !! wikitext
17540 <font color=#x>foo</font>
17541 !! html
17542 <p><font color="#x">foo</font>
17543 </p>
17544 !! end
17545
17546 # Parsoid does not serialize to empty attribute syntax,
17547 # so wt2wt and html2wt cases are skipped
17548 !! test
17549 Attribute test: no value (T54330)
17550 !! options
17551 parsoid=wt2html,html2html
17552 !! wikitext
17553 <font color>foo</font>
17554 !! html/php
17555 <p><font color="">foo</font>
17556 </p>
17557 !! html/parsoid
17558 <p><font color="">foo</font></p>
17559 !! end
17560
17561 !! test
17562 T4095: link with three closing brackets
17563 !! wikitext
17564 [[Main Page]]]
17565 !! html/php
17566 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17567 </p>
17568 !! html/parsoid
17569 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17570 !! end
17571
17572 !! test
17573 T4095: link with pipe and three closing brackets
17574 !! wikitext
17575 [[Main Page|link]]]
17576 !! html/php
17577 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17578 </p>
17579 !! html/parsoid
17580 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17581 !! end
17582
17583 !! test
17584 T4095: link with pipe and three closing brackets, version 2
17585 !! wikitext
17586 [[Main Page|[http://example.com/]]]
17587 !! html/php
17588 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17589 </p>
17590 !! html/parsoid
17591 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17592 !! end
17593
17594
17595 ###
17596 ### Safety
17597 ###
17598
17599 !! article
17600 Template:Dangerous attribute
17601 !! text
17602 " onmouseover="alert(document.cookie)
17603 !! endarticle
17604
17605 !! article
17606 Template:Dangerous style attribute
17607 !! text
17608 border-size: expression(alert(document.cookie))
17609 !! endarticle
17610
17611 !! article
17612 Template:Div style
17613 !! text
17614 <div style="float: right; {{{1}}}">Magic div</div>
17615 !! endarticle
17616
17617 !! test
17618 T4304: HTML attribute safety (safe template; regression T4309)
17619 !! wikitext
17620 <div title="{{test}}"></div>
17621 !! html/php
17622 <div title="This is a test template"></div>
17623
17624 !! html/parsoid
17625 <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>
17626 !! end
17627
17628 # Parsoid has enough context to handle this case
17629 !! test
17630 T4304: HTML attribute safety (dangerous template; 2309)
17631 !! wikitext
17632 <div title="{{dangerous attribute}}"></div>
17633 !! html/php
17634 <div title=""></div>
17635
17636 !! html/parsoid
17637 <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>
17638 !! end
17639
17640 !! test
17641 T4304: HTML attribute safety (dangerous style template; 2309)
17642 !! wikitext
17643 <div style="{{dangerous style attribute}}"></div>
17644 !! html/php
17645 <div style="/* insecure input */"></div>
17646
17647 !! html/parsoid
17648 <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>
17649 !! end
17650
17651 !! test
17652 T4304: HTML attribute safety (safe parameter; 2309)
17653 !! wikitext
17654 {{div style|width: 200px}}
17655 !! html/php
17656 <div style="float: right; width: 200px">Magic div</div>
17657
17658 !! html/parsoid
17659 <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>
17660 !! end
17661
17662 !! test
17663 T4304: HTML attribute safety (unsafe parameter; 2309)
17664 !! wikitext
17665 {{div style|width: expression(alert(document.cookie))}}
17666 !! html/php
17667 <div style="/* insecure input */">Magic div</div>
17668
17669 !! html/parsoid
17670 <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>
17671 !! end
17672
17673 ## Parsoid output here differs; needs investigation.
17674 !! test
17675 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17676 !! wikitext
17677 {{div style|"><script>alert(document.cookie)</script>}}
17678 !! html
17679 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17680
17681 !! end
17682
17683 ## Parsoid output here differs; needs investigation.
17684 !! test
17685 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17686 !! wikitext
17687 {{div style|" ><script>alert(document.cookie)</script>}}
17688 !! html
17689 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17690
17691 !! end
17692
17693 !! test
17694 T4304: HTML attribute safety (link)
17695 !! wikitext
17696 <div title="[[Main Page]]"></div>
17697 !! html/php
17698 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17699
17700 !! html/parsoid
17701 <div title="[[Main Page]]"></div>
17702 !! end
17703
17704 !! test
17705 T4304: HTML attribute safety (italics)
17706 !! wikitext
17707 <div title="''foobar''"></div>
17708 !! html
17709 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17710
17711 !! end
17712
17713 !! test
17714 T4304: HTML attribute safety (bold)
17715 !! wikitext
17716 <div title="'''foobar'''"></div>
17717 !! html
17718 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17719
17720 !! end
17721
17722 !! test
17723 T4304: HTML attribute safety (ISBN)
17724 !! wikitext
17725 <div title="ISBN 1234567890"></div>
17726 !! html
17727 <div title="&#73;SBN 1234567890"></div>
17728
17729 !! end
17730
17731 !! test
17732 T4304: HTML attribute safety (RFC)
17733 !! wikitext
17734 <div title="RFC 1234"></div>
17735 !! html
17736 <div title="&#82;FC 1234"></div>
17737
17738 !! end
17739
17740 !! test
17741 T4304: HTML attribute safety (PMID)
17742 !! wikitext
17743 <div title="PMID 1234567890"></div>
17744 !! html
17745 <div title="&#80;MID 1234567890"></div>
17746
17747 !! end
17748
17749 !! test
17750 T4304: HTML attribute safety (web link)
17751 !! wikitext
17752 <div title="http://example.com/"></div>
17753 !! html
17754 <div title="http&#58;//example.com/"></div>
17755
17756 !! end
17757
17758 !! test
17759 T4304: HTML attribute safety (named web link)
17760 !! wikitext
17761 <div title="[http://example.com/ link]"></div>
17762 !! html/php
17763 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17764
17765 !! html/parsoid
17766 <div title="[http://example.com/ link]"></div>
17767 !! end
17768
17769 !! test
17770 T5244: HTML attribute safety (extension; safe)
17771 !! wikitext
17772 <div style="<nowiki>background:blue</nowiki>"></div>
17773 !! html/php
17774 <div style="background:blue"></div>
17775
17776 !! html/parsoid
17777 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17778 !! end
17779
17780 !! test
17781 T5244: HTML attribute safety (extension; unsafe)
17782 !! wikitext
17783 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17784 !! html/php
17785 <div style="/* insecure input */"></div>
17786
17787 !! html/parsoid
17788 <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>
17789 !! end
17790
17791 # More MSIE fun discovered by Tom Gilder
17792
17793 !! test
17794 MSIE CSS safety test: spurious slash
17795 !! wikitext
17796 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17797 !! html/php
17798 <div style="/* insecure input */">evil</div>
17799
17800 !! html/parsoid
17801 <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>
17802 !! end
17803
17804 !! test
17805 MSIE CSS safety test: hex code
17806 !! wikitext
17807 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17808 !! html/php
17809 <div style="/* insecure input */">evil</div>
17810
17811 !! html/parsoid
17812 <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>
17813 !! end
17814
17815 !! test
17816 MSIE CSS safety test: comment in url
17817 !! wikitext
17818 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17819 !! html/php
17820 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17821
17822 !! html/parsoid
17823 <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>
17824 !! end
17825
17826 !! test
17827 MSIE CSS safety test: comment in expression
17828 !! wikitext
17829 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17830 !! html/php
17831 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17832
17833 !! html/parsoid
17834 <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>
17835 !! end
17836
17837 !! test
17838 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17839 !! wikitext
17840 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17841 !! html/php
17842 <p style="/* invalid control char */">A</p>
17843
17844 !! html/parsoid
17845 <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>
17846 !! end
17847
17848 !! test
17849 MSIE 6 CSS safety test: Fullwidth (T57332)
17850 !! wikitext
17851 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17852 <div style="top:EXPRESSION(alert())">B</div>
17853 !! html/php
17854 <p style="/* insecure input */">A</p>
17855 <div style="/* insecure input */">B</div>
17856
17857 !! html/parsoid
17858 <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>
17859 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17860 !! end
17861
17862 !! test
17863 MSIE 6 CSS safety test: IPA extensions (T57332)
17864 !! wikitext
17865 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17866 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17867 !! html/php
17868 <div style="/* insecure input */">A</div>
17869 <p style="/* insecure input */">B</p>
17870
17871 !! html/parsoid
17872 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17873 <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>
17874 !! end
17875
17876 !! test
17877 MSIE 6 CSS safety test: sup/sub script (T57332)
17878 !! wikitext
17879 <div style="background-image:url⁽javascript:alert())">A</div>
17880 <div style="background-image:url₍javascript:alert())">B</div>
17881 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17882 !! html/php
17883 <div style="/* insecure input */">A</div>
17884 <div style="/* insecure input */">B</div>
17885 <p style="/* insecure input */">C</p>
17886
17887 !! html/parsoid
17888 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17889 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17890 <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>
17891 !! end
17892
17893 !! test
17894 Opera -o-link CSS
17895 !! options
17896 parsoid=wt2html,html2html
17897 !! wikitext
17898 <div
17899 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;"
17900 style="-o-link:attr(title);-o-link-source:current">X</div>
17901 !! html/php
17902 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17903
17904 !! html/parsoid
17905 <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>
17906 !! end
17907
17908 !! test
17909 MSIE 6 CSS safety test: Repetition markers (T57332)
17910 !! wikitext
17911 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17912 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17913 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17914 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17915 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17916 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17917 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17918 !! html/php
17919 <p style="/* insecure input */">A</p>
17920 <p style="/* insecure input */">B</p>
17921 <p style="/* insecure input */">C</p>
17922 <p style="/* insecure input */">D</p>
17923 <p style="/* insecure input */">E</p>
17924 <p style="/* insecure input */">F</p>
17925 <p style="/* insecure input */">G</p>
17926
17927 !! html/parsoid
17928 <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>
17929 <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>
17930 <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>
17931 <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>
17932 <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>
17933 <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>
17934 <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>
17935 !! end
17936
17937 !! test
17938 Table attribute legitimate extension
17939 !! wikitext
17940 {|
17941 !+ style="<nowiki>color:blue</nowiki>"| status
17942 |}
17943 !! html
17944 <table>
17945 <tr>
17946 <th style="color:blue"> status
17947 </th></tr></table>
17948
17949 !!end
17950
17951 !! test
17952 Table attribute safety
17953 !! wikitext
17954 {|
17955 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17956 |}
17957 !! html
17958 <table>
17959 <tr>
17960 <th style="/* insecure input */"> status
17961 </th></tr></table>
17962
17963 !! end
17964
17965 !! test
17966 CSS line continuation 1
17967 !! wikitext
17968 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17969 !! html
17970 <div style="/* insecure input */"></div>
17971
17972 !! end
17973
17974 !! test
17975 CSS line continuation 2
17976 !! wikitext
17977 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17978 !! html
17979 <div style="/* invalid control char */"></div>
17980
17981 !! end
17982
17983 !! article
17984 Template:Identity
17985 !! text
17986 {{{1}}}
17987 !! endarticle
17988
17989 !! test
17990 Expansion of multi-line templates in attribute values (T8255)
17991 !! wikitext
17992 <div style="background: {{identity|#00FF00}}">-</div>
17993 !! html
17994 <div style="background: #00FF00">-</div>
17995
17996 !! end
17997
17998 !! test
17999 Expansion of multi-line templates in attribute values (T8255 sanity check)
18000 !! wikitext
18001 <div style="background:
18002 #00FF00">-</div>
18003 !! html/php
18004 <div style="background: #00FF00">-</div>
18005
18006 !! html/parsoid
18007 <div style="background:
18008 #00FF00">-</div>
18009 !! end
18010
18011 !! test
18012 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18013 !! wikitext
18014 <div style="background: &#10;#00FF00">-</div>
18015 !! html
18016 <div style="background: &#10;#00FF00">-</div>
18017
18018 !! end
18019
18020 !! test
18021 Tags which are hidden from tidiers cannot pass through the Sanitizer
18022 !! wikitext
18023 <mw:toc><script>alert();</script></mw:toc>
18024 !! html+tidy
18025 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18026 </p>
18027 !! end
18028
18029 ###
18030 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18031 ###
18032
18033 !! test
18034 Parser hook: empty input
18035 !! wikitext
18036 <tag></tag>
18037 !! html/php
18038 <pre>
18039 ''
18040 array (
18041 )
18042 </pre>
18043
18044 !! html/parsoid
18045 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18046 !! end
18047
18048 ## Don't expect parsoid to rt this form.
18049 !! test
18050 Parser hook: empty input using terminated empty elements
18051 !! options
18052 parsoid=wt2html,html2html
18053 !! wikitext
18054 <tag/>
18055 !! html/php
18056 <pre>
18057 NULL
18058 array (
18059 )
18060 </pre>
18061
18062 !! html/parsoid
18063 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18064 !! end
18065
18066 !! test
18067 Parser hook: empty input using terminated empty elements (space before)
18068 !! wikitext
18069 <tag />
18070 !! html/php
18071 <pre>
18072 NULL
18073 array (
18074 )
18075 </pre>
18076
18077 !! html/parsoid
18078 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18079 !! end
18080
18081 !! test
18082 Parser hook: basic input
18083 !! wikitext
18084 <tag>input</tag>
18085 !! html/php
18086 <pre>
18087 'input'
18088 array (
18089 )
18090 </pre>
18091
18092 !! html/parsoid
18093 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18094 !! end
18095
18096 ## Don't expect parsoid to rt this form.
18097 !! test
18098 Parser hook: case insensitive
18099 !! options
18100 parsoid=wt2html,html2html
18101 !! wikitext
18102 <TAG>input</TAG>
18103 !! html/php
18104 <pre>
18105 'input'
18106 array (
18107 )
18108 </pre>
18109
18110 !! html/parsoid
18111 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18112 !! end
18113
18114 ## Don't expect parsoid to rt this form.
18115 !! test
18116 Parser hook: case insensitive, redux
18117 !! options
18118 parsoid=wt2html,html2html
18119 !! wikitext
18120 <TaG>input</TAg>
18121 !! html/php
18122 <pre>
18123 'input'
18124 array (
18125 )
18126 </pre>
18127
18128 !! html/parsoid
18129 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18130 !! end
18131
18132 !! test
18133 Parser hook: nested tags
18134 !! wikitext
18135 <tag><tag></tag></tag>
18136 !! html/php
18137 <pre>
18138 '<tag>'
18139 array (
18140 )
18141 </pre>&lt;/tag&gt;
18142
18143 !! html/parsoid
18144 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18145 !! end
18146
18147 !! test
18148 Parser hook: basic arguments
18149 !! wikitext
18150 <tag width="200" height="100" depth="50" square=""></tag>
18151 !! html/php
18152 <pre>
18153 ''
18154 array (
18155 'width' => '200',
18156 'height' => '100',
18157 'depth' => '50',
18158 'square' => '',
18159 )
18160 </pre>
18161
18162 !! html/parsoid
18163 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18164 !! end
18165
18166 ## Don't expect parsoid to rt this form.
18167 !! test
18168 Parser hook: basic arguments, variations
18169 !! options
18170 parsoid=wt2html,html2html
18171 !! wikitext
18172 <tag width=200 height = "100" depth = '50' square></tag>
18173 !! html/php
18174 <pre>
18175 ''
18176 array (
18177 'width' => '200',
18178 'height' => '100',
18179 'depth' => '50',
18180 'square' => '',
18181 )
18182 </pre>
18183
18184 !! html/parsoid
18185 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18186 !! end
18187
18188 !! test
18189 Parser hook: argument containing a forward slash (T7344)
18190 !! wikitext
18191 <tag filename="/tmp/bla"></tag>
18192 !! html/php
18193 <pre>
18194 ''
18195 array (
18196 'filename' => '/tmp/bla',
18197 )
18198 </pre>
18199
18200 !! html/parsoid
18201 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18202 !! end
18203
18204 ## Don't expect parsoid to rt this form.
18205 !! test
18206 Parser hook: empty input using terminated empty elements (T4374)
18207 !! options
18208 parsoid=wt2html,html2html
18209 !! wikitext
18210 <tag foo=bar/>text
18211 !! html/php
18212 <pre>
18213 NULL
18214 array (
18215 'foo' => 'bar',
18216 )
18217 </pre>text
18218
18219 !! html/parsoid
18220 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18221 !! end
18222
18223 ## </tag> should be output literally since there is no matching tag that begins it
18224 ## Don't expect parsoid to rt this form.
18225 !! test
18226 Parser hook: basic arguments using terminated empty elements (T4374)
18227 !! options
18228 parsoid=wt2html
18229 !! wikitext
18230 <tag width=200 height = "100" depth = '50' square/>
18231 other stuff
18232 </tag>
18233 !! html/php
18234 <pre>
18235 NULL
18236 array (
18237 'width' => '200',
18238 'height' => '100',
18239 'depth' => '50',
18240 'square' => '',
18241 )
18242 </pre>
18243 <p>other stuff
18244 &lt;/tag&gt;
18245 </p>
18246 !! html/parsoid
18247 <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
18248 &lt;/tag></p>
18249 !! end
18250
18251 ## Don't expect parsoid to rt this form.
18252 !! test
18253 Parser hook: Don't allow unclosed extension tags
18254 !! options
18255 parsoid=wt2html
18256 !! wikitext
18257 test <tag>123
18258
18259 this is a '''test'''
18260 !! html/php
18261 <p>test &lt;tag&gt;123
18262 </p><p>this is a <b>test</b>
18263 </p>
18264 !! html/parsoid
18265 <p>test &lt;tag>123</p>
18266
18267 <p>this is a <b>test</b></p>
18268 !! end
18269
18270 ###
18271 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18272 ###
18273
18274 !! test
18275 Parser hook: static parser hook not inside a comment
18276 !! wikitext
18277 <statictag>hello, world</statictag>
18278
18279 <statictag action="flush" />
18280 !! html/php
18281 <p><br />
18282 hello, world
18283 </p>
18284 !! html/parsoid
18285 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18286 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18287 !! end
18288
18289 !! test
18290 Parser hook: static parser hook inside a comment
18291 !! wikitext
18292 <!-- <statictag>hello, world</statictag> -->
18293 <statictag action="flush" />
18294 !! html/php
18295 <p><br />
18296 </p>
18297 !! html/parsoid
18298 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18299 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18300 !! end
18301
18302 # Nested template calls; this case was broken by Parser.php rev 1.506,
18303 # since reverted.
18304
18305 !! article
18306 Template:One-parameter
18307 !! text
18308 (My parameter is: {{{1}}})
18309 !! endarticle
18310
18311 !! article
18312 Template:Map-one-parameter
18313 !! text
18314 {{{{{1}}}|{{{2}}}}}
18315 !! endarticle
18316
18317 !! test
18318 Nested template calls
18319 !! wikitext
18320 {{Map-one-parameter|One-parameter|param}}
18321 !! html
18322 <p>(My parameter is: param)
18323 </p>
18324 !! end
18325
18326
18327 ###
18328 ### Sanitizer
18329 ###
18330
18331 # Remex wraps empty tag runs with p-tags.
18332 # Parsoid strips them out during p-wrapping.
18333 !! test
18334 Sanitizer: Closing of open tags
18335 !! wikitext
18336 <s></s><table></table>
18337 !! html/php+tidy
18338 <p><s></s></p><table></table>
18339 !! html/parsoid
18340 <s></s><table></table>
18341 !! end
18342
18343 !! test
18344 Sanitizer: Closing of open but not closed tags
18345 !! wikitext
18346 <s>foo
18347 !! html
18348 <p><s>foo</s>
18349 </p>
18350 !! end
18351
18352 !! test
18353 Sanitizer: Closing of closed but not open tags
18354 !! options
18355 parsoid=wt2html
18356 !! wikitext
18357 </s>
18358 !! html/php+tidy
18359 <p class="mw-empty-elt">
18360 </p>
18361 !! html/parsoid
18362 !! end
18363
18364 !! test
18365 Sanitizer: Closing of closed but not open table tags
18366 !! options
18367 parsoid=wt2html
18368 !! wikitext
18369 Table not started</td></tr></table>
18370 !! html+tidy
18371 <p>Table not started
18372 </p>
18373 !! end
18374
18375 !! test
18376 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18377 !! config
18378 wgFragmentMode=[ 'html5', 'legacy' ]
18379 !! wikitext
18380 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18381 !! html/php
18382 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18383 </p>
18384 !! html/parsoid
18385 <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>
18386 !! end
18387
18388 !! test
18389 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18390 !! config
18391 wgFragmentMode=[ 'legacy' ]
18392 !! wikitext
18393 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18394 !! html/php
18395 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18396 </p>
18397 !! end
18398
18399 # In HTML5, the restrictions are that id must contain at least one character,
18400 # and must not contain any space characters.
18401 !! test
18402 Sanitizer: Validating the contents of the id attribute (T6515)
18403 !! options
18404 disabled
18405 !! wikitext
18406 <br id="" /><br id="a space" />
18407 !! html
18408 Something ...
18409 !! end
18410
18411 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18412 !! test
18413 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18414 !! options
18415 disabled
18416 !! wikitext
18417 <br id="foo" /><br id="foo" />
18418 !! html
18419 Something need to be done. foo-2 ?
18420 !! end
18421
18422 !! test
18423 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18424 !! wikitext
18425 <div itemscope>
18426 <meta itemprop="hello" content="world">
18427 <meta http-equiv="refresh" content="5">
18428 <meta itemprop="hello" http-equiv="refresh" content="5">
18429 <link itemprop="hello" href="{{SERVER}}">
18430 <link rel="stylesheet" href="{{SERVER}}">
18431 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18432 </div>
18433 !! html
18434 <div itemscope="">
18435 <p> <meta itemprop="hello" content="world" />
18436 &lt;meta http-equiv="refresh" content="5"&gt;
18437 <meta itemprop="hello" content="5" />
18438 <link itemprop="hello" href="http&#58;//example.org" />
18439 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18440 <link itemprop="hello" href="http&#58;//example.org" />
18441 </p>
18442 </div>
18443
18444 !! end
18445
18446 !! test
18447 Sanitizer: Strip comments from CSS attributes
18448 !! options
18449 parsoid=wt2html,wt2wt
18450 !! wikitext
18451 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18452 !! html/php
18453 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18454 </p>
18455 !! html/parsoid
18456 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18457 !! end
18458
18459 !! test
18460 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18461 !! wikitext
18462 [[meatball:Soft"Security]]
18463 !! html/php
18464 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18465 </p>
18466 !! html/parsoid
18467 <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>
18468 !! end
18469
18470 !! test
18471 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18472 !! wikitext
18473 [[meatball:Foo<Bar]]
18474 [[meatball:Foo>Bar]]
18475 [[meatball:Foo&lt;bar]]
18476 [[meatball:Foo&gt;bar]]
18477 !! html/php
18478 <p>[[meatball:Foo&lt;Bar]]
18479 [[meatball:Foo&gt;Bar]]
18480 [[meatball:Foo&lt;bar]]
18481 [[meatball:Foo&gt;bar]]
18482 </p>
18483 !! html/parsoid
18484 <p>[[meatball:Foo&lt;Bar]]
18485 [[meatball:Foo>Bar]]
18486 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18487 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18488 !! end
18489
18490 !! test
18491 Language converter: output gets cut off unexpectedly (T7757)
18492 !! options
18493 language=zh
18494 !! wikitext
18495 this bit is safe: }-
18496
18497 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18498
18499 then we get cut off here: }-
18500
18501 all additional text is vanished
18502 !! html/php
18503 <p>this bit is safe: }-
18504 </p><p>but if we add a conversion instance: xxx
18505 </p><p>then we get cut off here: }-
18506 </p><p>all additional text is vanished
18507 </p>
18508 !! html/parsoid
18509 <p>this bit is safe: }-</p>
18510 <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>
18511 <p>then we get cut off here: }-</p>
18512 <p>all additional text is vanished</p>
18513 !! end
18514
18515 !! test
18516 Language converter glossary rules inside attributes (T119158)
18517 !! options
18518 language=sr variant=sr-el
18519 !! wikitext
18520 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18521
18522 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18523 !! html/php
18524 <p>
18525 </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>
18526 </p>
18527 !! html/parsoid
18528 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18529
18530 <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>
18531 !! end
18532
18533 !! test
18534 Self closed html pairs (T7487)
18535 !! wikitext
18536 <center><font id="bug" />Centered text</center>
18537 <div><font id="bug2" />In div text</div>
18538 !! html+tidy
18539 <center><font id="bug"></font>Centered text</center>
18540 <div><font id="bug2"></font>In div text</div>
18541 !! end
18542
18543 !! test
18544 Punctuation: nbsp before exclamation
18545 !! wikitext
18546 C'est grave !
18547 !! html
18548 <p>C'est grave&#160;!
18549 </p>
18550 !! end
18551
18552 !! test
18553 Punctuation: CSS !important (T13874)
18554 !! wikitext
18555 <div style="width:50% !important">important</div>
18556 !! html
18557 <div style="width:50% !important">important</div>
18558
18559 !!end
18560
18561 !! test
18562 Punctuation: CSS ! important (T13874; with space after)
18563 !! wikitext
18564 <div style="width:50% ! important">important</div>
18565 !! html
18566 <div style="width:50% ! important">important</div>
18567
18568 !!end
18569
18570 !! test
18571 HTML bullet list, closed tags (T7497)
18572 !! wikitext
18573 <ul>
18574 <li>One</li>
18575 <li>Two</li>
18576 </ul>
18577 !! html/php
18578 <ul>
18579 <li>One</li>
18580 <li>Two</li>
18581 </ul>
18582
18583 !! html/parsoid
18584 <ul data-parsoid='{"stx":"html"}'>
18585 <li data-parsoid='{"stx":"html"}'>One</li>
18586 <li data-parsoid='{"stx":"html"}'>Two</li>
18587 </ul>
18588
18589 !! end
18590
18591 !! test
18592 HTML bullet list, unclosed tags (T7497)
18593 !! wikitext
18594 <ul>
18595 <li>One
18596 <li>Two
18597 </ul>
18598 !! html/php+tidy
18599 <ul>
18600 <li>One
18601 </li><li>Two
18602 </li></ul>
18603 !! html/parsoid
18604 <ul data-parsoid='{"stx":"html"}'>
18605 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18606 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18607 </ul>
18608
18609 !! end
18610
18611 !! test
18612 HTML ordered list, closed tags (T7497)
18613 !! wikitext
18614 <ol>
18615 <li>One</li>
18616 <li>Two</li>
18617 </ol>
18618 !! html/php
18619 <ol>
18620 <li>One</li>
18621 <li>Two</li>
18622 </ol>
18623
18624 !! html/parsoid
18625 <ol data-parsoid='{"stx":"html"}'>
18626 <li data-parsoid='{"stx":"html"}'>One</li>
18627 <li data-parsoid='{"stx":"html"}'>Two</li>
18628 </ol>
18629
18630 !! end
18631
18632 !! test
18633 HTML ordered list, unclosed tags (T7497)
18634 !! options
18635 !! wikitext
18636 <ol>
18637 <li>One
18638 <li>Two
18639 </ol>
18640 !! html/php+tidy
18641 <ol>
18642 <li>One
18643 </li><li>Two
18644 </li></ol>
18645 !! html/parsoid
18646 <ol data-parsoid='{"stx":"html"}'>
18647 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18648 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18649 </ol>
18650
18651 !! end
18652
18653 !! test
18654 HTML nested bullet list, closed tags (T7497)
18655 !! wikitext
18656 <ul>
18657 <li>One</li>
18658 <li>Two:
18659 <ul>
18660 <li>Sub-one</li>
18661 <li>Sub-two</li>
18662 </ul>
18663 </li>
18664 </ul>
18665 !! html/php
18666 <ul>
18667 <li>One</li>
18668 <li>Two:
18669 <ul>
18670 <li>Sub-one</li>
18671 <li>Sub-two</li>
18672 </ul>
18673 </li>
18674 </ul>
18675
18676 !! html/parsoid
18677 <ul data-parsoid='{"stx":"html"}'>
18678 <li data-parsoid='{"stx":"html"}'>One</li>
18679 <li data-parsoid='{"stx":"html"}'>Two:
18680 <ul data-parsoid='{"stx":"html"}'>
18681 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18682 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18683 </ul>
18684 </li>
18685 </ul>
18686 !! end
18687
18688 !! test
18689 HTML nested bullet list, open tags (T7497)
18690 !! wikitext
18691 <ul>
18692 <li>One
18693 <li>Two:
18694 <ul>
18695 <li>Sub-one
18696 <li>Sub-two
18697 </ul>
18698 </ul>
18699 !! html+tidy
18700 <ul>
18701 <li>One
18702 </li><li>Two:
18703 <ul>
18704 <li>Sub-one
18705 </li><li>Sub-two
18706 </li></ul>
18707 </li></ul>
18708 !! end
18709
18710 !! test
18711 HTML nested ordered list, closed tags (T7497)
18712 !! wikitext
18713 <ol>
18714 <li>One</li>
18715 <li>Two:
18716 <ol>
18717 <li>Sub-one</li>
18718 <li>Sub-two</li>
18719 </ol>
18720 </li>
18721 </ol>
18722 !! html
18723 <ol>
18724 <li>One</li>
18725 <li>Two:
18726 <ol>
18727 <li>Sub-one</li>
18728 <li>Sub-two</li>
18729 </ol>
18730 </li>
18731 </ol>
18732
18733 !! end
18734
18735 !! test
18736 HTML nested ordered list, open tags (T7497)
18737 !! wikitext
18738 <ol>
18739 <li>One
18740 <li>Two:
18741 <ol>
18742 <li>Sub-one
18743 <li>Sub-two
18744 </ol>
18745 </ol>
18746 !! html/php
18747 <ol>
18748 <li>One
18749 <li>Two:
18750 <ol>
18751 <li>Sub-one
18752 <li>Sub-two
18753 </ol>
18754 </ol>
18755
18756 !! html/parsoid
18757 <ol>
18758 <li>One
18759 </li>
18760 <li>Two:
18761 <ol>
18762 <li>Sub-one
18763 </li>
18764 <li>Sub-two
18765 </li>
18766 </ol>
18767 </li>
18768 </ol>
18769
18770 !! end
18771
18772 !! test
18773 HTML ordered list item with parameters oddity
18774 !! wikitext
18775 <ol><li id="fragment">One</li>
18776 </ol>
18777 !! html
18778 <ol><li id="fragment">One</li>
18779 </ol>
18780
18781 !! end
18782
18783 # parsoid doesn't explicitly mark autonumbered links, see T55505
18784 !!test
18785 T7918: autonumbering
18786 !! wikitext
18787 [http://first/] [http://second] [ftp://ftp]
18788
18789 ftp://inlineftp
18790
18791 [mailto:enclosed@mail.tld With target]
18792
18793 [mailto:enclosed@mail.tld]
18794
18795 mailto:inline@mail.tld
18796 !! html/php
18797 <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>
18798 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18799 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18800 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18801 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18802 </p>
18803 !! html/parsoid
18804 <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>
18805 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18806 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18807 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18808 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18809 !! end
18810
18811
18812 #
18813 # Security and HTML correctness
18814 # From Nick Jenkins' fuzz testing
18815 #
18816
18817 !! test
18818 Fuzz testing: Parser13
18819 !! wikitext
18820 {|
18821 | http://a|
18822 !! html
18823 <table>
18824 <tr>
18825 <td>
18826 </td>
18827 </tr>
18828 </table>
18829
18830 !! end
18831
18832 # Note that Parsoid output differs from the PHP parser here: the PHP
18833 # parser breaks the URL for the magic word, while in Parsoid the URL
18834 # production takes precedence.
18835 !! test
18836 Fuzz testing: Parser14
18837 !! wikitext
18838 == onmouseover= ==
18839 http://__TOC__
18840 !! html/php
18841 <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>
18842 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18843 <ul>
18844 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18845 </ul>
18846 </div>
18847
18848
18849 !! html/php+tidy
18850 <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>
18851 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18852 <ul>
18853 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18854 </ul>
18855 </div>
18856 !! html/parsoid
18857 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span> onmouseover= </h2>
18858 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18859 !! end
18860
18861 !! test
18862 Fuzz testing: Parser14-table
18863 !! options
18864 parsoid=wt2html,html2html
18865 !! wikitext
18866 ==a==
18867 {| STYLE=__TOC__
18868 !! html
18869 <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>
18870 <table style="&#95;_TOC&#95;_">
18871 <tr><td></td></tr>
18872 </table>
18873
18874 !! html+tidy
18875 <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>
18876 <table style="__TOC__">
18877 <tr>
18878 <td></td>
18879 </tr>
18880 </table>
18881 !! html/parsoid
18882 <h2 id="a">a</h2>
18883 <table style="__TOC__"></table>
18884 !! end
18885
18886 # Known to produce bogus xml (extra </td>)
18887 # Don't add the html/php section since it generates broken HTML
18888 !! test
18889 Fuzz testing: Parser16
18890 !! wikitext
18891 {|
18892 !https://||||||
18893 !! html+tidy
18894 <table>
18895 <tbody><tr>
18896 <th>https://</th>
18897 <th></th>
18898 <th></th>
18899 <th>
18900
18901 </th></tr>
18902 </tbody></table>
18903 !! end
18904
18905 !! test
18906 Fuzz testing: Parser21
18907 !! wikitext
18908 {|
18909 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18910 |
18911 !! html
18912 <table>
18913 <tr>
18914 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18915 </th>
18916 <td>
18917 </td>
18918 </tr>
18919 </table>
18920
18921 !! end
18922
18923 !! test
18924 Fuzz testing: Parser22
18925 !! wikitext
18926 http://===r:::https://b
18927
18928 {|
18929 !! html
18930 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18931 </p>
18932 <table>
18933 <tr><td></td></tr>
18934 </table>
18935
18936 !! end
18937
18938 # Known to produce bad XML for now
18939 !! test
18940 Fuzz testing: Parser24
18941 !! options
18942 parsoid=wt2html
18943 !! wikitext
18944 {|
18945 {{{|
18946 <u CLASS=
18947 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18948 <br style="onmouseover='alert(document.cookie);' " />
18949
18950 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18951 |
18952 !! html/php
18953 <table>
18954 {{{|
18955 <u class="&#124;">}}}} &gt;
18956 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18957
18958 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18959 <tr>
18960 <td></u>
18961 </td>
18962 </tr>
18963 </table>
18964
18965 !! html/parsoid
18966 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18967 <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>"}'/>}}}} >
18968 <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}'>
18969
18970
18971
18972 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18973 !! end
18974
18975 # Note: the current result listed for this is not what the original one was,
18976 # but the original bug was JavaScript injection, which is fixed in any case.
18977 # It's not clear that the original result listed was any more correct than the
18978 # current one. Original result:
18979 # <p>{{{|
18980 # </p>
18981 # <li class="&#124;&#124;">
18982 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18983 !!test
18984 Fuzz testing: Parser25 (T8055)
18985 !! wikitext
18986 {{{
18987 |
18988 <LI CLASS=||
18989 >
18990 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18991 !! html/php
18992 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18993 </p>
18994 !! html/parsoid
18995 <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"]}'>
18996 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18997 !! end
18998
18999 !!test
19000 Fuzz testing: URL adjacent extension (with space, clean)
19001 !! wikitext
19002 http://example.com <nowiki>junk</nowiki>
19003 !! html/php
19004 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19005 </p>
19006 !! html/parsoid
19007 <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>
19008 !! end
19009
19010 !!test
19011 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19012 !! wikitext
19013 http://example.com<nowiki>junk</nowiki>
19014 !! html/php
19015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19016 </p>
19017 !! html/parsoid
19018 <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>
19019 !! end
19020
19021 !! test
19022 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19023 !! wikitext
19024 http://example.com<pre>junk</pre>
19025 !! html/php
19026 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19027
19028 !! html/php+tidy
19029 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19030 !! html/parsoid
19031 <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>
19032 !! end
19033
19034 !! test
19035 Fuzz testing: image with bogus manual thumbnail
19036 !! wikitext
19037 [[Image:foobar.jpg|thumbnail= ]]
19038 !! html/php
19039 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19040
19041 !! html/parsoid
19042 <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>
19043 !! end
19044
19045 # Parsoid will emit the newline literally in wt2wt; see next test case.
19046 !! test
19047 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19048 !! options
19049 parsoid=wt2html
19050 !! wikitext
19051 <pre dir="&#10;"></pre>
19052 !! html/php
19053 <pre dir="&#10;"></pre>
19054
19055 !! html/parsoid
19056 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19057 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19058 !! end
19059
19060 !! test
19061 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19062 !! options
19063 parsoid=html2wt
19064 !! html/parsoid
19065 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19066 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19067 !! wikitext
19068 <pre dir="
19069 "></pre>
19070 !! html/php
19071 <pre dir=""></pre>
19072
19073 !! end
19074
19075 !! test
19076 Templates in extension attributes are not expanded
19077 !! wikitext
19078 <pre dir="{{echo|ltr}}"></pre>
19079 !! html/php
19080 <pre dir="{{echo|ltr}}"></pre>
19081
19082 !! html/parsoid
19083 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19084 !! end
19085
19086 !! test
19087 Parsing optional HTML elements (T8171)
19088 !! options
19089 !! wikitext
19090 <table>
19091 <tr>
19092 <td> Some tabular data</td>
19093 <td> More tabular data ...
19094 <td> And yet som tabular data</td>
19095 </tr>
19096 </table>
19097 !! html
19098 <table>
19099 <tr>
19100 <td> Some tabular data</td>
19101 <td> More tabular data ...
19102 </td><td> And yet som tabular data</td>
19103 </tr>
19104 </table>
19105
19106 !! end
19107
19108 !! test
19109 Correct handling of <td>, <tr> (T8171)
19110 !! options
19111 !! wikitext
19112 <table>
19113 <tr>
19114 <td> Some tabular data</td>
19115 <td> More tabular data ...</td>
19116 <td> And yet som tabular data</td>
19117 </tr>
19118 </table>
19119 !! html
19120 <table>
19121 <tr>
19122 <td> Some tabular data</td>
19123 <td> More tabular data ...</td>
19124 <td> And yet som tabular data</td>
19125 </tr>
19126 </table>
19127
19128 !! end
19129
19130
19131 !! test
19132 Parsing crashing regression (fr:JavaScript)
19133 !! wikitext
19134 </body></x>
19135 !! html
19136 <p>&lt;/body&gt;&lt;/x&gt;
19137 </p>
19138 !! end
19139
19140 !! test
19141 Inline wiki vs wiki block nesting
19142 !! wikitext
19143 '''Bold paragraph
19144
19145 New wiki paragraph
19146 !! html
19147 <p><b>Bold paragraph</b>
19148 </p><p>New wiki paragraph
19149 </p>
19150 !! end
19151
19152 # FIXME: The current php output is documented
19153 # and desired output is the parsoid target.
19154 !! test
19155 Inline HTML vs wiki block nesting
19156 !! wikitext
19157 <b>Bold paragraph
19158
19159 New wiki paragraph
19160 !! html/php
19161 <p><b>Bold paragraph
19162 </p><p>New wiki paragraph</b>
19163 </p>
19164 !! html/parsoid
19165 <p><b>Bold paragraph</b>
19166 </p><p>New wiki paragraph
19167 </p>
19168 !! end
19169
19170 # Original result was this:
19171 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19172 # </p>
19173 # While that might be marginally more intuitive, maybe, the six-apostrophe
19174 # construct is clearly pathological and the result stated here (which is what
19175 # the parser actually does) is about as reasonable as anything.
19176 !!test
19177 Mixing markup for italics and bold
19178 !! options
19179 !! wikitext
19180 '''bold''''''bold''bolditalics'''''
19181 !! html
19182 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19183 </p>
19184 !! end
19185
19186
19187 !! article
19188 Xyzzyx
19189 !! text
19190 Article for special page transclusion test
19191 !! endarticle
19192
19193 !! test
19194 Special page transclusion
19195 !! options
19196 !! wikitext
19197 {{Special:Prefixindex/Xyzzyx}}
19198 !! html
19199 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19200 </ul>
19201
19202 !! end
19203
19204 !! test
19205 Special page transclusion twice (T7021)
19206 !! options
19207 !! wikitext
19208 {{Special:Prefixindex/Xyzzyx}}
19209 {{Special:Prefixindex/Xyzzyx}}
19210 !! html
19211 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19212 </ul>
19213 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19214 </ul>
19215
19216 !! end
19217
19218 !! test
19219 Transclusion of default MediaWiki message
19220 !! wikitext
19221 {{MediaWiki:Mainpage}}
19222 !! html
19223 <p>Main Page
19224 </p>
19225 !! end
19226
19227 !! test
19228 Transclusion of nonexistent MediaWiki message
19229 !! wikitext
19230 {{MediaWiki:Mainpagexxx}}
19231 !! html
19232 <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>
19233 </p>
19234 !! end
19235
19236 !! test
19237 Transclusion of MediaWiki message with underscore
19238 !! wikitext
19239 {{MediaWiki:history_short}}
19240 !! html
19241 <p>History
19242 </p>
19243 !! end
19244
19245 !! test
19246 Transclusion of MediaWiki message with space
19247 !! wikitext
19248 {{MediaWiki:history short}}
19249 !! html
19250 <p>History
19251 </p>
19252 !! end
19253
19254 !! test
19255 Invalid header with following text
19256 !! wikitext
19257 = x = y
19258 !! html
19259 <p>= x = y
19260 </p>
19261 !! end
19262
19263
19264 !! test
19265 Section extraction test (section 0)
19266 !! options
19267 section=0
19268 !! wikitext
19269 start
19270 ==a==
19271 ===aa===
19272 ====aaa====
19273 ==b==
19274 ===ba===
19275 ===bb===
19276 ====bba====
19277 ===bc===
19278 ==c==
19279 ===ca===
19280 !! html/php
19281 start
19282 !! end
19283
19284 !! test
19285 Section extraction test (section 1)
19286 !! options
19287 section=1
19288 !! wikitext
19289 start
19290 ==a==
19291 ===aa===
19292 ====aaa====
19293 ==b==
19294 ===ba===
19295 ===bb===
19296 ====bba====
19297 ===bc===
19298 ==c==
19299 ===ca===
19300 !! html/php
19301 ==a==
19302 ===aa===
19303 ====aaa====
19304 !! end
19305
19306 !! test
19307 Section extraction test (section 2)
19308 !! options
19309 section=2
19310 !! wikitext
19311 start
19312 ==a==
19313 ===aa===
19314 ====aaa====
19315 ==b==
19316 ===ba===
19317 ===bb===
19318 ====bba====
19319 ===bc===
19320 ==c==
19321 ===ca===
19322 !! html/php
19323 ===aa===
19324 ====aaa====
19325 !! end
19326
19327 !! test
19328 Section extraction test (section 3)
19329 !! options
19330 section=3
19331 !! wikitext
19332 start
19333 ==a==
19334 ===aa===
19335 ====aaa====
19336 ==b==
19337 ===ba===
19338 ===bb===
19339 ====bba====
19340 ===bc===
19341 ==c==
19342 ===ca===
19343 !! html/php
19344 ====aaa====
19345 !! end
19346
19347 !! test
19348 Section extraction test (section 4)
19349 !! options
19350 section=4
19351 !! wikitext
19352 start
19353 ==a==
19354 ===aa===
19355 ====aaa====
19356 ==b==
19357 ===ba===
19358 ===bb===
19359 ====bba====
19360 ===bc===
19361 ==c==
19362 ===ca===
19363 !! html/php
19364 ==b==
19365 ===ba===
19366 ===bb===
19367 ====bba====
19368 ===bc===
19369 !! end
19370
19371 !! test
19372 Section extraction test (section 5)
19373 !! options
19374 section=5
19375 !! wikitext
19376 start
19377 ==a==
19378 ===aa===
19379 ====aaa====
19380 ==b==
19381 ===ba===
19382 ===bb===
19383 ====bba====
19384 ===bc===
19385 ==c==
19386 ===ca===
19387 !! html/php
19388 ===ba===
19389 !! end
19390
19391 !! test
19392 Section extraction test (section 6)
19393 !! options
19394 section=6
19395 !! wikitext
19396 start
19397 ==a==
19398 ===aa===
19399 ====aaa====
19400 ==b==
19401 ===ba===
19402 ===bb===
19403 ====bba====
19404 ===bc===
19405 ==c==
19406 ===ca===
19407 !! html/php
19408 ===bb===
19409 ====bba====
19410 !! end
19411
19412 !! test
19413 Section extraction test (section 7)
19414 !! options
19415 section=7
19416 !! wikitext
19417 start
19418 ==a==
19419 ===aa===
19420 ====aaa====
19421 ==b==
19422 ===ba===
19423 ===bb===
19424 ====bba====
19425 ===bc===
19426 ==c==
19427 ===ca===
19428 !! html/php
19429 ====bba====
19430 !! end
19431
19432 !! test
19433 Section extraction test (section 8)
19434 !! options
19435 section=8
19436 !! wikitext
19437 start
19438 ==a==
19439 ===aa===
19440 ====aaa====
19441 ==b==
19442 ===ba===
19443 ===bb===
19444 ====bba====
19445 ===bc===
19446 ==c==
19447 ===ca===
19448 !! html/php
19449 ===bc===
19450 !! end
19451
19452 !! test
19453 Section extraction test (section 9)
19454 !! options
19455 section=9
19456 !! wikitext
19457 start
19458 ==a==
19459 ===aa===
19460 ====aaa====
19461 ==b==
19462 ===ba===
19463 ===bb===
19464 ====bba====
19465 ===bc===
19466 ==c==
19467 ===ca===
19468 !! html/php
19469 ==c==
19470 ===ca===
19471 !! end
19472
19473 !! test
19474 Section extraction test (section 10)
19475 !! options
19476 section=10
19477 !! wikitext
19478 start
19479 ==a==
19480 ===aa===
19481 ====aaa====
19482 ==b==
19483 ===ba===
19484 ===bb===
19485 ====bba====
19486 ===bc===
19487 ==c==
19488 ===ca===
19489 !! html/php
19490 ===ca===
19491 !! end
19492
19493 !! test
19494 Section extraction test (nonexistent section 11)
19495 !! options
19496 section=11
19497 !! wikitext
19498 start
19499 ==a==
19500 ===aa===
19501 ====aaa====
19502 ==b==
19503 ===ba===
19504 ===bb===
19505 ====bba====
19506 ===bc===
19507 ==c==
19508 ===ca===
19509 !! html/php
19510 !! end
19511
19512 !! test
19513 Section extraction test with bogus heading (section 1)
19514 !! options
19515 section=1
19516 !! wikitext
19517 ==a==
19518 ==bogus== not a legal section
19519 ==b==
19520 !! html/php
19521 ==a==
19522 ==bogus== not a legal section
19523 !! end
19524
19525 !! test
19526 Section extraction test with bogus heading (section 2)
19527 !! options
19528 section=2
19529 !! wikitext
19530 ==a==
19531 ==bogus== not a legal section
19532 ==b==
19533 !! html/php
19534 ==b==
19535 !! end
19536
19537 !! test
19538 Section extraction test with comment after heading (section 1)
19539 !! options
19540 section=1
19541 !! wikitext
19542 ==a==
19543 ==b== <!-- -->
19544 ==c==
19545 !! html/php
19546 ==a==
19547 !! end
19548
19549 !! test
19550 Section extraction test with comment after heading (section 2)
19551 !! options
19552 section=2
19553 !! wikitext
19554 ==a==
19555 ==b== <!-- -->
19556 ==c==
19557 !! html/php
19558 ==b== <!-- -->
19559 !! end
19560
19561 !! test
19562 Section extraction test with bogus <nowiki> heading (section 1)
19563 !! options
19564 section=1
19565 !! wikitext
19566 ==a==
19567 ==bogus== <nowiki>not a legal section</nowiki>
19568 ==b==
19569 !! html/php
19570 ==a==
19571 ==bogus== <nowiki>not a legal section</nowiki>
19572 !! end
19573
19574 !! test
19575 Section extraction test with bogus <nowiki> heading (section 2)
19576 !! options
19577 section=2
19578 !! wikitext
19579 ==a==
19580 ==bogus== <nowiki>not a legal section</nowiki>
19581 ==b==
19582 !! html/php
19583 ==b==
19584 !! end
19585
19586 # Formerly testing for T4587, now resolved by the use of unmarked sections
19587 # instead of respecting commented sections
19588 !! test
19589 Section extraction prefixed by comment (section 1)
19590 !! options
19591 section=1
19592 !! wikitext
19593 <!-- -->==sec1==
19594 ==sec2==
19595 !! html/php
19596 ==sec2==
19597 !!end
19598
19599 !! test
19600 Section extraction prefixed by comment (section 2)
19601 !! options
19602 section=2
19603 !! wikitext
19604 <!-- -->==sec1==
19605 ==sec2==
19606 !! html/php
19607
19608 !!end
19609
19610 # Formerly testing for T4607, now resolved by the use of unmarked sections
19611 # instead of respecting HTML-style headings
19612 !! test
19613 Section extraction, mixed wiki and html (section 1)
19614 !! options
19615 section=1
19616 !! wikitext
19617 <h2>unmarked</h2>
19618 unmarked
19619 ==1==
19620 one
19621 ==2==
19622 two
19623 !! html/php
19624 ==1==
19625 one
19626 !! end
19627
19628 !! test
19629 Section extraction, mixed wiki and html (section 2)
19630 !! options
19631 section=2
19632 !! wikitext
19633 <h2>unmarked</h2>
19634 unmarked
19635 ==1==
19636 one
19637 ==2==
19638 two
19639 !! html/php
19640 ==2==
19641 two
19642 !! end
19643
19644
19645 # Formerly testing for T5342
19646 !! test
19647 Section extraction, heading surrounded by <noinclude>
19648 !! options
19649 section=1
19650 !! wikitext
19651 <noinclude>==unmarked==</noinclude>
19652 ==marked==
19653 !! html/php
19654 ==marked==
19655 !!end
19656
19657 # Test behavior of T21910
19658 !! test
19659 Sectiion with all-equals
19660 !! options
19661 section=2
19662 !! wikitext
19663 ===
19664 The line above must have a trailing space
19665 === <!--
19666 --> <!-- -->
19667 But just in case it doesn't...
19668 !! html/php
19669 === <!--
19670 --> <!-- -->
19671 But just in case it doesn't...
19672 !! end
19673
19674 !! test
19675 Section replacement test (section 0)
19676 !! options
19677 replace=0,"xxx"
19678 !! wikitext
19679 start
19680 ==a==
19681 ===aa===
19682 ====aaa====
19683 ==b==
19684 ===ba===
19685 ===bb===
19686 ====bba====
19687 ===bc===
19688 ==c==
19689 ===ca===
19690 !! html/php
19691 xxx
19692
19693 ==a==
19694 ===aa===
19695 ====aaa====
19696 ==b==
19697 ===ba===
19698 ===bb===
19699 ====bba====
19700 ===bc===
19701 ==c==
19702 ===ca===
19703 !! end
19704
19705 !! test
19706 Section replacement test (section 1)
19707 !! options
19708 replace=1,"xxx"
19709 !! wikitext
19710 start
19711 ==a==
19712 ===aa===
19713 ====aaa====
19714 ==b==
19715 ===ba===
19716 ===bb===
19717 ====bba====
19718 ===bc===
19719 ==c==
19720 ===ca===
19721 !! html/php
19722 start
19723 xxx
19724
19725 ==b==
19726 ===ba===
19727 ===bb===
19728 ====bba====
19729 ===bc===
19730 ==c==
19731 ===ca===
19732 !! end
19733
19734 !! test
19735 Section replacement test (section 2)
19736 !! options
19737 replace=2,"xxx"
19738 !! wikitext
19739 start
19740 ==a==
19741 ===aa===
19742 ====aaa====
19743 ==b==
19744 ===ba===
19745 ===bb===
19746 ====bba====
19747 ===bc===
19748 ==c==
19749 ===ca===
19750 !! html/php
19751 start
19752 ==a==
19753 xxx
19754
19755 ==b==
19756 ===ba===
19757 ===bb===
19758 ====bba====
19759 ===bc===
19760 ==c==
19761 ===ca===
19762 !! end
19763
19764 !! test
19765 Section replacement test (section 3)
19766 !! options
19767 replace=3,"xxx"
19768 !! wikitext
19769 start
19770 ==a==
19771 ===aa===
19772 ====aaa====
19773 ==b==
19774 ===ba===
19775 ===bb===
19776 ====bba====
19777 ===bc===
19778 ==c==
19779 ===ca===
19780 !! html/php
19781 start
19782 ==a==
19783 ===aa===
19784 xxx
19785
19786 ==b==
19787 ===ba===
19788 ===bb===
19789 ====bba====
19790 ===bc===
19791 ==c==
19792 ===ca===
19793 !! end
19794
19795 !! test
19796 Section replacement test (section 4)
19797 !! options
19798 replace=4,"xxx"
19799 !! wikitext
19800 start
19801 ==a==
19802 ===aa===
19803 ====aaa====
19804 ==b==
19805 ===ba===
19806 ===bb===
19807 ====bba====
19808 ===bc===
19809 ==c==
19810 ===ca===
19811 !! html/php
19812 start
19813 ==a==
19814 ===aa===
19815 ====aaa====
19816 xxx
19817
19818 ==c==
19819 ===ca===
19820 !! end
19821
19822 !! test
19823 Section replacement test (section 5)
19824 !! options
19825 replace=5,"xxx"
19826 !! wikitext
19827 start
19828 ==a==
19829 ===aa===
19830 ====aaa====
19831 ==b==
19832 ===ba===
19833 ===bb===
19834 ====bba====
19835 ===bc===
19836 ==c==
19837 ===ca===
19838 !! html/php
19839 start
19840 ==a==
19841 ===aa===
19842 ====aaa====
19843 ==b==
19844 xxx
19845
19846 ===bb===
19847 ====bba====
19848 ===bc===
19849 ==c==
19850 ===ca===
19851 !! end
19852
19853 !! test
19854 Section replacement test (section 6)
19855 !! options
19856 replace=6,"xxx"
19857 !! wikitext
19858 start
19859 ==a==
19860 ===aa===
19861 ====aaa====
19862 ==b==
19863 ===ba===
19864 ===bb===
19865 ====bba====
19866 ===bc===
19867 ==c==
19868 ===ca===
19869 !! html/php
19870 start
19871 ==a==
19872 ===aa===
19873 ====aaa====
19874 ==b==
19875 ===ba===
19876 xxx
19877
19878 ===bc===
19879 ==c==
19880 ===ca===
19881 !! end
19882
19883 !! test
19884 Section replacement test (section 7)
19885 !! options
19886 replace=7,"xxx"
19887 !! wikitext
19888 start
19889 ==a==
19890 ===aa===
19891 ====aaa====
19892 ==b==
19893 ===ba===
19894 ===bb===
19895 ====bba====
19896 ===bc===
19897 ==c==
19898 ===ca===
19899 !! html/php
19900 start
19901 ==a==
19902 ===aa===
19903 ====aaa====
19904 ==b==
19905 ===ba===
19906 ===bb===
19907 xxx
19908
19909 ===bc===
19910 ==c==
19911 ===ca===
19912 !! end
19913
19914 !! test
19915 Section replacement test (section 8)
19916 !! options
19917 replace=8,"xxx"
19918 !! wikitext
19919 start
19920 ==a==
19921 ===aa===
19922 ====aaa====
19923 ==b==
19924 ===ba===
19925 ===bb===
19926 ====bba====
19927 ===bc===
19928 ==c==
19929 ===ca===
19930 !! html/php
19931 start
19932 ==a==
19933 ===aa===
19934 ====aaa====
19935 ==b==
19936 ===ba===
19937 ===bb===
19938 ====bba====
19939 xxx
19940
19941 ==c==
19942 ===ca===
19943 !!end
19944
19945 !! test
19946 Section replacement test (section 9)
19947 !! options
19948 replace=9,"xxx"
19949 !! wikitext
19950 start
19951 ==a==
19952 ===aa===
19953 ====aaa====
19954 ==b==
19955 ===ba===
19956 ===bb===
19957 ====bba====
19958 ===bc===
19959 ==c==
19960 ===ca===
19961 !! html/php
19962 start
19963 ==a==
19964 ===aa===
19965 ====aaa====
19966 ==b==
19967 ===ba===
19968 ===bb===
19969 ====bba====
19970 ===bc===
19971 xxx
19972 !! end
19973
19974 !! test
19975 Section replacement test (section 10)
19976 !! options
19977 replace=10,"xxx"
19978 !! wikitext
19979 start
19980 ==a==
19981 ===aa===
19982 ====aaa====
19983 ==b==
19984 ===ba===
19985 ===bb===
19986 ====bba====
19987 ===bc===
19988 ==c==
19989 ===ca===
19990 !! html/php
19991 start
19992 ==a==
19993 ===aa===
19994 ====aaa====
19995 ==b==
19996 ===ba===
19997 ===bb===
19998 ====bba====
19999 ===bc===
20000 ==c==
20001 xxx
20002 !! end
20003
20004 !! test
20005 Section replacement test with initial whitespace (T15728)
20006 !! options
20007 replace=2,"xxx"
20008 !! wikitext
20009 Preformatted initial line
20010 ==a==
20011 ===a===
20012 !! html/php
20013 Preformatted initial line
20014 ==a==
20015 xxx
20016 !! end
20017
20018
20019 !! test
20020 Section extraction, heading followed by pre with 20 spaces (T8398)
20021 !! options
20022 section=1
20023 !! wikitext
20024 ==a==
20025 a
20026 !! html/php
20027 ==a==
20028 a
20029 !! end
20030
20031 !! test
20032 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20033 !! options
20034 section=1
20035 !! wikitext
20036 ==a==
20037 a
20038 !! html/php
20039 ==a==
20040 a
20041 !! end
20042
20043
20044 !! test
20045 Section extraction, <pre> around bogus header (T12309)
20046 !! options
20047 section=2
20048 !! wikitext
20049 == Section One ==
20050 <pre>
20051 =======
20052 </pre>
20053
20054 == Section Two ==
20055 stuff
20056 !! html/php
20057 == Section Two ==
20058 stuff
20059 !! end
20060
20061 !! test
20062 Section replacement, <pre> around bogus header (T12309)
20063 !! options
20064 replace=2,"xxx"
20065 !! wikitext
20066 == Section One ==
20067 <pre>
20068 =======
20069 </pre>
20070
20071 == Section Two ==
20072 stuff
20073 !! html/php
20074 == Section One ==
20075 <pre>
20076 =======
20077 </pre>
20078
20079 xxx
20080 !! end
20081
20082 !! test
20083 Handling of &#x0A; in URLs
20084 !! wikitext
20085 ** irc://&#x0A;a
20086 !! html/php
20087 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20088
20089 !! html/parsoid
20090 <ul><li><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></li></ul>
20091 !! end
20092
20093 !! test
20094 Handling of %0A in URLs
20095 !! wikitext
20096 ** irc://%0Aa
20097 !! html/php
20098 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20099
20100 !! html/parsoid
20101 <ul><li><ul><li> <a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20102 !! end
20103
20104 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20105 !! test
20106 5 quotes, code coverage +1 line
20107 !! options
20108 parsoid=wt2html
20109 !! wikitext
20110 '''''
20111 !! html/php
20112 !! html/parsoid
20113 <b><i></i></b>
20114 !! end
20115
20116 # same html as previous, but wikitext adjusted to match parsoid html2wt
20117 # note that wt2html and html2html will put the <i> before the <b>
20118 !! test
20119 5 quotes, code coverage +1 line w/ nowiki (1)
20120 !! options
20121 parsoid=wt2wt,html2wt
20122 !! wikitext
20123 '''''<nowiki/>'''''
20124 !! html/php
20125 <p><i></i>
20126 </p>
20127 !! html/parsoid
20128 <p><b><i></i></b></p>
20129 !! end
20130
20131 # same as previous, just swapping the <i> and <b>
20132 !! test
20133 5 quotes, code coverage +1 line w/ nowiki (2)
20134 !! wikitext
20135 '''''<nowiki/>'''''
20136 !! html/php
20137 <p><i></i>
20138 </p>
20139 !! html/parsoid
20140 <p><i><b></b></i></p>
20141 !! end
20142
20143 !! test
20144 Special:Search page linking.
20145 !! wikitext
20146 {{Special:search}}
20147 !! html
20148 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20149 </p>
20150 !! end
20151
20152 !! test
20153 {{!}} is a magic word
20154 !! wikitext
20155 {{!}} is a magic word there and {{!}} is still a magic word here
20156 | is not a magic word here but {{!}} is still a magic word here
20157 !! html/php
20158 <p>| is a magic word there and | is still a magic word here
20159 | is not a magic word here but | is still a magic word here
20160 </p>
20161 !! html/parsoid
20162 <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
20163 | 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>
20164 !! end
20165
20166 !! test
20167 Say the magic word
20168 !! options
20169 title=[[Parser test]]
20170 !! wikitext
20171 * {{PAGENAME}}
20172 * {{PAGENAMEE}}
20173 * {{FULLPAGENAME}}
20174 * {{FULLPAGENAMEE}}
20175 * {{BASEPAGENAME}}
20176 * {{BASEPAGENAMEE}}
20177 * {{SUBPAGENAME}}
20178 * {{SUBPAGENAMEE}}
20179 * {{ROOTPAGENAME}}
20180 * {{ROOTPAGENAMEE}}
20181 * {{TALKPAGENAME}}
20182 * {{TALKPAGENAMEE}}
20183 * {{SUBJECTPAGENAME}}
20184 * {{SUBJECTPAGENAMEE}}
20185 * {{NAMESPACEE}}
20186 * {{NAMESPACE}}
20187 * {{NAMESPACENUMBER}}
20188 * {{TALKSPACE}}
20189 * {{TALKSPACEE}}
20190 * {{SUBJECTSPACE}}
20191 * {{SUBJECTSPACEE}}
20192 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20193 !! html
20194 <ul><li> Parser test</li>
20195 <li> Parser_test</li>
20196 <li> Parser test</li>
20197 <li> Parser_test</li>
20198 <li> Parser test</li>
20199 <li> Parser_test</li>
20200 <li> Parser test</li>
20201 <li> Parser_test</li>
20202 <li> Parser test</li>
20203 <li> Parser_test</li>
20204 <li> Talk:Parser test</li>
20205 <li> Talk:Parser_test</li>
20206 <li> Parser test</li>
20207 <li> Parser_test</li>
20208 <li> </li>
20209 <li> </li>
20210 <li> 0</li>
20211 <li> Talk</li>
20212 <li> Talk</li>
20213 <li> </li>
20214 <li> </li>
20215 <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>
20216
20217 !! end
20218 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20219
20220 !! test
20221 Gallery with valid attributes
20222 !! wikitext
20223 <gallery type="123" summary="345">
20224 File:File:Foobar.jpg
20225 </gallery>
20226 !! html/php
20227 <ul class="gallery mw-gallery-traditional" type="123">
20228 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20229 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20230 <div class="gallerytext">
20231 </div>
20232 </div></li>
20233 </ul>
20234
20235 !! html/parsoid
20236 <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"}}'>
20237 <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>
20238 </ul>
20239 !! end
20240
20241 ## Parsoid thinks the "centre" here is a property, not a caption.
20242 !! test
20243 Gallery
20244 !! options
20245 parsoid={
20246 "modes": ["wt2html"],
20247 "nativeGallery": true
20248 }
20249 !! wikitext
20250 <gallery>
20251 image1.png |
20252 image2.gif|||||
20253
20254 image3|
20255 image4 |300px| centre
20256 image5.svg| http://///////
20257 [[x|xx]]]]
20258 * image6
20259 </gallery>
20260 !! html/php
20261 <ul class="gallery mw-gallery-traditional">
20262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20263 <div class="thumb" style="height: 150px;">Image1.png</div>
20264 <div class="gallerytext">
20265 </div>
20266 </div></li>
20267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20268 <div class="thumb" style="height: 150px;">Image2.gif</div>
20269 <div class="gallerytext">
20270 </div>
20271 </div></li>
20272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20273 <div class="thumb" style="height: 150px;">Image3</div>
20274 <div class="gallerytext">
20275 </div>
20276 </div></li>
20277 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20278 <div class="thumb" style="height: 150px;">Image4</div>
20279 <div class="gallerytext">
20280 <pre>centre
20281 </pre>
20282 </div>
20283 </div></li>
20284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20285 <div class="thumb" style="height: 150px;">Image5.svg</div>
20286 <div class="gallerytext">
20287 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20288 </p>
20289 </div>
20290 </div></li>
20291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20292 <div class="thumb" style="height: 150px;">* image6</div>
20293 <div class="gallerytext">
20294 </div>
20295 </div></li>
20296 </ul>
20297
20298 !! html/parsoid
20299 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20300 <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>
20301 <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>
20302 <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>
20303 <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>
20304 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20305 <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>
20306 </ul>
20307 !! end
20308
20309 !! test
20310 Gallery (with options, html)
20311 !! options
20312 parsoid={
20313 "modes": ["wt2html", "html2html"],
20314 "nativeGallery": true
20315 }
20316 !! wikitext
20317 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20318 File:Nonexistent.jpg|caption
20319 File:Nonexistent.jpg
20320 image:foobar.jpg|some '''caption''' [[Main Page]]
20321 image:foobar.jpg
20322 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20323 </gallery>
20324 !! html/php
20325 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20326 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20327 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20328 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20329 <div class="gallerytext">
20330 <p>caption
20331 </p>
20332 </div>
20333 </div></li>
20334 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20335 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20336 <div class="gallerytext">
20337 </div>
20338 </div></li>
20339 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20340 <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>
20341 <div class="gallerytext">
20342 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20343 </p>
20344 </div>
20345 </div></li>
20346 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20347 <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>
20348 <div class="gallerytext">
20349 </div>
20350 </div></li>
20351 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20352 <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>
20353 <div class="gallerytext">
20354 <p>blabla.
20355 </p>
20356 </div>
20357 </div></li>
20358 </ul>
20359
20360 !! html/parsoid
20361 <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":{}}'>
20362 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20363 <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>
20364 <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>
20365 <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>
20366 <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>
20367 <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>
20368 </ul>
20369 !! end
20370
20371 !! test
20372 Gallery (with options, extsrc)
20373 !! options
20374 parsoid={
20375 "nativeGallery": false
20376 }
20377 !! wikitext
20378 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20379 File:Nonexistent.jpg|caption
20380 File:Nonexistent.jpg
20381 image:foobar.jpg|some '''caption''' [[Main Page]]
20382 image:foobar.jpg
20383 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20384 </gallery>
20385 !! html/php
20386 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20387 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20388 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20389 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20390 <div class="gallerytext">
20391 <p>caption
20392 </p>
20393 </div>
20394 </div></li>
20395 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20396 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20397 <div class="gallerytext">
20398 </div>
20399 </div></li>
20400 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20401 <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>
20402 <div class="gallerytext">
20403 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20404 </p>
20405 </div>
20406 </div></li>
20407 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20408 <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>
20409 <div class="gallerytext">
20410 </div>
20411 </div></li>
20412 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20413 <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>
20414 <div class="gallerytext">
20415 <p>blabla.
20416 </p>
20417 </div>
20418 </div></li>
20419 </ul>
20420
20421 !! html/parsoid
20422 <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"}}'>
20423 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20424 <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>
20425 <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>
20426 <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>
20427 <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>
20428 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
20429 </ul>
20430 !! end
20431
20432 !! test
20433 Gallery (without px units)
20434 !! wikitext
20435 <gallery widths="70" heights="40">
20436 File:Foobar.jpg
20437 </gallery>
20438 !! html/php
20439 <ul class="gallery mw-gallery-traditional">
20440 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20441 <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>
20442 <div class="gallerytext">
20443 </div>
20444 </div></li>
20445 </ul>
20446
20447 !! html/parsoid
20448 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20449 <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>
20450 </ul>
20451 !! end
20452
20453 !! test
20454 Gallery (with invalid units)
20455 !! wikitext
20456 <gallery widths="70em" heights="40em">
20457 File:Foobar.jpg
20458 </gallery>
20459 !! html/php
20460 <ul class="gallery mw-gallery-traditional">
20461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20462 <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>
20463 <div class="gallerytext">
20464 </div>
20465 </div></li>
20466 </ul>
20467
20468 !! html/parsoid
20469 <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"}}'>
20470 <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>
20471 </ul>
20472 !! end
20473
20474 !! test
20475 Gallery with link that has fragment
20476 !! options
20477 parsoid={
20478 "modes": ["wt2html", "html2html"],
20479 "nativeGallery": true
20480 }
20481 !! wikitext
20482 <gallery>
20483 image:foobar.jpg|link=Main_Page
20484 image:foobar.jpg|link=Main_Page#section
20485 image:foobar.jpg|link=Main Page#section|caption
20486 </gallery>
20487 !! html/php
20488 <ul class="gallery mw-gallery-traditional">
20489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20490 <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>
20491 <div class="gallerytext">
20492 </div>
20493 </div></li>
20494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20495 <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>
20496 <div class="gallerytext">
20497 </div>
20498 </div></li>
20499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20500 <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>
20501 <div class="gallerytext">
20502 <p>caption
20503 </p>
20504 </div>
20505 </div></li>
20506 </ul>
20507
20508 !! html/parsoid
20509 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20510 <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>
20511 <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>
20512 <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>
20513 </ul>
20514 !! end
20515
20516 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20517 !! test
20518 Gallery with template inside caption
20519 !! options
20520 parsoid={
20521 "nativeGallery": true
20522 }
20523 !! wikitext
20524 <gallery caption="{{echo|hi}}">
20525 File:Foobar.jpg|{{echo|ho}}
20526 </gallery>
20527 !! html/php
20528 <ul class="gallery mw-gallery-traditional">
20529 <li class='gallerycaption'>{{echo|hi}}</li>
20530 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20531 <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>
20532 <div class="gallerytext">
20533 <p>ho
20534 </p>
20535 </div>
20536 </div></li>
20537 </ul>
20538
20539 !! html/parsoid
20540 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20541 <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>
20542 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><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>
20543 </ul>
20544 !! end
20545
20546 !! test
20547 Gallery with wikitext inside caption
20548 !! options
20549 parsoid={
20550 "nativeGallery": true
20551 }
20552 !! wikitext
20553 <gallery>
20554 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20555 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20556 </gallery>
20557 !! html/php
20558 <ul class="gallery mw-gallery-traditional">
20559 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20560 <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>
20561 <div class="gallerytext">
20562 <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>
20563 </p>
20564 </div>
20565 </div></li>
20566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20567 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
20568 <div class="gallerytext">
20569 <p>This is a test template
20570 </p>
20571 </div>
20572 </div></li>
20573 </ul>
20574
20575 !! html/parsoid
20576 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20577 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./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>
20578 <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>
20579 </ul>
20580 !! end
20581
20582 !! test
20583 Gallery (with showfilename option)
20584 !! options
20585 parsoid={
20586 "nativeGallery": true
20587 }
20588 !! wikitext
20589 <gallery showfilename="">
20590 File:Nonexistent.jpg|caption
20591 File:Nonexistent.jpg
20592 File:Foobar.jpg|some '''caption''' [[Main Page]]
20593 File:Foobar.jpg
20594 </gallery>
20595 !! html/php
20596 <ul class="gallery mw-gallery-traditional">
20597 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20598 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20599 <div class="gallerytext">
20600 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20601 caption
20602 </p>
20603 </div>
20604 </div></li>
20605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20606 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20607 <div class="gallerytext">
20608 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20609 </p>
20610 </div>
20611 </div></li>
20612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20613 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20614 <div class="gallerytext">
20615 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20616 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20617 </p>
20618 </div>
20619 </div></li>
20620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20621 <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>
20622 <div class="gallerytext">
20623 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20624 </p>
20625 </div>
20626 </div></li>
20627 </ul>
20628
20629 !! html/parsoid
20630 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20631 <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>
20632 <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>
20633 <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>
20634 <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>
20635 </ul>
20636 !! end
20637
20638 ## Should Parsoid be preserving these variations? See T151367
20639 !! test
20640 Gallery (with namespace-less filenames)
20641 !! options
20642 parsoid={
20643 "modes": ["wt2html", "html2html"],
20644 "nativeGallery": true
20645 }
20646 !! wikitext
20647 <gallery>
20648 File:Nonexistent.jpg
20649 Nonexistent.jpg
20650 image:foobar.jpg
20651 foobar.jpg
20652 </gallery>
20653 !! html/php
20654 <ul class="gallery mw-gallery-traditional">
20655 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20656 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20657 <div class="gallerytext">
20658 </div>
20659 </div></li>
20660 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20661 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20662 <div class="gallerytext">
20663 </div>
20664 </div></li>
20665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20666 <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>
20667 <div class="gallerytext">
20668 </div>
20669 </div></li>
20670 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20671 <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>
20672 <div class="gallerytext">
20673 </div>
20674 </div></li>
20675 </ul>
20676
20677 !! html/parsoid
20678 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20679 <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>
20680 <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>
20681 <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>
20682 <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>
20683 </ul>
20684 !! end
20685
20686 !! test
20687 Gallery override link with wikilink (T36852)
20688 !! options
20689 parsoid={
20690 "nativeGallery": true
20691 }
20692 !! wikitext
20693 <gallery>
20694 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20695 </gallery>
20696 !! html/php
20697 <ul class="gallery mw-gallery-traditional">
20698 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20699 <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>
20700 <div class="gallerytext">
20701 </div>
20702 </div></li>
20703 </ul>
20704
20705 !! html/parsoid
20706 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20707 <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>
20708 </ul>
20709 !! end
20710
20711 !! test
20712 Gallery override link with absolute external link (T36852)
20713 !! options
20714 parsoid={
20715 "nativeGallery": true
20716 }
20717 !! wikitext
20718 <gallery>
20719 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20720 </gallery>
20721 !! html/php
20722 <ul class="gallery mw-gallery-traditional">
20723 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20724 <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>
20725 <div class="gallerytext">
20726 </div>
20727 </div></li>
20728 </ul>
20729
20730 !! html/parsoid
20731 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20732 <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>
20733 </ul>
20734 !! end
20735
20736 !! test
20737 Gallery override link with absolute external link with LanguageConverter
20738 !! options
20739 language=zh
20740 !! wikitext
20741 <gallery>
20742 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20743 </gallery>
20744 !! html/php
20745 <ul class="gallery mw-gallery-traditional">
20746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20747 <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>
20748 <div class="gallerytext">
20749 <p>caption
20750 </p>
20751 </div>
20752 </div></li>
20753 </ul>
20754
20755 !! html/parsoid
20756 <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"}}'>
20757 <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>
20758 </ul>
20759 !! end
20760
20761 !! test
20762 Gallery override link with malicious javascript (T36852)
20763 !! options
20764 parsoid={
20765 "modes": ["wt2html", "html2html"],
20766 "nativeGallery": true
20767 }
20768 !! wikitext
20769 <gallery>
20770 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20771 </gallery>
20772 !! html/php
20773 <ul class="gallery mw-gallery-traditional">
20774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20775 <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>
20776 <div class="gallerytext">
20777 </div>
20778 </div></li>
20779 </ul>
20780
20781 !! html/parsoid
20782 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20783 <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>
20784 </ul>
20785 !! end
20786
20787 # Note that parsoid uses the invalid link as a caption, PHP does not.
20788 !! test
20789 Gallery with invalid title as link (T45964)
20790 !! options
20791 parsoid={
20792 "modes": ["wt2html", "html2html"],
20793 "nativeGallery": true
20794 }
20795 !! wikitext
20796 <gallery>
20797 File:Foobar.jpg|link=<
20798 </gallery>
20799 !! html/php
20800 <ul class="gallery mw-gallery-traditional">
20801 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20802 <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>
20803 <div class="gallerytext">
20804 </div>
20805 </div></li>
20806 </ul>
20807
20808 !! html/parsoid
20809 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20810 <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>
20811 </ul>
20812 !! end
20813
20814 !! test
20815 Serialize gallery without attrs in data-mw
20816 !! options
20817 parsoid={
20818 "modes": ["html2wt"],
20819 "nativeGallery": true
20820 }
20821 !! html/parsoid
20822 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20823 <li class="gallerycaption">123</li>
20824 <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>
20825 </ul>
20826 !! wikitext
20827 <gallery caption="123">
20828 File:Test.png
20829 </gallery>
20830 !! end
20831
20832 !! test
20833 Gallery with class and style attributes
20834 !! options
20835 parsoid={
20836 "nativeGallery": true
20837 }
20838 !! wikitext
20839 <gallery class="center" style="text-align: center;">
20840 File:Foobar.jpg
20841 </gallery>
20842 !! html/php
20843 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20844 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20845 <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>
20846 <div class="gallerytext">
20847 </div>
20848 </div></li>
20849 </ul>
20850
20851 !! html/parsoid
20852 <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":{}}'>
20853 <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>
20854 </ul>
20855 !! end
20856
20857 !! test
20858 Gallery in slideshow mode
20859 !! options
20860 parsoid={
20861 "nativeGallery": true
20862 }
20863 !! wikitext
20864 <gallery mode="slideshow" showthumbnails="">
20865 File:Foobar.jpg
20866 </gallery>
20867 !! html/php
20868 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20870 <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>
20871 <div class="gallerytext">
20872 </div>
20873 </div></li>
20874 </ul>
20875
20876 !! html/parsoid
20877 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20878 <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>
20879 </ul>
20880 !! end
20881
20882 !! test
20883 HTML Hex character encoding (spells the word "JavaScript")
20884 !! options
20885 parsoid=wt2html,wt2wt,html2html
20886 !! wikitext
20887 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20888 !! html/php
20889 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20890 </p>
20891 !! html/parsoid
20892 <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>
20893 !! end
20894
20895 !! test
20896 HTML Hex character encoding bogus encoding (T28437 regression check)
20897 !! wikitext
20898 &#xsee;&#XSEE;
20899 !! html
20900 <p>&amp;#xsee;&amp;#XSEE;
20901 </p>
20902 !! end
20903
20904 !! test
20905 HTML Hex character encoding mixed case
20906 !! options
20907 parsoid=wt2html,wt2wt,html2html
20908 !! wikitext
20909 &#xEE;&#Xee;
20910 !! html/php
20911 <p>&#xee;&#xee;
20912 </p>
20913 !! html/parsoid
20914 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20915 !! end
20916
20917 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20918 # Note that U+000C (form feed) is not a valid XML character, so
20919 # it is banned even though allowed in HTML5.
20920 !! test
20921 Illegal character references (T106578)
20922 !! wikitext
20923 ; Null: &#00;
20924 ; FF: &#xC;
20925 ; CR: &#xD;
20926 ; Control (low): &#8;
20927 ; Control (high): &#x7F; &#x9F;
20928 ; Surrogate: &#xD83D;&#xDCA9;
20929 ; This is an okay astral character: &#x1F4A9;
20930 !! html+tidy
20931 <dl><dt> Null</dt>
20932 <dd> &amp;#00;</dd>
20933 <dt> FF</dt>
20934 <dd> &amp;#xC;</dd>
20935 <dt> CR</dt>
20936 <dd> &amp;#xD;</dd>
20937 <dt> Control (low)</dt>
20938 <dd> &amp;#8;</dd>
20939 <dt> Control (high)</dt>
20940 <dd> &amp;#x7F; &amp;#x9F;</dd>
20941 <dt> Surrogate</dt>
20942 <dd> &amp;#xD83D;&amp;#xDCA9;</dd>
20943 <dt> This is an okay astral character</dt>
20944 <dd> &#x1f4a9;</dd></dl>
20945 !! end
20946
20947 !! test
20948 __FORCETOC__ override
20949 !! wikitext
20950 __NEWSECTIONLINK__
20951 __FORCETOC__
20952 !! html/php
20953 <p><br />
20954 </p>
20955 !! end
20956
20957 !! test
20958 ISBN code coverage
20959 !! wikitext
20960 ISBN 978-0-1234-56&#x20;789
20961 !! html/php
20962 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20963 </p>
20964 !! html/parsoid
20965 <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>
20966 !! end
20967
20968 !! test
20969 ISBN followed by 5 spaces
20970 !! wikitext
20971 ISBN
20972 !! html
20973 <p>ISBN
20974 </p>
20975 !! end
20976
20977 !! test
20978 Double ISBN
20979 !! wikitext
20980 ISBN ISBN 1234567890
20981 !! html/php
20982 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20983 </p>
20984 !! html/parsoid
20985 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20986 !! end
20987
20988 # Uppercase X and lowercase x as well
20989 !! test
20990 ISBN with an X
20991 !! wikitext
20992 ISBN 3-462-04561-X
20993 ISBN 3-462-04561-x
20994 ISBN 080442957X
20995 ISBN 080442957x
20996 ISBN 978080442957X
20997 ISBN 978080442957x
20998 !! html/php
20999 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21000 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21001 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21002 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21003 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21004 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21005 </p>
21006 !! html/parsoid
21007 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21008 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21009 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21010 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21011 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21012 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21013 !! end
21014
21015 !! test
21016 ISBN with empty prefix (parsoid test)
21017 !! wikitext
21018 ISBN 1234567890
21019 !! html/php
21020 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21021 </p>
21022 !! html/parsoid
21023 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21024 !! end
21025
21026 !! test
21027 T24905: <abbr> followed by ISBN followed by </a>
21028 !! wikitext
21029 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21030 !! html/php
21031 <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>
21032 </p>
21033 !! html/parsoid
21034 <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>
21035 !! end
21036
21037 !! test
21038 Double RFC
21039 !! wikitext
21040 RFC RFC 1234
21041 !! html
21042 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21043 </p>
21044 !! end
21045
21046 !! test
21047 Double RFC with a wiki link
21048 !! wikitext
21049 RFC [[RFC 1234]]
21050 !! html
21051 <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>
21052 </p>
21053 !! end
21054
21055 !! test
21056 RFC code coverage
21057 !! wikitext
21058 RFC 983&#x20;987
21059 !! html/php
21060 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21061 </p>
21062 !! html/parsoid
21063 <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>
21064 !! end
21065
21066 !! test
21067 Centre-aligned image
21068 !! wikitext
21069 [[Image:foobar.jpg|centre]]
21070 !! html/php
21071 <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>
21072
21073 !! html/parsoid
21074 <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>
21075 !! end
21076
21077 !! test
21078 None-aligned image
21079 !! wikitext
21080 [[Image:foobar.jpg|none]]
21081 !! html/php
21082 <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>
21083
21084 !! html/parsoid
21085 <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>
21086 !! end
21087
21088 !! test
21089 Width + Height sized image (using px) (height is ignored)
21090 !! wikitext
21091 [[Image:foobar.jpg|640x480px]]
21092 !! html/php
21093 <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>
21094 </p>
21095 !! html/parsoid
21096 <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>
21097 !! end
21098
21099 !! test
21100 Width-sized image (using px, no following whitespace)
21101 !! wikitext
21102 [[Image:foobar.jpg|640px]]
21103 !! html/php
21104 <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>
21105 </p>
21106 !! html/parsoid
21107 <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>
21108 !! end
21109
21110 !! test
21111 Width-sized image (using px, with following whitespace - test regression from r39467)
21112 !! wikitext
21113 [[Image:foobar.jpg|640px ]]
21114 !! html/php
21115 <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>
21116 </p>
21117 !! html/parsoid
21118 <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>
21119 !!end
21120
21121 !! test
21122 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21123 !! wikitext
21124 [[Image:foobar.jpg| 640px]]
21125 !! html/php
21126 <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>
21127 </p>
21128 !! html/parsoid
21129 <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>
21130 !! end
21131
21132 !! test
21133 Image with page parameter
21134 !! options
21135 djvu
21136 !! wikitext
21137 [[File:LoremIpsum.djvu|page=2]]
21138 !! html/php
21139 <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>
21140 </p>
21141 !! html/parsoid
21142 <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>
21143 !! end
21144
21145 !! test
21146 Another italics / bold test
21147 !! wikitext
21148 ''' ''x'
21149 !! html
21150 <pre>'<i> </i>x'
21151 </pre>
21152 !!end
21153
21154 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21155 !! test
21156 dt/dd/dl test
21157 !! wikitext
21158 :;;;::
21159 !! html/php
21160 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21161
21162 !! html/parsoid
21163 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21164
21165 !!end
21166
21167 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21168 !! test
21169 Images with the "|" character in the comment
21170 !! wikitext
21171 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21172 !! html/php
21173 <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>
21174
21175 !! html/parsoid
21176 <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>
21177 !! end
21178
21179 !! test
21180 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21181 !! wikitext
21182 <html><script>alert(1);</script></html>
21183 !! html
21184 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21185 </p>
21186 !! end
21187
21188 !! test
21189 HTML with raw HTML ($wgRawHtml==true)
21190 !! options
21191 wgRawHtml=1
21192 !! wikitext
21193 <html><script>alert(1);</script></html>
21194 !! html/php
21195 <p><script>alert(1);</script>
21196 </p>
21197 !! end
21198
21199 !! test
21200 Parents of subpages, one level up
21201 !! options
21202 subpage title=[[Subpage test/L1/L2/L3]]
21203 !! wikitext
21204 [[../|L2]]
21205 !! html
21206 <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>
21207 </p>
21208 !! end
21209
21210
21211 !! test
21212 Parents of subpages, one level up, not named
21213 !! options
21214 subpage title=[[Subpage test/L1/L2/L3]]
21215 !! wikitext
21216 [[../]]
21217 !! html
21218 <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>
21219 </p>
21220 !! end
21221
21222
21223
21224 !! test
21225 Parents of subpages, two levels up
21226 !! options
21227 subpage title=[[Subpage test/L1/L2/L3]]
21228 !! wikitext
21229 [[../../|L1]]2
21230
21231 [[../../|L1]]l
21232 !! html
21233 <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
21234 </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>
21235 </p>
21236 !! end
21237
21238 !! test
21239 Parents of subpages, two levels up, without trailing slash or name.
21240 !! options
21241 subpage title=[[Subpage test/L1/L2/L3]]
21242 !! wikitext
21243 [[../..]]
21244 !! html
21245 <p>[[../..]]
21246 </p>
21247 !! end
21248
21249 !! test
21250 Parents of subpages, two levels up, with lots of extra trailing slashes.
21251 !! options
21252 subpage title=[[Subpage test/L1/L2/L3]]
21253 !! wikitext
21254 [[../../////]]
21255 !! html
21256 <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>
21257 </p>
21258 !! end
21259
21260 !! article
21261 Subpage test/L1/L2/L3Sibling
21262 !! text
21263 Sibling article
21264 !! endarticle
21265
21266 !! test
21267 Transclusion of a sibling page (one level up)
21268 !! options
21269 subpage title=[[Subpage test/L1/L2/L3]]
21270 !! wikitext
21271 {{../L3Sibling}}
21272 !! html
21273 <p>Sibling article
21274 </p>
21275 !! end
21276
21277 !! test
21278 Transclusion of a child page
21279 !! options
21280 subpage title=[[Subpage test/L1/L2]]
21281 !! wikitext
21282 {{/L3Sibling}}
21283 !! html
21284 <p>Sibling article
21285 </p>
21286 !! end
21287
21288 # This is wt2html only in Parsoid because we add <nowiki>
21289 # because of {{..}} and we don't expect to fix that to
21290 # eliminate the nowikis selective for {{..}} markup.
21291 !! test
21292 Non-transclusion because of too many up levels
21293 !! options
21294 subpage title=[[Subpage test/L1/L2/L3]]
21295 parsoid=wt2html
21296 !! wikitext
21297 {{../../../../More than parent}}
21298 !! html/php
21299 <p>{{../../../../More than parent}}
21300 </p>
21301 !! html/parsoid
21302 <p>{{../../../../More than parent}}</p>
21303 !! end
21304
21305 !! test
21306 Definition list code coverage
21307 !! wikitext
21308 ; title : def
21309 ; title : def
21310 ;title: def
21311 !! html/php
21312 <dl><dt> title &#160;</dt>
21313 <dd> def</dd>
21314 <dt> title&#160;</dt>
21315 <dd> def</dd>
21316 <dt>title</dt>
21317 <dd> def</dd></dl>
21318
21319 !! html/parsoid
21320 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21321 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21322 <dt>title</dt><dd> def</dd></dl>
21323 !! end
21324
21325 !! test
21326 Don't fall for the self-closing div
21327 !! wikitext
21328 <div>hello world</div/>
21329 !! html
21330 <div>hello world</div>
21331
21332 !! end
21333
21334 !! test
21335 MSGNW magic word
21336 !! wikitext
21337 {{MSGNW:msg}}
21338 !! html/php
21339 <p>&#91;&#91;:Template:Msg&#93;&#93;
21340 </p>
21341 !! end
21342
21343 !! test
21344 RAW magic word
21345 !! wikitext
21346 {{RAW:QUERTY}}
21347 !! html
21348 <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>
21349 </p>
21350 !! end
21351
21352 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21353 !! test
21354 Always escape literal '>' in output, not just after '<'
21355 !! wikitext
21356 ><>
21357 !! html
21358 <p>&gt;&lt;&gt;
21359 </p>
21360 !! end
21361
21362 !! test
21363 Template caching
21364 !! wikitext
21365 {{Test}}
21366 {{Test}}
21367 !! html
21368 <p>This is a test template
21369 This is a test template
21370 </p>
21371 !! end
21372
21373
21374 !! article
21375 MediaWiki:Fake
21376 !! text
21377 ==header==
21378 !! endarticle
21379
21380 !! test
21381 Inclusion of !userCanEdit() content
21382 !! wikitext
21383 {{MediaWiki:Fake}}
21384 !! html
21385 <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>
21386
21387 !! end
21388
21389
21390 !! test
21391 Out-of-order TOC heading levels
21392 !! wikitext
21393 ==2==
21394 ======6======
21395 ===3===
21396 =1=
21397 =====5=====
21398 ==2==
21399 !! html
21400 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21401 <ul>
21402 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21403 <ul>
21404 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21405 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21406 </ul>
21407 </li>
21408 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21409 <ul>
21410 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21411 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21412 </ul>
21413 </li>
21414 </ul>
21415 </div>
21416
21417 <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>
21418 <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>
21419 <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>
21420 <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>
21421 <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>
21422 <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>
21423
21424 !! end
21425
21426
21427 !! test
21428 ISBN with a dummy number
21429 !! wikitext
21430 ISBN ---
21431 !! html
21432 <p>ISBN ---
21433 </p>
21434 !! end
21435
21436
21437 !! test
21438 ISBN with space-delimited number
21439 !! wikitext
21440 ISBN 92 9017 032 8
21441 !! html/php
21442 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21443 </p>
21444 !! html/parsoid
21445 <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>
21446 !! end
21447
21448
21449 !! test
21450 ISBN with multiple spaces, no number
21451 !! wikitext
21452 ISBN foo
21453 !! html
21454 <p>ISBN foo
21455 </p>
21456 !! end
21457
21458
21459 !! test
21460 ISBN length
21461 !! wikitext
21462 ISBN 123456789
21463
21464 ISBN 1234567890
21465
21466 ISBN 12345678901
21467 !! html/php
21468 <p>ISBN 123456789
21469 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21470 </p><p>ISBN 12345678901
21471 </p>
21472 !! html/parsoid
21473 <p>ISBN 123456789</p>
21474
21475 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21476
21477 <p>ISBN 12345678901</p>
21478 !! end
21479
21480
21481 !! test
21482 ISBN with trailing year (T9110)
21483 !! wikitext
21484 ISBN 1-234-56789-0 - 2006
21485
21486 ISBN 1 234 56789 0 - 2006
21487 !! html/php
21488 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21489 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21490 </p>
21491 !! html/parsoid
21492 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21493
21494 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21495 !! end
21496
21497
21498 !! test
21499 anchorencode
21500 !! config
21501 wgFragmentMode=[ 'html5', 'legacy' ]
21502 !! wikitext
21503 {{anchorencode:foo bar©#%n}}
21504 !! html/php
21505 <p>foo_bar©#%n
21506 </p>
21507 !! html/parsoid
21508 <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>
21509 !! end
21510
21511 !! test
21512 anchorencode (legacy)
21513 !! config
21514 wgFragmentMode=[ 'legacy' ]
21515 !! wikitext
21516 {{anchorencode:foo bar©#%n}}
21517 !! html/php
21518 <p>foo_bar.C2.A9.23.25n
21519 </p>
21520 !! end
21521
21522 !! test
21523 anchorencode trims spaces
21524 !! config
21525 wgFragmentMode=[ 'html5', 'legacy' ]
21526 !! wikitext
21527 {{anchorencode: __pretty__please__}}
21528 !! html/php
21529 <p>pretty_please
21530 </p>
21531 !! html/parsoid
21532 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21533 !! end
21534
21535 !! test
21536 anchorencode deals with links
21537 !! config
21538 wgFragmentMode=[ 'html5', 'legacy' ]
21539 !! wikitext
21540 {{anchorencode: [[hello|world]] [[hi]]}}
21541 !! html/php
21542 <p>world_hi
21543 </p>
21544 !! html/parsoid
21545 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21546 !! end
21547
21548 !! test
21549 anchorencode deals with templates
21550 !! config
21551 wgFragmentMode=[ 'html5', 'legacy' ]
21552 !! wikitext
21553 {{anchorencode: {{Foo}} x}}
21554 !! html/php
21555 <p>FOO_x
21556 </p>
21557 !! html/parsoid
21558 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21559 !! end
21560
21561 !! test
21562 anchorencode encodes like the TOC generator: (T20431)
21563 !! config
21564 wgFragmentMode=[ 'html5', 'legacy' ]
21565 !! wikitext
21566 === _ +:.3A%3A _ &&amp;]] x ===
21567 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21568 __NOEDITSECTION__
21569 !! html/php
21570 <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>
21571 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21572 </p>
21573 !! html/parsoid
21574 <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>
21575 <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>
21576 <meta property="mw:PageProp/noeditsection"/>
21577 !! end
21578
21579 !! test
21580 anchorencode encodes like the TOC generator: (T20431) (legacy)
21581 !! config
21582 wgFragmentMode=[ 'legacy' ]
21583 !! wikitext
21584 === _ +:.3A%3A&&amp;]] ===
21585 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21586 __NOEDITSECTION__
21587 !! html/php
21588 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21589 <p>.2B:.3A.253A.26.26.5D.5D
21590 </p>
21591 !! end
21592
21593 !! test
21594 T8200: blockquotes and paragraph formatting
21595 !! wikitext
21596 <blockquote>
21597 foo
21598 </blockquote>
21599
21600 bar
21601
21602 baz
21603 !! html
21604 <blockquote>
21605 <p>foo
21606 </p>
21607 </blockquote>
21608 <p>bar
21609 </p>
21610 <pre>baz
21611 </pre>
21612 !! end
21613
21614 !! test
21615 T10293: Use of center tag ruins paragraph formatting
21616 !! wikitext
21617 <center>
21618 foo
21619 </center>
21620
21621 bar
21622
21623 baz
21624 !! html
21625 <center>
21626 <p>foo
21627 </p>
21628 </center>
21629 <p>bar
21630 </p>
21631 <pre>baz
21632 </pre>
21633 !! end
21634
21635 !!test
21636 Parsing of overlapping (improperly nested) inline html tags
21637 !! wikitext
21638 <span><s>x</span></s>
21639 !! html/php
21640 <p><span><s>x&lt;/span&gt;</s></span>
21641 </p>
21642 !! html/parsoid
21643 <p><span><s>x</s></span>
21644 </p>
21645 !!end
21646
21647 ###
21648 ### Language variants related tests
21649 ###
21650
21651 # Parsoid does not mark self-links.
21652 # Parsoid does not convert links; PHP will do any necessary redirects.
21653
21654 !! test
21655 Self-link in language variants
21656 !! options
21657 title=[[Dunav]] language=sr
21658 !! wikitext
21659 Both [[Dunav]] and [[Дунав]] are names for this river.
21660 !! html/php
21661 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21662 </p>
21663 !! html/parsoid
21664 <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>
21665 !! end
21666
21667 !! article
21668 Дуна
21669 !! text
21670 content
21671 !! endarticle
21672
21673 !! test
21674 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21675 !! options
21676 title=[[Duna]] language=sr
21677 !! wikitext
21678 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21679 !! html/php
21680 <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.
21681 </p>
21682 !! html/parsoid
21683 <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>
21684 !! end
21685
21686 !! test
21687 Link to a section of a variant of this title shouldn't be parsed as self-link
21688 !! options
21689 title=[[Duna]] language=sr
21690 !! wikitext
21691 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21692 !! html/php
21693 <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.
21694 </p>
21695 !! html/parsoid
21696 <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>
21697 !! end
21698
21699 !! test
21700 Link to pages in language variants
21701 !! options
21702 language=sr
21703 !! wikitext
21704 Main Page can be written as [[Маин Паге]]
21705 !! html/php
21706 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21707 </p>
21708 !! html/parsoid
21709 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21710 !! end
21711
21712
21713 !! test
21714 Multiple links to pages in language variants
21715 !! options
21716 language=sr
21717 !! wikitext
21718 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21719 !! html/php
21720 <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>.
21721 </p>
21722 !! html/parsoid
21723 <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>
21724 !! end
21725
21726
21727 !! test
21728 Simple template in language variants
21729 !! options
21730 language=sr
21731 !! wikitext
21732 {{тест}}
21733 !! html/php
21734 <p>This is a test template
21735 </p>
21736 !! end
21737
21738
21739 !! test
21740 Template with explicit namespace in language variants
21741 !! options
21742 language=sr
21743 !! wikitext
21744 {{Template:тест}}
21745 !! html/php
21746 <p>This is a test template
21747 </p>
21748 !! end
21749
21750
21751 !! test
21752 Basic test for template parameter in language variants
21753 !! options
21754 language=sr
21755 !! wikitext
21756 {{парамтест|param=foo}}
21757 !! html/php
21758 <p>This is a test template with parameter foo
21759 </p>
21760 !! end
21761
21762 !! test
21763 Simple category in language variants
21764 !! options
21765 language=sr cat
21766 !! wikitext
21767 [[Category:МедиаWики Усер'с Гуиде]]
21768 !! html/php
21769 cat=МедиаWики_Усер'с_Гуиде sort=
21770 !! html/parsoid
21771 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21772 !! end
21773
21774 !! article
21775 Category:分类
21776 !! text
21777 blah
21778 !! endarticle
21779
21780 !! article
21781 Category:分類
21782 !! text
21783 blah
21784 !! endarticle
21785
21786 ## We used to, but no longer wt2wt this test since the default serializer
21787 ## will normalize all categories to serialize on their own line.
21788 ## This wikitext usage is going to be fairly uncommon in production and
21789 ## selser will take care of preserving formatting in those scenarios.
21790 !! test
21791 Don't convert blue categorylinks to another variant (T35210)
21792 !! options
21793 cat
21794 language=zh
21795 parsoid=wt2html
21796 !! wikitext
21797 [[A]][[Category:分类]]
21798 !! html/php
21799 cat=分类 sort=
21800 !! html/parsoid
21801 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21802 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21803 !! end
21804
21805 !! test
21806 Stripping -{}- tags (language variants)
21807 !! options
21808 language=sr
21809 !! wikitext
21810 Latin proverb: -{Ne nuntium necare}-
21811 !! html/php
21812 <p>Latin proverb: Ne nuntium necare
21813 </p>
21814 !! html/parsoid
21815 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21816 !! end
21817
21818
21819 !! test
21820 Prevent conversion with -{}- tags (language variants)
21821 !! options
21822 language=sr variant=sr-ec
21823 !! wikitext
21824 Latinski: -{Ne nuntium necare}-
21825 !! html/php
21826 <p>Латински: Ne nuntium necare
21827 </p>
21828 !! html/parsoid
21829 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21830 !! end
21831
21832
21833 !! test
21834 Prevent conversion of text with -{}- tags (language variants)
21835 !! options
21836 language=sr variant=sr-ec
21837 !! wikitext
21838 Latinski: -{Ne nuntium necare}-
21839 !! html/php
21840 <p>Латински: Ne nuntium necare
21841 </p>
21842 !! html/parsoid
21843 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21844 !! end
21845
21846
21847 !! test
21848 Prevent conversion of links with -{}- tags (language variants)
21849 !! options
21850 language=sr variant=sr-ec
21851 !! wikitext
21852 -{[[Main Page]]}-
21853 !! html/php
21854 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21855 </p>
21856 !! html/parsoid
21857 <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>
21858 !! end
21859
21860
21861 !! test
21862 -{}- tags within headlines (within html for parserConvert())
21863 !! config
21864 wgFragmentMode=[ 'html5', 'legacy' ]
21865 !! options
21866 language=sr variant=sr-ec
21867 !! wikitext
21868 == -{Naslov}- ==
21869
21870 Note that even an unprotected headline ID is not affected by language
21871 conversion:
21872
21873 == Latinski ==
21874 !! html/php
21875 <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>
21876 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21877 цонверсион:
21878 </p>
21879 <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>
21880
21881 !! html/parsoid
21882 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span> </h2>
21883
21884 <p>Note that even an unprotected headline ID is not affected by language
21885 conversion:</p>
21886
21887 <h2 id="Latinski">Latinski</h2>
21888 !! end
21889
21890 !! test
21891 Explicit definition of language variant alternatives
21892 !! options
21893 language=zh variant=zh-tw
21894 !! wikitext
21895 -{zh:China;zh-tw:Taiwan}-, not China
21896 !! html/php
21897 <p>Taiwan, not China
21898 </p>
21899 !! html/parsoid
21900 <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>
21901 !! end
21902
21903 !! test
21904 Filter syntax for language variants
21905 !! options
21906 language=zh variant=zh-tw
21907 !! wikitext
21908 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21909 !! html/php
21910 <p>fooblog, WEBJOURNAL, WEBLOGquux
21911 </p>
21912 !! html/parsoid
21913 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21914 !! end
21915
21916 # Note that Parsoid post-processing for language variants needs to
21917 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21918 !! test
21919 Conversion around HTML tags
21920 !! options
21921 language=sr variant=sr-ec
21922 !! wikitext
21923 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21924 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21925 !! html/php
21926 <p>
21927 <span title="ЛаCтин">ски</span>
21928 </p>
21929 !! html/parsoid
21930 <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"}]}'/>
21931 <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>
21932 !! end
21933
21934 !! test
21935 Explicit session-wise two-way language variant mapping (A flag and - flag)
21936 !! options
21937 language=zh variant=zh-tw
21938 !! wikitext
21939 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21940
21941 Taiwan is not China.
21942
21943 But -{A|zh:China; zh-tw:Taiwan}- is China,
21944
21945 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21946
21947 and -{China}- is China.
21948 !! html/php
21949 <p>This is Taiwan, but we'll forget that now.
21950 </p><p>Taiwan is not China.
21951 </p><p>But Taiwan is Taiwan,
21952 </p><p>(This should be stripped!)
21953 </p><p>and China is China.
21954 </p>
21955 !! html/parsoid
21956 <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>
21957 <p>Taiwan is not China.</p>
21958 <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>
21959 <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>
21960 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21961 !! end
21962
21963 !! test
21964 Explicit session-wise one-way language variant mapping (A flag and - flag)
21965 !! options
21966 language=zh variant=zh-tw
21967 !! wikitext
21968 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21969
21970 COUNTRY is China or Taiwan.
21971
21972 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21973
21974 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21975
21976 and -{COUNTRY}- is COUNTRY.
21977 !! html/php
21978 <p>This is Taiwan, but we'll forget that now.
21979 </p><p>COUNTRY is China or Taiwan.
21980 </p><p>But Taiwan is Taiwan,
21981 </p><p>(This should be stripped!)
21982 </p><p>and COUNTRY is COUNTRY.
21983 </p>
21984 !! html/parsoid
21985 <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>
21986 <p>COUNTRY is China or Taiwan.</p>
21987 <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>
21988 <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>
21989 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21990 !! end
21991
21992 !! test
21993 Explicit session-wise two-way language variant mapping (H flag for hide)
21994 !! options
21995 language=zh variant=zh-tw
21996 !! wikitext
21997 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21998
21999 Taiwan is China.
22000 !! html/php
22001 <p>(This should be stripped!)
22002 </p><p>Taiwan is Taiwan.
22003 </p>
22004 !! html/parsoid
22005 <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>
22006 <p>Taiwan is China.</p>
22007 !! end
22008
22009 !! test
22010 Explicit session-wise one-way language variant mapping (H flag for hide)
22011 !! options
22012 language=zh variant=zh-tw
22013 !! wikitext
22014 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22015
22016 COUNTRY is Taiwan or China.
22017 !! html/php
22018 <p>(This should be stripped!)
22019 </p><p>Taiwan is Taiwan or China.
22020 </p>
22021 !! html/parsoid
22022 <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>
22023 <p>COUNTRY is Taiwan or China.</p>
22024 !! end
22025
22026 ## Note that parsoid test runner does not support 'showtitle' option.
22027 !! test
22028 Adding explicit conversion rule for title (T flag)
22029 !! options
22030 language=zh variant=zh-tw showtitle
22031 !! wikitext
22032 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22033
22034 Taiwan is China.
22035 !! html/php
22036 Taiwan
22037 <p>Should be stripped!
22038 </p><p>Taiwan is China.
22039 </p>
22040 !! html/parsoid
22041 <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>
22042 <p>Taiwan is China.</p>
22043 !! end
22044
22045 !! test
22046 Code coverage: T combined with H flag
22047 !! options
22048 language=zh variant=zh-tw showtitle
22049 !! wikitext
22050 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22051
22052 Taiwan is China.
22053 !! html/php
22054 Taiwan
22055 <p>Should be stripped!
22056 </p><p>Taiwan is Taiwan.
22057 </p>
22058 !! html/parsoid
22059 <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>
22060 <p>Taiwan is China.</p>
22061 !! end
22062
22063 !! test
22064 Code coverage: T with no variants
22065 !! options
22066 language=zh variant=zh-tw showtitle
22067 !! wikitext
22068 -{H|zh:China; zh-tw:Taiwan}-
22069 Taiwan is China.-{T|Taiwan is China}-
22070 !! html/php
22071 Taiwan is China
22072 <p>
22073 Taiwan is Taiwan.
22074 </p>
22075 !! html/parsoid
22076 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22077 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22078 !! end
22079
22080 !! test
22081 Code coverage: rules with no variants
22082 !! options
22083 language=zh variant=zh-tw
22084 !! wikitext
22085 -{H|zh:China; zh-tw:Taiwan}-
22086 Taiwan is China.
22087 -{H|China}-
22088 Taiwan is China.
22089 !! html/php
22090 <p>
22091 Taiwan is Taiwan.
22092
22093 Taiwan is China.
22094 </p>
22095 !! html/parsoid
22096 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22097 Taiwan is China.
22098 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22099 Taiwan is China.</p>
22100 !! end
22101
22102
22103 !! test
22104 Code coverage: D flag for conversion rule
22105 !! options
22106 language=zh variant=zh-tw
22107 !! wikitext
22108 -{D|zh-cn:XA; zh-tw:YA}-
22109 -{A;D|zh-cn:XB; zh-tw:YB}-
22110 -{D;H|zh-cn:XC; zh-tw:YC}-
22111
22112 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22113
22114 -{D|0=>zh-tw:1}-
22115 -{A;D|2=>zh-tw:3}-
22116 -{D;H|4=>zh-tw:5}-
22117
22118 XA XB XC YA YB YC FOO BAR BAT 012345
22119 !! html/php
22120 <p>大陆:XA;台灣:YA;
22121
22122 大陆:XC;台灣:YC;
22123 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22124 </p><p>0⇒台灣:1;
22125
22126 4⇒台灣:5;
22127 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22128 </p>
22129 !! html/parsoid
22130 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22131 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22132 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22133 <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>
22134 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22135 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22136 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22137 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22138 !! end
22139
22140 !! test
22141 Code coverage: N flag for conversion rule
22142 !! options
22143 language=zh variant=zh-cn
22144 !! wikitext
22145 -{N|zh-cn}-
22146
22147 -{N|zh-tw}-
22148
22149 -{N|sr-ec}-
22150 !! html/php
22151 <p>大陆
22152 </p><p>台灣
22153 </p><p>српски (ћирилица)‎
22154 </p>
22155 !! html/parsoid
22156 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22157 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22158 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22159 !! end
22160
22161 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22162 !! test
22163 Code coverage: N flag for conversion rule (wt2html only)
22164 !! options
22165 language=zh variant=zh-cn
22166 parsoid=wt2html,html2html
22167 !! wikitext
22168 -{D;N|en}-
22169 !! html/php
22170 <p>English
22171 </p>
22172 !! html/parsoid
22173 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22174 !! end
22175
22176 !! test
22177 Testing that changing the language variant here in the tests actually works
22178 !! options
22179 language=zh variant=zh showtitle
22180 !! wikitext
22181 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22182 !! html/php
22183 China
22184 <p>Should be stripped!
22185 </p>
22186 !! html/parsoid
22187 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22188 !! end
22189
22190 !! test
22191 Recursive conversion of alt and title attrs shouldn't clear converter state
22192 !! options
22193 language=zh variant=zh-cn
22194 showtitle
22195 !! wikitext
22196 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22197 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22198 !! html/php
22199 China
22200 <p>
22201 Should be stripped<span title="Exclamation">!</span>
22202 </p>
22203 !! html/parsoid
22204 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22205 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>
22206 !! end
22207
22208 !! test
22209 T26072: more test on conversion rule for title
22210 !! options
22211 language=zh variant=zh-tw showtitle
22212 !! wikitext
22213 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22214
22215 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22216 !! html/php
22217 Taiwan
22218 <p>This should be stripped!
22219 </p><p>This won't take interferes with the title rule.
22220 </p>
22221 !! html/parsoid
22222 <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>
22223 <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>
22224 !! end
22225
22226 !! test
22227 Partly disable title conversion if variant == main language code
22228 !! options
22229 language=zh variant=zh title=[[ZH]] showtitle
22230 !! wikitext
22231 -{T|zh-cn:CN;zh-tw:TW}-
22232 !! html/php
22233 ZH
22234 <p>
22235 </p>
22236 !! html/parsoid
22237 <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>
22238 !! end
22239
22240 !! test
22241 Partly disable title conversion if variant == main language code, more
22242 !! options
22243 language=zh variant=zh title=[[ZH]] showtitle
22244 !! wikitext
22245 -{T|TW}-
22246 !! html/php
22247 ZH
22248 <p>
22249 </p>
22250 !! html/parsoid
22251 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22252 !! end
22253
22254 !! test
22255 Raw output of variant escape tags (R flag)
22256 !! options
22257 language=zh variant=zh-tw
22258 !! wikitext
22259 Raw: -{R|zh:China;zh-tw:Taiwan}-
22260 !! html/php
22261 <p>Raw: zh:China;zh-tw:Taiwan
22262 </p>
22263 !! html/parsoid
22264 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22265 !! end
22266
22267 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22268 !! test
22269 Raw output of variant escape tags (R flag) (wt2html only)
22270 !! options
22271 language=zh variant=zh-tw
22272 parsoid=wt2html,html2html
22273 !! wikitext
22274 -{Variant}- -{D|syntax}- -{D;R|options}-
22275 !! html/php
22276 <p>Variant syntax options
22277 </p>
22278 !! html/parsoid
22279 <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>
22280 !! end
22281
22282 !! test
22283 Nested markup inside raw output of variant escape tags (R flag)
22284 !! options
22285 language=zh variant=zh-tw
22286 !! wikitext
22287 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22288 !! html/php
22289 <p>Nested raw: nested Taiwan nested
22290 </p>
22291 !! html/parsoid
22292 <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>
22293 !! end
22294
22295 !! test
22296 Nested markup and spaces inside raw output of variant escape tags (R flag)
22297 !! options
22298 language=zh variant=zh-tw
22299 !! wikitext
22300 X-{ outer -{ inner }- outer }-X
22301 !! html/php
22302 <p>X outer inner outer X
22303 </p>
22304 !! html/parsoid
22305 <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>
22306 !! end
22307
22308 !! test
22309 Templates inside raw output of variant escape tags (R flag)
22310 !! options
22311 language=zh variant=zh-tw
22312 !! wikitext
22313 Nested raw: -{R|nested {{echo|hi}} templates}-
22314 !! html/php
22315 <p>Nested raw: nested hi templates
22316 </p>
22317 !! html/parsoid
22318 <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>
22319 !! end
22320
22321 !! test
22322 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22323 !! options
22324 language=zh variant=zh-cn
22325 !! wikitext
22326 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22327 !! html/php
22328 <p>0
22329 </p>
22330 !! html/parsoid
22331 <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>
22332 !! end
22333
22334 !! test
22335 Conversion rules from [numeric-only string] to [something else] (T48634)
22336 !! options
22337 language=zh variant=zh-cn
22338 !! wikitext
22339 -{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
22340 !! html/php
22341 <p>D12345EE12345
22342 </p>
22343 !! html/parsoid
22344 <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>
22345 !! end
22346
22347 !! test
22348 Two-way converter rule entries with an empty value should be ignored (T53551)
22349 !! options
22350 language=zh variant=zh-cn
22351 !! wikitext
22352 -{H|zh-cn:foo;zh-tw:;}-foobar
22353 !! html/php
22354 <p>foobar
22355 </p>
22356 !! html/parsoid
22357 <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>
22358 !! end
22359
22360 !! test
22361 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22362 !! options
22363 language=zh variant=zh-cn
22364 !! wikitext
22365 -{H|=>zh-cn:foo;}-foobar
22366 !! html/php
22367 <p>foobar
22368 </p>
22369 !! html/parsoid
22370 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22371 !! end
22372
22373 !! test
22374 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22375 !! options
22376 language=zh variant=zh-cn
22377 !! wikitext
22378 -{H|}-foobar
22379 !! html/php
22380 <p>foobar
22381 </p>
22382 !! html/parsoid
22383 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22384 !! end
22385
22386 !! test
22387 Nested using of manual convert syntax
22388 !! options
22389 language=zh variant=zh-hk
22390 !! wikitext
22391 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22392 !! html/php
22393 <p>Nested: Hello Hong Kong!
22394 </p>
22395 !! html/parsoid
22396 <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>
22397 !! end
22398
22399 !! test
22400 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22401 !! options
22402 language=zh variant=zh-cn
22403 !! wikitext
22404 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22405 !! html/php
22406 <p><span title="X">A</span>
22407 </p>
22408 !! html/parsoid
22409 <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>
22410 !! end
22411
22412 !! test
22413 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22414 !! options
22415 language=zh variant=zh-cn
22416 !! wikitext
22417 -{<span title="-{X}-">A</span>}-
22418 !! html/php+disabled
22419 <p><span title="X">A</span>
22420 </p>
22421 !! html/parsoid
22422 <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>
22423 !! end
22424
22425 # Parsoid and PHP disagree on how to parse this example: Parsoid
22426 # insists that the content of a language converter element be a valid
22427 # DOM fragment or attribute string
22428 !! test
22429 Language converter markup with block content
22430 !! options
22431 language=zh variant=zh-cn
22432 !! wikitext
22433 <span>a-{b<div>c}-d
22434
22435 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22436
22437 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22438 !! html/php+tidy
22439 <span>ab<div>cd
22440 <span>ab<div>cd
22441 <span>ad
22442 </span></div></span></div></span>
22443 !! html/parsoid
22444 <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>
22445
22446 <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>
22447
22448 <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>
22449 !! end
22450
22451 !! test
22452 LanguageConverter selser (1)
22453 !! options
22454 language=zh variant=zh-cn
22455 parsoid={
22456 "modes": ["wt2wt", "selser"],
22457 "changes": [
22458 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22459 ]
22460 }
22461 !! wikitext
22462 -{raw}-
22463 !! wikitext/edited
22464 -{edited}-
22465 !! end
22466
22467 !! test
22468 LanguageConverter selser (2)
22469 !! options
22470 language=zh variant=zh-cn
22471 parsoid={
22472 "modes": ["wt2wt", "selser"],
22473 "changes": [
22474 ["span[class='x']", "contents", "text", "-{foo}-"],
22475 ["a", "contents", "text", "-{"],
22476 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22477 ]
22478 }
22479 !! wikitext
22480 <span class="x">TEXT1</span>
22481 [http://example.com TEXT2]
22482 [[Foo|TEXT3]]
22483 {{echo|TEXT4}}
22484 !! wikitext/edited
22485 <span class="x"><nowiki>-{foo}-</nowiki></span>
22486 [http://example.com -{]
22487 [[Foo|<nowiki>-{</nowiki>]]
22488 {{1x|<nowiki>-{</nowiki>}}
22489 !! end
22490
22491 # Tests LanguageVariantText in ConstrainedText
22492 !! test
22493 LanguageConverter selser (3)
22494 !! options
22495 language=zh variant=zh-cn
22496 parsoid={
22497 "modes": ["wt2wt", "selser"],
22498 "changes": [
22499 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22500 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22501 ]
22502 }
22503 !! wikitext
22504 {|
22505 |-
22506 |<span>Foo</span>
22507 |}
22508 !! wikitext/edited
22509 {|
22510 |-
22511 |<nowiki/>-{edited}-
22512 |}
22513 !! end
22514
22515 # Tests LanguageVariantText._fromSelSer
22516 !! test
22517 LanguageConverter selser (4)
22518 !! options
22519 language=zh variant=zh-cn
22520 parsoid={
22521 "modes": ["wt2wt", "selser"],
22522 "changes": [
22523 ["td > span.x", "remove"]
22524 ]
22525 }
22526 !! wikitext
22527 {|
22528 |-
22529 |<span class="x">Foo</span>-{Bar}-
22530 ||<span class="x">Foo</span>-{Bar}-
22531 |}
22532 !! wikitext/edited
22533 {|
22534 |-
22535 |<nowiki/>-{Bar}-
22536 ||-{Bar}-
22537 |}
22538 !! end
22539
22540 # Since Parsoid is starting to emit canonical wikitext for links,
22541 # [http://example.com http://example.com] will not RT back to that
22542 # form anymore.
22543 # Parsoid does not language-convert links (it is done in a
22544 # post-processing step)
22545 !! test
22546 Proper conversion of text in external links
22547 !! options
22548 language=sr variant=sr-ec
22549 parsoid=wt2html
22550 !! wikitext
22551 http://www.google.com
22552 gopher://www.google.com
22553 [http://www.google.com http://www.google.com]
22554 [gopher://www.google.com gopher://www.google.com]
22555 [https://www.google.com irc://www.google.com]
22556 [ftp://www.google.com www.google.com/ftp://dir]
22557 [//www.google.com www.google.com]
22558 !! html/php
22559 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22560 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22561 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22562 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22563 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22564 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22565 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22566 </p>
22567 !! html/parsoid
22568 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22569 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22570 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22571 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22572 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22573 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22574 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22575 !! end
22576
22577 !! test
22578 Do not convert roman numbers to language variants
22579 !! options
22580 language=sr variant=sr-ec
22581 !! wikitext
22582 Fridrih IV je car.
22583 !! html/php
22584 <p>Фридрих IV је цар.
22585 </p>
22586 !! html/parsoid
22587 <p>Fridrih IV je car.</p>
22588 !! end
22589
22590 !! test
22591 Unclosed language converter markup "-{"
22592 !! options
22593 language=sr
22594 !! wikitext
22595 -{T|hello
22596 !! html
22597 <p>-{T|hello
22598 </p>
22599 !! end
22600
22601 !! test
22602 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22603 !! options
22604 language=sr
22605 !! wikitext
22606 -{R|=&gt;}-
22607 !! html/php
22608 <p>=&gt;
22609 </p>
22610 !! html/parsoid
22611 <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>
22612 !!end
22613
22614 !! test
22615 Don't break link parsing if language converter markup is in the caption.
22616 !! options
22617 language=sr variant=sr-ec
22618 !! wikitext
22619 [[Main Page|-{R|main page}-]]
22620 !! html/php
22621 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22622 </p>
22623 !! html/parsoid
22624 <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>
22625 !! end
22626
22627 !! test
22628 T146304: Don't break template parsing if language converter markup is in the parameter.
22629 !! options
22630 language=sr variant=sr-ec
22631 !! wikitext
22632 {{echo|-{R|foo}-}}
22633 !! html/php
22634 <p>foo
22635 </p>
22636 !! html/parsoid
22637 <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>
22638 !! end
22639
22640 !! test
22641 T146305: Don't break image parsing if language converter markup is in the caption.
22642 !! options
22643 language=sr
22644 !! wikitext
22645 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22646 !! html/php
22647 <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>
22648
22649 !! html/parsoid
22650 <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>
22651 !! end
22652
22653 !! test
22654 T146305: Don't break image parsing if nested language converter markup is in the caption.
22655 !! options
22656 language=zh variant=zh-cn
22657 !! wikitext
22658 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22659 !! html/php
22660 <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>
22661
22662 !! html/parsoid
22663 <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>
22664 !! end
22665
22666 # XXX html2wt disabled because rich markup in alt is not preserved.
22667 !! test
22668 Don't break gallery if language converter markup is inside.
22669 !! options
22670 language=zh
22671 !! wikitext
22672 <gallery>
22673 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22674 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22675 </gallery>
22676 !! html/php
22677 <ul class="gallery mw-gallery-traditional">
22678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22679 <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>
22680 <div class="gallerytext">
22681 <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>
22682 </p>
22683 </div>
22684 </div></li>
22685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22686 <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>
22687 <div class="gallerytext">
22688 <p>This is a test template
22689 </p>
22690 </div>
22691 </div></li>
22692 </ul>
22693
22694 !! html/parsoid
22695 <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"}}'>
22696 <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>
22697 <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>
22698 </ul>
22699 !! end
22700
22701 !! test
22702 T153135: Don't break list handling if language converter markup is in the item.
22703 !! options
22704 language=zh variant=zh-cn
22705 !! wikitext
22706 ;-{zh-cn:AAA;zh-tw:BBB}-
22707 ;-{R|foo:bar}-
22708 !! html/php
22709 <dl><dt>AAA</dt>
22710 <dt>foo:bar</dt></dl>
22711
22712 !! html/parsoid
22713 <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>
22714 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22715 </dl>
22716 !! end
22717
22718 // Note that parsoid does not protect colons unless language converter
22719 // markup is properly nested, because it is a backtracking parser.
22720 !! test
22721 T153135: Unclosed markup in definition list (code coverage)
22722 !! options
22723 language=zh variant=zh-cn
22724 !! wikitext
22725 ;<b>foo:bar
22726 ;-{zh-cn:AAA
22727 !! html/php+tidy
22728 <dl><dt><b>foo:bar</b></dt><b>
22729 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22730 </b></p>
22731 !! html/parsoid
22732 <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}'>
22733 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22734 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22735 </b></dl>
22736 !! end
22737
22738 !! test
22739 T153135: Nested language converter markup in definition list (code coverage)
22740 !! options
22741 language=zh variant=zh-cn
22742 !! wikitext
22743 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22744 !! html/php
22745 <dl><dt>AAA foo:bar bat:baz</dt>
22746 <dd>def</dd></dl>
22747
22748 !! html/parsoid
22749 <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>
22750 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22751 </dl>
22752 !! end
22753
22754 # html2wt mode disabled due to <nowiki> insertion.
22755 !! test
22756 T153140: Don't break table handling if language converter markup is in the cell.
22757 !! options
22758 language=sr variant=sr-ec
22759 parsoid=wt2html,wt2wt,html2html
22760 !! wikitext
22761 {|
22762 |-
22763 | -{R|B}-
22764 |}
22765 !! html/php
22766 <table>
22767
22768 <tr>
22769 <td> B
22770 </td></tr></table>
22771
22772 !! html/parsoid
22773 <table>
22774 <tbody>
22775 <tr>
22776 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22777 </tr>
22778 </tbody>
22779 </table>
22780 !! end
22781
22782 !! test
22783 Language converter tricky html2wt cases (1)
22784 !! options
22785 language=sr
22786 parsoid=html2wt,wt2wt
22787 !! html/parsoid
22788 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22789 !! wikitext
22790 -{<nowiki>}-</nowiki>}-
22791 !! html/php
22792 <p>&#125;-
22793 </p>
22794 !! end
22795
22796 !! test
22797 Language converter tricky html2wt cases (2)
22798 !! options
22799 language=sr
22800 parsoid=html2wt,wt2wt
22801 !! html/parsoid
22802 <p>-{foo}-</p>
22803 !! wikitext
22804 <nowiki>-{foo}-</nowiki>
22805 !! html/php
22806 <p>-&#123;foo&#125;-
22807 </p>
22808 !! end
22809
22810 !! test
22811 Language converter tricky html2wt cases (3)
22812 !! options
22813 language=sr
22814 parsoid=html2wt,wt2wt
22815 !! html/parsoid
22816 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22817 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22818 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22819 !! wikitext
22820 -{R||}-
22821
22822 -{R|R|raw}-
22823
22824 -{<nowiki>-{foo}-</nowiki>}-
22825 !! html/php
22826 <p>|
22827 </p><p>R|raw
22828 </p><p>-&#123;foo&#125;-
22829 </p>
22830 !! end
22831
22832 !! test
22833 Language converter tricky html2wt cases (4)
22834 !! options
22835 language=sr
22836 parsoid=html2wt,wt2wt
22837 !! html/parsoid
22838 <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>
22839 !! wikitext
22840 -{R|{{echo|hey}}}-
22841 !! html/php
22842 <p>hey
22843 </p>
22844 !! end
22845
22846 # Note that the <nowiki> escaping added by parsoid for source text,
22847 # destination text, and language names only works on the PHP side
22848 # for *destination text*. (HTML entity escaping wouldn't work
22849 # any better.) This is probably a bug, at least for source texts.
22850 # (For language names PHP uses a precise regexp based on the languages
22851 # it currently knows have variants, which is fragile since this set
22852 # can grow/shrink over time.)
22853 !! test
22854 Language converter tricky html2wt cases (5)
22855 !! options
22856 language=zh variant=zh-cn
22857 !! html/parsoid
22858 <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>
22859 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22860 <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>
22861 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22862 <p>a:b=>c xyz</p>
22863 !! wikitext
22864 -{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
22865
22866 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22867
22868 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22869
22870 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22871
22872 a:b=>c xyz
22873 !! html/php+disabled
22874 <p>foobat;xyz=&gt;zh-cn:abc
22875 </p><p>A
22876 </p><p>0;zh-tw:bar
22877 </p><p>abc
22878 </p><p>a:b=&gt;c 0;zh-tw:bar
22879 </p>
22880 !! end
22881
22882 !! test
22883 T179579: Nowiki and lc interaction
22884 !! options
22885 parsoid=wt2html
22886 language=sr
22887 !! wikitext
22888 -{</nowiki>123}-
22889
22890 -{123<nowiki>|</nowiki>456}-
22891 !! html/parsoid
22892 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22893
22894 <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>
22895 !! end
22896
22897 !! test
22898 T2529: Uncovered bullet
22899 !! wikitext
22900 * Foo {{bullet}}
22901 !! html
22902 <ul><li> Foo </li>
22903 <li> Bar</li></ul>
22904
22905 !! end
22906
22907 !! test
22908 T2529: Uncovered bullet in a deeply nested list
22909 !! wikitext
22910 ******* Foo {{bullet}}
22911 !! html
22912 <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>
22913 <li> Bar</li></ul>
22914
22915 !! end
22916
22917 !! test
22918 T2529: Uncovered table already at line-start
22919 !! wikitext
22920 x
22921
22922 {{table}}
22923 y
22924 !! html
22925 <p>x
22926 </p>
22927 <table>
22928 <tr>
22929 <td> 1 </td>
22930 <td> 2
22931 </td></tr>
22932 <tr>
22933 <td> 3 </td>
22934 <td> 4
22935 </td></tr></table>
22936 <p>y
22937 </p>
22938 !! end
22939
22940 !! test
22941 T2529: Uncovered bullet in parser function result
22942 !! wikitext
22943 * Foo {{lc:{{bullet}} }}
22944 !! html
22945 <ul><li> Foo </li>
22946 <li> bar</li></ul>
22947
22948 !! end
22949
22950 !! test
22951 T7678: Double-parsed template argument
22952 !! wikitext
22953 {{lc:{{{1}}}|hello}}
22954 !! html
22955 <p>{{{1}}}
22956 </p>
22957 !! end
22958
22959 !! test
22960 T7678: Double-parsed template invocation
22961 !! wikitext
22962 {{lc:{{paramtest {{!}} param = hello }} }}
22963 !! html
22964 <p>{{paramtest | param = hello }}
22965 </p>
22966 !! end
22967
22968 !! test
22969 Case insensitivity of parser functions for non-ASCII characters (T10143)
22970 !! options
22971 language=cs
22972 title=[[Main Page]]
22973 !! wikitext
22974 {{PRVNÍVELKÉ:ěščř}}
22975 {{prvnívelké:ěščř}}
22976 {{PRVNÍMALÉ:ěščř}}
22977 {{prvnímalé:ěščř}}
22978 {{MALÁ:ěščř}}
22979 {{malá:ěščř}}
22980 {{VELKÁ:ěščř}}
22981 {{velká:ěščř}}
22982 !! html
22983 <p>Ěščř
22984 Ěščř
22985 ěščř
22986 ěščř
22987 ěščř
22988 ěščř
22989 ĚŠČŘ
22990 ĚŠČŘ
22991 </p>
22992 !! end
22993
22994 !! test
22995 Morwen/13: Unclosed link followed by heading
22996 !! wikitext
22997 [[link
22998 ==heading==
22999 !! html
23000 <p>[[link
23001 </p>
23002 <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>
23003
23004 !! end
23005
23006 !! test
23007 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23008 !! wikitext
23009 {{foo|
23010 =heading=
23011 !! html
23012 <p>{{foo|
23013 </p>
23014 <h1><span class="mw-headline" id="heading">heading</span></h1>
23015
23016 !! end
23017
23018 !! test
23019 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23020 !! wikitext
23021 {{foo|
23022 ==heading==
23023 !! html
23024 <p>{{foo|
23025 </p>
23026 <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>
23027
23028 !! end
23029
23030 !! test
23031 Tildes in comments
23032 !! options
23033 pst
23034 !! wikitext
23035 <!-- ~~~~ -->
23036 !! html/php
23037 <!-- ~~~~ -->
23038 !! end
23039
23040 !! test
23041 Paragraphs inside divs (no extra line breaks)
23042 !! wikitext
23043 <div>Line one
23044
23045 Line two</div>
23046 !! html
23047 <div>Line one
23048 Line two</div>
23049
23050 !! end
23051
23052 !! test
23053 Paragraphs inside divs (extra line break on open)
23054 !! wikitext
23055 <div>
23056 Line one
23057
23058 Line two</div>
23059 !! html
23060 <div>
23061 <p>Line one
23062 </p>
23063 Line two</div>
23064
23065 !! end
23066
23067 !! test
23068 Paragraphs inside divs (extra line break on close)
23069 !! wikitext
23070 <div>Line one
23071
23072 Line two
23073 </div>
23074 !! html
23075 <div>Line one
23076 <p>Line two
23077 </p>
23078 </div>
23079
23080 !! end
23081
23082 !! test
23083 Paragraphs inside divs (extra line break on open and close)
23084 !! wikitext
23085 <div>
23086 Line one
23087
23088 Line two
23089 </div>
23090 !! html
23091 <div>
23092 <p>Line one
23093 </p><p>Line two
23094 </p>
23095 </div>
23096
23097 !! end
23098
23099 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23100 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23101 !! test
23102 Nesting tags, paragraphs on lines which begin with <div>
23103 !! wikitext
23104 <div></div><strong>A
23105 B</strong>
23106 !! html/php+tidy
23107 <div></div><p><strong>A
23108 </strong></p><strong></strong><p><strong>B</strong>
23109 </p>
23110 !! html/parsoid
23111 <div></div>
23112 <p><strong>A
23113 B</strong>
23114 </p>
23115 !! end
23116
23117 # T8200: <blockquote> should behave like <div> with respect to line breaks
23118 !! test
23119 T8200: paragraphs inside blockquotes (no extra line breaks)
23120 !! wikitext
23121 <blockquote>Line one
23122
23123 Line two</blockquote>
23124 !! html
23125 <blockquote>Line one
23126 Line two</blockquote>
23127
23128 !! html+tidy
23129 <blockquote><p>Line one
23130 Line two</p></blockquote>
23131 !! end
23132
23133 !! test
23134 T8200: paragraphs inside blockquotes (extra line break on open)
23135 !! wikitext
23136 <blockquote>
23137 Line one
23138
23139 Line two</blockquote>
23140 !! html
23141 <blockquote>
23142 <p>Line one
23143 </p>
23144 Line two</blockquote>
23145
23146 !! html+tidy
23147 <blockquote>
23148 <p>Line one
23149 </p><p>
23150 Line two</p></blockquote>
23151 !! end
23152
23153 !! test
23154 T8200: paragraphs inside blockquotes (extra line break on close)
23155 !! wikitext
23156 <blockquote>Line one
23157
23158 Line two
23159 </blockquote>
23160 !! html
23161 <blockquote>Line one
23162 <p>Line two
23163 </p>
23164 </blockquote>
23165
23166 !! html+tidy
23167 <blockquote><p>Line one
23168 </p><p>Line two
23169 </p>
23170 </blockquote>
23171 !! end
23172
23173 !! test
23174 T8200: paragraphs inside blockquotes (extra line break on open and close)
23175 !! wikitext
23176 <blockquote>
23177 Line one
23178
23179 Line two
23180 </blockquote>
23181 !! html
23182 <blockquote>
23183 <p>Line one
23184 </p><p>Line two
23185 </p>
23186 </blockquote>
23187
23188 !! end
23189
23190 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23191 !! test
23192 Paragraphs inside blockquotes/divs (no extra line breaks)
23193 !! wikitext
23194 <blockquote><div>Line one
23195
23196 Line two</div></blockquote>
23197 !! html
23198 <blockquote><div>Line one
23199 Line two</div></blockquote>
23200
23201 !! end
23202
23203 !! test
23204 Paragraphs inside blockquotes/divs (extra line break on open)
23205 !! wikitext
23206 <blockquote><div>
23207 Line one
23208
23209 Line two</div></blockquote>
23210 !! html
23211 <blockquote><div>
23212 <p>Line one
23213 </p>
23214 Line two</div></blockquote>
23215
23216 !! end
23217
23218 !! test
23219 Paragraphs inside blockquotes/divs (extra line break on close)
23220 !! wikitext
23221 <blockquote><div>Line one
23222
23223 Line two
23224 </div></blockquote>
23225 !! html
23226 <blockquote><div>Line one
23227 <p>Line two
23228 </p>
23229 </div></blockquote>
23230
23231 !! end
23232
23233 !! test
23234 Paragraphs inside blockquotes/divs (extra line break on open and close)
23235 !! wikitext
23236 <blockquote><div>
23237 Line one
23238
23239 Line two
23240 </div></blockquote>
23241 !! html
23242 <blockquote><div>
23243 <p>Line one
23244 </p><p>Line two
23245 </p>
23246 </div></blockquote>
23247
23248 !! end
23249
23250 !! test
23251 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23252 !! options
23253 wgLinkHolderBatchSize=0
23254 !! wikitext
23255 [[meatball:1]]
23256 [[meatball:2]]
23257 [[meatball:3]]
23258 !! html
23259 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23260 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23261 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23262 </p>
23263 !! end
23264
23265 !! test
23266 Free external link invading image caption
23267 !! wikitext
23268 [[Image:Foobar.jpg|thumb|http://x|hello]]
23269 !! html/php
23270 <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>
23271
23272 !! html/parsoid
23273 <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>
23274 !! end
23275
23276 !! test
23277 T17196: localised external link numbers
23278 !! options
23279 language=fa
23280 !! wikitext
23281 [http://en.wikipedia.org/]
23282 !! html/php
23283 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23284 </p>
23285 !! html/parsoid
23286 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23287 !! end
23288
23289 !! test
23290 Multibyte character in padleft
23291 !! wikitext
23292 {{padleft:-Hello|7|Æ}}
23293 !! html/php
23294 <p>Æ-Hello
23295 </p>
23296 !! html/parsoid
23297 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23298 !! end
23299
23300 !! test
23301 Multibyte character in padright
23302 !! wikitext
23303 {{padright:Hello-|7|Æ}}
23304 !! html/php
23305 <p>Hello-Æ
23306 </p>
23307 !! html/parsoid
23308 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23309 !! end
23310
23311 !!test
23312 formatdate parser function
23313 !! wikitext
23314 {{#formatdate:2009-03-24}}
23315 !! html
23316 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23317 </p>
23318 !! end
23319
23320 !!test
23321 formatdate parser function, with default format
23322 !! wikitext
23323 {{#formatdate:2009-03-24|mdy}}
23324 !! html
23325 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23326 </p>
23327 !! end
23328
23329 !! test
23330 Spacing of numbers in formatted dates
23331 !! wikitext
23332 {{#formatdate:January 15}}
23333 !! html
23334 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23335 </p>
23336 !! end
23337
23338 !! test
23339 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
23340 !! options
23341 language=nl title=[[MediaWiki:Common.css]]
23342 !! wikitext
23343 {{#formatdate:2009-03-24|dmy}}
23344 !! html
23345 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23346 </p>
23347 !! end
23348
23349 #
23350 #
23351 #
23352
23353 #
23354 # Edit comments
23355 #
23356
23357 !! test
23358 Edit comment with link
23359 !! options
23360 comment
23361 !! wikitext
23362 I like the [[Main Page]] a lot
23363 !! html/php
23364 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23365 !!end
23366
23367 !! test
23368 Edit comment with link and link text
23369 !! options
23370 comment
23371 !! wikitext
23372 I like the [[Main Page|best pages]] a lot
23373 !! html/php
23374 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23375 !!end
23376
23377 !! test
23378 Edit comment with link and link text with suffix
23379 !! options
23380 comment
23381 !! wikitext
23382 I like the [[Main Page|best page]]s a lot
23383 !! html/php
23384 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23385 !!end
23386
23387 !! test
23388 Edit comment with section link (non-local, eg in history list)
23389 !! options
23390 comment title=[[Main Page]]
23391 !! wikitext
23392 /* External links */ removed bogus entries
23393 !! html/php
23394 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23395 !!end
23396
23397 !! test
23398 Edit comment with section link and text before it (non-local, eg in history list)
23399 !! options
23400 comment title=[[Main Page]]
23401 !! wikitext
23402 pre-comment text /* External links */ removed bogus entries
23403 !! html/php
23404 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>
23405 !!end
23406
23407 !! test
23408 Edit comment with section link (local, eg in diff view)
23409 !! options
23410 comment local title=[[Main Page]]
23411 !! wikitext
23412 /* External links */ removed bogus entries
23413 !! html/php
23414 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23415 !!end
23416
23417 !! test
23418 Edit comment with subpage link (T16080)
23419 !! options
23420 comment
23421 subpage
23422 title=[[Subpage test]]
23423 !! wikitext
23424 Poked at a [[/subpage]] here...
23425 !! html/php
23426 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23427 !!end
23428
23429 !! test
23430 Edit comment with subpage link and link text (T16080)
23431 !! options
23432 comment
23433 subpage
23434 title=[[Subpage test]]
23435 !! wikitext
23436 Poked at a [[/subpage|neat little page]] here...
23437 !! html/php
23438 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23439 !!end
23440
23441 !! test
23442 Edit comment with bogus subpage link in non-subpage NS (T16080)
23443 !! options
23444 comment
23445 title=[[Subpage test]]
23446 !! wikitext
23447 Poked at a [[/subpage]] here...
23448 !! html/php
23449 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...
23450 !!end
23451
23452 !! test
23453 Edit comment with bare anchor link (local, as on diff)
23454 !! options
23455 comment
23456 local
23457 title=[[Main Page]]
23458 !! wikitext
23459 [[#section]]
23460 !! html/php
23461 <a href="#section">#section</a>
23462 !! end
23463
23464 !! test
23465 Edit comment with bare anchor link (non-local, as on history)
23466 !! options
23467 comment
23468 title=[[Main Page]]
23469 !! wikitext
23470 [[#section]]
23471 !! html/php
23472 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23473 !! end
23474
23475 !! test
23476 Anchor starting with underscore
23477 !! options
23478 title=[[Foo]]
23479 !! wikitext
23480 [[#_ref|One]]
23481 !! html/php
23482 <p><a href="#_ref">One</a>
23483 </p>
23484 !! html/parsoid
23485 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23486 !! end
23487
23488 !! test
23489 Id starting with underscore
23490 !! wikitext
23491 <div id="_ref"></div>
23492 !! html/*
23493 <div id="_ref"></div>
23494
23495 !! end
23496
23497 !! test
23498 Edit comment with link with more than one pipe (T99346)
23499 !! options
23500 comment
23501 !! wikitext
23502 [[Main Page|Many|pipes]]
23503 !! html/php
23504 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23505 !! end
23506
23507 !! test
23508 Complex edit comment with link with more than one pipe (T99346)
23509 !! options
23510 comment
23511 !! wikitext
23512 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23513 !! html/php
23514 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;
23515 !! end
23516
23517 !! test
23518 Space normalisation on autocomment (T24784)
23519 !! options
23520 comment
23521 title=[[Main Page]]
23522 !! wikitext
23523 /* __hello__world__ */
23524 !! html/php
23525 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23526 !! end
23527
23528 !! test
23529 percent-encoding and + signs in comments (T28410)
23530 !! options
23531 comment
23532 !! wikitext
23533 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23534 !! html/php
23535 <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>
23536 !! end
23537
23538 # Parsoid doesn't support this yet: see T75581
23539 # but it *should* omit the 'src' attribute if the image is bad.
23540 # PHP side of tests was disabled in
23541 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23542 # because of issues in the PHP parserTests infrastructure
23543 # (but the output below is indeed what the PHP side emits)
23544 !! test
23545 Bad images - basic functionality
23546 !! wikitext
23547 [[File:Bad.jpg]]
23548 !! DISABLED/html/php
23549 !! html/parsoid
23550 <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>
23551 !! end
23552
23553 !! test
23554 Bad images - T18039: text after bad image disappears
23555 !! wikitext
23556 Foo bar
23557 [[File:Bad.jpg]]
23558 Bar foo
23559 !! DISABLED/html/php
23560 <p>Foo bar
23561 </p><p>Bar foo
23562 </p>
23563 !! html/parsoid
23564 <p>Foo bar
23565 <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>
23566 Bar foo</p>
23567 !! end
23568
23569 !! test
23570 Verify that displaytitle works (T24501) no displaytitle
23571 !! options
23572 showtitle
23573 !! config
23574 wgAllowDisplayTitle=true
23575 wgRestrictDisplayTitle=false
23576 !! wikitext
23577 this is not the the title
23578 !! html/php
23579 Parser test
23580 <p>this is not the the title
23581 </p>
23582 !! end
23583
23584 !! test
23585 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23586 !! options
23587 showtitle
23588 title=[[Screen]]
23589 !! config
23590 wgAllowDisplayTitle=true
23591 wgRestrictDisplayTitle=false
23592 !! wikitext
23593 this is not the the title
23594 {{DISPLAYTITLE:whatever}}
23595 !! html/php
23596 whatever
23597 <p>this is not the the title
23598 </p>
23599 !! end
23600
23601 !! test
23602 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23603 !! options
23604 showtitle
23605 title=[[Screen]]
23606 !! config
23607 wgAllowDisplayTitle=true
23608 wgRestrictDisplayTitle=true
23609 !! wikitext
23610 this is not the the title
23611 {{DISPLAYTITLE:whatever}}
23612 !! html/php
23613 Screen
23614 <p>this is not the the title
23615 </p>
23616 !! end
23617
23618 !! test
23619 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23620 !! options
23621 showtitle
23622 title=[[Screen]]
23623 !! config
23624 wgAllowDisplayTitle=true
23625 wgRestrictDisplayTitle=true
23626 !! wikitext
23627 this is not the the title
23628 {{DISPLAYTITLE:screen}}
23629 !! html/php
23630 screen
23631 <p>this is not the the title
23632 </p>
23633 !! end
23634
23635 !! test
23636 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23637 !! options
23638 showtitle
23639 title=[[Screen]]
23640 !! config
23641 wgAllowDisplayTitle=false
23642 !! wikitext
23643 this is not the the title
23644 {{DISPLAYTITLE:screen}}
23645 !! html/php
23646 Screen
23647 <p>this is not the the title
23648 <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>
23649 </p>
23650 !! end
23651
23652 !! test
23653 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23654 !! options
23655 showtitle
23656 title=[[Screen]]
23657 !! config
23658 wgAllowDisplayTitle=false
23659 !! wikitext
23660 this is not the the title
23661 !! html/php
23662 Screen
23663 <p>this is not the the title
23664 </p>
23665 !! end
23666
23667 !! test
23668 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23669 !! options
23670 showtitle
23671 title=[[Screen]]
23672 !! config
23673 wgAllowDisplayTitle=true
23674 wgRestrictDisplayTitle=true
23675 !! wikitext
23676 this is not the the title
23677 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23678 !! html/php
23679 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23680 <p>this is not the the title
23681 </p>
23682 !! end
23683
23684 !! test
23685 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23686 !! options
23687 showtitle
23688 title=[[Screen]]
23689 !! config
23690 wgAllowDisplayTitle=true
23691 wgRestrictDisplayTitle=true
23692 !! wikitext
23693 this is not the the title
23694 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23695 !! html/php
23696 <span style="color: red;">s</span>creen
23697 <p>this is not the the title
23698 </p>
23699 !! end
23700
23701 !! test
23702 Page status indicators: Empty name is invalid
23703 !! options
23704 showindicators
23705 !! wikitext
23706 <indicator name=" "></indicator>
23707 <indicator></indicator>
23708 !! html/php
23709 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23710 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23711 </p>
23712 !! end
23713
23714 !! test
23715 Page status indicators: Weird syntaxes that are okay
23716 !! options
23717 showindicators
23718 !! wikitext
23719 <indicator name="empty" />
23720 <indicator name="name"></indicator>
23721 !! html/php
23722 empty=
23723 name=
23724 <p><br />
23725 </p>
23726 !! end
23727
23728 !! test
23729 Page status indicators: Torture test
23730 !! options
23731 showindicators
23732 !! wikitext
23733 <indicator name="01">hello world</indicator>
23734 <indicator name="02">[[Main Page]]</indicator>
23735 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23736 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23737 <indicator name="05">* foo
23738 * bar</indicator>
23739 <indicator name="06"><nowiki>foo</nowiki></indicator>
23740 <indicator name="07"> Preformatted</indicator>
23741 <indicator name="08"><div>Broken tag</indicator>
23742 <indicator name="09">{| class=wikitable
23743 | cell
23744 |}</indicator>
23745 <indicator name="10">Two
23746
23747 paragraphs</indicator>
23748 !! html/php
23749 01=hello world
23750 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23751 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" />
23752 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>
23753 05=<ul><li> foo</li>
23754 <li> bar</li></ul>
23755
23756 06=foo
23757 07=<pre>Preformatted
23758 </pre>
23759 08=<div>Broken tag</div>
23760
23761 09=<table class="wikitable">
23762 <tr>
23763 <td> cell
23764 </td></tr></table>
23765
23766 10=<p>Two
23767 </p><p>paragraphs
23768 </p>
23769 <p><br />
23770 </p><p><br />
23771 </p><p><br />
23772 </p><p><br />
23773 </p><p><br />
23774 </p>
23775 !! end
23776
23777 !! test
23778 preload: check <noinclude> and <includeonly>
23779 !! options
23780 preload
23781 !! wikitext
23782 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23783 !! html/php
23784 Hello kind world.
23785 !! end
23786
23787 !! test
23788 preload: check <onlyinclude>
23789 !! options
23790 preload
23791 !! wikitext
23792 Goodbye <onlyinclude>Hello world</onlyinclude>
23793 !! html/php
23794 Hello world
23795 !! end
23796
23797 !! test
23798 preload: can pass tags through if we want to
23799 !! options
23800 preload
23801 !! wikitext
23802 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23803 !! html/php
23804 <includeonly>Hello world</includeonly>
23805 !! end
23806
23807 !! test
23808 preload: check that it doesn't try to do tricks
23809 !! options
23810 preload
23811 !! wikitext
23812 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23813 !! html/php
23814 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23815 !! end
23816
23817 !! test
23818 Play a bit with r67090 and T5158
23819 !! wikitext
23820 <div style="width:50% !important">&nbsp;</div>
23821 <div style="width:50%&nbsp;!important">&nbsp;</div>
23822 <div style="width:50%&#160;!important">&nbsp;</div>
23823 <div style="border : solid;">&nbsp;</div>
23824 !! html/php
23825 <div style="width:50% !important">&#160;</div>
23826 <div style="width:50% !important">&#160;</div>
23827 <div style="width:50% !important">&#160;</div>
23828 <div style="border&#160;: solid;">&#160;</div>
23829
23830 !! html/parsoid
23831 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23832 <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>
23833 <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>
23834 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23835
23836 !! end
23837
23838 !! test
23839 HTML5 data attributes
23840 !! wikitext
23841 <span data-foo="bar">Baz</span>
23842 <p data-abc-def_hij="">Quuz</p>
23843 !! html/php
23844 <p><span data-foo="bar">Baz</span>
23845 </p>
23846 <p data-abc-def_hij="">Quuz</p>
23847
23848 !! html/parsoid
23849 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23850 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23851 !! end
23852
23853 !! test
23854 Strip reserved data attributes
23855 !! wikitext
23856 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23857 !! html/php
23858 <div data-ok="fred">d</div>
23859
23860 !! html/parsoid
23861 <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>
23862 !! end
23863
23864 !! test
23865 percent-encoding and + signs in internal links (T28410)
23866 !! wikitext
23867 [[User:+%]] [[Page+title%]]
23868 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23869 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23870 [[%33%45]] [[%33%45+]]
23871 !! html/php
23872 <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>
23873 <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>
23874 <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>
23875 <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>
23876 </p>
23877 !! html/parsoid
23878 <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>
23879 <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>
23880 <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>
23881 <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>
23882 !! end
23883
23884 !! test
23885 Special characters in embedded file links (T29679)
23886 !! wikitext
23887 [[File:Contains & ampersand.jpg]]
23888 [[File:Does not exist.jpg|Title with & ampersand]]
23889 !! html/php
23890 <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>
23891 <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>
23892 </p>
23893 !! html/parsoid
23894 <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>
23895 <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>
23896 !! end
23897
23898 !! test
23899 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23900 !! wikitext
23901 Text&apos;s been normalized?
23902 !! html
23903 <p>Text&#39;s been normalized?
23904 </p>
23905 !! end
23906
23907 !! test
23908 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23909 !! wikitext
23910 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23911 !! html
23912 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23913 </p>
23914 !! end
23915
23916 !! test
23917 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23918 !! wikitext
23919 [http://www.example.org/ ideograms]
23920 !! html
23921 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23922 </p>
23923 !! end
23924
23925 !! test
23926 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23927 !! wikitext
23928 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23929 !! html
23930 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23931 </p>
23932 !! end
23933
23934 !! article
23935 Mediawiki:loop1
23936 !! text
23937 {{Identical|A}}
23938 !! endarticle
23939
23940 !! article
23941 Mediawiki:loop2
23942 !! text
23943 {{Identical|B}}
23944 !! endarticle
23945
23946 !! article
23947 Template:Identical
23948 !! text
23949 {{int:loop1}}
23950 {{int:loop2}}
23951 !! endarticle
23952
23953 !! test
23954 T33098 Template which includes system messages which includes the template
23955 !! wikitext
23956 {{Identical}}
23957 !! html
23958 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23959 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23960 </p>
23961 !! end
23962
23963 !! test
23964 T33490 Turkish: ucfirst 'blah'
23965 !! options
23966 language=tr
23967 !! wikitext
23968 {{ucfirst:blah}}
23969 !! html
23970 <p>Blah
23971 </p>
23972 !! end
23973
23974 !! test
23975 T33490 Turkish: ucfirst 'ix'
23976 !! options
23977 language=tr
23978 !! wikitext
23979 {{ucfirst:ix}}
23980 !! html
23981 <p>İx
23982 </p>
23983 !! end
23984
23985 !! test
23986 T33490 Turkish: lcfirst 'BLAH'
23987 !! options
23988 language=tr
23989 !! wikitext
23990 {{lcfirst:BLAH}}
23991 !! html
23992 <p>bLAH
23993 </p>
23994 !! end
23995
23996 !! test
23997 T33490 Turkish: ucfırst (with a dotless i)
23998 !! options
23999 language=tr
24000 !! wikitext
24001 {{ucfırst:blah}}
24002 !! html
24003 <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>
24004 </p>
24005 !! end
24006
24007 !! test
24008 T33490 ucfırst (with a dotless i) with English language
24009 !! options
24010 language=en
24011 !! wikitext
24012 {{ucfırst:blah}}
24013 !! html
24014 <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>
24015 </p>
24016 !! end
24017
24018 # Note that Parsoid doesn't emit an explicit TOC.
24019 # Note also that the html2wt direction tends to emit an extra newline
24020 # between the __TOC__ magicword and the first heading unless *both*
24021 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24022 # it's "{}").
24023
24024 !! test
24025 T28375: TOC with italics
24026 !! options
24027 title=[[Main Page]]
24028 !! wikitext
24029 __TOC__
24030 == ''Lost'' episodes ==
24031 !! html/php
24032 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24033 <ul>
24034 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
24035 </ul>
24036 </div>
24037
24038 <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>
24039
24040 !! html/parsoid
24041 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24042 <h2 id="Lost_episodes" data-parsoid='{}'> <i>Lost</i> episodes </h2>
24043 !! end
24044
24045 !! test
24046 T28375: TOC with bold
24047 !! options
24048 title=[[Main Page]]
24049 !! wikitext
24050 __TOC__
24051 == '''should be bold''' then normal text ==
24052 !! html/php
24053 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24054 <ul>
24055 <li class="toclevel-1 tocsection-1"><a href="#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>
24056 </ul>
24057 </div>
24058
24059 <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>
24060
24061 !! html/parsoid
24062 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24063 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
24064 !! end
24065
24066 !! test
24067 T35845: Headings become cursive in TOC when they contain an image
24068 !! options
24069 title=[[Main Page]]
24070 !! wikitext
24071 __TOC__
24072 == Image [[Image:foobar.jpg]] ==
24073 !! html/php
24074 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24075 <ul>
24076 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24077 </ul>
24078 </div>
24079
24080 <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>
24081
24082 !! html/parsoid
24083 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24084 <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>
24085 !! end
24086
24087 !! test
24088 T35845 (2): Headings become bold in TOC when they contain a blockquote
24089 !! options
24090 title=[[Main Page]]
24091 !! wikitext
24092 __TOC__
24093 == <blockquote>Quote</blockquote> ==
24094 !! html/php
24095 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24096 <ul>
24097 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24098 </ul>
24099 </div>
24100
24101 <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>
24102
24103 !! html/php+tidy
24104 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24105 <ul>
24106 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24107 </ul>
24108 </div>
24109
24110 <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>
24111 !! html/parsoid
24112 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24113 <h2 id="Quote" data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
24114 !! end
24115
24116 !! test
24117 Unclosed tags in TOC
24118 !! config
24119 wgFragmentMode=[ 'html5', 'legacy' ]
24120 !! options
24121 title=[[Main Page]]
24122 !! wikitext
24123 __TOC__
24124 == Proof: 2 < 3 ==
24125 <small>Hanc marginis exiguitas non caperet.</small>
24126 QED
24127 !! html/php
24128 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24129 <ul>
24130 <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>
24131 </ul>
24132 </div>
24133
24134 <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>
24135 <p><small>Hanc marginis exiguitas non caperet.</small>
24136 QED
24137 </p>
24138 !! html/parsoid
24139 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24140 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span> Proof: 2 &lt; 3 </h2>
24141 <p><small>Hanc marginis exiguitas non caperet.</small>
24142 QED</p>
24143 !! end
24144
24145 !! test
24146 Multiple tags in TOC
24147 !! wikitext
24148 __TOC__
24149 == <i>Foo</i> <b>Bar</b> ==
24150
24151 == <i>Foo</i> <blockquote>Bar</blockquote> ==
24152 !! html/php
24153 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24154 <ul>
24155 <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>
24156 <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>
24157 </ul>
24158 </div>
24159
24160 <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>
24161 <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>
24162
24163 !! html/php+tidy
24164 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24165 <ul>
24166 <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>
24167 <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>
24168 </ul>
24169 </div>
24170
24171 <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>
24172 <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>
24173 !! html/parsoid
24174 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24175 <h2 id="Foo_Bar" data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
24176
24177 <h2 id="Foo_Bar_2" data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
24178 !! end
24179
24180 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24181 # html5 tag parsing.
24182 !! test
24183 Tags with parameters in TOC
24184 !! options
24185 parsoid=wt2html
24186 !! wikitext
24187 __TOC__
24188 == <sup class="in-h2">Hello</sup> ==
24189
24190 == <sup class="a > b">Evilbye</sup> ==
24191 !! html/php
24192 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24193 <ul>
24194 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24195 <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>
24196 </ul>
24197 </div>
24198
24199 <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>
24200 <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>
24201
24202 !! html/parsoid
24203 <meta property="mw:PageProp/toc" />
24204 <h2 id="Hello"> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
24205
24206 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
24207 !! end
24208
24209 !! test
24210 span tags with directionality in TOC
24211 !! wikitext
24212 __TOC__
24213 == <span dir="ltr">C++</span> ==
24214
24215 == <span dir="rtl">זבנג!</span> ==
24216
24217 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
24218
24219 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
24220
24221 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
24222 !! html/php
24223 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24224 <ul>
24225 <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>
24226 <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>
24227 <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>
24228 <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>
24229 <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>
24230 </ul>
24231 </div>
24232
24233 <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>
24234 <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>
24235 <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>
24236 <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>
24237 <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>
24238
24239 !! html/parsoid
24240 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24241 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span> <span dir="ltr">C++</span> </h2>
24242 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span> <span dir="rtl">זבנג!</span> </h2>
24243 <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>
24244 <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>
24245 <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>
24246 !! end
24247
24248 !! test
24249 T74884: bdi element in ToC
24250 !! wikitext
24251 __TOC__
24252 == <bdi>test</bdi> ==
24253 !! html/php
24254 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24255 <ul>
24256 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24257 </ul>
24258 </div>
24259
24260 <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>
24261
24262 !! html/parsoid
24263 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24264 <h2 id="test" data-parsoid='{}'> <bdi>test</bdi> </h2>
24265 !! end
24266
24267 !! test
24268 T35715: s/strike element in ToC
24269 !! wikitext
24270 __TOC__
24271 == <s>test</s> test <strike>test</strike> ==
24272 !! html/php
24273 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24274 <ul>
24275 <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>
24276 </ul>
24277 </div>
24278
24279 <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>
24280
24281 !! html/parsoid
24282 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24283 <h2 id="test_test_test" data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
24284 !! end
24285
24286 !! test
24287 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24288 !! wikitext
24289 __TOC__
24290 == x ==
24291 !! html/php
24292 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24293 <ul>
24294 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24295 </ul>
24296 </div>
24297
24298 <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>
24299
24300 !! html/parsoid
24301 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24302 <h2 id="x" data-parsoid='{}'> x </h2>
24303 !! end
24304
24305 !! article
24306 MediaWiki:T34057
24307 !! text
24308 == {{int:headline_sample}} ==
24309 !! endarticle
24310
24311 !! test
24312 T34057: Title needed when expanding <h> nodes.
24313 !! options
24314 title=[[Main Page]]
24315 !! wikitext
24316 {{int:T34057}}
24317 !! html
24318 <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>
24319
24320 !! end
24321
24322 !! test
24323 Strip marker in urlencode
24324 !! wikitext
24325 {{urlencode:x<nowiki/>y}}
24326 {{urlencode:x<nowiki/>y|wiki}}
24327 {{urlencode:x<nowiki/>y|path}}
24328 {{urlencode:x<pre id="one">two</pre>y}}
24329 !! html/php
24330 <p>xy
24331 xy
24332 xy
24333 xy
24334 </p>
24335 !! end
24336
24337 !! test
24338 Strip marker in lc
24339 !! wikitext
24340 {{lc:x<nowiki/>y}}
24341 !! html
24342 <p>xy
24343 </p>
24344 !! end
24345
24346 !! test
24347 Strip marker in uc
24348 !! wikitext
24349 {{uc:x<nowiki/>y}}
24350 !! html
24351 <p>XY
24352 </p>
24353 !! end
24354
24355 !! test
24356 Strip marker in formatNum
24357 !! wikitext
24358 {{formatnum:1<nowiki/>2}}
24359 {{formatnum:1<nowiki/>2|R}}
24360 !! html
24361 <p>12
24362 12
24363 </p>
24364 !! end
24365
24366 !! test
24367 Check noCommafy in formatNum
24368 !! options
24369 language=be-tarask
24370 !! wikitext
24371 {{formatnum:123456.78}}
24372 {{formatnum:123456.78|NOSEP}}
24373 !! html
24374 <p>123 456,78
24375 123456.78
24376 </p>
24377 !! end
24378
24379 !! test
24380 Wrong option for formatNum (T58199)
24381 !! wikitext
24382 {{formatnum:1,234.56|Random}}
24383 {{formatnum:1,234.56|EVERYTHING}}
24384 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24385 !! html
24386 <p>1,234.56
24387 1,234.56
24388 1,234.56
24389 </p>
24390 !! end
24391
24392 !! test
24393 Strip marker in grammar
24394 !! options
24395 language=fi
24396 !! wikitext
24397 {{grammar:elative|foo<nowiki/>bar}}
24398 !! html
24399 <p>foobarista
24400 </p>
24401 !! end
24402
24403 !! test
24404 Strip marker in padleft
24405 !! wikitext
24406 {{padleft:|2|x<nowiki/>y}}
24407 !! html
24408 <p>xy
24409 </p>
24410 !! end
24411
24412 !! test
24413 Strip marker in padright
24414 !! wikitext
24415 {{padright:|2|x<nowiki/>y}}
24416 !! html
24417 <p>xy
24418 </p>
24419 !! end
24420
24421 !! test
24422 Strip marker in anchorencode
24423 !! wikitext
24424 {{anchorencode:x<nowiki/>y}}
24425 !! html/php
24426 <p>xy
24427 </p>
24428 !! html/parsoid
24429 <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>
24430 !! end
24431
24432 !! test
24433 nowiki inside link inside heading (T20295)
24434 !! wikitext
24435 ==[[foo|x<nowiki>y</nowiki>z]]==
24436 !! html
24437 <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>
24438
24439 !! end
24440
24441 !! test
24442 new support for bdi element (T33817)
24443 !! wikitext
24444 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24445 !! html
24446 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24447
24448 !!end
24449
24450 !! test
24451 Ignore pipe between table row attributes
24452 !! wikitext
24453 {|
24454 | quux
24455 |- id=foo | style='color: red'
24456 | bar
24457 |}
24458 !! html
24459 <table>
24460 <tr>
24461 <td> quux
24462 </td></tr>
24463 <tr id="foo" style="color: red">
24464 <td> bar
24465 </td></tr></table>
24466
24467 !! end
24468
24469 !!test
24470 Language parser function
24471 !! wikitext
24472 {{#language:ar}}
24473 !! html
24474 <p>العربية
24475 </p>
24476 !! end
24477
24478 !!test
24479 Padleft and padright (default 0-padding)
24480 !! wikitext
24481 {{padleft:xyz|5}}
24482 {{padright:xyz|5}}
24483 !! html/php
24484 <p>00xyz
24485 xyz00
24486 </p>
24487 !! html/parsoid
24488 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24489 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24490 !! end
24491
24492 !!test
24493 Padleft and padright (partial fill)
24494 !! wikitext
24495 {{padleft:xyz|6|ab}}
24496 {{padright:xyz|6|ab}}
24497 !! html/php
24498 <p>abaxyz
24499 xyzaba
24500 </p>
24501 !! html/parsoid
24502 <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>
24503 <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>
24504 !! end
24505
24506 !!test
24507 Padleft and padright as substr
24508 !! wikitext
24509 {{padleft:|3|abcde}}
24510 {{padright:|3|abcde}}
24511 !! html/php
24512 <p>abc
24513 abc
24514 </p>
24515 !! html/parsoid
24516 <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>
24517 <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>
24518 !! end
24519
24520 !!test
24521 Special parser function
24522 !! wikitext
24523 {{#special:RandomPage}}
24524 {{#special:BaDtItLe}}
24525 {{#special:Foobar}}
24526 !! html
24527 <p>Special:Random
24528 Special:Badtitle
24529 Special:Foobar
24530 </p>
24531 !! end
24532
24533 !!test
24534 T36939 - Case insensitive link parsing ([HttP://])
24535 !! wikitext
24536 [HttP://MediaWiki.Org/]
24537 !! html/php
24538 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24539 </p>
24540 !! html/parsoid
24541 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24542 !! end
24543
24544 !!test
24545 T36939 - Case insensitive link parsing ([HttP:// title])
24546 !! wikitext
24547 [HttP://MediaWiki.Org/ MediaWiki]
24548 !! html
24549 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24550 </p>
24551 !! end
24552
24553 !!test
24554 T36939 - Case insensitive link parsing (HttP://)
24555 !! wikitext
24556 HttP://MediaWiki.Org/
24557 !! html/php
24558 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24559 </p>
24560 !! html/parsoid
24561 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24562 !! end
24563
24564 !!test
24565 Disable TOC
24566 !! options
24567 notoc
24568 !! wikitext
24569 Lead
24570 == Section 1 ==
24571 == Section 2 ==
24572 == Section 3 ==
24573 == Section 4 ==
24574 == Section 5 ==
24575 !! html
24576 <p>Lead
24577 </p>
24578
24579 <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>
24580 <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>
24581 <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>
24582 <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>
24583 <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>
24584
24585 !! end
24586
24587
24588 ###
24589 ### Parsoid-specific tests
24590 ### Parsoid-PHP parser incompatibilities
24591 ###
24592 !!test
24593 1. SOL-sensitive wikitext tokens as template-args
24594 !!options
24595 parsoid=wt2html,wt2wt
24596 !! wikitext
24597 {{echo|*a}}
24598 {{echo|#a}}
24599 {{echo|:a}}
24600 !! html
24601 <span about="#mwt1" typeof="mw:Transclusion">
24602 </span><ul about="#mwt1"><li>a</li>
24603 </ul>
24604 <span about="#mwt2" typeof="mw:Transclusion">
24605 </span><ol about="#mwt2"><li>a</li>
24606 </ol>
24607 <span about="#mwt3" typeof="mw:Transclusion">
24608 </span><dl about="#mwt3"><dd>a</dd>
24609 </dl>
24610 !!end
24611
24612 #### -----------------------------------------------------------------
24613 #### Parsoid-specific functionality tests
24614 #### -----------------------------------------------------------------
24615
24616 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24617 # We know wt2wt will fail, but we expect selser to pass.
24618 # Due to the nature of our testing, wt2wt and selser tests will enter the
24619 # blacklist and we'll catch selser regressions based on changes to the
24620 # blacklist entries for selser tests.
24621 !! test
24622 1. Bad treebuilder fixup of formatting elt is cleaned up
24623 !! options
24624 parsoid=wt2html,wt2wt
24625 !! wikitext
24626 {|
24627 |
24628 <small>
24629 [[Image:Foobar.jpg|right|Test]]
24630 </small>
24631 |}
24632 !! html/parsoid
24633 <table>
24634 <tbody><tr><td>
24635 <small>
24636 <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>
24637 </small>
24638 </td></tr>
24639 </tbody></table>
24640 !! end
24641
24642 !! test
24643 2. Bad treebuilder fixup of formatting elt is cleaned up
24644 !! options
24645 parsoid=wt2html,wt2wt
24646 !! wikitext
24647 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24648
24649 <small>[[Image:Foobar.jpg|right|300px]]</small>
24650 !! html/parsoid
24651
24652 <p><b>foo</b></p>
24653 <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>
24654 <p><b>bar</b></p>
24655 <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>
24656 !! end
24657
24658 !! test
24659 3. Bad treebuilder fixup of formatting elt is cleaned up
24660 !! options
24661 parsoid=wt2html,wt2wt
24662 !! wikitext
24663 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24664 !! html/parsoid
24665 <p><small><b>foo</b></small></p>
24666 <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>
24667 <p><small><b>bar</b></small></p>
24668 !! end
24669
24670 !! test
24671 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24672 !! options
24673 parsoid=wt2html,wt2wt
24674 !! wikitext
24675 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24676 !! html/parsoid
24677 <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>
24678 !! end
24679
24680 #### ----------------------------------------------------------------
24681 #### Parsoid-only testing of Parsoid's impl of LST
24682 #### Not implemented yet, see
24683 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24684 #### ----------------------------------------------------------------
24685
24686 ## We still need to support serializing the older format while content is stored.
24687 !! test
24688 LST Sections: Backwards compatibility
24689 !! options
24690 parsoid={
24691 "suppressErrors": true,
24692 "modes": ["html2wt"]
24693 }
24694 !! wikitext
24695 <section begin="2011-05-16" />
24696 <section end="2014-04-10 (MW 1.23wmf22)" />
24697 !! html/parsoid
24698 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24699 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24700 !! end
24701
24702 !! test
24703 LST Sections: Newfangled approach
24704 !! wikitext
24705 <section begin="2011-05-16" />
24706 <section end="2014-04-10 (MW 1.23wmf22)" />
24707 !! html/parsoid
24708 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24709 </span>
24710 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24711 </span></p>
24712 !! end
24713
24714 #--------- Test stripping of empty nodes in template content ----------
24715
24716 !! test
24717 Empty LI and TR nodes should be stripped from template content
24718 !! wikitext
24719 {{EmptyLITest}}
24720 {{EmptyTRTest}}
24721 !! html/parsoid
24722 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24723 <li>a</li>
24724 <li>b</li>
24725 </ul>
24726 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24727 <tbody>
24728 <tr>
24729 <td>foo</td>
24730 </tr>
24731 <tr>
24732 <td>bar</td>
24733 </tr>
24734 </tbody>
24735 </table>
24736 !! end
24737
24738 !! test
24739 Empty LI and TR nodes should not be stripped from top-level content
24740 !! wikitext
24741 * a
24742 *
24743 * b
24744 {|
24745 |-
24746 |-
24747 |foo
24748 |}
24749 !! html/parsoid
24750 <ul>
24751 <li> a</li>
24752 <li class='mw-empty-elt'></li>
24753 <li> b</li>
24754 </ul>
24755 <table>
24756 <tbody>
24757 <tr class='mw-empty-elt'></tr>
24758 <tr>
24759 <td>foo</td>
24760 </tr>
24761 </tbody>
24762 </table>
24763 !! end
24764
24765 !! test
24766 Empty TR nodes should not be stripped if they have any attributes set
24767 !! wikitext
24768 {{EmptyTRWithHTMLAttrTest}}
24769 !! html/parsoid
24770 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24771 <tr align='center'></tr>
24772 <tr><td>foo</td></tr>
24773 <tr align='center'></tr>
24774 <tr><td>bar</td></tr>
24775 </table>
24776 !! end
24777
24778 #### ----------------------------------------------------------------
24779 #### The following section of tests are primarily to test
24780 #### wikitext escaping capabilities of Parsoid. Given that
24781 #### escaping can be done any number of ways, the wikitext (input)
24782 #### is always adjusted to reflect how Parsoid adds nowiki
24783 #### escape tags.
24784 ####
24785 #### We are marking several tests as parsoid-only since the
24786 #### HTML in the result section is different from what the
24787 #### PHP parser generates for it.
24788 #### ----------------------------------------------------------------
24789
24790
24791 #### --------------- Headings ---------------
24792 #### 0. Unnested
24793 #### 1. Nested inside html <h1>=foo=</h1>
24794 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24795 #### 3. Nested inside html with wikitext split by html tags
24796 #### 4. No escape needed
24797 #### 5. Empty headings <h1></h1>
24798 #### 6. Heading chars in SOL context
24799 #### ----------------------------------------
24800 !! test
24801 Headings: 0. Unnested
24802 !! options
24803 parsoid=html2wt
24804 !! html/parsoid
24805 <p>=foo=</p>
24806
24807 <p> =foo=
24808 <!--cmt-->
24809 =foo=</p>
24810
24811 <p>=foo<i>a</i>=</p>
24812 !! wikitext
24813 <nowiki>=foo=</nowiki>
24814
24815 <nowiki> </nowiki>=foo=
24816 <!--cmt-->
24817 <nowiki>=foo=</nowiki>
24818
24819 =foo''a''<nowiki>=</nowiki>
24820 !!end
24821
24822 # New headings and existing headings are handled differently
24823 !! test
24824 Headings: 1. Nested inside html
24825 !! options
24826 parsoid=html2wt
24827 !! html/parsoid
24828 <h1>=foo=</h1>
24829 <h2>=foo=</h2>
24830 <h3>=foo=</h3>
24831
24832 <h1 data-parsoid=''>=foo=</h1>
24833 <h2 data-parsoid=''>=foo=</h2>
24834 <h3 data-parsoid=''>=foo=</h3>
24835 <h4 data-parsoid=''>=foo=</h4>
24836 <h5 data-parsoid=''>=foo=</h5>
24837 <h6 data-parsoid=''>=foo=</h6>
24838 !! wikitext
24839 = =foo= =
24840
24841 == =foo= ==
24842
24843 === =foo= ===
24844
24845 =<nowiki>=foo=</nowiki>=
24846 ==<nowiki>=foo=</nowiki>==
24847 ===<nowiki>=foo=</nowiki>===
24848 ====<nowiki>=foo=</nowiki>====
24849 =====<nowiki>=foo=</nowiki>=====
24850 ======<nowiki>=foo=</nowiki>======
24851
24852 !!end
24853
24854 !! test
24855 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24856 !! options
24857 parsoid=html2wt
24858 !! html/parsoid
24859 <h1>foo</h1>*bar
24860 <h1>foo</h1>=bar
24861 <h1>foo</h1>=bar=
24862 !! wikitext
24863 = foo =
24864 <nowiki>*</nowiki>bar
24865
24866 = foo =
24867 =bar
24868
24869 = foo =
24870 <nowiki>=bar=</nowiki>
24871 !!end
24872
24873 !! test
24874 Headings: 3. Nested inside html with wikitext split by html tags
24875 !! options
24876 parsoid=html2wt
24877 !! html/parsoid
24878 <h1>=<b>bold</b>foo=</h1>
24879 !! wikitext
24880 = ='''bold'''foo= =
24881 !!end
24882
24883 !! test
24884 Headings: 4a. No escaping needed (testing just h1 and h2)
24885 !! options
24886 parsoid=html2wt
24887 !! html/parsoid
24888 <h1>=foo</h1>
24889 <h1>foo=</h1>
24890 <h1> =foo= </h1>
24891 <h1>=foo= bar</h1>
24892 <h2>=foo</h2>
24893 <h2>foo=</h2>
24894 <h1>=</h1>
24895 <h1><i>=</i>foo=</h1>
24896 !! wikitext
24897 = =foo =
24898
24899 = foo= =
24900
24901 = =foo= =
24902
24903 = =foo= bar =
24904
24905 == =foo ==
24906
24907 == foo= ==
24908
24909 = = =
24910
24911 = ''=''foo= =
24912 !!end
24913
24914 !! test
24915 Headings: 4b. No escaping needed (inside p-tags)
24916 !! options
24917 parsoid=html2wt
24918 !! html/parsoid
24919 <p>=foo= x
24920 =foo= <s></s>
24921 </p>
24922 !! wikitext
24923 =foo= x
24924 =foo= <s></s>
24925 !! html/php
24926 <p>=foo= x
24927 =foo= <s></s>
24928 </p>
24929 !!end
24930
24931 !! test
24932 Headings: 4c. Short headings (1)
24933 !! options
24934 parsoid=html2wt
24935 !! html/parsoid
24936 <p>===
24937 </p>
24938 !! wikitext
24939 <nowiki>===</nowiki>
24940 !! html/php
24941 <p>===
24942 </p>
24943 !! end
24944
24945 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24946 !! test
24947 Headings: 4d. Short headings (2)
24948 !! options
24949 parsoid=wt2html,html2html
24950 !! wikitext
24951 =
24952 ==
24953 ===
24954 ====
24955 =====
24956 !! html/php
24957 <p>=
24958 ==
24959 </p>
24960 <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>
24961 <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>
24962 <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>
24963
24964 !! html/parsoid
24965 <p>=
24966 ==</p>
24967 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24968 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24969 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24970 !! end
24971
24972 !! test
24973 Headings: 5. Empty headings
24974 !! options
24975 parsoid=html2wt
24976 !! html/parsoid
24977 <h1 data-parsoid='{}'></h1>
24978
24979 <h2 data-parsoid='{}'></h2>
24980
24981 <h3 data-parsoid='{}'></h3>
24982
24983 <h4 data-parsoid='{}'></h4>
24984
24985 <h5 data-parsoid='{}'></h5>
24986
24987 <h6 data-parsoid='{}'></h6>
24988 !! wikitext
24989 =<nowiki/>=
24990
24991 ==<nowiki/>==
24992
24993 ===<nowiki/>===
24994
24995 ====<nowiki/>====
24996
24997 =====<nowiki/>=====
24998
24999 ======<nowiki/>======
25000 !!end
25001
25002 !! test
25003 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25004 !! options
25005 parsoid=html2wt
25006 !! html/parsoid
25007 <p>=a=</p>
25008
25009 <p>=a=</p>
25010
25011 <p>=a=</p>
25012 !! wikitext
25013 <nowiki>=a=</nowiki>
25014
25015 <nowiki>=a=</nowiki>
25016
25017 <nowiki>=a=</nowiki>
25018 !!end
25019
25020 !! test
25021 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25022 !! options
25023 parsoid=html2wt
25024 !! html/parsoid
25025 <p>=a=
25026 b</p>
25027
25028 <p>=a=
25029 b</p>
25030
25031 <p>=a=
25032 b</p>
25033 !! wikitext
25034 <nowiki>=a=</nowiki>
25035 b
25036
25037 <nowiki>=a=</nowiki>
25038 b
25039
25040 <nowiki>=a=</nowiki>
25041 b
25042 !!end
25043
25044 !! test
25045 Headings: 6c. Heading chars in SOL context (leading newline break)
25046 !! options
25047 parsoid=html2wt
25048 !! html/parsoid
25049 <p>a
25050 =b=</p>
25051 !! wikitext
25052 a
25053 <nowiki>=b=</nowiki>
25054 !!end
25055
25056 !! test
25057 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25058 !! options
25059 parsoid=html2wt
25060 !! html/parsoid
25061 <!--c0--><p>=a=</p>
25062
25063 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25064 !! wikitext
25065 <!--c0--><nowiki>=a=</nowiki>
25066
25067 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25068 !!end
25069
25070 !! test
25071 Headings: 6d. Heading chars in SOL context (No escaping needed)
25072 !! options
25073 parsoid=html2wt
25074 !! html/parsoid
25075 =a=<div>b</div>
25076 !! wikitext
25077 =a=<div>b</div>
25078 !!end
25079
25080 !! test
25081 Headings: 7. Insert a newline between new content and headings
25082 !! options
25083 parsoid=html2wt
25084 !! html/parsoid
25085 <h2>NEW</h2>
25086 <p>new</p>
25087 <h2 data-parsoid='{}'>A</h2>
25088 <p data-parsoid='{}'>a</p>
25089 !! wikitext
25090 == NEW ==
25091 new
25092
25093 ==A==
25094 a
25095
25096 !! end
25097
25098 !! test
25099 Headings: Used as horizontal rule
25100 !! config
25101 wgFragmentMode=[ 'html5', 'legacy' ]
25102 !! options
25103 parsoid=wt2html
25104 !! wikitext
25105 ===============
25106 !! html/php
25107 <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>
25108
25109 !! html/parsoid
25110 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25111 !! end
25112
25113 #### --------------- Lists ---------------
25114 #### 0. Outside nests (*foo, etc.)
25115 #### 1. Nested inside html <ul><li>*foo</li></ul>
25116 #### 2. Inside definition lists
25117 #### 3. Only bullets at start should be escaped
25118 #### 4. No escapes needed
25119 #### 5. No unnecessary escapes
25120 #### 6. Escape bullets in SOL position
25121 #### 7. Escape bullets in a multi-line context
25122 #### ----------------------------------------
25123
25124 !! test
25125 Lists: 0. Outside nests
25126 !! options
25127 parsoid=html2wt
25128 !! html/parsoid
25129 <p>*foo</p>
25130
25131 <p>#foo</p>
25132
25133 <p>;Foo:bar</p>
25134 !! wikitext
25135 <nowiki>*</nowiki>foo
25136
25137 <nowiki>#</nowiki>foo
25138
25139 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25140 !!end
25141
25142 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25143 ## to test wikitext escaping, and insignificant whitespace diffs
25144 ## cause PHP parser tests to barf
25145 !! test
25146 Lists: 1. Nested inside html (No unnecessary escapes)
25147 !! options
25148 parsoid=html2wt
25149 !! html/parsoid
25150 <ul>
25151 <li>*foo</li>
25152 <li>#foo</li>
25153 <li>:foo</li>
25154 <li>;foo</li>
25155 <li data-parsoid='{}'>*foo</li>
25156 <li data-parsoid='{}'>#foo</li>
25157 <li data-parsoid='{}'>:foo</li>
25158 <li data-parsoid='{}'>;foo</li>
25159 </ul>
25160
25161 <ol>
25162 <li>*foo</li>
25163 <li>#foo</li>
25164 <li>:foo</li>
25165 <li>;foo</li>
25166 <li data-parsoid='{}'>*foo</li>
25167 <li data-parsoid='{}'>#foo</li>
25168 <li data-parsoid='{}'>:foo</li>
25169 <li data-parsoid='{}'>;foo</li>
25170 </ol>
25171 !! wikitext
25172 * *foo
25173 * #foo
25174 * :foo
25175 * ;foo
25176 *<nowiki>*foo</nowiki>
25177 *<nowiki>#foo</nowiki>
25178 *<nowiki>:foo</nowiki>
25179 *<nowiki>;foo</nowiki>
25180
25181 # *foo
25182 # #foo
25183 # :foo
25184 # ;foo
25185 #<nowiki>*foo</nowiki>
25186 #<nowiki>#foo</nowiki>
25187 #<nowiki>:foo</nowiki>
25188 #<nowiki>;foo</nowiki>
25189 !!end
25190
25191 !! test
25192 Lists: 2. Inside definition lists
25193 !! options
25194 parsoid=html2wt
25195 !! html/parsoid
25196 <dl><dt>;foo</dt></dl>
25197 <dl><dt>:foo</dt></dl>
25198 <dl><dt>:foo</dt>
25199 <dd>bar</dd></dl>
25200 <dl><dd>:foo</dd></dl>
25201 !! wikitext
25202 ; ;foo
25203
25204 ; <nowiki>:foo</nowiki>
25205
25206 ; <nowiki>:foo</nowiki>
25207 : bar
25208
25209 : :foo
25210 !!end
25211
25212 !! test
25213 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25214 !! options
25215 parsoid=html2wt
25216 !! html/parsoid
25217 <ul>
25218 <li>*foo*bar</li>
25219 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25220 </ul>
25221 !! wikitext
25222 * *foo*bar
25223 *<nowiki>*foo</nowiki>''it''*bar
25224 !!end
25225
25226 !! test
25227 Lists: 4. No escapes needed
25228 !! options
25229 parsoid=html2wt
25230 !! html/parsoid
25231 <ul>
25232 <li>foo*bar
25233 </li>
25234 </ul>
25235 <ul>
25236 <li><i>foo</i>*bar
25237 </li>
25238 </ul>
25239 <ul>
25240 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25241 </li>
25242 </ul>
25243 <ul>
25244 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25245 </li>
25246 </ul>
25247 !! wikitext
25248 *foo*bar
25249
25250 *''foo''*bar
25251
25252 *[[Foo]]: bar
25253
25254 *[[Foo]]*bar
25255 !!end
25256
25257 !! test
25258 Lists: 5. No unnecessary escapes
25259 !! options
25260 parsoid=html2wt
25261 !! html/parsoid
25262 <ul><li> bar <span>[[foo]]</span></li></ul>
25263 <ul><li> =bar <span>[[foo]]</span></li></ul>
25264 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25265 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25266 <ul><li> =bar <span>foo]]</span>=</li></ul>
25267 <ul><li> <s></s>: a</li></ul>
25268 <ul><li> <i>* foo</i></li></ul>
25269
25270 !! wikitext
25271 * bar <span><nowiki>[[foo]]</nowiki></span>
25272
25273 * =bar <span><nowiki>[[foo]]</nowiki></span>
25274
25275 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25276
25277 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25278
25279 * =bar <span>foo]]</span>=
25280
25281 * <s></s>: a
25282
25283 * ''* foo''
25284 !!end
25285
25286 !! test
25287 Lists: 6. Escape bullets in SOL position
25288 !! options
25289 parsoid=html2wt
25290 !! html/parsoid
25291 <p><!--cmt-->*foo</p>
25292 !! wikitext
25293 <!--cmt--><nowiki>*</nowiki>foo
25294 !!end
25295
25296 !! test
25297 Lists: 7. Escape bullets in a multi-line context
25298 !! options
25299 parsoid=html2wt
25300 !! html/parsoid
25301 <p>a
25302 *b
25303 </p>
25304 !! wikitext
25305 a
25306 <nowiki>*</nowiki>b
25307 !!end
25308
25309 !! test
25310 Lists: 8. Escape colons only if not present in tags
25311 !! options
25312 parsoid=html2wt
25313 !! html/parsoid
25314 <dl><dt>a:b<i>c:d</i></dt></dl>
25315 !! wikitext
25316 ; <nowiki>a:b</nowiki>''c:d''
25317 !! end
25318
25319 #### --------------- HRs ---------------
25320 #### 1. Single line
25321 #### -----------------------------------
25322
25323 !! test
25324 HRs: 1. Single line
25325 !! options
25326 parsoid=html2wt
25327 !! html/parsoid
25328 <hr />----
25329 <hr />=foo=
25330 <hr />*foo
25331 !! wikitext
25332 ----<nowiki>----</nowiki>
25333 ----=foo=
25334 ----*foo
25335 !! end
25336
25337 #### --------------- Tables ---------------
25338 #### 1a. Simple example
25339 #### 1b. No escaping needed (!foo)
25340 #### 1c. No escaping needed (|foo)
25341 #### 1d. No escaping needed (|}foo)
25342 ####
25343 #### 2a. Nested in td (<td>foo|bar</td>)
25344 #### 2b. Nested in td (<td>foo||bar</td>)
25345 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25346 ####
25347 #### 3a. Nested in th (<th>foo!bar</th>)
25348 #### 3b. Nested in th (<th>foo!!bar</th>)
25349 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25350 ####
25351 #### 4a. Escape -
25352 #### 4b. Escape +
25353 #### 4c. No escaping needed
25354 #### --------------------------------------
25355
25356 !! test
25357 Tables: 1a. Simple example
25358 !! options
25359 parsoid=html2wt
25360 !! html/parsoid
25361 <p>{|
25362 |}
25363 </p>
25364 !! wikitext
25365 <nowiki>{|</nowiki>
25366 |}
25367 !! end
25368
25369 !! test
25370 Tables: 1b. No escaping needed
25371 !! options
25372 parsoid=html2wt
25373 !! html/parsoid
25374 <p>!foo
25375 </p>
25376 !! wikitext
25377 !foo
25378 !! end
25379
25380 !! test
25381 Tables: 1c. No escaping needed
25382 !! options
25383 parsoid=html2wt
25384 !! html/parsoid
25385 <p>|foo
25386 </p>
25387 !! wikitext
25388 |foo
25389 !! end
25390
25391 !! test
25392 Tables: 1d. No escaping needed
25393 !! options
25394 parsoid=html2wt
25395 !! html/parsoid
25396 <p>|}foo
25397 </p>
25398 !! wikitext
25399 |}foo
25400 !! end
25401
25402 !! test
25403 Tables: 2a. Nested in td
25404 !! options
25405 parsoid=html2wt
25406 !! html/parsoid
25407 <table><tbody><tr>
25408 <td>foo|bar</td></tr>
25409 <tr><td>x<div>a|b</div></td>
25410 </tbody></table>
25411 !! wikitext
25412 {|
25413 |<nowiki>foo|bar</nowiki>
25414 |-
25415 |x<div><nowiki>a|b</nowiki></div>
25416 |}
25417 !! html/php+tidy
25418 <table>
25419 <tbody><tr>
25420 <td>foo|bar
25421 </td></tr>
25422 <tr>
25423 <td>x<div>a|b</div>
25424 </td></tr></tbody></table>
25425 !! end
25426
25427 !! test
25428 Tables: 2b. Nested in td
25429 !! options
25430 parsoid=html2wt
25431 !! html/parsoid
25432 <table><tbody><tr>
25433 <td>foo||bar</td>
25434 <td>a<i>b||c</i></td>
25435 <td>a<i><div>b||c</div></i></td>
25436 </tr></tbody></table>
25437 !! wikitext
25438 {|
25439 |<nowiki>foo||bar</nowiki>
25440 |a''<nowiki>b||c</nowiki>''
25441 |a''<div><nowiki>b||c</nowiki></div>''
25442 |}
25443 !! html/php
25444 <table>
25445 <tr>
25446 <td>foo||bar
25447 </td>
25448 <td>a<i>b||c</i>
25449 </td>
25450 <td>a<i><div>b||c</div></i>
25451 </td></tr></table>
25452
25453 !! end
25454
25455 !! test
25456 Tables: 2c. Nested in td -- no escaping needed
25457 !! options
25458 parsoid=html2wt
25459 !! html/*
25460 <table>
25461 <tr>
25462 <td>foo!!bar
25463 </td></tr></table>
25464
25465 !! wikitext
25466 {|
25467 |foo!!bar
25468 |}
25469 !! end
25470
25471 !! test
25472 Tables: 3a. Nested in th
25473 !! options
25474 parsoid=html2wt
25475 !! html/*
25476 <table>
25477 <tr>
25478 <th>foo!bar
25479 </th></tr></table>
25480
25481 !! wikitext
25482 {|
25483 !foo!bar
25484 |}
25485 !! end
25486
25487 !! test
25488 Tables: 3b. Nested in th
25489 !! options
25490 parsoid=html2wt
25491 !! html/parsoid
25492 <table><tbody>
25493 <tr><th>foo!!bar</th>
25494 <th><i>foo|bar</i></th>
25495 <th><i>foo!!bar</i></th>
25496 <th><i><span>foo!!bar</span></i></th>
25497 </tr></tbody></table>
25498 !! wikitext
25499 {|
25500 !<nowiki>foo!!bar</nowiki>
25501 !''<nowiki>foo|bar</nowiki>''
25502 !''<nowiki>foo!!bar</nowiki>''
25503 !''<span><nowiki>foo!!bar</nowiki></span>''
25504 |}
25505 !! html/php
25506 <table>
25507 <tr>
25508 <th>foo!!bar
25509 </th>
25510 <th><i>foo|bar</i>
25511 </th>
25512 <th><i>foo!!bar</i>
25513 </th>
25514 <th><i><span>foo!!bar</span></i>
25515 </th></tr></table>
25516
25517 !! end
25518
25519 !! test
25520 Tables: 3c. Nested in th
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <table><tbody>
25525 <tr><th>foo||bar</th>
25526 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25527 </tr></tbody></table>
25528 !! wikitext
25529 {|
25530 !<nowiki>foo||bar</nowiki>
25531 !<nowiki>foo||bar</nowiki>
25532 |}
25533 !! html/php
25534 <table>
25535 <tr>
25536 <th>foo||bar
25537 </th>
25538 <th>foo||bar
25539 </th></tr></table>
25540
25541 !! end
25542
25543 !! test
25544 Tables: 4a. Escape -
25545 !! options
25546 parsoid=html2wt
25547 !! html/*
25548 <table>
25549 <tr>
25550 <th>-bar
25551 </th></tr>
25552 <tr>
25553 <td>-bar
25554 </td></tr></table>
25555
25556 !! wikitext
25557 {|
25558 !-bar
25559 |-
25560 |<nowiki>-bar</nowiki>
25561 |}
25562 !! end
25563
25564 !! test
25565 Tables: 4b. Escape +
25566 !! options
25567 parsoid=html2wt
25568 !! html/*
25569 <table>
25570 <tr>
25571 <th>+bar
25572 </th></tr>
25573 <tr>
25574 <td>+bar
25575 </td></tr></table>
25576
25577 !! wikitext
25578 {|
25579 !+bar
25580 |-
25581 |<nowiki>+bar</nowiki>
25582 |}
25583 !! end
25584
25585 !! test
25586 Tables: 4c. No escaping needed
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <table><tbody>
25591 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25592 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25593 <tr><td>foo
25594 <p>bar|baz
25595 +bar
25596 -bar</p></td></tr>
25597 <tr><td>x
25598 <div>a|b</div></td>
25599 </tbody></table>
25600 !! wikitext
25601 {|
25602 |foo-bar
25603 |foo+bar
25604 |-
25605 |''foo''-bar
25606 |''foo''+bar
25607 |-
25608 |foo
25609 bar|baz
25610 +bar
25611 -bar
25612 |-
25613 |x
25614 <div>a|b</div>
25615 |}
25616 !! html/php
25617 <table>
25618 <tr>
25619 <td>foo-bar
25620 </td>
25621 <td>foo+bar
25622 </td></tr>
25623 <tr>
25624 <td><i>foo</i>-bar
25625 </td>
25626 <td><i>foo</i>+bar
25627 </td></tr>
25628 <tr>
25629 <td>foo
25630 <p>bar|baz
25631 +bar
25632 -bar
25633 </p>
25634 </td></tr>
25635 <tr>
25636 <td>x
25637 <div>a|b</div>
25638 </td></tr></table>
25639
25640 !! end
25641
25642 !! test
25643 Tables: 4d. No escaping needed
25644 !! options
25645 parsoid=html2wt
25646 !! html/parsoid
25647 <table>
25648 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25649 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25650 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25651 </tbody></table>
25652 !! wikitext
25653 {|
25654 |[[Foo]]-bar
25655 ||+1
25656 ||-2
25657 |}
25658 !! html/php
25659 <table>
25660 <tr>
25661 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25662 </td>
25663 <td>+1
25664 </td>
25665 <td>-2
25666 </td></tr></table>
25667
25668 !! end
25669
25670 !! test
25671 T97430: Don't emit empty nowiki pairs around marker meta tags
25672 !! options
25673 parsoid=html2wt
25674 !! html/parsoid
25675 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25676 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25677 !! wikitext
25678 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25679 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25680 !! end
25681
25682 !! test
25683 Unclosed xmlish element in table line shouldn't eat end delimiters
25684 !! options
25685 parsoid=html2wt
25686 !! html/parsoid
25687 <table>
25688 <tbody><tr><td> &lt;foo</td>
25689 <td> bar></td></tr>
25690 </tbody></table>
25691 !! wikitext
25692 {|
25693 | <foo
25694 | bar>
25695 |}
25696 !! html/php
25697 <table>
25698 <tr>
25699 <td> &lt;foo
25700 </td>
25701 <td> bar&gt;
25702 </td></tr></table>
25703
25704 !! end
25705
25706 #### --------------- Links ----------------
25707 #### 1. Quote marks in link text
25708 #### 2. Wikilinks: Escapes needed
25709 #### 3. Wikilinks: No escapes needed
25710 #### 4. Extlinks: Escapes needed
25711 #### 5. Extlinks: No escapes needed
25712 #### --------------------------------------
25713 !! test
25714 Links 1. WikiLinks: No escapes needed
25715 !! options
25716 parsoid=html2wt
25717 !! html/parsoid
25718 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25719 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25720 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25721 !! wikitext
25722 [[Foo|Foo''boo'']]
25723 [[Foo|[Foobar]]]
25724 [[Foo|x [Foobar] x]]
25725 !! html/php
25726 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25727 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25728 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25729 </p>
25730 !! end
25731
25732 !! test
25733 Links 2. WikiLinks: Escapes needed
25734 !! options
25735 parsoid=html2wt
25736 !! html/parsoid
25737 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25738 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25739 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25740 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25741 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25742 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25743 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25744 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25745 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25746 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25747 !! wikitext
25748 [[Foo|<nowiki>Foobar]</nowiki>]]
25749 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25750 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25751 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25752 [[Foo|<nowiki>|Bar</nowiki>]]
25753 [[Foo|<nowiki>]]bar</nowiki>]]
25754 [[Foo|<nowiki>[[bar</nowiki>]]
25755 [[Foo|<nowiki>x [[ y</nowiki>]]
25756 [[Foo|<nowiki>x ]] y</nowiki>]]
25757 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25758 !! html/php
25759 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25760 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25761 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25762 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25763 <a href="/wiki/Foo" title="Foo">|Bar</a>
25764 <a href="/wiki/Foo" title="Foo">]]bar</a>
25765 <a href="/wiki/Foo" title="Foo">[[bar</a>
25766 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25767 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25768 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25769 </p>
25770 !! end
25771
25772 !! test
25773 Links 3. WikiLinks: No escapes needed
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25778 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25779 !! wikitext
25780 [[Foo|[Foobar]]
25781 [[Foo|foo|bar]]
25782 !! html/php
25783 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25784 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25785 </p>
25786 !! end
25787
25788 !! test
25789 Links 4. ExtLinks: Escapes needed
25790 !! options
25791 parsoid=html2wt
25792 !! html/parsoid
25793 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25794 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25795 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25796 <p>[http://google.com]</p>
25797 <p>[http://google.com google]</p>
25798 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25799 <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>
25800 !! wikitext
25801 [http://google.com <nowiki>[google]</nowiki>]
25802 [http://google.com <nowiki>google]</nowiki>]
25803 [http://google.com <nowiki>goog] le</nowiki>]
25804
25805 <nowiki>[http://google.com]</nowiki>
25806
25807 <nowiki>[http://google.com google]</nowiki>
25808
25809 [http://google.com<nowiki>]</nowiki>
25810
25811 [{{echo|http://google.com}}<nowiki>]</nowiki>
25812 !! html/php
25813 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25814 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25815 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25816 </p><p>[http://google.com]
25817 </p><p>[http://google.com google]
25818 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25819 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25820 </p>
25821 !! end
25822
25823 !! test
25824 Links 5. ExtLinks: No escapes needed
25825 !! options
25826 parsoid=html2wt
25827 !! html/parsoid
25828 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25829 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25830 !! wikitext
25831 [http://google.com [google]
25832
25833 [[http://google.com]]
25834 !! html/php
25835 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25836 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25837 </p>
25838 !! end
25839
25840 !! test
25841 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25842 !! options
25843 parsoid=html2wt
25844 !! html/parsoid
25845 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25846 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25847 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25848 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25849 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25850 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25851 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25852 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25853 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25854 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25855 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25856 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25857 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25858 </p>
25859 !! wikitext
25860 x<nowiki/>http://example.com<nowiki/>y
25861 http://example.com<nowiki/>?x
25862 http://example.com<nowiki/>&x
25863 http://example.com<nowiki/>'x
25864 http://example.com<nowiki/>,x
25865 http://example.com<nowiki/>.x
25866 http://example.com<nowiki/>;x
25867 http://example.com<nowiki/>:x
25868 http://example.com<nowiki/>;x
25869 http://example.com<nowiki/>!x
25870 http://example.com<nowiki/>=x
25871 http://example.com<nowiki/>(x)
25872 http://example.com(x<nowiki/>)
25873 !! end
25874
25875 !! test
25876 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25877 !! options
25878 parsoid=html2wt
25879 !! html/parsoid
25880 <p>x
25881 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25882 y
25883 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25884 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25885 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25886 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25887 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25888 </p>
25889 !! wikitext
25890 x
25891 http://example.com
25892 y
25893 "http://example.com"
25894 (http://example.com)
25895 (http://example.com) foo
25896 http://example.com,
25897 http://example.com, foo
25898 !! html/php
25899 <p>x
25900 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25901 y
25902 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25903 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25904 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25905 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25906 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25907 </p>
25908 !! end
25909
25910 !! test
25911 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25912 !! options
25913 parsoid=html2wt
25914 !! html/parsoid
25915 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25916 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25917 !! wikitext
25918 http://example.com.,;:!?\
25919 -http://example.com:
25920 !! html/php
25921 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25922 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25923 </p>
25924 !! end
25925
25926 !! test
25927 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25928 !! options
25929 parsoid=html2wt
25930 !! html/parsoid
25931 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25932 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25933 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25934 !! wikitext
25935 RFC 123<nowiki/>4
25936 RFC 123<nowiki/>y
25937 X<nowiki/>RFC 123<nowiki/>y
25938 !! end
25939
25940 !! test
25941 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25946 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25947 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25948 </p>
25949 !! wikitext
25950 RFC 123?foo
25951 RFC 123&foo
25952 -RFC 123-
25953 !! html/php
25954 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25955 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25956 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25957 </p>
25958 !! end
25959
25960 !! test
25961 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25962 !! options
25963 parsoid=html2wt
25964 !! html/parsoid
25965 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25966 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25967 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25968 !! wikitext
25969 PMID 123<nowiki/>4
25970 PMID 123<nowiki/>y
25971 X<nowiki/>PMID 123<nowiki/>y
25972 !! end
25973
25974 !! test
25975 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25980 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25981 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25982 </p>
25983 !! wikitext
25984 PMID 123?foo
25985 PMID 123&foo
25986 -PMID 123-
25987 !! html/php
25988 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25989 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25990 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25991 </p>
25992 !! end
25993
25994 !! test
25995 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25996 !! options
25997 parsoid=html2wt
25998 !! html/parsoid
25999 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26000 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26001 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26002 </p>
26003 !! wikitext
26004 ISBN 1234567890<nowiki/>1
26005 ISBN 1234567890<nowiki/>x
26006 a<nowiki/>ISBN 1234567890<nowiki/>b
26007 !! end
26008
26009 !! test
26010 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26011 !! options
26012 parsoid=html2wt
26013 !! html/parsoid
26014 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26015 !! wikitext
26016 -ISBN 1234567890's
26017 !! html/php
26018 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26019 </p>
26020 !! end
26021
26022 !! test
26023 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26024 !! options
26025 parsoid=html2wt
26026 !! html/*
26027 <p>this is not a link: http://example.com
26028 </p>
26029 !! wikitext
26030 this is not a link: <nowiki>http://example.com</nowiki>
26031 !! end
26032
26033 !! test
26034 Links 15. Link trails can't become link prefixes.
26035 !! options
26036 language=is
26037 parsoid=html2wt
26038 !! html/parsoid
26039 <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>
26040 !! wikitext
26041 [[Söfnuður]]-[[00]]
26042 !! html/php
26043 <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>
26044 </p>
26045 !! end
26046
26047 #### --------------- Quotes ---------------
26048 #### 1. Quotes inside <b> and <i>
26049 #### 2. Link fragments separated by <i> and <b> tags
26050 #### 3. Link fragments inside <i> and <b>
26051 #### 4. No escaping needed
26052 #### --------------------------------------
26053 !! test
26054 1a. Quotes inside <b> and <i>
26055 !! options
26056 parsoid=html2wt
26057 !! html/*
26058 <p><i>'foo'</i>
26059 <i>''foo''</i>
26060 <i>'''foo'''</i>
26061 <i>foo</i>'s
26062 <b>'foo'</b>
26063 <b>''foo''</b>
26064 <b>'''foo'''</b>
26065 <b>foo'<i>bar'</i>baz</b>
26066 <b>foo</b>'s
26067 '<i>foo</i>
26068 <i>foo</i>'
26069 <i>foo'</i>'
26070 '<i>foo</i>'
26071 '<b>foo</b>
26072 <b>foo</b>'
26073 '<b>foo</b>'
26074 <i>fools'<span> errand</span></i>
26075 <i><span>fool</span>'s errand</i>
26076 '<i>foo</i> bar '<i>baz</i>
26077 a|!*#-:;+-~[]{}b'<i>x</i>
26078 </p>
26079 !! wikitext
26080 ''<nowiki/>'foo'''
26081 ''<nowiki>''foo''</nowiki>''
26082 ''<nowiki>'''foo'''</nowiki>''
26083 ''foo''<nowiki/>'s
26084 '''<nowiki/>'foo''''
26085 '''<nowiki>''foo''</nowiki>'''
26086 '''<nowiki>'''foo'''</nowiki>'''
26087 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26088 '''foo'''<nowiki/>'s
26089 '''foo''
26090 ''foo''<nowiki/>'
26091 ''foo'''<nowiki/>'
26092 '''foo''<nowiki/>'
26093 ''''foo'''
26094 '''foo'''<nowiki/>'
26095 ''''foo'''<nowiki/>'
26096 ''fools'<span> errand</span>''
26097 ''<span>fool</span>'s errand''
26098 '<nowiki/>''foo'' bar '''baz''
26099 a|!*#-:;+-~[]{}b'''x''
26100 !! end
26101
26102 !! test
26103 1b. Quotes inside <b> and <i> with other tags on same line
26104 !! options
26105 parsoid=html2wt
26106 !! html/parsoid
26107 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26108 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26109 <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>
26110 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26111 '<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>
26112 '<i>foo</i> <div title="name">test</div>
26113 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26114 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26115 <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>
26116 </ol>
26117 !! wikitext
26118 '''a'' foo ''[[bar]]''
26119 ''a''' foo ''[[bar]]''
26120 ''a''' foo '''{{echo|[[bar]]}}'''
26121 [[foo]] x'''[[bar]]''
26122 '''foo'' <ref>test</ref>
26123 '''foo'' <div title="name">test</div>
26124 '''foo'' and <br> bar
26125 <references />
26126 !! end
26127
26128 !! test
26129 2. Link fragments separated by <i> and <b> tags
26130 !! options
26131 parsoid=html2wt
26132 !! html/parsoid
26133 <p>[[<i>foo</i>hello]]</p>
26134 <p>[[<b>foo</b>hello]]</p>
26135 !! wikitext
26136 [[''foo''<nowiki>hello]]</nowiki>
26137
26138 [['''foo'''<nowiki>hello]]</nowiki>
26139 !! end
26140
26141 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26142 # this is one of the shortcomings of this format
26143 !! test
26144 3. Link fragments inside <i> and <b>
26145 !! options
26146 parsoid=html2wt
26147 !! html/parsoid
26148 <p><i>[[foo</i>]]</p>
26149 <p><b>[[foo</b>]]</p>
26150 !! wikitext
26151 ''[[foo''<nowiki>]]</nowiki>
26152
26153 '''[[foo'''<nowiki>]]</nowiki>
26154 !! end
26155
26156 !! test
26157 4. No escaping needed
26158 !! options
26159 parsoid=html2wt
26160 !! html/parsoid
26161 <p>'<span><i>bar</i></span>'
26162 '<span><b>bar</b></span>'
26163 'a:b'foo
26164 </p>
26165 !! wikitext
26166 '<span>''bar''</span>'
26167 '<span>'''bar'''</span>'
26168 'a:b'foo
26169 !! end
26170
26171 #### ----------- Paragraphs ---------------
26172 #### 1. No unnecessary escapes
26173 #### --------------------------------------
26174
26175 !! test
26176 1. No unnecessary escapes
26177 !! options
26178 parsoid=html2wt
26179 !! html/parsoid
26180 <p>bar <span>[[foo]]</span>
26181 </p><p>=bar <span>[[foo]]</span>
26182 </p><p>[[bar <span>[[foo]]</span>
26183 </p><p>]]bar <span>[[foo]]</span>
26184 </p><p>=bar <span>foo]]</span>=
26185 </p>
26186 !! wikitext
26187 bar <span><nowiki>[[foo]]</nowiki></span>
26188
26189 =bar <span><nowiki>[[foo]]</nowiki></span>
26190
26191 [[bar <span><nowiki>[[foo]]</nowiki></span>
26192
26193 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26194
26195 =bar <span>foo]]</span><nowiki>=</nowiki>
26196 !!end
26197
26198 #### ----------------------- PRE --------------------------
26199 #### 1. Leading whitespace in SOL context should be escaped
26200 #### ------------------------------------------------------
26201 !! test
26202 1. Leading whitespace in SOL context should be escaped
26203 !! options
26204 parsoid=html2wt
26205 !! html/parsoid
26206 <p> a</p>
26207
26208 <p> a</p>
26209
26210 <p> a(tab)</p>
26211
26212 <p> a
26213 <!--cmt-->
26214 a</p>
26215
26216 <p>a
26217 b</p>
26218
26219 <p>a
26220 b</p>
26221
26222 <p>a
26223 b</p>
26224 !! wikitext
26225 <nowiki> </nowiki>a
26226
26227 <nowiki> </nowiki> a
26228
26229 a(tab)
26230
26231 <nowiki> </nowiki> a
26232 <!--cmt-->
26233 <nowiki> </nowiki>a
26234
26235 a
26236 <nowiki> </nowiki>b
26237
26238 a
26239 b
26240
26241 a
26242 b
26243 !! html/php
26244 <p> a
26245 </p><p> a
26246 </p><p> a(tab)
26247 </p><p> a
26248 a
26249 </p><p>a
26250 b
26251 </p><p>a
26252 b
26253 </p><p>a
26254 b
26255 </p>
26256 !! end
26257
26258 !! test
26259 2. Leading whitespace in non-indent-pre contexts should not be escaped
26260 !! options
26261 parsoid=html2wt
26262 !! html/parsoid
26263 <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>
26264 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26265 <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>
26266 b</span></li>
26267 </ol>
26268 !! wikitext
26269 foo <ref>''a''
26270 b</ref>
26271 <references />
26272 !! end
26273
26274 !! test
26275 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26276 !! options
26277 parsoid=html2wt
26278 !! html/parsoid
26279 <blockquote>
26280 <p>
26281 a
26282 <span>b</span>
26283 c</p>
26284 </blockquote>
26285 !! wikitext
26286 <blockquote>
26287 a
26288 <span>b</span>
26289 c
26290 </blockquote>
26291 !! end
26292
26293 !! test
26294 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26295 !! options
26296 parsoid=html2wt
26297 !! html/parsoid
26298 <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>
26299 !! wikitext
26300 [[File:Foobar.jpg|thumb|caption]]
26301 !! end
26302
26303 !! test
26304 5. Nowiki escaping should account for indent-pres
26305 !! options
26306 parsoid=html2wt
26307 !! html/parsoid
26308 <pre>==foo==</pre>
26309 !! wikitext
26310 ==foo==
26311 !! end
26312
26313 !!test
26314 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26315 !! options
26316 parsoid=html2wt
26317 !! html/parsoid
26318 <pre>
26319 * foo
26320 * bar
26321 </pre>
26322 !! wikitext
26323 * foo
26324 * bar
26325 !! end
26326
26327 #### --------------- Behavior Switches --------------------
26328
26329 !! test
26330 1. Valid behavior switches should be escaped
26331 !! options
26332 parsoid=html2wt
26333 !! html/parsoid
26334 __TOC__
26335 <i>__TOC__</i>
26336 !! wikitext
26337 <nowiki>__TOC__</nowiki>
26338 ''<nowiki>__TOC__</nowiki>''
26339 !! end
26340
26341 !! test
26342 2. Invalid behavior switches should not be escaped
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 __TOO__
26347 __|__
26348 !! wikitext
26349 __TOO__
26350 __|__
26351 !! end
26352
26353 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26354 !! test
26355 Behavior switches should be SOL-transparent
26356 !! options
26357 parsoid=html2wt
26358 !! html/parsoid
26359 <meta property="mw:PageProp/toc" />
26360
26361 <!-- this one's bogus -->
26362 <pre>__TOO__</pre>
26363
26364 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26365
26366 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26367 !! wikitext
26368 __TOC__
26369
26370 <!-- this one's bogus -->
26371 __TOO__
26372
26373 __TOC__ foo
26374
26375 __TOC__
26376 bar
26377 !! end
26378
26379 #### --------------- HTML tags ---------------
26380 #### 1. a tags
26381 #### 2. other tags
26382 #### 3. multi-line html tag
26383 #### 4. extension tags
26384 #### -----------------------------------------
26385 !! test
26386 1. a tags
26387 !! options
26388 parsoid=html2wt
26389 !! html/parsoid
26390 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26391 !! wikitext
26392 <a href="http://google.com">google</a>
26393 !! end
26394
26395 !! test
26396 2. other tags
26397 !! options
26398 parsoid=html2wt
26399 !! html/parsoid
26400 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26401 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26402 <li> &lt;td&gt;</li></ul>
26403
26404 !! wikitext
26405 * <nowiki><div>foo</div></nowiki>
26406 * <nowiki><div style="color:red">foo</div></nowiki>
26407 * <nowiki><td></nowiki>
26408 !! end
26409
26410 !! test
26411 3. multi-line html tag
26412 !! options
26413 parsoid=html2wt
26414 !! html/parsoid
26415 <p>&lt;div
26416 &gt;foo&lt;/div
26417 &gt;
26418 </p>
26419 !! wikitext
26420 <nowiki><div
26421 >foo</div
26422 ></nowiki>
26423 !! end
26424
26425 !! test
26426 4. extension tags
26427 !! options
26428 parsoid=html2wt
26429 !! html/parsoid
26430 <p>&lt;ref&gt;foo&lt;/ref&gt;
26431 </p><p>&lt;ref&gt;bar
26432 </p><p>baz&lt;/ref&gt;
26433 </p>
26434 !! wikitext
26435 <nowiki><ref>foo</ref></nowiki>
26436
26437 <nowiki><ref>bar</nowiki>
26438
26439 baz<nowiki></ref></nowiki>
26440 !! end
26441
26442 #### --------------- Others ---------------
26443 !! test
26444 Escaping nowikis
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26449 </p>
26450 !! wikitext
26451 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26452 !! end
26453
26454 ## The quote-char in the input is necessary for triggering the bug
26455 !! test
26456 (T54035) Nowiki-escaping should not get tripped by " :" in text
26457 !! options
26458 parsoid=html2wt
26459 !! html/parsoid
26460 <p>foo's bar :</p>
26461 !! wikitext
26462 foo's bar :
26463 !! end
26464
26465 #----------- End of wikitext escaping tests --------------
26466
26467 !! test
26468
26469 Tag-like HTML structures are passed through as text
26470 !! wikitext
26471 <x y>
26472
26473 <x.y>
26474
26475 <x-y>
26476
26477 1>2
26478
26479 x<y
26480
26481 a>b
26482
26483 1<d e>f
26484 !! html
26485 <p>&lt;x y&gt;
26486 </p><p>&lt;x.y&gt;
26487 </p><p>&lt;x-y&gt;
26488 </p><p>1&gt;2
26489 </p><p>x&lt;y
26490 </p><p>a&gt;b
26491 </p><p>1&lt;d e&gt;f
26492 </p>
26493 !! end
26494
26495 !! test
26496 HTML tag with necessary entities in attributes
26497 !! wikitext
26498 <span title="&amp;amp;">foo</span>
26499 !! html
26500 <p><span title="&amp;amp;">foo</span>
26501 </p>
26502 !! end
26503
26504 !! test
26505 HTML tag with 'unnecessary' entity encoding in attributes
26506 !! wikitext
26507 <span title="&amp;">foo</span>
26508 !! html
26509 <p><span title="&amp;">foo</span>
26510 </p>
26511 !! end
26512
26513 !! test
26514 HTML tag with broken attribute value quoting
26515 !! options
26516 parsoid=wt2html,html2html
26517 !! wikitext
26518 <span title="Hello world>Foo</span>
26519 !! html/php
26520 <p><span title="Hello world">Foo</span>
26521 </p>
26522 !! html/parsoid
26523 <p><span title="Hello world">Foo</span></p>
26524 !! end
26525
26526 !! test
26527 Self-closed tag with broken attribute value quoting
26528 !! options
26529 parsoid=wt2html,html2html
26530 !! wikitext
26531 <div title="Hello world />Foo
26532 !! html/php+tidy
26533 <div title="Hello world"></div><p>Foo
26534 </p>
26535 !! html/parsoid
26536 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26537 !! end
26538
26539 !! test
26540 Table with broken attribute value quoting
26541 !! options
26542 parsoid=wt2html,html2html
26543 !! wikitext
26544 {|
26545 | title="Hello world|Foo
26546 |}
26547 !! html/php
26548 <table>
26549 <tr>
26550 <td title="Hello world">Foo
26551 </td></tr></table>
26552
26553 !! html/parsoid
26554 <table>
26555 <tr>
26556 <td title="Hello world">Foo
26557 </td></tr></table>
26558
26559 !! end
26560
26561 !! test
26562 Table with broken attribute value quoting on consecutive lines
26563 !! options
26564 parsoid=wt2html,html2html
26565 !! wikitext
26566 {|
26567 | title="Hello world|Foo
26568 | style="color:red|Bar
26569 |}
26570 !! html/php
26571 <table>
26572 <tr>
26573 <td title="Hello world">Foo
26574 </td>
26575 <td style="color:red">Bar
26576 </td></tr></table>
26577
26578 !! html/parsoid
26579 <table><tbody>
26580 <tr>
26581 <td title="Hello world">Foo
26582 </td><td style="color: red">Bar
26583 </td></tr></tbody></table>
26584
26585 !! end
26586
26587 !!test
26588 Accept empty td cell attribute
26589 !! wikitext
26590 {|
26591 | align="center" | foo || |
26592 |}
26593 !! html
26594 <table>
26595 <tr>
26596 <td align="center"> foo </td>
26597 <td>
26598 </td></tr></table>
26599
26600 !!end
26601
26602 !!test
26603 Non-empty attributes in th-cells
26604 !! wikitext
26605 {|
26606 ! Foo !! style="color: red" | Bar
26607 |}
26608 !! html
26609 <table>
26610 <tr>
26611 <th> Foo </th>
26612 <th style="color: red"> Bar
26613 </th></tr></table>
26614
26615 !!end
26616
26617 !!test
26618 Accept empty attributes in th-cells
26619 !! wikitext
26620 {|
26621 !| foo !!| bar
26622 |}
26623 !! html
26624 <table>
26625 <tr>
26626 <th> foo </th>
26627 <th> bar
26628 </th></tr></table>
26629
26630 !!end
26631
26632 !!test
26633 Empty table rows go away
26634 !! wikitext
26635 {|
26636 | Hello
26637 | there
26638 |- class="foo"
26639 |-
26640 |}
26641 !! html
26642 <table>
26643 <tr>
26644 <td> Hello
26645 </td>
26646 <td> there
26647 </td></tr>
26648
26649 </table>
26650
26651 !! end
26652
26653 ###
26654 ### Parsoid-centric tests for testing RTing of inter-element separators
26655 ### Edge cases not tested by existing parser tests and specific to
26656 ### Parsoid-specific serialization strategies.
26657 ###
26658
26659 !!test
26660 RT-ed inter-element separators should be valid separators
26661 !! wikitext
26662 {|
26663 |- [[foo]]
26664 |}
26665 !! html/php
26666 <table>
26667
26668 </table>
26669
26670 !! html/parsoid
26671 <table>
26672 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26673 </tbody></table>
26674 !!end
26675
26676 # Parsoid-only test of a DOM pass
26677 !!test
26678 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26679 !! wikitext
26680 {|
26681 |<small>foo
26682 bar
26683 |}
26684
26685 {|
26686 |<small>foo<small>
26687 |}
26688 !! html/parsoid
26689 <table>
26690 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26691 <p>bar</p></small></td></tr>
26692 </tbody></table>
26693
26694 <table>
26695 <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>
26696 </tbody></table>
26697 !!end
26698
26699 # Note that the "style" attribute is really a template parameter here.
26700 # The = would have to be {{=}} if you wanted the literal.
26701 !!test
26702 Empty TD followed by TD with tpl-generated attribute
26703 !! wikitext
26704 {|
26705 |-
26706 |
26707 |{{echo|style='color:red'}}|foo
26708 |}
26709 !! html
26710 <table>
26711
26712 <tr>
26713 <td>
26714 </td>
26715 <td>foo
26716 </td></tr></table>
26717
26718 !!end
26719
26720 !!test
26721 Indented table with an empty td
26722 !! wikitext
26723 {|
26724 |-
26725 |
26726 |foo
26727 |}
26728 !! html
26729 <table>
26730
26731 <tr>
26732 <td>
26733 </td>
26734 <td>foo
26735 </td></tr></table>
26736
26737 !!end
26738
26739 ## We have some newline diffs RT-ing this edge case
26740 ## and it is not important enough -- we seem to be emitting
26741 ## at most 2 newlines after a </tr> and this is unrelated to
26742 ## the issue from T85627 that this is testing.
26743 !!test
26744 Indented table with blank lines in between (T85627)
26745 !! options
26746 parsoid=wt2html
26747 !! wikitext
26748 {|
26749 |foo
26750
26751
26752 |}
26753 !! html
26754 <table>
26755
26756 <tr>
26757 <td>foo
26758 </td></tr></table>
26759
26760 !!end
26761
26762 !!test
26763 Indented block & table
26764 !! wikitext
26765 <div>foo</div>
26766 {|
26767 |foo
26768 |}
26769 !! html/php
26770 <div>foo</div>
26771 <table>
26772 <tr>
26773 <td>foo
26774 </td></tr></table>
26775
26776 !! html/parsoid
26777 <div data-parsoid='{"stx":"html"}'>foo</div>
26778 <table><tbody>
26779 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26780 </tbody></table>
26781 !!end
26782
26783 !! test
26784 Indent and comment before table row
26785 !! wikitext
26786 {|
26787 <!--hi-->|-
26788 | there
26789 |}
26790 !! html/php
26791 <table>
26792
26793 <tr>
26794 <td> there
26795 </td></tr></table>
26796
26797 !! html/parsoid
26798 <table>
26799 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26800 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26801 </tbody></table>
26802 !! end
26803
26804 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26805 !!test
26806 Empty TR followed by a template-generated TR
26807 !!options
26808 parsoid
26809 !! wikitext
26810 {|
26811 |-
26812 {{echo|<tr><td>foo</td></tr>}}
26813 |}
26814 !! html
26815 <table>
26816 <tbody>
26817 <tr class='mw-empty-elt'></tr>
26818 <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}}]}'>
26819 <td>foo</td></tr>
26820 </tbody></table>
26821 !!end
26822
26823 ## PHP and parsoid output differ for this, and since this is primarily
26824 ## for testing Parsoid's serializer, marking this Parsoid only
26825 !!test
26826 Empty TR followed by mixed-ws-comment line should RT correctly
26827 !!options
26828 parsoid
26829 !! wikitext
26830 {|
26831 |-
26832 <!--c-->
26833 |-
26834 <!--c--> <!--d-->
26835 |}
26836 !! html
26837 <table>
26838 <tbody>
26839 <tr class='mw-empty-elt'></tr>
26840 <!--c-->
26841 <tr>
26842 <!--c--> </tr><!--d-->
26843 </tbody></table>
26844
26845 !!end
26846
26847 !!test
26848 Multi-line image caption generated by templates with/without trailing newlines
26849 !! wikitext
26850 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26851 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26852 !! html/parsoid
26853 <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>
26854 <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>
26855 !!end
26856
26857 !! test
26858 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26859 !! options
26860 parsoid=html2wt
26861 !! html/parsoid
26862 <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>
26863
26864 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26865 !! wikitext
26866 <includeonly>foo</includeonly>
26867 new para
26868
26869 [[Category:Foo]]
26870
26871 = new heading =
26872 !! end
26873
26874 ## PHP emits broken html for this, and since this is primarily
26875 ## a Parsoid serializer test, marking this Parsoid only
26876 !!test
26877 Improperly nested inline or quotes tags with whitespace in between
26878 !! wikitext
26879 <span> <s>x</span> </s>
26880 ''' ''x''' ''
26881 !! html/parsoid
26882 <p><span> <s>x</s></span><s> </s>
26883 <b> <i>x</i></b><i> </i>
26884 </p>
26885 !!end
26886
26887 !!test
26888 Encapsulate protected attributes from wt
26889 !! wikitext
26890 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26891
26892 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26893 | ok
26894 |}
26895 !! html/parsoid
26896 <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>
26897
26898 <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">
26899 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26900 </tbody></table>
26901 !!end
26902
26903 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26904 ## Having nested or stray pre tags results in the attempt to add duplicates,
26905 ## causing an assertion fail. This test tries to prevent that situation.
26906 !!test
26907 Ensure ParagraphWrapper can deal with stray closing pre tags
26908 !!options
26909 parsoid=wt2html
26910 !! wikitext
26911 plain text</pre>
26912 !! html/parsoid
26913 plain text
26914 !!end
26915
26916 !!test
26917 1. Ensure fostered text content is wrapped in element nodes
26918 !!options
26919 parsoid=wt2html
26920 !! wikitext
26921 <table>hi</table><table>ho</table>
26922 !! html/parsoid
26923 <p>hi</p>
26924 <table></table>
26925 <p>ho</p>
26926 <table></table>
26927 !!end
26928
26929 !!test
26930 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26931 !!options
26932 parsoid=wt2html,wt2wt
26933 !! wikitext
26934 <table>
26935 <tr> || ||
26936 <td> a
26937 </table>
26938 !! html/parsoid
26939 <p> || ||
26940 </p><table>
26941 <tbody><tr><td> a</td></tr>
26942 </tbody></table>
26943 !!end
26944
26945 !!test
26946 Encapsulation properly handles null DSR information from foster box
26947 !!options
26948 parsoid=wt2html,wt2wt
26949 !! wikitext
26950 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26951 !! html/parsoid
26952 <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>
26953 !!end
26954
26955 !!test
26956 1. Encapsulate foster-parented transclusion content
26957 !!options
26958 parsoid=wt2wt,wt2html
26959 !! wikitext
26960 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26961 !! html/parsoid
26962 <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>
26963 <tbody>
26964 <tr>
26965 <td>bar</td>
26966 </tr>
26967 </tbody>
26968 </table>
26969 !!end
26970
26971 !!test
26972 2. Encapsulate foster-parented transclusion content
26973 !!options
26974 parsoid=wt2wt,wt2html
26975 !! wikitext
26976 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26977 !! html/parsoid
26978 <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>
26979 <table>
26980 <tbody>
26981 <tr>
26982 <td>bar</td>
26983 </tr>
26984 </tbody>
26985 </table>
26986 !!end
26987
26988 !!test
26989 3. Encapsulate foster-parented transclusion content
26990 !!options
26991 parsoid=wt2wt,wt2html
26992 !! wikitext
26993 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26994 !! html/parsoid
26995 <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;]}">
26996 <p>foo</p>
26997 </div>
26998 <table>
26999 <tbody>
27000 <tr>
27001 <td>bar</td>
27002 </tr>
27003 </tbody>
27004 </table>
27005 !!end
27006
27007 !!test
27008 4. Encapsulate foster-parented transclusion content
27009 !!options
27010 parsoid=wt2wt,wt2html
27011 !! wikitext
27012 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27013 !! html/parsoid
27014 <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;]}">
27015 <p>foo</p>
27016 </div>
27017 <table>
27018 <tbody>
27019 <tr>
27020 <td>bar</td>
27021 </tr>
27022 </tbody>
27023 </table>
27024 !!end
27025
27026 !!test
27027 5. Encapsulate foster-parented transclusion content
27028 !!options
27029 parsoid=wt2wt,wt2html
27030 !! wikitext
27031 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27032 !! html/parsoid
27033 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
27034 <table>
27035 <tbody>
27036 <tr>
27037 <td>
27038 <div>
27039 <p>foo</p>
27040 </div>
27041 </td>
27042 </tr>
27043 </tbody>
27044 </table>
27045 !!end
27046
27047 !!test
27048 6. Encapsulate foster-parented transclusion content
27049 !!options
27050 parsoid=wt2wt,wt2html
27051 !! wikitext
27052 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27053 !! html/parsoid
27054 <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>
27055 <table>
27056 <tbody>
27057 <tr>
27058 <td>
27059 <div>
27060 <p>foo</p>
27061 </div>
27062 </td>
27063 </tr>
27064 </tbody>
27065 </table>
27066 <p>ok</p>
27067 !!end
27068
27069 !!test
27070 7. Encapsulate foster-parented transclusion content
27071 !!options
27072 parsoid=wt2wt,wt2html
27073 !! wikitext
27074 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27075 !! html/parsoid
27076 <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>
27077 <table>
27078 <tbody>
27079 <tr>
27080 <td>bar</td>
27081 </tr>
27082 </tbody>
27083 </table>
27084 !!end
27085
27086 # Note that the wt is broken on purpose: the = should be {{=}} if you
27087 # don't want it to be a template parameter key.
27088 !!test
27089 8. Encapsulate foster-parented transclusion content
27090 !!options
27091 parsoid=wt2wt,wt2html
27092 !! wikitext
27093 {{echo|a
27094 }}{|{{echo|style='color:red'}}
27095 |-
27096 |b
27097 |}
27098 !! html/parsoid
27099 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27100 <span> </span>
27101 <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>
27102 <table>
27103 <tbody>
27104 <tr>
27105 <td>b</td>
27106 </tr>
27107 </tbody>
27108 </table>
27109 !!end
27110
27111 !!test
27112 9. Encapsulate foster-parented transclusion content
27113 !!options
27114 parsoid=wt2wt,wt2html
27115 !! wikitext
27116 <table>{{echo|hi</table>hello}}
27117 !! html/parsoid
27118 <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>
27119 !!end
27120
27121 !!test
27122 Table in fosterable position
27123 !!options
27124 parsoid=wt2html
27125 !! wikitext
27126 {{OpenTable}}
27127 <div>
27128 {|
27129 |}
27130 </div>
27131 |}
27132 !! html/parsoid
27133 <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">
27134 </span>
27135 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27136
27137 <table>
27138 </table>
27139 !!end
27140
27141 # Parsoid only for T66747
27142 !! test
27143 Properly encapsulate empty-content transclusions in fosterable positions
27144 !! wikitext
27145 <table>
27146 {{#if:|
27147 <td>foo</td>
27148 }}
27149 </table>
27150 !! html/parsoid
27151 <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"}]]}'>
27152
27153 </table>
27154 !! end
27155
27156 !! test
27157 Always encapsulate foster box when template range is expanded to table
27158 !! options
27159 parsoid=wt2wt
27160 !! wikitext
27161 {|
27162 hello
27163 {{OpenTable}}
27164 |}
27165 !! html/parsoid
27166
27167 !! end
27168
27169 !! test
27170 T115289: Unclosed table
27171 !! wikitext
27172 {{echo|<table>}}<!--c-->[[Category:Two]]
27173 !! html/parsoid
27174 <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>
27175 !! end
27176
27177 !! test
27178 T115289: Don't migrate newlines out of tables with fostered content
27179 !! wikitext
27180 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27181 !! html/parsoid
27182 <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>
27183 !! end
27184
27185 !! test
27186 T73074: More fostering fun
27187 !! wikitext
27188 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27189 !! html/parsoid
27190 <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>
27191 !! end
27192
27193 !!test
27194 Support <object> element with .data attribute
27195 !!options
27196 parsoid=html2wt
27197 !! html/parsoid
27198 <object data="test.swf"></object>
27199 !! wikitext
27200 <object data="test.swf"></object>
27201 !!end
27202
27203 !! test
27204 Don't block XML namespace declaration
27205 !! wikitext
27206 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27207 !! html/php
27208 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27209 </p>
27210 !! html/parsoid
27211 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27212 !! end
27213
27214 # -----------------------------------------------------------------
27215 # The following section of tests are primarily to spec requirements
27216 # around Parsoid's serialization (old, new, edited content)
27217 #
27218 # All these tests are marked Parsoid html2wt and html2html only
27219 # ----------------------------------------------------------------
27220
27221 !! test
27222 Ignore rel attribute in a-tags during serialization to url-links
27223 !! options
27224 parsoid=html2wt
27225 !! html/parsoid
27226 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27227 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27228 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27229 !! wikitext
27230 http://en.wikipedia.org/wiki/Foobar
27231 http://en.wikipedia.org/wiki/Foobar
27232 http://en.wikipedia.org/wiki/Foobar
27233 !! end
27234
27235 # 'mi' is a localinterwiki prefix as well as a language
27236 !! test
27237 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27238 !! options
27239 parsoid=html2wt
27240 !! html/parsoid
27241 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27242 !! wikitext
27243 [[Foo]]
27244 !! end
27245
27246 !! test
27247 Parsoid should accept interwiki shortcuts
27248 !! options
27249 parsoid=html2wt
27250 !! html/parsoid
27251 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27252 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27253 <a href='./fr:Foo'>Foo</a></p>
27254 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27255 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27256 <a href='fr%3AFoo'>Foo</a></p>
27257 <p><a href='FR%3AFoo'>Foo</a>
27258 <a href='./FR:Foo'>Foo</a></p>
27259 !! wikitext
27260 [[:fr:Foo|Foo]]
27261 [[:fr:Foo|Foo]]
27262 [[:fr:Foo|Foo]]
27263
27264 [[:fr:Foo|Foo]]
27265 [[:fr:Foo|Foo]]
27266 [[:fr:Foo|Foo]]
27267
27268 [[:fr:Foo|Foo]]
27269 [[:fr:Foo|Foo]]
27270 !! end
27271
27272 !! test
27273 Parsoid should not accept invalid interwiki shortcuts
27274 !! options
27275 parsoid=html2wt
27276 !! html/parsoid
27277 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27278 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27279 <a href='news:Foo'>Foo</a></p>
27280 !! wikitext
27281 [news:Foo Foo]
27282 [news:Foo Foo]
27283 [news:Foo Foo]
27284 !! end
27285
27286 # See T93839
27287 !! test
27288 New wikilinks should be serialized properly
27289 !! options
27290 parsoid=html2wt
27291 !! html/parsoid
27292 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27293 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27294 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27295 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27296 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27297 !! wikitext
27298 [[Foo]]
27299 [[Foo]]
27300 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27301 http://en.wikipedia.org/wiki/Foo
27302 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27303 !! end
27304
27305 !! test
27306 New wiki links (href variations)
27307 !! options
27308 parsoid=html2wt
27309 !! html/parsoid
27310 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27311 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27312 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27313 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27314 !! wikitext
27315 [[Foo_bar]]
27316 [[Foo_bar]]
27317 [[Foo_bar]]
27318 [[Toxine bactérienne]]
27319 !! end
27320
27321 !! test
27322 New wiki links (content string variations)
27323 !! options
27324 parsoid=html2wt
27325 !! html/parsoid
27326 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27327 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27328 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27329 !! wikitext
27330 [[Foo_bar]]
27331 [[Foo bar]]
27332 [[Foo_bar|./Foo_bar]]
27333 !! end
27334
27335 !! test
27336 New category links (href variations)
27337 !! options
27338 parsoid=html2wt
27339 !! html/parsoid
27340 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27341 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27342 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27343 !! wikitext
27344 [[Category:Toxine bactérienne]]
27345 [[Category:Toxine bactérienne]]
27346 [[Category:Toxine bactérienne]]
27347 !! end
27348
27349 !! test
27350 New sol transparent links don't need indent-pre nowiki protection
27351 !! options
27352 parsoid=html2wt
27353 language=de
27354 !! html/parsoid
27355 <link rel="mw:PageProp/redirect" href="./Main_Page">
27356 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27357 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27358 !! wikitext
27359 #WEITERLEITUNG [[Main Page]]
27360 <!-- this is good --> [[Category:Good]]
27361 <!-- this is great --> [[Kategorie:Great]]
27362 !! end
27363
27364 !! test
27365 New interlanguage links (href variations)
27366 !! options
27367 parsoid=html2wt
27368 !! html/parsoid
27369 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27370 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27371 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27372 !! wikitext
27373 [[es:Toxine bactérienne]]
27374 [[es:Toxine_bactérienne]]
27375 [[es:Toxine_bactérienne]]
27376 !! end
27377
27378 !! test
27379 Image: Modifying size of an image (1)
27380 !! options
27381 parsoid={
27382 "modes": ["wt2wt"],
27383 "changes": [
27384 ["img[height]", "attr", "height", "22"],
27385 ["img[width]", "attr", "width", "200"]
27386 ]
27387 }
27388 !! wikitext
27389 [[Image:Foobar.jpg|230x230px]]
27390 !! wikitext/edited
27391 [[Image:Foobar.jpg|200x200px]]
27392 !!end
27393
27394 !! test
27395 Image: Modifying size of an image (2)
27396 !! options
27397 parsoid={
27398 "modes": ["wt2wt"],
27399 "changes": [
27400 ["img[height]", "attr", "height", "100"],
27401 ["img[width]", "attr", "width", "500"]
27402 ]
27403 }
27404 !! wikitext
27405 [[Image:Foobar.jpg|230x230px]]
27406 !! wikitext/edited
27407 [[Image:Foobar.jpg|500x500px]]
27408 !!end
27409
27410 # Change in size is ignored so long as class='mw-default-size'
27411 !! test
27412 Image: Modifying size of an image (3)
27413 !! options
27414 parsoid={
27415 "modes": ["wt2wt"],
27416 "changes": [
27417 ["figure[class]", "removeClass", "mw-default-size"],
27418 ["figure img", "attr", "height", "19"],
27419 ["figure img", "attr", "width", "170"]
27420 ]
27421 }
27422 !! wikitext
27423 [[Image:Foobar.jpg|thumb]]
27424 !! wikitext/edited
27425 [[Image:Foobar.jpg|thumb|170x170px]]
27426 !!end
27427
27428 !! test
27429 Image: Modifying alignment of an image (T50665)
27430 !! options
27431 parsoid={
27432 "modes": ["wt2wt"],
27433 "changes": [
27434 ["figure[class]", "removeClass", "mw-halign-right"],
27435 ["figure[class]", "addClass", "mw-halign-left"]
27436 ]
27437 }
27438 !! wikitext
27439 [[Image:Foobar.jpg|thumb|caption|right]]
27440 !! wikitext/edited
27441 [[Image:Foobar.jpg|thumb|caption|left]]
27442 !! end
27443
27444 !! test
27445 Image: Modifying mw-default-size of an frameless image (T64805)
27446 !! options
27447 parsoid={
27448 "modes": ["wt2wt"],
27449 "changes": [
27450 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27451 ]
27452 }
27453 !! wikitext
27454 [[Image:Foobar.jpg|frameless|right]]
27455 !! wikitext/edited
27456 [[Image:Foobar.jpg|frameless|right|220x220px]]
27457 !! end
27458
27459 !! test
27460 Image: Modifying valign of an image (T51221)
27461 !! options
27462 parsoid={
27463 "modes": ["wt2wt"],
27464 "changes": [
27465 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27466 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27467 ]
27468 }
27469 !! wikitext
27470 [[File:Foobar.jpg|20px|middle]]
27471 !! wikitext/edited
27472 [[File:Foobar.jpg|20px|text-top]]
27473 !! end
27474
27475 !! test
27476 Image: Modifying alt attribute of an image (T58400)
27477 !! options
27478 parsoid={
27479 "modes": ["wt2wt"],
27480 "changes": [
27481 ["img[alt]", "attr", "alt", "some alternate edited text"]
27482 ]
27483 }
27484 !! wikitext
27485 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27486 !! wikitext/edited
27487 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27488 !!end
27489
27490 !! test
27491 Image: Modifying caption of an image
27492 !! options
27493 parsoid={
27494 "modes": ["wt2wt"],
27495 "changes": [
27496 ["figcaption", "text", "new caption"]
27497 ]
27498 }
27499 !! wikitext
27500 [[Image:Foobar.jpg|thumb|original caption]]
27501 !! wikitext/edited
27502 [[Image:Foobar.jpg|thumb|new caption]]
27503 !!end
27504
27505 !! test
27506 Image: empty alt attribute (T50924)
27507 !! options
27508 parsoid
27509 !! wikitext
27510 [[File:Foobar.jpg|thumb|alt=|bar]]
27511 !! html
27512 <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>
27513 !! end
27514
27515 !! test
27516 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27517 !! options
27518 parsoid=html2wt
27519 language=ar
27520 disabled
27521 !! html/parsoid
27522 <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>
27523 !! wikitext
27524 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27525 !! end
27526
27527 !! test
27528 Image: Block level image should have \n before and after
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"><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>
27536 <p>456</p>
27537 !! end
27538
27539 !! test
27540 Image: New block level image should have \n before and after (existing content)
27541 !! wikitext
27542 123
27543 [[File:Foobar.jpg|right|thumb|150x150px]]
27544 456
27545 !! html/parsoid
27546 <p>123</p>
27547 <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>
27548 <p>456</p>
27549 !! end
27550
27551 !! test
27552 Image: upright option (parsoid)
27553 !! wikitext
27554 [[File:Foobar.jpg|thumb|upright|caption]]
27555 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27556 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27557 !! html/parsoid
27558 <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>
27559 <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>
27560 <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>
27561 !! end
27562
27563 !! test
27564 Image: upright option is ignored on inline and frame images (parsoid)
27565 !! wikitext
27566 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27567 !! html/parsoid
27568 <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>
27569 !! end
27570
27571 !! test
27572 Image: in template parameter with empty parameter
27573 !! wikitext
27574 {{echo|[[File:Foobar.jpg|link=]]}}
27575 !! html/parsoid
27576 <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>
27577 !! end
27578
27579 !! test
27580 Image: from basic HTML (1)
27581 !! options
27582 parsoid=html2wt
27583 !! html/parsoid
27584 <span typeof="mw:Image">
27585 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27586 </span>
27587 !! wikitext
27588 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27589 !! end
27590
27591 !! test
27592 Image: from basic HTML (2)
27593 !! options
27594 parsoid=html2wt
27595 !! html/parsoid
27596 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27597 !! wikitext
27598 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27599 !! end
27600
27601 !! test
27602 Image: from basic HTML (3)
27603 !! options
27604 parsoid=html2wt
27605 !! html/parsoid
27606 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27607 !! wikitext
27608 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27609 !! end
27610
27611 !! test
27612 Image: from basic HTML (4)
27613 !! options
27614 parsoid=html2wt
27615 !! html/parsoid
27616 <img src="./File:Foobar.jpg">
27617 !! wikitext
27618 [[File:Foobar.jpg|link=]]
27619 !! end
27620
27621 !! test
27622 Image: Invalid title as link
27623 !! wikitext
27624 [[File:Foobar.jpg|link=<]]
27625 !! html/php
27626 <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>
27627 </p>
27628 !! html/parsoid
27629 <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>
27630 !! end
27631
27632 !! test
27633 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27634 !! options
27635 parsoid=html2wt
27636 !! html/parsoid
27637 <ul>
27638 <li><p>foo</p></li>
27639 </ul>
27640 !! wikitext
27641 * foo
27642 !! end
27643
27644 !! test
27645 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27646 !! options
27647 parsoid=html2wt
27648 !! html/parsoid
27649 <ul> <li>foo</li></ul>
27650 !! wikitext
27651 * foo
27652 !! end
27653
27654 !! test
27655 Don't strip leading whitespace when handling indent-pre suppressing tags
27656 !! options
27657 parsoid=html2wt
27658 !! html/parsoid
27659 <table>
27660 <tr><td> indented row</td></tr>
27661 </table>
27662 <blockquote><p>
27663 <b>This is very bold of you!</b>
27664 </p>
27665 <table><tr><td>
27666 indented cell (no pre-wrapping!)
27667 </td></tr></table>
27668 </blockquote>
27669 <p>foo</p>
27670 <div>bar</div>
27671 !! wikitext
27672 {|
27673 | indented row
27674 |}
27675 <blockquote>
27676 '''This is very bold of you!'''
27677
27678 {|
27679 |
27680 indented cell (no pre-wrapping!)
27681 |}
27682 </blockquote>
27683 foo
27684 <div>bar</div>
27685 !! end
27686
27687 !! test
27688 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27689 !! options
27690 parsoid=html2wt
27691 !! html/parsoid
27692 <p>foo</p>
27693 <span>bar</span>
27694
27695 <span>foo2
27696 </span>bar2
27697
27698 <div>foo</div>
27699 <span>bar</span>
27700
27701 <div>
27702 <span>foo</span>
27703 </div>
27704 !! wikitext
27705 foo
27706
27707 <span>bar</span>
27708
27709 <span>foo2
27710 <nowiki> </nowiki></span>bar2
27711
27712 <div>foo</div>
27713 <nowiki> </nowiki><span>bar</span>
27714
27715 <div>
27716 <nowiki> </nowiki><span>foo</span>
27717 </div>
27718 !! end
27719
27720 !! test
27721 Lists: Dont insert newlines in a serialized list item.
27722 !! options
27723 parsoid=html2wt
27724 !! html/parsoid
27725 <ul><li>a<br>b</li><li>c</li></ul>
27726 !! wikitext
27727 * a<br>b
27728 * c
27729 !! end
27730
27731 !! test
27732 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27733 !! options
27734 parsoid={
27735 "modes": ["html2wt"],
27736 "scrubWikitext": false
27737 }
27738 !! html/parsoid
27739 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27740 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27741
27742 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27743 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27744
27745 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27746
27747 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27748 !! wikitext
27749 == hello there [[Category:A1]] ==
27750
27751 == [[Category:A2]] hi pal ==
27752
27753 == <!--foo--> [[Category:A3]] how goes it ==
27754
27755 == it goes well [[Category:A4]] <!--bar--> ==
27756
27757 ==howdy [[Category:A5]]==
27758
27759 == __TOC__ ok ==
27760 !! end
27761
27762 !! test
27763 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27764 !! options
27765 parsoid={
27766 "modes": ["html2wt"],
27767 "scrubWikitext": true
27768 }
27769 !! html/parsoid
27770 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27771 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27772
27773 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27774 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27775
27776 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27777 !! wikitext
27778 == hello there ==
27779 [[Category:A1]]
27780 [[Category:A2]]
27781
27782 == hi pal ==
27783
27784 <!--foo--> [[Category:A3]]
27785
27786 == how goes it ==
27787
27788 == it goes well ==
27789 [[Category:A4]] <!--bar-->
27790
27791 __TOC__
27792
27793 == ok ==
27794 !! end
27795
27796 !! test
27797 Headings: Don't hoist metas that come from templates
27798 !! options
27799 parsoid={
27800 "modes": ["html2wt"],
27801 "scrubWikitext": true
27802 }
27803 !! html/parsoid
27804 <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>
27805 !! wikitext
27806 == {{echo|foo [[Category:Foo]]}} ==
27807 !! end
27808
27809 !! test
27810 Headings: Category in ref isn't hoisted
27811 !! options
27812 parsoid={
27813 "modes": ["html2wt"],
27814 "scrubWikitext": true
27815 }
27816 !! html/parsoid
27817 <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>
27818
27819 <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>
27820 !! wikitext
27821 == foo <ref>bar
27822 [[Category:Baz]] </ref> ==
27823
27824 <references />
27825 !! end
27826
27827 !! test
27828 Parsoid: Serialize positional parameters with = in them as named parameter
27829 !! options
27830 parsoid=html2wt
27831 !! html/parsoid
27832 <p about="#mwt1" typeof="mw:Transclusion"
27833 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27834
27835 <p about="#mwt1" typeof="mw:Transclusion"
27836 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27837
27838 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27839 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27840 <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>
27841 !! wikitext
27842 {{echo|1=f=oo}}
27843
27844 {{echo|1=f=oo|2=bar}}
27845
27846 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27847 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27848 {{echo|<nowiki>f=oo</nowiki>|bar}}
27849 !! end
27850
27851 !! test
27852 Parsoid: Serialize positional parameters with = in extlink as named parameter
27853 !! options
27854 parsoid=html2wt
27855 !! html/parsoid
27856 <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>
27857 !! wikitext
27858 {{echo|1=http://stuff?is=ok}}
27859 !! end
27860
27861 !! test
27862 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27863 !! options
27864 parsoid=html2wt
27865 !! html/parsoid
27866 <div>a<p>b</p></div>
27867 <div>a
27868 <p>b</p></div>
27869 <div>
27870 a
27871 <p>b</p></div>
27872 !! wikitext
27873 <div>a
27874 b
27875 </div>
27876 <div>a
27877 b
27878 </div>
27879 <div>
27880 a
27881
27882 b
27883 </div>
27884 !! end
27885
27886 !! test
27887 Substrings resembling wikitext in hrefs should not get nowiki escapes
27888 !! options
27889 parsoid=html2wt
27890 !! html/parsoid
27891 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27892 !! wikitext
27893 [[Foo''bar''baz]]
27894 !! end
27895
27896 !! test
27897 Enforce single-line context in the serializer
27898 !! options
27899 parsoid=html2wt
27900 !! html/parsoid
27901 <h2>testing
27902 123</h2>
27903
27904 <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">
27905 </span><span about="#mwt1">you</span> </h2>
27906
27907 <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>
27908
27909 <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
27910 there</span></li></ol>
27911
27912 <ul><li>asd
27913 sdf</li></ul>
27914
27915 <ul><li>foo
27916 bar
27917 baz</li>
27918 <li>foo <b>bar</b>
27919 baz</li></ul>
27920
27921 <dl><dt>hi
27922 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27923 ho</dd></dl>
27924
27925 <dl><dd> <table>
27926 <tbody><tr><td> ha
27927 ha
27928 ha</td></tr>
27929 </tbody></table></dd></dl>
27930 !! wikitext
27931 == testing 123 ==
27932
27933 == hi {{bogus|there
27934 you}} ==
27935
27936 == foo <ref>hello
27937 there</ref> ==
27938
27939 <references />
27940
27941 * asd sdf
27942
27943 * foo bar baz
27944 * foo '''bar''' baz
27945
27946 ; hi ho : hi ho
27947
27948 : {|
27949 | ha
27950 ha
27951 ha
27952 |}
27953 !! end
27954
27955 !! test
27956 Serialize new placeholder space without spans
27957 !! options
27958 parsoid=html2wt
27959 !! html/parsoid
27960 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27961
27962 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27963
27964 <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>
27965 !! wikitext
27966 foo : bar
27967
27968 foo : bar
27969
27970 <ref>foo : bar</ref>ok
27971 !! end
27972
27973
27974 #-----------------------
27975 # Tag minimization tests
27976 #-----------------------
27977
27978 !! test
27979 1. I/B quote minimization: wikitext-only tags should be combined
27980 !! options
27981 parsoid=html2wt
27982 !! html/parsoid
27983 <p><i>A</i><i>B</i></p>
27984 <p><b>A</b><b>B</b></p>
27985 <p><i>A</i><b><i>B</i></b></p>
27986 <p><b>A</b><i><b>B</b></i></p>
27987 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27988 <p><i><b>A</b></i><i><b>B</b></i></p>
27989 <p><i><b>A</b></i><b><i>B</i></b></p>
27990 <p><b><i>A</i></b><i><b>B</b></i></p>
27991 !! wikitext
27992 ''AB''
27993
27994 '''AB'''
27995
27996 ''A'''B'''''
27997
27998 '''A''B'''''
27999
28000 '''A''BC''D'''
28001
28002 '''''AB'''''
28003
28004 '''''AB'''''
28005
28006 '''''AB'''''
28007 !! end
28008
28009 !! test
28010 2. I/B quote minimization: wikitext and html tags should not be combined
28011 !! options
28012 parsoid=html2wt
28013 !! html/parsoid
28014 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28015 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28016 !! wikitext
28017 ''A''<i>B</i>
28018
28019 ''A''<nowiki/>'''<i>B</i>'''
28020 !! end
28021
28022 !! test
28023 3. I/B quote minimization: templated content stops minimization
28024 !! options
28025 parsoid=html2wt
28026 !! html/parsoid
28027 <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>
28028 <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>
28029 !! wikitext
28030 ''A''{{echo|''B''}}
28031
28032 ''A''{{echo|'''''B'''''}}
28033 !! end
28034
28035 !! test
28036 4. I/B quote minimization: new content should be mimimized with adjacent old content
28037 !! options
28038 parsoid=html2wt
28039 !! html/parsoid
28040 <p><i>A</i><i>B</i></p>
28041 <p><b>A</b><b>B</b></p>
28042 <p><i>A</i><b><i>B</i></b></p>
28043 !! wikitext
28044 ''AB''
28045
28046 '''AB'''
28047
28048 ''A'''B'''''
28049 !! end
28050
28051 !! test
28052 5a. Merge adjacent quote nodes if they've been edited
28053 !! options
28054 parsoid={
28055 "modes": ["wt2wt", "selser"],
28056 "changes": [
28057 ["p", "contents", "remove", ":contains('b')"]
28058 ]
28059 }
28060 !! wikitext
28061 ''a''b''c''
28062 !! wikitext/edited
28063 ''ac''
28064 !! end
28065
28066 !! test
28067 5b. Merge adjacent quote nodes if they've been edited
28068 !! options
28069 parsoid={
28070 "modes": ["wt2wt", "selser"],
28071 "changes": [
28072 ["#x", "remove"]
28073 ]
28074 }
28075 !! wikitext
28076 ''a''<span id="x">b</span>''c''
28077 !! wikitext/edited
28078 ''ac''
28079 !! end
28080
28081 !! test
28082 1. Merge adjacent link nodes as long as at least one element is new
28083 !! options
28084 parsoid={
28085 "modes": ["html2wt"],
28086 "scrubWikitext": true
28087 }
28088 !! html/parsoid
28089 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28090 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28091 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28092 !! wikitext
28093 [[Football]]
28094 [[Football]]
28095 [[Football|Foot]][[Football|ball]]
28096 !! end
28097
28098 !! test
28099 2. Merge adjacent link nodes and enable additional normalizations
28100 !! options
28101 parsoid={
28102 "modes": ["html2wt"],
28103 "scrubWikitext": true
28104 }
28105 !! html/parsoid
28106 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28107 !! wikitext
28108 [[Football|''Football'']]
28109 !! end
28110
28111 !! test
28112 3. Don't merge adjacent link nodes if scrubWikitext is false
28113 !! options
28114 parsoid={
28115 "modes": ["html2wt"],
28116 "scrubWikitext": false
28117 }
28118 !! html/parsoid
28119 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28120 !! wikitext
28121 [[Football|Foot]][[Football|ball]]
28122 !! end
28123
28124 #------------------------------
28125 # End of tag minimization tests
28126 #------------------------------
28127
28128 !!test
28129 T56262: New entities
28130 !! options
28131 parsoid=html2wt
28132 !! html/parsoid
28133 <span typeof="mw:Entity">&nbsp;</span>
28134 !! wikitext
28135 &nbsp;
28136 !! end
28137
28138 ## Note that there is no wikitext output for 'unknownproperty' ##
28139 ## Unknown magic words are silently dropped ##
28140
28141 !! test
28142 Magic words
28143 !! options
28144 parsoid=html2wt
28145 !! html/parsoid
28146 <meta property='mw:PageProp/toc' />
28147 <meta property='mw:PageProp/notoc' />
28148 <meta property='mw:PageProp/forcetoc' />
28149 <meta property='mw:PageProp/index' />
28150 <meta property='mw:PageProp/noindex' />
28151 <meta property='mw:PageProp/nogallery' />
28152 <meta property='mw:PageProp/noeditsection' />
28153 <meta property='mw:PageProp/notitleconvert' />
28154 <meta property='mw:PageProp/nocontentconvert' />
28155 <meta property='mw:PageProp/unknownproperty' />
28156 !! wikitext
28157 __TOC__
28158 __NOTOC__
28159 __FORCETOC__
28160 __INDEX__
28161 __NOINDEX__
28162 __NOGALLERY__
28163 __NOEDITSECTION__
28164 __NOTITLECONVERT__
28165 __NOCONTENTCONVERT__
28166 !! end
28167
28168 !! test
28169 Consecutive <pre>s should not get merged
28170 !! options
28171 parsoid=html2wt,html2html
28172 !! html/parsoid
28173 <pre>a</pre><pre>b</pre>
28174
28175 <pre>c
28176 </pre><pre>
28177 d</pre>
28178
28179 <pre>e
28180
28181 </pre><pre>
28182
28183 f</pre>
28184 !! wikitext
28185 a
28186
28187 b
28188
28189 c
28190
28191 d
28192
28193 e
28194
28195
28196
28197 f
28198 !! end
28199
28200 !! test
28201 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28202 !! options
28203 parsoid=html2wt
28204 !! html/parsoid
28205 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28206 !! wikitext
28207 [[Special:BookSources/1234567890|ISBN 1234567895]]
28208 !! end
28209
28210 !! test
28211 Edited RFC links not serializable as RFC links should serialize as extlinks
28212 !! options
28213 parsoid=html2wt
28214 !! html/parsoid
28215 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28216 !! wikitext
28217 [https://tools.ietf.org/html/rfc123 New RFC]
28218 !! end
28219
28220 !! test
28221 Edited PMID links not serializable as PMID links should serialize as extlinks
28222 !! options
28223 parsoid=html2wt
28224 !! html/parsoid
28225 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28226 !! wikitext
28227 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28228 !! end
28229
28230 !! test
28231 WTS of autolinks with trailing/surrounding context
28232 !! options
28233 parsoid=html2wt
28234 !! html/parsoid
28235 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28236 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28237 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28238 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28239 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28240 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28241 !! wikitext
28242 http://cscott.net'''foo'''
28243
28244 http://cscott.net<b>foo</b>
28245
28246 '''http://cscott.net'''
28247
28248 '''http://cscott.net '''
28249
28250 '''http://cscott.net<nowiki/>x'''
28251
28252 http://cscott.net<nowiki/>x
28253 !! end
28254
28255 !! test
28256 WTS of autolinks with nowikis (round-trip)
28257 !! wikitext
28258 x<nowiki/>http://cscott.net<nowiki/>x
28259 !! html/parsoid
28260 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28261 !! end
28262
28263 # this is the "easy" test because it leaves in place all the
28264 # data-parsoid information indicating this is an autolink
28265 !! test
28266 WTS of autolinks with escapes (editing)
28267 !! options
28268 parsoid={
28269 "modes": ["wt2wt"],
28270 "changes": [
28271 [ "span", "remove" ]
28272 ]
28273 }
28274 !! wikitext
28275 x<nowiki/>http://cscott.net<nowiki/>x
28276 !! wikitext/edited
28277 x<nowiki/>http://cscott.net<nowiki/>x
28278 !! end
28279
28280 !! test
28281 WTS of edited autolink-like text (T103364)
28282 !! options
28283 parsoid={
28284 "modes": ["wt2wt"],
28285 "changes": [
28286 [ "span[typeof]", "removeAttr", "typeof" ]
28287 ]
28288 }
28289 !! wikitext
28290 Not a link: <nowiki>http://example.com</nowiki>.
28291 !! wikitext/edited
28292 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28293 !! end
28294
28295 !! test
28296 WTS of newly-authored autolink-like text (T103364)
28297 !! options
28298 parsoid=html2wt
28299 !! html/parsoid
28300 <p>http://example.com is not a link.</p>
28301 !! wikitext
28302 <nowiki>http://example.com</nowiki> is not a link.
28303 !! end
28304
28305 !! test
28306 WTS of autolink-like text after an autolink (T108563)
28307 !! options
28308 parsoid=html2wt
28309 !! html/parsoid
28310 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28311 !! wikitext
28312 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28313 !! end
28314
28315 !! test
28316 Magic links inside links (not autolinked)
28317 !! wikitext
28318 [[Foo|http://example.com]]
28319 [[Foo|RFC 1234]]
28320 [[Foo|PMID 1234]]
28321 [[Foo|ISBN 123456789x]]
28322
28323 [http://foo.com http://example.com]
28324 [http://foo.com RFC 1234]
28325 [http://foo.com PMID 1234]
28326 [http://foo.com ISBN 123456789x]
28327 !! html+tidy
28328 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28329 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28330 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28331 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28332 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28333 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28334 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28335 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28336 </p>
28337 !! html/parsoid
28338 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28339 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28340 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28341 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28342
28343 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28344 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28345 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28346 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28347 !! end
28348
28349 !! test
28350 Magic links inside image captions (autolinked)
28351 !! wikitext
28352 [[File:Foobar.jpg|thumb|http://example.com]]
28353 [[File:Foobar.jpg|thumb|RFC 1234]]
28354 [[File:Foobar.jpg|thumb|PMID 1234]]
28355 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28356 !! html+tidy
28357 <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>
28358 <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>
28359 <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>
28360 <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>
28361 !! html/parsoid
28362 <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>
28363 <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>
28364 <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>
28365 <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>
28366 !! end
28367
28368 !! test
28369 WTS of magic word text (T109371)
28370 !! options
28371 parsoid=html2wt
28372 !! html/parsoid
28373 <p>RFC 1234</p>
28374 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28375 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28376 !! wikitext
28377 <nowiki>RFC 1234</nowiki>
28378
28379 [http://foo.com RFC 1234]
28380
28381 [[Foo|RFC 1234]]
28382 !! end
28383
28384 !! test
28385 Edited Redirect link should emit a non-piped wikitext link
28386 !! options
28387 parsoid=html2wt
28388 !! html/parsoid
28389 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28390 !! wikitext
28391 #REDIRECT [[Bar]]
28392 !! end
28393
28394 !! test
28395 T75121: Infer extension name from typeOf if data-mw is not present
28396 !! options
28397 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28398 !! html/parsoid
28399 <div typeOf="mw:Extension/foo"></div>
28400 !! wikitext
28401 <foo />
28402 !! end
28403
28404 # Note that the <p> wrapping isn't present in PHP parser output
28405 # The important thing for this test is that P-wrapping doesn't
28406 # interfere with the <nowiki> protection for leading - in <td>
28407 # (which isn't necessary for <th>).
28408 !! test
28409 T88318: p-wrapped dash in table.
28410 !! options
28411 parsoid=html2wt,wt2wt
28412 !! html/parsoid
28413 <table><tbody>
28414 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28415 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28416 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28417 </tbody></table>
28418 !! wikitext
28419 {|
28420 !-
28421 !-
28422 |-
28423 |<nowiki>-</nowiki>
28424 |<nowiki>- </nowiki>
28425 |-
28426 |<small>-</small>
28427 |<br>
28428 -
28429 |<br>
28430 -
28431 |}
28432 !! html/php+tidy
28433 <table>
28434 <tbody><tr>
28435 <th>-
28436 </th>
28437 <th>-
28438 </th></tr>
28439 <tr>
28440 <td>-
28441 </td>
28442 <td>-
28443 </td></tr>
28444 <tr>
28445 <td><small>-</small>
28446 </td>
28447 <td><br />
28448 <p>-
28449 </p>
28450 </td>
28451 <td><br />
28452 <p>-
28453 </p>
28454 </td></tr></tbody></table>
28455 !! end
28456
28457 !! test
28458 T149209: WTS: Handle newlines in table cells properly
28459 !! options
28460 parsoid=html2wt
28461 !! html/parsoid
28462 <table>
28463 <tbody>
28464 <tr><td>a
28465 b
28466 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28467 <tr><td><p>x</p>
28468 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28469 </tbody></table>
28470 <table>
28471 <tbody>
28472 <tr><th>a
28473 b
28474 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28475 <tr><th><p>x</h>
28476 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28477 </tbody></table>
28478 !! wikitext
28479 {|
28480 |a
28481 b
28482 |c
28483 |-
28484 |x
28485 {{!}}y
28486 |}
28487 {|
28488 !a
28489 b
28490 !c
28491 |-
28492 !x
28493 !y
28494 |}
28495 !! end
28496
28497 !! test
28498 T149209: Selser: Handle newlines in table cells properly
28499 !! options
28500 parsoid={
28501 "modes": ["selser"],
28502 "changes": [
28503 [ "#h1", "html", "a\nb\n" ],
28504 [ "#h2", "html", "a\nb\n" ],
28505 [ "#c1", "html", "a\nb\n" ],
28506 [ "#c2", "html", "<p>a</p>" ],
28507 [ "#c3", "html", "<p>a</p>" ],
28508 [ "#c4", "html", "edit-me<p>a</p>" ]
28509 ]
28510 }
28511 !! wikitext
28512 {|
28513 ! id="h1" |edit-me!!1
28514 |-
28515 ! id="h2" |edit-me||2
28516 |-
28517 | id="c1" |edit-me||3
28518 |-
28519 | id="c2" |edit-me||4
28520 |-
28521 | id="c3" |edit-me||p||q||r
28522 |-
28523 | id="c4" |edit-me||p||q||r
28524 |}
28525 !! wikitext/edited
28526 {|
28527 ! id="h1" |a
28528 b
28529 !1
28530 |-
28531 ! id="h2" |a
28532 b
28533 !2
28534 |-
28535 | id="c1" |a
28536 b
28537 |3
28538 |-
28539 | id="c2" |a
28540 |4
28541 |-
28542 | id="c3" |a
28543 |p||q||r
28544 |-
28545 | id="c4" |edit-me
28546 a
28547 |p||q||r
28548 |}
28549 !! end
28550
28551 !! test
28552 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28553 !! options
28554 parsoid=html2wt
28555 !! html/parsoid
28556 <table id='mwAb'>
28557 <td id='mwAc'>foo</td>
28558 <td id='serialize-this'>bar</td>
28559 </table>
28560 !! wikitext
28561 {|
28562 |foo
28563 | id="serialize-this" |bar
28564 |}
28565 !! end
28566
28567 !! test
28568 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28569 !! options
28570 parsoid=html2wt
28571 !! html/parsoid
28572 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28573 !! wikitext
28574 <div id="hello">ok</div>
28575 !! end
28576
28577 !! test
28578 WTS change modes
28579 !! options
28580 parsoid={
28581 "modes": ["wt2wt"],
28582 "changes": [
28583 [ "#xyz", "before", "<b>before</b> stuff " ],
28584 [ "#xyz", "after", " stuff <i>after</i>" ],
28585 [ "#xyz", "html", "x <b>y</b> z" ]
28586 ]
28587 }
28588 !! wikitext
28589 <span id="xyz">hello</span>
28590 !! wikitext/edited
28591 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28592 !! end
28593
28594 !! test
28595 Never serialize a-tag as html, regardless of what data-parsoid has to say
28596 !! options
28597 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28598 !! html/parsoid
28599 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28600 !! wikitext
28601 [[Foo]]
28602 !! end
28603
28604 ## SSS FIXME: This is broken output nevertheless.
28605 ## What might be a reasonable non-broken output for this?
28606 ## This is an edge case unlikely to be seen in production
28607 ## that I am not wasting more time on this right now.
28608 !! test
28609 Never serialize a-tag as html, no matter what attributes it has
28610 !! options
28611 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28612 !! html/parsoid
28613 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28614 !! wikitext
28615 [http://boo.org http://boohoo.org]
28616 !! end
28617
28618 # Misnested is an indication that selser can reuse the source but these have
28619 # shown to sneak through on occasion. See T101768.
28620 # The original wikitext here is: [http://test.com [[one]] two three]
28621 !! test
28622 Strip span tags added to mark misnested links
28623 !! options
28624 parsoid=html2wt
28625 !! html/parsoid
28626 <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>
28627 !! wikitext
28628 [http://test.com][[one]] two three
28629 !! end
28630
28631 !! test
28632 Catch regression when unpacking misnested links
28633 !! options
28634 parsoid=wt2html
28635 !! wikitext
28636 {{echo|hi}}[http://example.com [[ho]]]
28637 !! html/parsoid
28638 <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>
28639 !! end
28640
28641 !! test
28642 Catch regression when unpacking with trailing content
28643 !! wikitext
28644 {{echo|Foo <references/> bar}}
28645 !! html/parsoid
28646 <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>
28647 !! end
28648
28649 !! test
28650 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28651 !! options
28652 parsoid=html2wt
28653 !! html/parsoid
28654 <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|}"]}'>
28655 <tbody><tr><td>d
28656 </td></tr>
28657 </tbody></table>
28658 !! wikitext
28659 {{echo|a}}
28660 {|{{echo|c
28661 {{!}}d
28662 }}
28663 |}
28664 !! end
28665
28666 ## This test verifies the presence and computation of this attribute indirectly
28667 ## by making an edit and ensuring that the serialization is correct (which it would be
28668 ## only if firstWikitextNode is properly set).
28669 !! test
28670 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28671 !! options
28672 parsoid= {
28673 "modes": ["wt2wt"],
28674 "changes": [
28675 [ "div#x", "remove" ],
28676 [ "div", "before", "<div>new</div>" ]
28677 ]
28678 }
28679 !! wikitext
28680 <div id="x">foo</div>
28681 {|
28682 {{echo|<div>boo</div>
28683 {{!}}b}}
28684 |c
28685 |}
28686 !! wikitext/edited
28687
28688 <div>new</div>
28689 {|
28690 {{echo|<div>boo</div>
28691 {{!}}b}}
28692 |c
28693 |}
28694 !! end
28695
28696 # --------------------------------------------
28697 # Tests spec'ing wikitext serialization norms |
28698 # --------------------------------------------
28699
28700 !! test
28701 Serialize multi-line indent-pre starting with wikitext syntax
28702 !! options
28703 parsoid=html2wt
28704 !! html/parsoid
28705 <pre>* 1
28706 ** 2
28707 * 3</pre>
28708 !! wikitext
28709 * 1
28710 ** 2
28711 * 3
28712 !! end
28713
28714 !! test
28715 1. Categories should always be serialized on their own line
28716 !! options
28717 parsoid=html2wt
28718 !! html/parsoid
28719 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28720 !! wikitext
28721 foo
28722 [[Category:Foo]]
28723 bar
28724 !! end
28725
28726 !! test
28727 2. Categories that are part of templates should not introduce a line break
28728 !! wikitext
28729 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28730 !! html/parsoid
28731 <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>
28732 !! end
28733
28734 # Careful while editing these next 2 tests. There are \u200f characters
28735 # before and after the <link> tags in the HTML and following some
28736 # of the categories in wikitext
28737 # Do not remove these characters in edits.
28738 #
28739 # As part of the serialization, these bidi characters will get stripped.
28740 !! test
28741 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28742 !! options
28743 parsoid={
28744 "modes": ["html2wt"],
28745 "scrubWikitext": true
28746 }
28747 !! html/parsoid
28748 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28749 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28750 !! wikitext
28751 [[קטגוריה:טקסים]]
28752 [[קטגוריה: שיטות משפט]]
28753 !! end
28754
28755 !! test
28756 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28757 !! options
28758 parsoid={
28759 "modes": ["html2wt"],
28760 "scrubWikitext": true
28761 }
28762 !! html/parsoid
28763 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28764 !! wikitext
28765 [[קטגוריה:טקסים]]
28766 ‏y
28767 !! end
28768
28769 !! test
28770 Lists: Add space after bullets
28771 !! options
28772 parsoid=html2wt
28773 !! html/parsoid
28774 <ul>
28775 <li>foo</li>
28776 <li> bar</li>
28777 <li><span> baz</span></li>
28778 </ul>
28779 !! wikitext
28780 * foo
28781 * bar
28782 * <span> baz</span>
28783 !! end
28784
28785 !! test
28786 1. Headings: Add space before/after == (T53744)
28787 !! options
28788 parsoid=html2wt
28789 !! html/parsoid
28790 <h2>foo</h2>
28791 <h2> bar</h2>
28792 <h2>baz </h2>
28793 <h2><span> baz</span></h2>
28794 !! wikitext
28795 == foo ==
28796
28797 == bar ==
28798
28799 == baz ==
28800
28801 == <span> baz</span> ==
28802 !! end
28803
28804 !! test
28805 2. Headings: Add space before/after == even after hoisted content
28806 !! options
28807 parsoid={
28808 "modes": ["html2wt"],
28809 "scrubWikitext": true
28810 }
28811 !! html/parsoid
28812 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28813 !! wikitext
28814 [[Category:A2]]
28815
28816 == ok ==
28817 !! end
28818
28819 !! test
28820 1. Headings: suppress newly created empty headings
28821 !! options
28822 parsoid={
28823 "modes": ["html2wt"],
28824 "scrubWikitext": true
28825 }
28826 !! html/parsoid
28827 <h2></h2>
28828 !! wikitext
28829 !! end
28830
28831 !! test
28832 2. Headings: don't suppress empty headings if scrubWikitext is false
28833 !! options
28834 parsoid=html2wt
28835 !! html/parsoid
28836 <h2></h2>
28837 !! wikitext
28838 ==<nowiki/>==
28839 !! end
28840
28841 !! test
28842 3. Headings: suppress empty headings on edits
28843 !! options
28844 parsoid={
28845 "modes": ["selser"],
28846 "scrubWikitext": true,
28847 "changes": [
28848 [ "#x", "remove"]
28849 ]
28850 }
28851 !! wikitext
28852 ==<span id="x">foo</span>==
28853 !! wikitext/edited
28854 !! end
28855
28856 !! test
28857 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28858 !! options
28859 parsoid={
28860 "modes": ["html2wt"],
28861 "scrubWikitext": true
28862 }
28863 !! html/parsoid
28864 <h2>foo<br/>bar</h2>
28865 <h2>foo <span><br/>bar</span> baz</h2>
28866 !! wikitext
28867 == foo bar ==
28868
28869 == foo <span> bar</span> baz ==
28870 !! end
28871
28872 !! test
28873 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28874 !! options
28875 parsoid={
28876 "modes": ["html2wt"],
28877 "scrubWikitext": false
28878 }
28879 !! html/parsoid
28880 <h2>foo<br/>bar</h2>
28881 !! wikitext
28882 == foo<br> bar ==
28883 !! end
28884
28885 !! test
28886 1. WT Quote Tags: suppress newly created empty style tags
28887 !! options
28888 parsoid={
28889 "modes": ["html2wt"],
28890 "scrubWikitext": true
28891 }
28892 !! html/parsoid
28893 <i></i><b></b>
28894 !! wikitext
28895 !! end
28896
28897 !! test
28898 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28899 !! options
28900 parsoid=html2wt
28901 !! html/parsoid
28902 <i></i><b></b>
28903 !! wikitext
28904 ''<nowiki/>'''''<nowiki/>'''
28905 !! end
28906
28907 !! test
28908 3. WT Quote Tags: suppress empty style tags on edits
28909 !! options
28910 parsoid={
28911 "modes": ["selser"],
28912 "scrubWikitext": true,
28913 "changes": [
28914 [ "#x", "remove"]
28915 ]
28916 }
28917 !! wikitext
28918 '''<span id="x">foo</span>'''
28919 !! wikitext/edited
28920 !! end
28921
28922 !! test
28923 1. Anchors: suppress newly created empty anchors
28924 !! options
28925 parsoid={
28926 "modes": ["html2wt"],
28927 "scrubWikitext": true
28928 }
28929 !! html/parsoid
28930 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28931 !! wikitext
28932 !! end
28933
28934 !! test
28935 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28936 !! options
28937 parsoid={
28938 "modes": ["html2wt"],
28939 "scrubWikitext": false
28940 }
28941 !! html/parsoid
28942 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28943 !! wikitext
28944 [[Test|<nowiki/>]]
28945 !! end
28946
28947 !! test
28948 3. Anchors: suppress empty anchors on edits
28949 !! options
28950 parsoid={
28951 "modes": ["selser"],
28952 "scrubWikitext": true,
28953 "changes": [
28954 [ "#x", "remove"]
28955 ]
28956 }
28957 !! wikitext
28958 [[Test|<span id="x">foo</span>]]
28959 !! wikitext/edited
28960 !! end
28961
28962 !! test
28963 3a. Anchors: do not suppress numbered extlinks
28964 !! options
28965 parsoid={
28966 "modes": ["wt2wt"],
28967 "scrubWikitext": true
28968 }
28969 !! wikitext
28970 [http://foo.com]
28971 !! html/parsoid
28972 <a rel="mw:ExtLink" href="http://foo.com"></a>
28973 !! end
28974
28975 !! test
28976 3b. Anchors: do not suppress numbered extlinks
28977 !! options
28978 parsoid={
28979 "modes": ["wt2wt"],
28980 "scrubWikitext": true,
28981 "changes": [
28982 [ "#x", "remove"]
28983 ]
28984 }
28985 !! wikitext
28986 [http://foo.com <span id="x">foo</span>]
28987 !! wikitext/edited
28988 [http://foo.com]
28989 !! end
28990
28991 !!test
28992 Normalizations should be restricted to edited content
28993 !!options
28994 parsoid={
28995 "modes": ["selser"],
28996 "scrubWikitext": true,
28997 "changes": [
28998 [ "h1", "before", "<i></i>"]
28999 ]
29000 }
29001 !!wikitext
29002 a
29003 = =
29004 b
29005 !!wikitext/edited
29006 a
29007 = =
29008 b
29009 !!end
29010
29011 !! test
29012 1. Multiple normalizations (html2wt)
29013 !! options
29014 parsoid={
29015 "modes": ["html2wt"],
29016 "scrubWikitext": true
29017 }
29018 !! html
29019 <h2><i></i></h2>
29020 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29021 </a><b><i></i></b>x</p>
29022 !! wikitext
29023
29024 [[foo]]
29025 x
29026
29027 !! end
29028
29029 !! test
29030 2. Multiple normalizations (selser)
29031 !! options
29032 parsoid={
29033 "modes": ["selser"],
29034 "scrubWikitext": true,
29035 "changes": [
29036 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29037 ]
29038 }
29039 !! wikitext
29040 <span id="x">foo</span>
29041 !! wikitext/edited
29042 <span id="x">foo</span>
29043
29044 x
29045 !! end
29046
29047 !! test
29048 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29049 !! options
29050 parsoid={
29051 "modes": ["html2wt"],
29052 "scrubWikitext": true
29053 }
29054 !! html/parsoid
29055 <p> hi</p>
29056 <p> hello</p>
29057 !! wikitext
29058 hi
29059
29060 hello
29061 !! end
29062
29063 !! test
29064 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29065 !! options
29066 parsoid=html2wt
29067 !! html/parsoid
29068 <p> hi</p>
29069 <p> hello</p>
29070 !! wikitext
29071 <nowiki> </nowiki>hi
29072
29073 <nowiki> </nowiki> hello
29074 !! end
29075
29076 !! test
29077 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29078 !! options
29079 parsoid={
29080 "modes": ["html2wt"],
29081 "scrubWikitext": true
29082 }
29083 !! html/parsoid
29084 <p>Foo
29085 bar
29086 baz</p>
29087
29088 <table><tr><td>Foo
29089 bar
29090 baz bang</td></tr></table>
29091
29092 <p><!--boo--> foo
29093 bar</p>
29094
29095 <p> foo
29096 bar<span>boo</span></p>
29097 !! wikitext
29098 Foo
29099 bar
29100 baz
29101
29102 {|
29103 |Foo
29104 bar
29105 baz bang
29106 |}
29107
29108 <!--boo-->foo
29109 bar
29110
29111 foo
29112 bar<span>boo</span>
29113 !! end
29114
29115 !! test
29116 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29117 !! options
29118 parsoid={
29119 "modes": ["selser"],
29120 "scrubWikitext": true,
29121 "changes": [
29122 [ "p", "html", " a\n b" ]
29123 ]
29124 }
29125 !! wikitext
29126 xyz
29127 !! wikitext/edited
29128 a
29129 b
29130 !! end
29131
29132 !! test
29133 1. New links that end in spaces
29134 !! options
29135 parsoid={
29136 "modes": ["html2wt"],
29137 "scrubWikitext": false
29138 }
29139 !! html/parsoid
29140 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29141 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29142 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29143 !! wikitext
29144 [[Berlin ]]<nowiki/>is the capital of Germany.
29145
29146 [[Foo ]]'''bar'''
29147
29148 [[Boston ]] is a city.
29149 !! end
29150
29151 !! test
29152 2. New links that end in spaces
29153 !! options
29154 parsoid={
29155 "modes": ["html2wt"],
29156 "scrubWikitext": true
29157 }
29158 !! html/parsoid
29159 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29160 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29161 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29162 !! wikitext
29163 [[Berlin]] is the capital of Germany.
29164
29165 [[Foo]] '''bar'''
29166
29167 [[Boston]] is a city.
29168 !! end
29169
29170 !! test
29171 1. Table cells with escapable prefixes
29172 !! options
29173 parsoid={
29174 "modes": ["html2wt"],
29175 "scrubWikitext": false
29176 }
29177 !! html
29178 <table>
29179 <tr><td>a</td></tr>
29180 <tr><td>-</td></tr>
29181 <tr><td>+</td></tr>
29182 </table>
29183 !! wikitext
29184 {|
29185 |a
29186 |-
29187 |<nowiki>-</nowiki>
29188 |-
29189 |<nowiki>+</nowiki>
29190 |}
29191 !! end
29192
29193 !! test
29194 2. Table cells with escapable prefixes
29195 !! options
29196 parsoid={
29197 "modes": ["html2wt"],
29198 "scrubWikitext": true
29199 }
29200 !! html
29201 <table>
29202 <tr><td>a</td></tr>
29203 <tr><td>-</td></tr>
29204 <tr><td>+</td></tr>
29205 </table>
29206 !! wikitext
29207 {|
29208 |a
29209 |-
29210 | -
29211 |-
29212 | +
29213 |}
29214 !! end
29215
29216 !! test
29217 3a. Table cells with escapable prefixes after edits
29218 !! options
29219 parsoid={
29220 "modes": ["selser"],
29221 "scrubWikitext": true,
29222 "changes": [
29223 [ "table tbody tr:first-child td:first-child", "remove"]
29224 ]
29225 }
29226 !! wikitext
29227 {|
29228 |a||-
29229 |}
29230 !! wikitext/edited
29231 {|
29232 | -
29233 |}
29234 !! end
29235
29236 !! test
29237 3b. Table cells with escapable prefixes after edits
29238 !! options
29239 parsoid={
29240 "modes": ["selser"],
29241 "scrubWikitext": true,
29242 "changes": [
29243 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29244 [ "#x", "remove" ]
29245 ]
29246 }
29247 !! wikitext
29248 {|
29249 |pqr
29250 |<span id="x">foo</span>+
29251 |}
29252 !! wikitext/edited
29253 {|
29254 | -
29255 | +
29256 |}
29257 !! end
29258
29259 # FIXME: This test will fail because
29260 # normalization doesn't realize that the id attribute
29261 # will eliminate the escapable scenario
29262 !! test
29263 4a. Table cells without escapable prefixes after edits
29264 !! options
29265 parsoid={
29266 "modes": ["selser"],
29267 "scrubWikitext": true,
29268 "changes": [
29269 [ "#x", "html", "-" ]
29270 ]
29271 }
29272 !! wikitext
29273 {|
29274 | id="x" |abcd
29275 |}
29276 !! wikitext/edited
29277 {|
29278 | id="x" |-
29279 |}
29280 !! end
29281
29282 ## This tests normalizer's ability to discriminate between
29283 ## cells having identical content.
29284 !! test
29285 4b. Table cells without escapable prefixes after edits
29286 !! options
29287 parsoid={
29288 "modes": ["selser"],
29289 "scrubWikitext": true,
29290 "changes": [
29291 [ "td", "html", "-" ]
29292 ]
29293 }
29294 !! wikitext
29295 {|
29296 |a||b
29297 |}
29298 !! wikitext/edited
29299 {|
29300 | -||-
29301 |}
29302 !! end
29303
29304 ## This tests normalizer's ability to not be tripped by
29305 ## comments (and whitespace)
29306 !! test
29307 4c. Table cells without escapable prefixes after edits
29308 !! options
29309 parsoid={
29310 "modes": ["selser"],
29311 "scrubWikitext": true,
29312 "changes": [
29313 [ "table tbody tr td:first-child", "remove" ]
29314 ]
29315 }
29316 !! wikitext
29317 {|
29318 |-
29319 <!--foo--> |a||-
29320 |}
29321 !! wikitext/edited
29322 {|
29323 |-
29324 <!--foo--> | -
29325 |}
29326 !! end
29327
29328 ## This tests normalizer's ability to handle HTML cells
29329 !! test
29330 4d. Table cells without escapable prefixes after edits
29331 !! options
29332 parsoid={
29333 "modes": ["selser"],
29334 "scrubWikitext": true,
29335 "changes": [
29336 [ "td", "html", "-" ]
29337 ]
29338 }
29339 !! wikitext
29340 <table>
29341 <tr><td>a</td></tr>
29342 </table>
29343 !! wikitext/edited
29344 <table>
29345 <tr><td>-</td></tr>
29346 </table>
29347 !! end
29348
29349 ## T111151 Remove font elements without attributes
29350 !! test
29351 5a. font tags without attributes should be dropped in scrubWikitext mode
29352 !! options
29353 parsoid={
29354 "modes": ["html2wt"],
29355 "scrubWikitext": true
29356 }
29357 !! html
29358 <font>foo</font>
29359 <font><font>bar</font></font>
29360 <font class="x">boo</font>
29361 !! wikitext
29362 foo
29363 bar
29364 <font class="x">boo</font>
29365 !! end
29366
29367 !! test
29368 5b. font tags should not be dropped without scrubWikitext being enabled
29369 !! options
29370 parsoid={
29371 "modes": ["html2wt"],
29372 "scrubWikitext": false
29373 }
29374 !! html
29375 <font>foo</font>
29376 !! wikitext
29377 <font>foo</font>
29378 !! end
29379
29380 !! test
29381 Escape nowiki DOM elements
29382 !! options
29383 parsoid=html2wt
29384 !! html/parsoid
29385 <nowiki><i>foo</i></nowiki>
29386 !! wikitext
29387 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29388 !! end
29389
29390 # This is meant to be an interim fix while we go about figuring out
29391 # how to not introduce these trailing <nowiki/>s in the first place.
29392 !! test
29393 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29394 !! options
29395 parsoid=html2wt
29396 !! html/parsoid
29397 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29398 y</p>
29399 <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>
29400 <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>
29401 !! wikitext
29402 x
29403 y
29404
29405 {{echo|
29406 1 = <nowiki/>}}
29407
29408 {{echo|
29409 1 = <nowiki/>
29410 }}
29411 !! end
29412
29413 # ---------------------------------------------------
29414 # End of tests spec'ing wikitext serialization norms |
29415 # ---------------------------------------------------
29416
29417 # T104032
29418 !! test
29419 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29420 !! options
29421 parsoid=html2wt
29422 !! html/parsoid
29423 a<p>b</p>
29424 <b>c</b><p>d</p>
29425 <table><tr>
29426 <td>a<p>b</p></td>
29427 <td><b>c</b><p>d</p></td>
29428 </tr></table>
29429 !! wikitext
29430 a
29431
29432 b
29433
29434 '''c'''
29435
29436 d
29437 {|
29438 |a
29439 b
29440 |'''c'''
29441 d
29442 |}
29443 !! end
29444
29445 !! test
29446 Anchor without href scenarios
29447 !! options
29448 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29449 !! html/parsoid
29450 <a class="bc"></a>
29451 <a class="no">dice</a>
29452 <a name="foo"></a>
29453 !! wikitext
29454
29455 dice
29456 <span name="foo"></span>
29457 !! end
29458
29459 !! test
29460 New transclusion added after a list should be serialized after the list
29461 !! options
29462 parsoid=html2wt
29463 !! html/parsoid
29464 <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>
29465 !! wikitext
29466 * a
29467 {{echo|foo}}
29468 !! end
29469
29470 # -----------------------------------------------------------------
29471 # End of section for Parsoid-only html2wt tests for serialization
29472 # of new content
29473 # -----------------------------------------------------------------
29474
29475 # -----------------------------------------------------------------
29476 # The following section of tests are primarily to spec behavior of
29477 # the selective serializer. All these tests have manual selser
29478 # changes. The automated selser changes for all tests handle the
29479 # wide variation of changes, but these tests here capture specs
29480 # deterministically.
29481 # ----------------------------------------------------------------
29482
29483 ## T90517
29484 !! test
29485 Selser: New comments should not be lost
29486 !! options
29487 parsoid={
29488 "modes": ["selser"],
29489 "changes": [
29490 [ "#a", "after", "<!--c1-->" ],
29491 [ "#b", "before", "<!--c2-->" ]
29492 ]
29493 }
29494 !! wikitext
29495 <span id="a">a</span>
29496
29497 <span id="b">b</span>
29498 !! wikitext/edited
29499 <span id="a">a</span><!--c1-->
29500
29501 <!--c2--><span id="b">b</span>
29502 !! end
29503
29504 ## T89383
29505 !! test
29506 Selser: Check for validity of DSR before using it
29507 !! options
29508 parsoid={
29509 "modes": ["selser"],
29510 "changes": [
29511 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29512 ]
29513 }
29514 !! wikitext
29515 <span id="a">a</span>
29516 !! wikitext/edited
29517 {{DISPLAYTITLE:foo}}
29518 <span id="a">a</span>
29519 !! end
29520
29521 !! test
29522 1. DOMDiff: Changes to <ref> content should be looked up using id
29523 !! options
29524 parsoid={
29525 "modes": ["selser"],
29526 "changes": [
29527 ["#X", "after", "bar"],
29528 ["#Y", "after", "baz"]
29529 ]
29530 }
29531 !! wikitext
29532 X <ref><span id="X">foo</span></ref>
29533 Y <ref name="a" />
29534 <references>
29535 <ref name="a"><span id="Y">foo</span></ref>
29536 </references>
29537 !! wikitext/edited
29538 X <ref><span id="X">foo</span>bar</ref>
29539 Y <ref name="a" />
29540 <references>
29541 <ref name="a"><span id="Y">foo</span>baz</ref>
29542 </references>
29543 !! end
29544
29545 !! test
29546 2. DOMDiff: Changes to <ref> content should be looked up using id
29547 !! options
29548 parsoid={
29549 "modes": ["selser"],
29550 "changes": [
29551 ["#Z", "after", "bar"]
29552 ]
29553 }
29554 !! wikitext
29555 A <ref>foo bar for a</ref>
29556 B <ref group="X" name="b" />
29557
29558 <references />
29559
29560 <references group="X">
29561 <ref name="b"><span id="Z">foo</span></ref>
29562 </references>
29563 !! wikitext/edited
29564 A <ref>foo bar for a</ref>
29565 B <ref group="X" name="b" />
29566
29567 <references />
29568
29569 <references group="X">
29570 <ref name="b"><span id="Z">foo</span>bar</ref>
29571 </references>
29572 !! end
29573
29574 !! test
29575 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29576 !! options
29577 parsoid={
29578 "modes": ["selser"],
29579 "changes": [
29580 [ "div:first-child", "text", "bar" ]
29581 ]
29582 }
29583 !! wikitext
29584 <div style="{{1x|color:red;}}%">foo</div>
29585 !! wikitext/edited
29586 <div style="{{1x|color:red;}}%">bar</div>
29587 !! end
29588
29589 !! test
29590 Empty LI (T49673)
29591 !! wikitext
29592 * a
29593 *
29594 *
29595 * b
29596 !! html+tidy
29597 <ul><li> a</li>
29598 <li class="mw-empty-elt"> </li>
29599 <li class="mw-empty-elt"></li>
29600 <li> b</li></ul>
29601 !! end
29602
29603 !! test
29604 Thumbnail output
29605 !! wikitext
29606 [[File:Thumb.png|thumb]]
29607 !! html/php+tidy
29608 <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>
29609 !! html/parsoid
29610 <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>
29611 !! end
29612
29613 !! test
29614 unclosed internal link XSS (T137264)
29615 !! wikitext
29616 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29617 !! html/php
29618 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29619 </p>
29620 !! html/parsoid
29621 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29622 !! end
29623
29624 !! test
29625 Validating that <style> isn't eaten by tidy (T167349)
29626 !! options
29627 styletag=1
29628 !! wikitext
29629 <div class="foo">
29630 <style>.foo::before { content: "<foo>"; }</style>
29631 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29632 </div>
29633 !! html/php+tidy
29634 <div class="foo">
29635 <style>.foo::before { content: "<foo>"; }</style>
29636 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29637 </div>
29638 !! end
29639
29640 !! test
29641 Validating that <style> isn't wrapped in a paragraph (T186965)
29642 !! options
29643 styletag=1
29644 !! wikitext
29645 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29646
29647 <style>.foo::before { content: "<foo>"; }</style>
29648
29649 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29650
29651 But if it's on a line with other content, let it be wrapped.
29652
29653 <style>.foo::before { content: "<foo>"; }</style> bar
29654
29655 foo <style>.foo::before { content: "<foo>"; }</style>
29656
29657 foo <style>.foo::before { content: "<foo>"; }</style> bar
29658
29659 And the same if we have non-paragraph-breaking whitespace
29660
29661 foo
29662 <style>.foo::before { content: "<foo>"; }</style>
29663 bar
29664 !! html/php
29665 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29666 </p>
29667 <style>.foo::before { content: "<foo>"; }</style>
29668 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29669 <p>But if it's on a line with other content, let it be wrapped.
29670 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29671 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29672 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29673 </p><p>And the same if we have non-paragraph-breaking whitespace
29674 </p><p>foo
29675 <style>.foo::before { content: "<foo>"; }</style>
29676 bar
29677 </p>
29678 !! end
29679
29680 !! test
29681 Validating that <link> isn't wrapped in a paragraph (T186965)
29682 !! options
29683 styletag=1
29684 !! wikitext
29685 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29686
29687 <link rel="foo" href="bar"/>
29688
29689 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29690
29691 But if it's on a line with other content, let it be wrapped.
29692
29693 <link rel="foo" href="bar"/> bar
29694
29695 foo <link rel="foo" href="bar"/>
29696
29697 foo <link rel="foo" href="bar"/> bar
29698
29699 And the same if we have non-paragraph-breaking whitespace
29700
29701 foo
29702 <link rel="foo" href="bar"/>
29703 bar
29704 !! html/php
29705 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29706 </p>
29707 <link rel="foo" href="bar"/>
29708 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29709 <p>But if it's on a line with other content, let it be wrapped.
29710 </p><p><link rel="foo" href="bar"/> bar
29711 </p><p>foo <link rel="foo" href="bar"/>
29712 </p><p>foo <link rel="foo" href="bar"/> bar
29713 </p><p>And the same if we have non-paragraph-breaking whitespace
29714 </p><p>foo
29715 <link rel="foo" href="bar"/>
29716 bar
29717 </p>
29718 !! end
29719
29720 !! test
29721 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29722 !! config
29723 wgFragmentMode=[ 'html5', 'legacy' ]
29724 !! wikitext
29725 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29726 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29727 !! html/php
29728 <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>
29729 <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>
29730 </p>
29731 !! html/parsoid
29732 <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>
29733 <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>
29734 !! end
29735
29736 !! test
29737 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29738 !! config
29739 wgFragmentMode=[ 'legacy' ]
29740 !! wikitext
29741 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29742 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29743 !! html/php
29744 <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>
29745 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29746 </p>
29747 !! end
29748
29749 !! test
29750 Decoding of HTML entities in embedded HTML tags
29751 !! wikitext
29752 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29753 !! html/php
29754 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29755
29756 !! html/parsoid
29757 <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>
29758 !! end
29759
29760 !! test
29761 Decoding of HTML entities in indicator names for IDs (T104196)
29762 !! options
29763 parsoid=wt2html,html2html
29764 showindicators
29765 !! wikitext
29766 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29767 !! html/php
29768 1&2&3&amp;4&amp;amp;5=Indicator
29769
29770 !! html/parsoid
29771 <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>
29772 !! end
29773
29774 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29775 !! test
29776 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29777 !! options
29778 showindicators
29779 !! wikitext
29780 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29781 !! html/php
29782 1&2&3&amp;4&amp;amp;5=Indicator
29783
29784 !! html/parsoid
29785 <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>
29786 !! end
29787
29788 # This fragment mode is what Parsoid supports.
29789 !! test
29790 HTML5 ids: fallback to legacy
29791 !! config
29792 wgFragmentMode=[ 'html5', 'legacy' ]
29793 !! wikitext
29794 == Foo bar ==
29795
29796 == foo Bar ==
29797
29798 == Тест ==
29799
29800 == Тест ==
29801
29802 == тест ==
29803
29804 == Hey < # " > % : ' ==
29805 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29806
29807 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29808
29809 <!-- These two links should produce identical HTML -->
29810 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29811
29812 !! html/php
29813 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29814 <ul>
29815 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29816 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29817 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29818 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29819 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29820 <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>
29821 </ul>
29822 </div>
29823
29824 <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>
29825 <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>
29826 <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>
29827 <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>
29828 <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>
29829 <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>
29830 <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>
29831 </p><p>💩 <span id="💩"></span>
29832 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29833 </p>
29834 !! html/parsoid
29835 <h2 id="Foo_bar"> Foo bar </h2>
29836
29837 <h2 id="foo_Bar_2"> foo Bar </h2>
29838
29839 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span> Тест </h2>
29840
29841 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span> Тест </h2>
29842
29843 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span> тест </h2>
29844
29845 <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>
29846 <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>
29847
29848 <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\":[190,209,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
29849
29850 <!-- These two links should produce identical HTML -->
29851 <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>
29852 !! end
29853
29854 # Parsoid doesn't support this mode
29855 !! test
29856 HTML5 ids: legacy with a fallback to modern
29857 !! config
29858 wgFragmentMode=[ 'legacy', 'html5' ]
29859 !! wikitext
29860 == Foo bar ==
29861
29862 == foo Bar ==
29863
29864 == Тест ==
29865
29866 == Тест ==
29867
29868 == тест ==
29869
29870 == Hey < # " > % : ' ==
29871 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29872
29873 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29874
29875 <!-- These two links should produce identical HTML -->
29876 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29877
29878 !! html/php
29879 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29880 <ul>
29881 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29882 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29883 <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>
29884 <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>
29885 <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>
29886 <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>
29887 </ul>
29888 </div>
29889
29890 <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>
29891 <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>
29892 <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>
29893 <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>
29894 <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>
29895 <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>
29896 <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>
29897 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29898 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29899 </p>
29900 !! end
29901
29902 # Parsoid doesn't support this mode.
29903 !! test
29904 HTML5 ids: no legacy
29905 !! config
29906 wgFragmentMode=[ 'html5' ]
29907 !! wikitext
29908 == Foo bar ==
29909
29910 == foo Bar ==
29911
29912 == Тест ==
29913
29914 == Тест ==
29915
29916 == тест ==
29917
29918 == Hey < # " > % : ' ==
29919 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29920
29921 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29922
29923 <!-- These two links should produce identical HTML -->
29924 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29925
29926 !! html/php
29927 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29928 <ul>
29929 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29930 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29931 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29932 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29933 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29934 <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>
29935 </ul>
29936 </div>
29937
29938 <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>
29939 <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>
29940 <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>
29941 <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>
29942 <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>
29943 <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>
29944 <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>
29945 </p><p>💩 <span id="💩"></span>
29946 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29947 </p>
29948 !! end
29949
29950 !! test
29951 T90902: Normalize weird characters in section IDs
29952 !! config
29953 wgFragmentMode=[ 'html5', 'legacy' ]
29954 !! wikitext
29955 == Foo&nbsp;bar ==
29956 [[#Foo&nbsp;bar]]
29957
29958 !! html/php
29959 <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>
29960 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29961 </p>
29962 !! end
29963
29964 !! test
29965 T51672: Test for brackets in attributes of elements in external link texts
29966 !! wikitext
29967 [http://example.com/ link <span title="title with [brackets]">span</span>]
29968 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29969
29970 !! html/php
29971 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29972 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29973 </p>
29974 !! html/parsoid
29975 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29976 <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>
29977 !! end
29978
29979 !! test
29980 T72875: Test for brackets in attributes of elements in internal link texts
29981 !! wikitext
29982 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29983 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29984
29985 !! html/php
29986 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29987 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29988 </p>
29989 !! html/parsoid
29990 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
29991 <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>
29992 !! end
29993
29994 !! test
29995 T179544: {{anchorencode:}} output should be always usable in links
29996 !! config
29997 wgFragmentMode=[ 'html5' ]
29998 !! wikitext
29999 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30000 !! html/php
30001 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30002 </p>
30003 !! html/parsoid
30004 <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>
30005 !! end
30006
30007 ## ------------------------------
30008 ## Parsoid section-wrapping tests
30009 ## ------------------------------
30010 !! test
30011 Section wrapping for well-nested sections (no leading content)
30012 !! options
30013 parsoid={
30014 "wrapSections": true
30015 }
30016 !! wikitext
30017 = 1 =
30018 a
30019
30020 = 2 =
30021 b
30022
30023 == 2.1 ==
30024 c
30025
30026 == 2.2 ==
30027 d
30028
30029 === 2.2.1 ===
30030 e
30031
30032 = 3 =
30033 f
30034 !! html/parsoid
30035 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30036 <p>a</p>
30037
30038 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30039 <p>b</p>
30040
30041 <section data-mw-section-id="3"><h2 id="2.1"> 2.1 </h2>
30042 <p>c</p>
30043
30044 </section><section data-mw-section-id="4"><h2 id="2.2"> 2.2 </h2>
30045 <p>d</p>
30046
30047 <section data-mw-section-id="5"><h3 id="2.2.1"> 2.2.1 </h3>
30048 <p>e</p>
30049
30050 </section></section></section><section data-mw-section-id="6"><h1 id="3"> 3 </h1>
30051 <p>f</p>
30052
30053 </section>
30054 !! end
30055
30056 !! test
30057 Section wrapping for well-nested sections (with leading content)
30058 !! options
30059 parsoid={
30060 "wrapSections": true
30061 }
30062 !! wikitext
30063 Para 1.
30064
30065 Para 2 with a <div>nested in it</div>
30066
30067 Para 3.
30068
30069 = 1 =
30070 a
30071
30072 = 2 =
30073 b
30074
30075 == 2.1 ==
30076 c
30077 !! html/parsoid
30078 <section data-mw-section-id="0"><p>Para 1.</p>
30079
30080 <p>Para 2 with a </p><div>nested in it</div>
30081
30082 <p>Para 3.</p>
30083
30084 </section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30085 <p>a</p>
30086
30087 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30088 <p>b</p>
30089
30090 <section data-mw-section-id="3"><h2 id="2.1"> 2.1 </h2>
30091 <p>c</p>
30092
30093 </section></section>
30094 !! end
30095
30096 !! test
30097 Section wrapping with template-generated sections (good nesting 1)
30098 !! options
30099 parsoid={
30100 "wrapSections": true
30101 }
30102 !! wikitext
30103 = 1 =
30104 a
30105
30106 {{echo|1=
30107 == 1.1 ==
30108 b
30109 }}
30110
30111 == 1.2 ==
30112 c
30113
30114 = 2 =
30115 d
30116 !! html/parsoid
30117 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30118 <p>a</p>
30119
30120 <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">
30121 </span><p about="#mwt1">b</p>
30122 </section><section data-mw-section-id="3"><h2 id="1.2"> 1.2 </h2>
30123 <p>c</p>
30124
30125 </section></section><section data-mw-section-id="4"><h1 id="2"> 2 </h1>
30126 <p>d</p></section>
30127 !! end
30128
30129 # In this example, the template scope is mildly expanded to incorporate the
30130 # trailing newline after the transclusion since that is part of section 1.1.1
30131 !! test
30132 Section wrapping with template-generated sections (good nesting 2)
30133 !! options
30134 parsoid={
30135 "wrapSections": true,
30136 "modes": ["wt2html", "wt2wt"]
30137 }
30138 !! wikitext
30139 = 1 =
30140 a
30141
30142 {{echo|1=
30143 == 1.1 ==
30144 b
30145 === 1.1.1 ===
30146 d
30147 }}
30148 = 2 =
30149 e
30150 !! html/parsoid
30151 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30152 <p>a</p>
30153
30154 <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">
30155 </span><p about="#mwt1">b</p><span about="#mwt1">
30156 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1"> 1.1.1 </h3><span about="#mwt1">
30157 </span><p about="#mwt1">d</p><span about="#mwt1">
30158 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2"> 2 </h1>
30159 <p>e</p></section>
30160 !! end
30161
30162 # In this example, the template scope is mildly expanded to incorporate the
30163 # trailing newline after the transclusion since that is part of section 1.2.1
30164 !! test
30165 Section wrapping with template-generated sections (good nesting 3)
30166 !! options
30167 parsoid={
30168 "wrapSections": true,
30169 "modes": ["wt2html", "wt2wt"]
30170 }
30171 !! wikitext
30172 = 1 =
30173 a
30174
30175 {{echo|1=
30176 x
30177 == 1.1 ==
30178 b
30179 ==1.2==
30180 c
30181 ===1.2.1===
30182 d
30183 }}
30184 = 2 =
30185 e
30186 !! html/parsoid
30187 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30188 <p>a</p>
30189
30190 <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">
30191 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1"> 1.1 </h2><span about="#mwt1">
30192 </span><p about="#mwt1">b</p><span about="#mwt1">
30193 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30194 </span><p about="#mwt1">c</p><span about="#mwt1">
30195 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30196 </span><p about="#mwt1">d</p><span about="#mwt1">
30197 </span></section></section></section><section data-mw-section-id="5"><h1 id="2"> 2 </h1>
30198 <p>e</p></section>
30199 !! end
30200
30201 # Because of section-wrapping and template-wrapping interactions,
30202 # the scope of the template is expanded so that the template markup
30203 # is valid in the presence of <section> tags.
30204 # This exercises the s1 is null scenario in the wrapSections code
30205 !! test
30206 Section wrapping with template-generated sections (bad nesting 1)
30207 !! options
30208 parsoid={
30209 "wrapSections": true
30210 }
30211 !! wikitext
30212 <div>
30213 a
30214
30215 {{echo|
30216 = 1 =
30217 b
30218 }}
30219
30220 c
30221 </div>
30222 !! html/parsoid
30223 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30224 <p>a</p>
30225
30226 <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"]}'>
30227 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1"> 1 </h1><span about="#mwt1">
30228 </span><p about="#mwt1">b
30229 </p><span about="#mwt1">
30230
30231 </span><p about="#mwt1">c</p><span about="#mwt1">
30232 </span></section></div></section>
30233 !! end
30234
30235 # Because of section-wrapping and template-wrapping interactions,
30236 # the scope of the template is expanded so that the template markup
30237 # is valid in the presence of <section> tags.
30238 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30239 !! test
30240 Section wrapping with template-generated sections (bad nesting 2)
30241 !! options
30242 parsoid={
30243 "wrapSections": true
30244 }
30245 !! wikitext
30246 = 1 =
30247 a
30248
30249 {{echo|1=
30250 = 2 =
30251 b
30252 == 2.1 ==
30253 c
30254 }}
30255
30256 d
30257
30258 = 3 =
30259 e
30260 !! html/parsoid
30261 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30262 <p>a</p>
30263
30264 </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">
30265 </span><p about="#mwt1">b</p><span about="#mwt1">
30266 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1"> 2.1 </h2><span about="#mwt1">
30267 </span><p about="#mwt1">c</p><span about="#mwt1">
30268
30269 </span><p about="#mwt1">d</p><span about="#mwt1">
30270
30271 </span></section></section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30272 <p>e</p></section>
30273 !! end
30274
30275 # Because of section-wrapping and template-wrapping interactions,
30276 # additional template wrappers are added to <section> tags
30277 # so that template wrapping semantics are valid whether section
30278 # tags are retained or stripped. But, the template scope can expand
30279 # greatly when accounting for section tags.
30280 # This exercises the s1 and s2 are in different subtrees scenario
30281 !! test
30282 Section wrapping with template-generated sections (bad nesting 3)
30283 !! options
30284 parsoid={
30285 "wrapSections": true,
30286 "modes": ["wt2html", "wt2wt"]
30287 }
30288 !! wikitext
30289 = 1 =
30290 a
30291
30292 {{echo|1=
30293 == 1.2 ==
30294 b
30295 = 2 =
30296 c
30297 }}
30298
30299 d
30300
30301 = 3 =
30302 e
30303 !! html/parsoid
30304 <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>
30305 <p>a</p>
30306
30307 <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">
30308 </span><p about="#mwt1">b</p><span about="#mwt1">
30309 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2"> 2 </h1><span about="#mwt1">
30310 </span><p about="#mwt1">c</p>
30311
30312 <p>d</p>
30313 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3"> 3 </h1>
30314 <p>e</p></section>
30315 !! end
30316
30317 !! test
30318 Section wrapping with uneditable lead section + div wrapping multiple sections
30319 !! options
30320 parsoid={
30321 "wrapSections": true
30322 }
30323 !! wikitext
30324 foo
30325
30326 <div style="border:1px solid red;">
30327 = 1 =
30328 a
30329
30330 == 1.1 ==
30331 b
30332
30333 = 2 =
30334 c
30335 </div>
30336
30337 = 3 =
30338 d
30339
30340 == 3.1 ==
30341 e
30342 !! html/parsoid
30343 <section data-mw-section-id="-1"><p>foo</p>
30344
30345 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30346 <section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30347 <p>a</p>
30348
30349 <section data-mw-section-id="2"><h2 id="1.1"> 1.1 </h2>
30350 <p>b</p>
30351
30352 </section></section><section data-mw-section-id="-1"><h1 id="2"> 2 </h1>
30353 <p>c</p>
30354 </section></div>
30355
30356 </section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30357 <p>d</p>
30358
30359 <section data-mw-section-id="5"><h2 id="3.1"> 3.1 </h2>
30360 <p>e</p>
30361 </section></section>
30362 !! end
30363
30364 !! test
30365 Section wrapping with editable lead section + div overlapping multiple sections
30366 !! options
30367 parsoid={
30368 "wrapSections": true
30369 }
30370 !! wikitext
30371 foo
30372
30373 = 1 =
30374 a
30375 <div style="border:1px solid red;">
30376 b
30377
30378 == 1.1 ==
30379 c
30380
30381 = 2 =
30382 d
30383 </div>
30384 e
30385
30386 = 3 =
30387 f
30388
30389 == 3.1 ==
30390 g
30391 !! html/parsoid
30392 <section data-mw-section-id="0"><p>foo</p>
30393
30394 </section><section data-mw-section-id="-1"><h1 id="1"> 1 </h1>
30395 <p>a</p>
30396 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30397 <p>b</p>
30398
30399 <section data-mw-section-id="2"><h2 id="1.1"> 1.1 </h2>
30400 <p>c</p>
30401
30402 </section><section data-mw-section-id="-1"><h1 id="2"> 2 </h1>
30403 <p>d</p>
30404 </section></div>
30405 <p>e</p>
30406
30407 </section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30408 <p>f</p>
30409
30410 <section data-mw-section-id="5"><h2 id="3.1"> 3.1 </h2>
30411 <p>g</p>
30412 </section></section>
30413 !! end
30414
30415 !! test
30416 HTML header tags should not be wrapped in section tags
30417 !! options
30418 parsoid={
30419 "wrapSections": true
30420 }
30421 !! wikitext
30422 foo
30423
30424 <h1>a</h1>
30425
30426 = b =
30427
30428 <h1>c</h1>
30429
30430 = d =
30431 !! html/parsoid
30432 <section data-mw-section-id="0"><p>foo</p>
30433
30434 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30435
30436 </section><section data-mw-section-id="1"><h1 id="b"> b </h1>
30437
30438 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30439
30440 </section><section data-mw-section-id="2"><h1 id="d"> d </h1></section>
30441 !! end
30442
30443 !! test
30444 Lead section containing only whitespace and comments.
30445 !! options
30446 parsoid={
30447 "wrapSections": true
30448 }
30449 !! wikitext
30450
30451 <!-- this is a comment, presumably significant to editors -->
30452 = 1 =
30453 a
30454
30455 = 2 =
30456 b
30457 !! html/parsoid
30458 <section data-mw-section-id="0" data-parsoid="{}">
30459 <!-- this is a comment, presumably significant to editors -->
30460 </section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30461 <p>a</p>
30462
30463 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30464 <p>b</p></section>
30465 !! end
30466
30467 !! test
30468 Pseudo-sections emitted by templates should have id -2
30469 !! options
30470 parsoid={
30471 "wrapSections": true
30472 }
30473 !! wikitext
30474 foo
30475 {{echo|<div>
30476 == a ==
30477 == b ==
30478 </div>
30479 }}
30480 !! html/parsoid
30481 <section data-mw-section-id="-1"><p>foo</p>
30482 </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}}]}'>
30483 <section data-mw-section-id="-1"><h2 id="a"> a </h2>
30484 </section><section data-mw-section-id="-1"><h2 id="b"> b </h2>
30485 </section></div><span about="#mwt1">
30486 </span></section>
30487 !! end