Merge "Test ApiDisabled.php"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:With: Colon
284 !! text
285 Template with colon
286 !! endarticle
287
288 ###
289 ### Basic tests
290 ###
291
292 !! test
293 Blank input
294 !! wikitext
295 !! html
296 !! end
297
298 !! test
299 Simple paragraph
300 !! wikitext
301 This is a simple paragraph.
302 !! html
303 <p>This is a simple paragraph.
304 </p>
305 !! end
306
307 !! test
308 Paragraphs with extra newline spacing
309 !! wikitext
310 foo
311
312 bar
313
314
315 baz
316
317
318
319 booz
320 !! html
321 <p>foo
322 </p><p>bar
323 </p><p><br />
324 baz
325 </p><p><br />
326 </p><p>booz
327 </p>
328 !! end
329
330 !! test
331 Paragraphs with newline spacing with comment lines in between
332 !! wikitext
333 ----
334 a
335 <!--foo-->
336 b
337 ----
338 a
339 <!--foo--><!--More than 1 comment, still stripped-->
340 b
341 ----
342 a
343 <!--foo--> <!----> <!-- bar -->
344 b
345 ----
346 a
347 <!--foo-->
348
349 b
350 ----
351 a
352
353 <!--foo-->
354 b
355 ----
356 a
357 <!--foo-->
358
359
360 b
361 ----
362 a
363
364
365 <!--foo-->
366 b
367 ----
368 !! html
369 <hr />
370 <p>a
371 b
372 </p>
373 <hr />
374 <p>a
375 b
376 </p>
377 <hr />
378 <p>a
379 b
380 </p>
381 <hr />
382 <p>a
383 </p><p>b
384 </p>
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395 <p>a
396 </p><p><br />
397 b
398 </p>
399 <hr />
400
401 !! end
402
403 !! test
404 Paragraphs with newline spacing with non-empty white-space lines in between
405 !! wikitext
406 ----
407 a
408
409 b
410 ----
411 a
412
413
414 b
415 ----
416 !! html
417 <hr />
418 <p>a
419 </p><p>b
420 </p>
421 <hr />
422 <p>a
423 </p><p><br />
424 b
425 </p>
426 <hr />
427
428 !! end
429
430 !! test
431 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
432 !! wikitext
433 ----
434 a
435 <!--foo-->
436 b
437 ----
438 a
439 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
440 b
441 ----
442 a
443
444 <!--foo-->
445 <!--bar-->
446 b
447 ----
448 a
449
450 <!--foo-->
451 <!--bar-->
452
453 b
454 ----
455 !! html
456 <hr />
457 <p>a
458 b
459 </p>
460 <hr />
461 <p>a
462 b
463 </p>
464 <hr />
465 <p>a
466 </p><p>b
467 </p>
468 <hr />
469 <p>a
470 </p><p><br />
471 b
472 </p>
473 <hr />
474
475 !! end
476
477 !! test
478 Extra newlines: More paragraphs with indented comment
479 !! wikitext
480 a
481
482 <!--boo-->
483
484 b
485 !! html
486 <p>a
487 </p><p><br />
488 b
489 </p>
490 !!end
491
492 !! test
493 Extra newlines followed by heading
494 !! wikitext
495 a
496
497
498
499 =b=
500 [[a]]
501
502
503 =b=
504 !! html
505 <p>a
506 </p><p><br />
507 </p>
508 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
509 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
510 </p><p><br />
511 </p>
512 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
513
514 !! end
515
516 !! test
517 Extra newlines between heading and content are swallowed
518 !! wikitext
519 =b=
520
521
522
523 [[a]]
524 !! html
525 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
526 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
527 </p>
528 !! end
529
530 !! test
531 Heading with line break in nowiki
532 !! options
533 parsoid=wt2html
534 !! config
535 wgFragmentMode=[ 'html5', 'legacy' ]
536 !! wikitext
537 ==A <nowiki>B
538 C</nowiki>==
539 !! html/php
540 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
541 C">A B
542 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
543
544 !! html/parsoid
545 <h2 id="A_B
546 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
547 C</span></h2>
548 !! end
549
550 !! test
551 Parsing an URL
552 !! wikitext
553 http://fr.wikipedia.org/wiki/🍺
554 <!-- EasterEgg we love beer, better be able be able to link to it -->
555 !! html
556 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
557 </p>
558 !! end
559
560 !! test
561 Simple list
562 !! wikitext
563 *Item 1
564 *Item 2
565 !! html
566 <ul><li>Item 1</li>
567 <li>Item 2</li></ul>
568
569 !! end
570
571 !! test
572 Italics and bold
573 !! wikitext
574 *plain
575 *plain''italic''plain
576 *plain''italic''plain''italic''plain
577 *plain'''bold'''plain
578 *plain'''bold'''plain'''bold'''plain
579 *plain''italic''plain'''bold'''plain
580 *plain'''bold'''plain''italic''plain
581 *plain''italic'''bold-italic'''italic''plain
582 *plain'''bold''bold-italic''bold'''plain
583 *plain'''''bold-italic'''italic''plain
584 *plain'''''bold-italic''bold'''plain
585 *plain''italic'''bold-italic'''''plain
586 *plain'''bold''bold-italic'''''plain
587 *plain l'''italic''plain
588 *plain l''''bold''' plain
589 !! html
590 <ul><li>plain</li>
591 <li>plain<i>italic</i>plain</li>
592 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
593 <li>plain<b>bold</b>plain</li>
594 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
595 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
596 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
597 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
598 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
599 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
600 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
601 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
602 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
603 <li>plain l'<i>italic</i>plain</li>
604 <li>plain l'<b>bold</b> plain</li></ul>
605
606 !! end
607
608 # this example taken from the [[simple:Moon]] article (T49326)
609 !! test
610 Italics and possessives (1)
611 !! wikitext
612 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
613 !! html
614 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
615 </p>
616 !! end
617
618 # this example taken from [[en:Flaming Pie]] (T51926)
619 !! test
620 Italics and possessives (2)
621 !! wikitext
622 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
623 !! html
624 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
625 </p>
626 !! end
627
628 # this example taken from [[en:Dictionary]] (T51926)
629 !! test
630 Italics and possessives (3)
631 !! wikitext
632 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
633 !! html
634 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
635 </p>
636 !! end
637
638
639 ###
640 ### 2-quote opening sequence tests
641 ###
642 !! test
643 Italics and bold: 2-quote opening sequence: (2,2)
644 !! wikitext
645 ''foo''
646 !! html
647 <p><i>foo</i>
648 </p>
649 !!end
650
651 !! test
652 Italics and bold: 2-quote opening sequence: (2,3)
653 !! wikitext
654 ''foo'''
655 !! html/*
656 <p><i>foo'</i>
657 </p>
658 !!end
659
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,4)
662 !! options
663 parsoid=wt2html
664 !! wikitext
665 ''foo''''
666 !! html/*
667 <p><i>foo''</i>
668 </p>
669 !!end
670
671 # same html as previous, but wikitext adjusted to match parsoid html2wt
672 !! test
673 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
674 !! wikitext
675 ''foo<nowiki>''</nowiki>''
676 !! html
677 <p><i>foo''</i>
678 </p>
679 !! end
680
681 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
682 !! test
683 Italics and bold: 2-quote opening sequence: (2,5)
684 !! options
685 parsoid=wt2html
686 !! wikitext
687 ''foo'''''
688 !! html/php
689 <p><i>foo</i>
690 </p>
691 !! html/parsoid
692 <p><i>foo</i><b></b>
693 </p>
694 !!end
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
699 !! wikitext
700 ''foo'''''<nowiki/>'''
701 !! html/php
702 <p><i>foo</i>
703 </p>
704 !! html/parsoid
705 <p><i>foo</i><b></b>
706 </p>
707 !! end
708
709
710 ###
711 ### 3-quote opening sequence tests
712 ###
713
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,2)
716 !! wikitext
717 '''foo''
718 !! html/*
719 <p>'<i>foo</i>
720 </p>
721 !!end
722
723 !! test
724 Italics and bold: 3-quote opening sequence: (3,3)
725 !! wikitext
726 '''foo'''
727 !! html
728 <p><b>foo</b>
729 </p>
730 !!end
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,4)
734 !! wikitext
735 '''foo''''
736 !! html/*
737 <p><b>foo'</b>
738 </p>
739 !!end
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: 3-quote opening sequence: (3,5)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 '''foo'''''
748 !! html/php
749 <p><b>foo</b>
750 </p>
751 !! html/parsoid
752 <p><b>foo</b><i></i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
759 !! wikitext
760 '''foo'''''<nowiki/>''
761 !! html/php
762 <p><b>foo</b>
763 </p>
764 !! html/parsoid
765 <p><b>foo</b><i></i>
766 </p>
767 !! end
768
769
770 ###
771 ### 4-quote opening sequence tests
772 ###
773
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,2)
776 !! options
777 parsoid=wt2html
778 !! wikitext
779 ''''foo''
780 !! html/*
781 <p>''<i>foo</i>
782 </p>
783 !!end
784
785 # same html as previous, but wikitext adjusted to match parsoid html2wt
786 !! test
787 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
788 !! wikitext
789 <nowiki>''</nowiki>''foo''
790 !! html
791 <p>''<i>foo</i>
792 </p>
793 !! end
794
795 !! test
796 Italics and bold: 4-quote opening sequence: (4,3)
797 !! wikitext
798 ''''foo'''
799 !! html/*
800 <p>'<b>foo</b>
801 </p>
802 !!end
803
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,4)
806 !! options
807 parsoid=wt2html
808 !! wikitext
809 ''''foo''''
810 !! html/*
811 <p>'<b>foo'</b>
812 </p>
813 !!end
814
815 # same html as previous, but wikitext adjusted to match parsoid html2wt
816 !! test
817 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
818 !! wikitext
819 '<nowiki/>'''foo''''
820 !! html
821 <p>'<b>foo'</b>
822 </p>
823 !! end
824
825 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
826 !! test
827 Italics and bold: 4-quote opening sequence: (4,5)
828 !! options
829 parsoid=wt2html
830 !! wikitext
831 ''''foo'''''
832 !! html/php
833 <p>'<b>foo</b>
834 </p>
835 !! html/parsoid
836 <p>'<b>foo</b><i></i>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
843 !! wikitext
844 '<nowiki/>'''foo'''''<nowiki/>''
845 !! html/php
846 <p>'<b>foo</b>
847 </p>
848 !! html/parsoid
849 <p>'<b>foo</b><i></i>
850 </p>
851 !! end
852
853
854 ###
855 ### 5-quote opening sequence tests
856 ###
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,2)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''
864 !! html/*
865 <p><b><i>foo</i></b>
866 </p>
867 !!end
868
869 # same html as previous, but wikitext adjusted to match parsoid html2wt
870 !! test
871 Italics and bold: 5-quote opening sequence: (5,2+3)
872 !! wikitext
873 '''''foo'''''
874 !! html/*
875 <p><i><b>foo</b></i>
876 </p>
877 !! end
878
879 !! test
880 Italics and bold: 5-quote opening sequence: (5,3)
881 !! options
882 parsoid=wt2html
883 !! wikitext
884 '''''foo'''
885 !! html/*
886 <p><i><b>foo</b></i>
887 </p>
888 !!end
889
890 # same html as previous, but wikitext adjusted to match parsoid html2wt
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,3+2)
893 !! wikitext
894 '''''foo'''''
895 !! html
896 <p><i><b>foo</b></i>
897 </p>
898 !! end
899
900 !! test
901 Italics and bold: 5-quote opening sequence: (5,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 '''''foo''''
906 !! html/*
907 <p><i><b>foo'</b></i>
908 </p>
909 !!end
910
911 !! test
912 Italics and bold: 5-quote opening sequence: (5,5)
913 !! wikitext
914 '''''foo'''''
915 !! html
916 <p><i><b>foo</b></i>
917 </p>
918 !!end
919
920 !! test
921 Italics and bold: 5-quote opening sequence: (5,6)
922 !! wikitext
923 '''''foo''''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !! end
928
929 ###
930 ### multiple quote sequences in a line
931 ###
932
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,2)
935 !! options
936 parsoid=wt2html
937 !! wikitext
938 ''foo''''bar''
939 !! html/*
940 <p><i>foo'<b>bar</b></i>
941 </p>
942 !! end
943
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
947 !! wikitext
948 ''foo'<nowiki/>'''bar'''''
949 !! html
950 <p><i>foo'<b>bar</b></i>
951 </p>
952 !! end
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !! end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
968 !! wikitext
969 ''foo'<nowiki/>'''bar'''''
970 !! html
971 <p><i>foo'<b>bar</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: multiple quote sequences: (2,4,4)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 ''foo''''bar''''
981 !! html/*
982 <p><i>foo'<b>bar'</b></i>
983 </p>
984 !! end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
989 !! wikitext
990 ''foo'<nowiki/>'''bar'<nowiki/>'''''
991 !! html
992 <p><i>foo'<b>bar'</b></i>
993 </p>
994 !! end
995
996 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
997 !! test
998 Italics and bold: multiple quote sequences: (3,4,2)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''foo''''bar''
1003 !! html/php
1004 <p><b>foo'</b>bar
1005 </p>
1006 !! html/parsoid
1007 <p><b>foo'</b>bar<i></i>
1008 </p>
1009 !! end
1010
1011 # same html as previous, but wikitext adjusted to match parsoid html2wt
1012 !! test
1013 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1014 !! wikitext
1015 '''foo''''bar''<nowiki/>''
1016 !! html/php
1017 <p><b>foo'</b>bar
1018 </p>
1019 !! html/parsoid
1020 <p><b>foo'</b>bar<i></i>
1021 </p>
1022 !! end
1023
1024 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1025 !! test
1026 Italics and bold: multiple quote sequences: (3,4,3)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''foo''''bar'''
1031 !! html/php
1032 <p><b>foo'</b>bar
1033 </p>
1034 !! html/parsoid
1035 <p><b>foo'</b>bar<b></b>
1036 </p>
1037 !! end
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1042 !! wikitext
1043 '''foo''''bar'''<nowiki/>'''
1044 !! html/php
1045 <p><b>foo'</b>bar
1046 </p>
1047 !! html/parsoid
1048 <p><b>foo'</b>bar<b></b>
1049 </p>
1050 !! end
1051
1052 ###
1053 ### other quote tests
1054 ###
1055 !! test
1056 Italics and bold: other quote tests: (2,3,5)
1057 !! wikitext
1058 ''this is about '''foo's family'''''
1059 !! html
1060 <p><i>this is about <b>foo's family</b></i>
1061 </p>
1062 !!end
1063
1064
1065 !! test
1066 Italics and bold: other quote tests: (2,(3,3),2)
1067 !! wikitext
1068 ''this is about '''foo's''' family''
1069 !! html
1070 <p><i>this is about <b>foo's</b> family</i>
1071 </p>
1072 !!end
1073
1074
1075 !! test
1076 Italics and bold: other quote tests: (3,2,3,2)
1077 !! options
1078 parsoid=wt2html
1079 !! wikitext
1080 '''this is about ''foo'''s family''
1081 !! html/*
1082 <p><b>this is about <i>foo</i></b><i>s family</i>
1083 </p>
1084 !!end
1085
1086
1087 # same html as previous, but wikitext adjusted to match parsoid html2wt
1088 !! test
1089 Italics and bold: other quote tests: (3,2,3+2+2,2)
1090 !! wikitext
1091 '''this is about ''foo'''''<nowiki/>''s family''
1092 !! html
1093 <p><b>this is about <i>foo</i></b><i>s family</i>
1094 </p>
1095 !! end
1096
1097
1098 !! test
1099 Italics and bold: other quote tests: (3,2,3,3)
1100 !! wikitext
1101 '''this is about ''foo'''s family'''
1102 !! html/*
1103 <p>'<i>this is about </i>foo<b>s family</b>
1104 </p>
1105 !!end
1106
1107
1108 !! test
1109 Italics and bold: other quote tests: (3,(2,2),3)
1110 !! wikitext
1111 '''this is about ''foo's'' family'''
1112 !! html
1113 <p><b>this is about <i>foo's</i> family</b>
1114 </p>
1115 !!end
1116
1117
1118 !! test
1119 Italicized possessive
1120 !! wikitext
1121 The ''[[Main Page]]'''s talk page.
1122 !! html/php
1123 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1124 </p>
1125 !! html/parsoid
1126 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1127 !! end
1128
1129 !! test
1130 Quote balancing context should be restricted to td/th cells on the same wikitext line
1131 !! options
1132 parsoid=wt2html,wt2wt
1133 !! wikitext
1134 {|
1135 !''a!!''b
1136 |''a||''b
1137 |}
1138 !! html+tidy
1139 <table>
1140 <tbody><tr>
1141 <th><i>a</i></th>
1142 <th><i>b</i>
1143 </th>
1144 <td><i>a</i></td>
1145 <td><i>b</i>
1146 </td></tr></tbody></table>
1147 !! end
1148
1149 ###
1150 ### Non-html5 tags
1151 ###
1152
1153 !! test
1154 Non-html5 tags should be accepted
1155 !! wikitext
1156 <center>''foo''</center>
1157 <big>''foo''</big>
1158 <font>''foo''</font>
1159 <strike>''foo''</strike>
1160 <tt>''foo''</tt>
1161 !! html
1162 <center><i>foo</i></center>
1163 <p><big><i>foo</i></big>
1164 <font><i>foo</i></font>
1165 <strike><i>foo</i></strike>
1166 <tt><i>foo</i></tt>
1167 </p>
1168 !! end
1169
1170 !! test
1171 <wbr> is valid wikitext (T54468)
1172 !! wikitext
1173 <wbr>
1174 !! html
1175 <p><wbr />
1176 </p>
1177 !! end
1178
1179 # <strike> is HTML4, <s> is HTML4/5.
1180 !! test
1181 <s> or <strike> for strikethrough
1182 !! wikitext
1183 <strike>strike</strike>
1184
1185 <s>s</s>
1186 !! html
1187 <p><strike>strike</strike>
1188 </p><p><s>s</s>
1189 </p>
1190 !! end
1191
1192 ## a not permitted
1193 ## i,b,br omitted
1194 !! test
1195 Text-level semantic html elements in wikitext
1196 !! wikitext
1197 <em>text</em>
1198 <strong>text</strong>
1199 <small>text</small>
1200 <s>text</s>
1201 <cite>text</cite>
1202 <q>text</q>
1203 <dfn>text</dfn>
1204 <abbr>text</abbr>
1205 <data>text</data>
1206 <time>text</time>
1207 <code>text</code>
1208 <var>text</var>
1209 <samp>text</samp>
1210 <kbd>text</kbd>
1211 <sub>text</sub>
1212 <u>text</u>
1213 <mark>text</mark>
1214 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1215 <bdi>text</bdi>
1216 <bdo>text</bdo>
1217 <span>text</span>
1218 <wbr />
1219 !! html
1220 <p><em>text</em>
1221 <strong>text</strong>
1222 <small>text</small>
1223 <s>text</s>
1224 <cite>text</cite>
1225 <q>text</q>
1226 <dfn>text</dfn>
1227 <abbr>text</abbr>
1228 <data>text</data>
1229 <time>text</time>
1230 <code>text</code>
1231 <var>text</var>
1232 <samp>text</samp>
1233 <kbd>text</kbd>
1234 <sub>text</sub>
1235 <u>text</u>
1236 <mark>text</mark>
1237 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1238 <bdi>text</bdi>
1239 <bdo>text</bdo>
1240 <span>text</span>
1241 <wbr />
1242 </p>
1243 !! end
1244
1245 # test cases taken from
1246 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1247 !! test
1248 Ruby markup (W3C-style)
1249 !! wikitext
1250 ;Mono-ruby for individual base characters
1251 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1252 ;Group ruby
1253 :<ruby>今日<rt>きょう</rt></ruby>
1254 ;Jukugo ruby
1255 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1256 ;Inline ruby
1257 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1258 ;Double-sided ruby
1259 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1260 <ruby>
1261 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1262 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1263 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1264 </ruby>
1265 !! html
1266 <dl><dt>Mono-ruby for individual base characters</dt>
1267 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1268 <dt>Group ruby</dt>
1269 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1270 <dt>Jukugo ruby</dt>
1271 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1272 <dt>Inline ruby</dt>
1273 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1274 <dt>Double-sided ruby</dt>
1275 <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1276 <p><ruby>
1277 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1278 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1279 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1280 </ruby>
1281 </p>
1282 !! end
1283
1284 # The next two test different paths in the sanitizer.
1285 !! test
1286 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1287 !! wikitext
1288 <blockquote|>a</blockquote>
1289
1290 <b→> doesn't terminate </b→>
1291
1292 <bä> doesn't terminate </bä>
1293
1294 <boo> doesn't terminate </boo>
1295
1296 <s.foo> doesn't terminate </s.foo>
1297
1298 <sub-ID#1>
1299 !! html
1300 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1301 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1302 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1303 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1304 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1305 </p><p>&lt;sub-ID#1&gt;
1306 </p>
1307 !! end
1308
1309 !! test
1310 Non-word characters don't terminate tag names
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html+tidy
1324 <p>&lt;blockquote|&gt;a
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 ###
1334 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1335 ### This checks that HTML5 tags (with non-word characters in the tag
1336 ### name) make it safely through the parser -- the Sanitizer will
1337 ### munge them later, as it should.
1338 ###
1339 !! test
1340 Non-word characters are valid in extension tags (T19663)
1341 !! wikitext
1342 <tåg>tåg</tåg>
1343 !! html/php
1344 <pre>
1345 'tåg'
1346 array (
1347 )
1348 </pre>
1349
1350 !! html/parsoid
1351 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1352 !! end
1353
1354 !! test
1355 Isolated close tags should be treated as literal text (T54760)
1356 !! options
1357 parsoid=wt2html
1358 !! wikitext
1359 </b>
1360
1361 <s.foo>s</s>
1362 !! html/php+tidy
1363 <p class="mw-empty-elt">
1364 </p><p>&lt;s.foo&gt;s
1365 </p>
1366 !! html/parsoid
1367 <p>&lt;s.foo&gt;s</p>
1368 !! end
1369
1370 ###
1371 ### Special characters
1372 ###
1373
1374 !! test
1375 Bare pipe character (T54363)
1376 !! wikitext
1377 |
1378 !! html
1379 <p>|
1380 </p>
1381 !! end
1382
1383 !! test
1384 Bare pipe character from a template (T54363)
1385 !! wikitext
1386 {{pipe}}
1387 !! html
1388 <p>|
1389 </p>
1390 !! end
1391
1392 ###
1393 ### <nowiki> test cases
1394 ###
1395
1396 !! test
1397 <nowiki> unordered list
1398 !! wikitext
1399 <nowiki>* This is not an unordered list item.</nowiki>
1400 !! html/php
1401 <p>* This is not an unordered list item.
1402 </p>
1403 !! html/parsoid
1404 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1405 !! end
1406
1407 !! test
1408 <nowiki> spacing
1409 !! wikitext
1410 <nowiki>Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </nowiki>
1417 !! html/php
1418 <p>Lorem ipsum dolor
1419
1420 sed abit.
1421 sed nullum.
1422
1423 :and a colon
1424
1425 </p>
1426 !! html/parsoid
1427 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1428
1429 sed abit.
1430 sed nullum.
1431
1432 :and a colon
1433 </span></p>
1434 !! end
1435
1436 !! test
1437 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1438 !! wikitext
1439 <nowiki><span class="error"></nowiki>
1440 !! html/php
1441 <p>&lt;span class="error"&gt;
1442 </p>
1443 !! html/parsoid
1444 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1445 !! end
1446
1447 !! test
1448 nowiki 3
1449 !! wikitext
1450 :There is not nowiki.
1451 :There is <nowiki>nowiki</nowiki>.
1452
1453 #There is not nowiki.
1454 #There is <nowiki>nowiki</nowiki>.
1455
1456 *There is not nowiki.
1457 *There is <nowiki>nowiki</nowiki>.
1458 !! html/php
1459 <dl><dd>There is not nowiki.</dd>
1460 <dd>There is nowiki.</dd></dl>
1461 <ol><li>There is not nowiki.</li>
1462 <li>There is nowiki.</li></ol>
1463 <ul><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ul>
1465
1466 !! html/parsoid
1467 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1468 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1469
1470 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1471 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1472
1473 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1474 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1475 !! end
1476
1477 !! test
1478 Entities inside <nowiki>
1479 !! wikitext
1480 <nowiki>&lt;</nowiki>
1481 !! html/php
1482 <p>&lt;
1483 </p>
1484 !! html/parsoid
1485 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1486 !! end
1487
1488 !! test
1489 Entities inside template parameters
1490 !! wikitext
1491 {{echo|&ndash;}}
1492 !! html/php+tidy
1493 <p>&#8211;
1494 </p>
1495 !! html/parsoid
1496 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1497 !! end
1498
1499 !! test
1500 Properly escape nowiki when combined with other wiki markup
1501 !! options
1502 parsoid=html2wt
1503 !! html/parsoid
1504 <p>* &lt;/nowiki&gt; tag</p>
1505 !! wikitext
1506 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1507 !! end
1508
1509 !! test
1510 T93824: Put escaped HTML tags inside nowiki
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1515 !! wikitext
1516 <nowiki><h2>foo</h2></nowiki>
1517 !! end
1518
1519 !! test
1520 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1525 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1526 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1527 !! wikitext
1528 This text: L'[[Foo]]
1529 This text: L<nowiki>''</nowiki>[[Foo]]
1530 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1531 !! end
1532
1533 # This test fails because wikitext whitespace is not normalized before comparing.
1534 !! test
1535 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 </p>
1541 !! wikitext
1542 This text : L<nowiki>''</nowiki>[[Foo]]
1543 !! end
1544
1545 # This test and the next one are html2wt only as they test that incorrect wikitext
1546 # passed in template arguments gets escaped or wrapped in nowikis where required.
1547 !! test
1548 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1549 !! options
1550 parsoid=html2wt
1551 !! html/parsoid
1552 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1553 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1554 !! wikitext
1555 {{echo|foo{{!}}bar}}
1556 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1557 !! end
1558
1559 !! test
1560 T53961: Output correct nowikis in template arguments
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1565 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1566 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1567 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1568 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1569 !! wikitext
1570 {{echo|a [ b}}
1571 {{echo|<nowiki>a }} b</nowiki>}}
1572 {{echo|<nowiki>a [[ b</nowiki>}}
1573 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1574 {{echo|a <nowiki>}</nowiki>}}
1575 !! end
1576
1577 !! test
1578 Cases where "!!" needs nowiki protection
1579 !! options
1580 parsoid=html2wt
1581 !! html/parsoid
1582 <table>
1583 <tr><th>this needs protection !! here</th></tr>
1584 </table>
1585
1586 <table>
1587 <tr><th>this does not need
1588 protection !! here</th></tr>
1589 </table>
1590 !! wikitext
1591 {|
1592 !<nowiki>this needs protection !! here</nowiki>
1593 |}
1594
1595 {|
1596 !this does not need
1597 protection !! here
1598 |}
1599 !! end
1600
1601 ###
1602 ### Comments
1603 ###
1604 !! test
1605 Comments and Indent-Pre
1606 !! wikitext
1607 <!-- comment 1 --> asdf
1608
1609 <!-- comment 1 --> asdf
1610 <!-- comment 2 -->
1611
1612 <!-- comment 1 --> asdf
1613 <!-- comment 2 -->xyz
1614
1615 <!-- comment 1 --> asdf
1616 <!-- comment 2 --> xyz
1617 !! html
1618 <pre>asdf
1619 </pre>
1620 <pre>asdf
1621 </pre>
1622 <pre>asdf
1623 </pre>
1624 <p>xyz
1625 </p>
1626 <pre>asdf
1627 xyz
1628 </pre>
1629 !! end
1630
1631 !! test
1632 Comment test 2a
1633 !! wikitext
1634 asdf
1635 <!-- comment 1 -->
1636 jkl
1637 !! html
1638 <p>asdf
1639 jkl
1640 </p>
1641 !! end
1642
1643 !! test
1644 Comment test 2b
1645 !! wikitext
1646 asdf
1647 <!-- comment 1 -->
1648
1649 jkl
1650 !! html
1651 <p>asdf
1652 </p><p>jkl
1653 </p>
1654 !! end
1655
1656 !! test
1657 Comment test 3
1658 !! wikitext
1659 asdf
1660 <!-- comment 1 -->
1661 <!-- comment 2 -->
1662 jkl
1663 !! html
1664 <p>asdf
1665 jkl
1666 </p>
1667 !! end
1668
1669 !! test
1670 Comment test 4
1671 !! wikitext
1672 asdf<!-- comment 1 -->jkl
1673 !! html
1674 <p>asdfjkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment spacing
1680 !! wikitext
1681 a
1682 <!-- foo --> b <!-- bar -->
1683 c
1684 !! html
1685 <p>a
1686 </p>
1687 <pre> b
1688 </pre>
1689 <p>c
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment whitespace
1695 !! wikitext
1696 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1697 !! html
1698
1699 !! end
1700
1701 !! test
1702 Comment semantics and delimiters
1703 !! wikitext
1704 <!-- --><!----><!-----><!------>
1705 !! html/php
1706
1707 !! html/parsoid
1708 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters, redux
1713 !! wikitext
1714 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1715 -- foo -- funky huh? ... -->
1716 !! html/php
1717
1718 !! html/parsoid
1719 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1720 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1721 !! end
1722
1723 !! test
1724 Comment semantics and delimiters: directors cut
1725 !! wikitext
1726 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1727 everything starting with < followed by !-- until the first -- and > we see,
1728 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1729 -->-->
1730 !! html/php
1731 <p>--&gt;
1732 </p>
1733 !! html/parsoid
1734 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1735 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1736 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1737 --><p>--></p>
1738 !! end
1739
1740 !! test
1741 Comment semantics: nesting
1742 !! wikitext
1743 <!--<!-- no, we're not going to do anything fancy here -->-->
1744 !! html/php
1745 <p>--&gt;
1746 </p>
1747 !! html/parsoid
1748 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1749 !! end
1750
1751 # Parsoid closes the unclosed comment, even if it means a slight
1752 # round-trip diff.
1753 !! test
1754 Comment semantics: unclosed comment at end
1755 !! options
1756 parsoid=wt2html,html2html
1757 !! wikitext
1758 <!--This comment will run out to the end of the document
1759 !! html/php
1760
1761 !! html/parsoid
1762 <!--This comment will run out to the end of the document-->
1763 !! end
1764
1765 !! test
1766 Comment semantics: normalize comments to play nice with XML and browsers
1767 !! wikitext
1768 <!-- Browsers --!> think this is closed -->
1769 <!--> This would normally be text -->
1770 <!---> As would this -->
1771 <!-- XML doesn't like trailing dashes -------->
1772 <!-- Nor doubled hyphens -- anywhere in the data -->
1773 But this is not a comment.
1774 !! html/php
1775 <p>But this is not a comment.
1776 </p>
1777 !! html/parsoid
1778 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1779 <!--&#x3E; This would normally be text -->
1780 <!--&#x2D;&#x3E; As would this -->
1781 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1782 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1783 <p>But this is not a comment.</p>
1784 !! end
1785
1786 !! test
1787 Comment semantics: round-trip even text which contains encoded -->
1788 !! wikitext
1789 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1790 !! html/parsoid
1791 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1792 !! end
1793
1794 !! test
1795 Comment in template title
1796 !! wikitext
1797 {{f<!---->oo}}
1798 !! html
1799 <p>FOO
1800 </p>
1801 !! end
1802
1803 !! test
1804 Comment on its own line post-expand
1805 !! wikitext
1806 a
1807 {{blank}}<!---->
1808 b
1809 !! html
1810 <p>a
1811 </p><p>b
1812 </p>
1813 !! end
1814
1815 !! test
1816 Comment on its own line post-expand with non-significant whitespace
1817 !! wikitext
1818 a
1819 {{blank}} <!---->
1820 b
1821 !! html
1822 <p>a
1823 </p><p>b
1824 </p>
1825 !! end
1826
1827 !! test
1828 Multiple comments should still parse as SOL-transparent
1829 !! options
1830 parsoid=wt2html,wt2wt
1831 !! wikitext
1832 <!--c1-->*a
1833 <!--c2--><!--c3--><!--c4-->*b
1834 !! html/php
1835 <ul><li>a</li>
1836 <li>b</li></ul>
1837
1838 !! html/parsoid
1839 <!--c1--><ul>
1840 <li>a
1841 </li>
1842 <!--c2--><!--c3--><!--c4-->
1843 <li>b
1844 </li>
1845 </ul>
1846 !! end
1847
1848 ## Make sure ">" gets escaped in comments to avoid XSS
1849 !! test
1850 IE conditional comments
1851 !! wikitext
1852 <!--[if lt IE 9]>
1853 <script>alert('hi');</script>
1854 <![endif]-->
1855 !! html/parsoid
1856 <!--[if lt IE 9]&#x3E;
1857 <script&#x3E;alert('hi');</script&#x3E;
1858 <![endif]-->
1859 !! end
1860
1861 ###
1862 ### paragraph wrapping tests
1863 ###
1864
1865 !! test
1866 No block tags
1867 !! wikitext
1868 a
1869
1870 b
1871 !! html
1872 <p>a
1873 </p><p>b
1874 </p>
1875 !! end
1876
1877 !! test
1878 Block tag on one line (<div>)
1879 !! wikitext
1880 a <div>foo</div>
1881
1882 b
1883 !! html
1884 a <div>foo</div>
1885 <p>b
1886 </p>
1887 !! html+tidy
1888 <p>a </p><div>foo</div>
1889 <p>b
1890 </p>
1891 !! end
1892
1893 # Remex wraps empty tag runs with p-tags.
1894 # Parsoid strips them out during p-wrapping.
1895 !! test
1896 No p-wrappable content
1897 !! wikitext
1898 <span><div>x</div></span>
1899 <span><s><div>x</div></s></span>
1900 <small><em></em></small><span><s><div>x</div></s></span>
1901 !! html/php+tidy
1902 <span><div>x</div></span>
1903 <span><s><div>x</div></s></span>
1904 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1905 !! html/parsoid
1906 <span><div>x</div></span>
1907 <span><s><div>x</div></s></span>
1908 <small><em></em></small><span><s><div>x</div></s></span>
1909 !! end
1910
1911 # T177612: Parsoid-only test
1912 !! test
1913 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1914 !! wikitext
1915 {{echo|<span><div>x</div></span>}}
1916 x
1917 !! html/parsoid
1918 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
1919 <p>x</p>
1920 !! end
1921
1922 !! test
1923 Block tag on one line (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 <p>b
1931 </p>
1932 !! html+tidy
1933 <p>a </p><blockquote><p>foo</p></blockquote>
1934 <p>b
1935 </p>
1936 !! end
1937
1938 !! test
1939 Block tag on both lines (<div>)
1940 !! wikitext
1941 a <div>foo</div>
1942
1943 b <div>foo</div>
1944 !! html
1945 a <div>foo</div>
1946 b <div>foo</div>
1947
1948 !! html+tidy
1949 <p>a </p><div>foo</div><p>
1950 b </p><div>foo</div>
1951 !! end
1952
1953 !! test
1954 Block tag on both lines (<blockquote>)
1955 !! wikitext
1956 a <blockquote>foo</blockquote>
1957
1958 b <blockquote>foo</blockquote>
1959 !! html
1960 a <blockquote>foo</blockquote>
1961 b <blockquote>foo</blockquote>
1962
1963 !! html+tidy
1964 <p>a </p><blockquote><p>foo</p></blockquote><p>
1965 b </p><blockquote><p>foo</p></blockquote>
1966 !! end
1967
1968 !! test
1969 Multiple lines without block tags
1970 !! wikitext
1971 <div>foo</div> a
1972 b
1973 c
1974 d<!--foo--> e
1975 x <div>foo</div> z
1976 !! html
1977 <div>foo</div> a
1978 <p>b
1979 c
1980 d e
1981 </p>
1982 x <div>foo</div> z
1983
1984 !! html+tidy
1985 <div>foo</div><p> a
1986 </p><p>b
1987 c
1988 d e
1989 </p><p>
1990 x </p><div>foo</div><p> z
1991 </p>
1992 !! end
1993
1994 # The difference between Parsoid & Remex here
1995 # is because of Parsoid's Tidy-emulation code
1996 # for p-wrapping. We'll start work to remove this
1997 # emulation code in Parsoid sooner than later.
1998 # Remex wraps empty tag runs with p-tags.
1999 # Parsoid strips them out in a separate pass.
2000 !! test
2001 Empty lines between lines with block tags
2002 !! wikitext
2003 <div></div>
2004
2005
2006 <div></div>a
2007
2008 b
2009 <div>a</div>b
2010
2011 <div>b</div>d
2012
2013
2014 <div>e</div>
2015 !! html
2016 <div></div>
2017 <p><br />
2018 </p>
2019 <div></div>a
2020 <p>b
2021 </p>
2022 <div>a</div>b
2023 <div>b</div>d
2024 <p><br />
2025 </p>
2026 <div>e</div>
2027
2028 !! html+tidy
2029 <div></div>
2030 <p><br />
2031 </p>
2032 <div></div><p>a
2033 </p><p>b
2034 </p>
2035 <div>a</div><p>b
2036 </p><div>b</div><p>d
2037 </p><p><br />
2038 </p>
2039 <div>e</div>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'></div>
2042
2043 <p><br /></p>
2044 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2045
2046 <p>b</p>
2047 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2048
2049 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2050
2051 <p><br /></p>
2052 <div data-parsoid='{"stx":"html"}'>e</div>
2053 !! end
2054
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div><p>foo</p></div>
2064 <p>a
2065 </p><p>b
2066 </p>
2067 !! html/parsoid
2068 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2069 <p>a</p>
2070 <p>b</p>
2071 !! end
2072
2073 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2074 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2075 ## them for now.
2076 !! test
2077 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2078 !! options
2079 parsoid=wt2html
2080 !! wikitext
2081 a [[Category:A1]] [[Category:A2]]
2082 [[Category:A3]]
2083 [[Category:A4]]
2084 !! html/parsoid
2085 <p>a</p>
2086 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2087 !! end
2088
2089 !! test
2090 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2091 !! options
2092 parsoid=wt2html
2093 !! wikitext
2094 [[Category:A1]]a
2095 !! html/parsoid
2096 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2097 !! end
2098
2099 !! test
2100 No paragraph necessary for SOL transparent template
2101 !! wikitext
2102 <span><div>foo</div></span>
2103 [[Category:Foo]]
2104
2105 <span><div>foo</div></span>
2106 {{echo|[[Category:Foo]]}}
2107 !! html/php
2108 <span><div>foo</div></span>
2109 <span><div>foo</div></span>
2110
2111 !! html/parsoid
2112 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2113 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2114
2115 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2116 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2117 !! end
2118
2119 !! test
2120 Avoid expanding multiline sol transparent template ranges unnecessarily
2121 !! wikitext
2122 hi
2123
2124
2125 {{echo|<br/>
2126 }}
2127
2128 [[Category:Ho]]
2129 !! html/php
2130 <p>hi
2131 </p><p><br />
2132 <br />
2133 </p>
2134 !! html/parsoid
2135 <p>hi</p>
2136
2137 <p><br />
2138 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2139 </span></p>
2140
2141 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2142 !! end
2143
2144 ###
2145 ### Preformatted text
2146 ###
2147
2148 !! test
2149 Preformatted text
2150 !! wikitext
2151 This is some
2152 Preformatted text
2153 With ''italic''
2154 And '''bold'''
2155 And a [[Main Page|link]]
2156 !! html
2157 <pre>This is some
2158 Preformatted text
2159 With <i>italic</i>
2160 And <b>bold</b>
2161 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2162 </pre>
2163 !! end
2164
2165 !! test
2166 Tabs don't trigger preformatted text
2167 !! wikitext
2168 This is not
2169 preformatted text.
2170 This is preformatted text.
2171 So is this.
2172 !! html/php
2173 <p> This is not
2174 preformatted text.
2175 </p>
2176 <pre>This is preformatted text.
2177 So is this.
2178 </pre>
2179 !! html/parsoid
2180 <p> This is not
2181 preformatted text.</p>
2182 <pre>This is preformatted text.
2183 So is this.</pre>
2184 !! end
2185
2186 !! test
2187 Space before tab needs nowiki pre protection
2188 !! options
2189 parsoid=html2wt
2190 !! html/parsoid
2191 <p> a</p>
2192 !! wikitext
2193 <nowiki> </nowiki> a
2194 !! end
2195
2196 !! test
2197 Ident preformatting with inline content
2198 !! wikitext
2199 a
2200 ''b''
2201 !! html
2202 <pre>a
2203 <i>b</i>
2204 </pre>
2205 !! end
2206
2207 !! test
2208 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2209 !! wikitext
2210 <pre><nowiki>
2211 <b>
2212 <cite>
2213 <em>
2214 </nowiki></pre>
2215 !! html
2216 <pre>
2217 &lt;b&gt;
2218 &lt;cite&gt;
2219 &lt;em&gt;
2220 </pre>
2221
2222 !! end
2223
2224 !! test
2225 Regression with preformatted in <center>
2226 !! wikitext
2227 <center>
2228 Blah
2229 </center>
2230 !! html
2231 <center>
2232 <pre>Blah
2233 </pre>
2234 </center>
2235
2236 !! end
2237
2238 !! test
2239 T54763: Preformatted in <blockquote>
2240 !! wikitext
2241 <blockquote>
2242 Blah
2243 {|
2244 |
2245 indented cell (no pre-wrapping!)
2246 |}
2247 </blockquote>
2248 !! html
2249 <blockquote>
2250 <p> Blah
2251 </p>
2252 <table>
2253 <tr>
2254 <td>
2255 <p> indented cell (no pre-wrapping!)
2256 </p>
2257 </td></tr></table>
2258 </blockquote>
2259
2260 !! end
2261
2262 !! test
2263 T53086: Double newlines in blockquotes should be turned into paragraphs
2264 !! wikitext
2265 <blockquote>
2266 Foo
2267
2268 Bar
2269 </blockquote>
2270 !! html
2271 <blockquote>
2272 <p>Foo
2273 </p><p>Bar
2274 </p>
2275 </blockquote>
2276
2277 !! end
2278
2279 !! test
2280 T17491: <ins>/<del> in blockquote
2281 !! wikitext
2282 <blockquote>
2283 Foo <del>bar</del> <ins>baz</ins> quux
2284 </blockquote>
2285 !! html
2286 <blockquote>
2287 <p>Foo <del>bar</del> <ins>baz</ins> quux
2288 </p>
2289 </blockquote>
2290
2291 !! end
2292
2293 !! test
2294 T17491: <ins>/<del> in blockquote (2)
2295 !! wikitext
2296 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2297 </blockquote>
2298 !! html
2299 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2300 </blockquote>
2301
2302 !! html+tidy
2303 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2304 </p></blockquote>
2305 !! end
2306
2307 !! test
2308 <pre> with attributes (T5202)
2309 !! wikitext
2310 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2311 !! html
2312 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2313
2314 !! end
2315
2316 !! test
2317 <pre> with width attribute (T5202)
2318 !! wikitext
2319 <pre width="8">Narrow screen goodies</pre>
2320 !! html
2321 <pre width="8">Narrow screen goodies</pre>
2322
2323 !! end
2324
2325 !! test
2326 <pre> with forbidden attribute (T5202)
2327 !! wikitext
2328 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2329 !! html
2330 <pre width="8">Narrow screen goodies</pre>
2331
2332 !! end
2333
2334 !! test
2335 Entities inside <pre>
2336 !! wikitext
2337 <pre>&lt;</pre>
2338 !! html
2339 <pre>&lt;</pre>
2340
2341 !! end
2342
2343 !! test
2344 <pre> with forbidden attribute values (T5202)
2345 !! wikitext
2346 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2347 !! html
2348 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2349
2350 !! end
2351
2352 !! test
2353 <nowiki> inside <pre> (T15238)
2354 !! wikitext
2355 <pre>
2356 <nowiki>
2357 </pre>
2358 <pre>
2359 <nowiki></nowiki>
2360 </pre>
2361 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2362 !! html
2363 <pre>
2364 &lt;nowiki&gt;
2365 </pre>
2366 <pre>
2367
2368 </pre>
2369 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2370
2371 !! end
2372
2373 !! test
2374 <nowiki> inside of #tag:pre
2375 !! wikitext
2376 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2377 !! html/php
2378 <pre>Foo &#8594;bar</pre>
2379
2380 !! html/parsoid
2381 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2382 !! end
2383
2384 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2385 ## aren't enclosed in nowikis.
2386 !! test
2387 <nowiki> and <pre> preference (first one wins)
2388 !! options
2389 parsoid=wt2html
2390 !! wikitext
2391 <pre>
2392 <nowiki>
2393 </pre>
2394 </nowiki>
2395 </pre>
2396
2397 <nowiki>
2398 <pre>
2399 <nowiki>
2400 </pre>
2401 </nowiki>
2402 </pre>
2403
2404 !! html/php
2405 <pre>
2406 &lt;nowiki&gt;
2407 </pre>
2408 <p>&lt;/nowiki&gt;
2409 &lt;/pre&gt;
2410 </p><p>
2411 &lt;pre&gt;
2412 &lt;nowiki&gt;
2413 &lt;/pre&gt;
2414
2415 &lt;/pre&gt;
2416 </p>
2417 !! html/parsoid
2418 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2419 </pre>
2420 <p>&lt;/nowiki></p>
2421
2422
2423 <p><span typeof="mw:Nowiki">
2424 &lt;pre>
2425 &lt;nowiki>
2426 &lt;/pre>
2427 </span></p>
2428 !! end
2429
2430 !! test
2431 </pre> inside nowiki
2432 !! wikitext
2433 <nowiki></pre></nowiki>
2434 !! html
2435 <p>&lt;/pre&gt;
2436 </p>
2437 !! end
2438
2439 !! test
2440 Empty pre; pre inside other HTML tags (T56946)
2441 !! wikitext
2442 a
2443
2444 <div><pre>
2445 foo
2446 </pre></div>
2447 <pre></pre>
2448 !! html/php+tidy
2449 <p>a
2450 </p>
2451 <div><pre>foo
2452 </pre></div>
2453 <pre></pre>
2454 !! html/parsoid
2455 <p>a</p>
2456
2457 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2458 </pre></div>
2459 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2460 !! end
2461
2462 !! test
2463 HTML pre followed by indent-pre
2464 !! wikitext
2465 <pre>foo</pre>
2466 bar
2467 !! html
2468 <pre>foo</pre>
2469 <pre>bar
2470 </pre>
2471 !! end
2472
2473 !! test
2474 Block tag pre
2475 !! wikitext
2476 <p><pre>foo</pre></p>
2477 !! html/php+tidy
2478 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2479 !! html/parsoid
2480 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2481 !! end
2482
2483 !!test
2484 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2485 !! wikitext
2486 {{echo|}}
2487 !! html
2488
2489 !!end
2490
2491 !!test
2492 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2493 !! wikitext
2494 {{echo|
2495 foo}}
2496 !! html
2497 <p>foo
2498 </p>
2499 !!end
2500
2501 !! test
2502 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2503 !! wikitext
2504 {{echo|a
2505 b}}
2506 !! html
2507 <pre>a
2508 </pre>
2509 <p>b
2510 </p>
2511 !!end
2512
2513 !! test
2514 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2515 !! wikitext
2516 {{echo|a
2517 b
2518 c
2519 d
2520 e
2521 }}
2522 !! html
2523 <pre>a
2524 </pre>
2525 <p>b
2526 c
2527 </p>
2528 <pre>d
2529 </pre>
2530 <p>e
2531 </p>
2532 !!end
2533
2534 !!test
2535 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2536 !! wikitext
2537 {{echo| foo}}
2538
2539 {{echo| foo}}{{echo| bar}}
2540
2541 {{echo| foo}}
2542 {{echo| bar}}
2543
2544 {{echo|<!--cmt--> foo}}
2545
2546 <!--cmt-->{{echo| foo}}
2547
2548 {{echo|{{echo| }}bar}}
2549 !! html
2550 <pre>foo
2551 </pre>
2552 <pre>foo bar
2553 </pre>
2554 <pre>foo
2555 bar
2556 </pre>
2557 <pre>foo
2558 </pre>
2559 <pre>foo
2560 </pre>
2561 <pre>bar
2562 </pre>
2563 !!end
2564
2565 !! test
2566 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2567 !! wikitext
2568 {{echo| }}a
2569
2570 {{echo|
2571 }}a
2572
2573 {{echo|
2574 b}}
2575
2576 {{echo|a
2577 }}b
2578
2579 {{echo|a
2580 }} b
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p><br />
2585 </p>
2586 <pre>a
2587 </pre>
2588 <p><br />
2589 </p>
2590 <pre>b
2591 </pre>
2592 <p>a
2593 </p>
2594 <pre>b
2595 </pre>
2596 <p>a
2597 </p>
2598 <pre>b
2599 </pre>
2600 !!end
2601
2602 ## Hmm, should Parsoid rt this?
2603 !! test
2604 Pres with newline attributes
2605 !! options
2606 parsoid=wt2html,html2html
2607 !! wikitext
2608 <pre class="one
2609 two">hi</pre>
2610 !! html/php
2611 <pre class="one two">hi</pre>
2612
2613 !! html/parsoid
2614 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2615 !! end
2616
2617 !! test
2618 Things that look like <pre> tags aren't treated as such
2619 !! wikitext
2620 Barack Obama <President> of the United States
2621 <President></President>
2622 !! html
2623 <p>Barack Obama &lt;President&gt; of the United States
2624 &lt;President&gt;&lt;/President&gt;
2625 </p>
2626 !! end
2627
2628 !! test
2629 Handle broken pre-like tags (T66025)
2630 !! options
2631 parsoid=wt2html
2632 !! wikitext
2633 {{echo|<pre <pre>x</pre>}}
2634
2635 <table><pre </table>
2636 !! html/php
2637 <pre>x</pre>
2638 <table>&lt;pre </table>
2639
2640 !! html/php+tidy
2641 <pre>x</pre>
2642 &lt;pre <table></table>
2643 !! html/parsoid
2644 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2645
2646
2647 <p>&lt;pre </p>
2648
2649 <table></table>
2650 !! end
2651
2652 !! test
2653 Parsoid: handle pre with space after attribute
2654 !! options
2655 parsoid=wt2html
2656 !! wikitext
2657 <pre style="width:50%;" >{{echo|foo}}</pre>
2658 !! html/php
2659 <pre style="width:50%;">{{echo|foo}}</pre>
2660
2661 !! html/parsoid
2662 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2663 !! end
2664
2665 # TODO / maybe: fix wt2wt for this
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td></td>
2673 <td></td>
2674
2675
2676
2677 |}
2678 !! html
2679 <table>
2680
2681 <tbody>
2682 <tr>
2683 <td></td>
2684
2685 <td></td></tr>
2686
2687
2688
2689 </tbody></table>
2690 !! end
2691
2692 !! test
2693 Self-closed pre
2694 !! wikitext
2695 <pre />
2696 !! html/php
2697 <pre></pre>
2698
2699 !! html/parsoid
2700 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2701 !! end
2702
2703 !! test
2704 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2705 !! options
2706 parsoid=wt2html
2707 !! wikitext
2708 {|
2709 <td>
2710 <td>
2711 </td>
2712
2713
2714
2715 |}
2716 !! html
2717 <table>
2718
2719 <tbody>
2720 <tr>
2721 <td></td>
2722
2723 <td>
2724 </td></tr>
2725
2726
2727
2728 </tbody></table>
2729 !! end
2730
2731
2732 #--------------------------------------------------------------------
2733 # Transclusion parameter whitespace stripping tests
2734 # Behavior is different for positional and named parameters
2735 #--------------------------------------------------------------------
2736 !! test
2737 Templates: Strip leading and trailing whitespace from named-param values
2738 !! wikitext
2739 {{echo|1= a }}
2740
2741 {{echo|1= {{echo|b}} }}
2742
2743 {{echo| 1 =
2744 c }}
2745
2746 {{echo| 1 =
2747 * d
2748 }}
2749 !! html
2750 <p>a
2751 </p><p>b
2752 </p><p>c
2753 </p>
2754 <ul><li>d</li></ul>
2755
2756 !! end
2757
2758 !! test
2759 Templates: Don't strip whitespace from positional-param values
2760 !! wikitext
2761 {{echo|a }}
2762
2763 {{echo|{{echo|b}} }}
2764
2765 {{echo| c
2766 }}
2767
2768 {{echo| {{echo|d}}
2769 }}
2770
2771 {{echo|
2772 e}}
2773
2774 {{echo|
2775 *f}}
2776
2777 {{echo|
2778 }}g
2779 !! html
2780 <p>a
2781 </p><p>b
2782 </p>
2783 <pre>c
2784 </pre>
2785 <p><br />
2786 </p>
2787 <pre>d
2788 </pre>
2789 <p><br />
2790 </p>
2791 <pre>e
2792 </pre>
2793 <p><br />
2794 </p>
2795 <ul><li>f</li></ul>
2796 <p><br />
2797 </p>
2798 <pre>g
2799 </pre>
2800 !! end
2801
2802 !! test
2803 Templates: Don't recognize targets split by newlines
2804 !! options
2805 parsoid=wt2html
2806 !! wikitext
2807 {{ech
2808 o|foo}}
2809 !! html/php
2810 <p>{{ech
2811 o|foo}}
2812 </p>
2813 !! html/parsoid
2814 <p>{{ech
2815 o|foo}}</p>
2816 !! end
2817
2818 !! test
2819 Templates: Recognize targets when newlines and comments don't split the target
2820 !! options
2821 parsoid=wt2html
2822 !! wikitext
2823 {{
2824 <!--X--> ech<!--X-->o<!--X-->
2825 <!--X--> <!--X-->
2826
2827 |foo}}
2828 !! html/php
2829 <p>foo
2830 </p>
2831 !! html/parsoid
2832 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2833 !! end
2834
2835 !! test
2836 Templates: Handle empty comment-and-ws-only lines correctly
2837 !! wikitext
2838 {{echo|foo
2839 <!--should be ignored-->
2840 <!--should be ignored as well-->
2841 bar}}
2842 !! html/php
2843 <p>foo
2844 bar
2845 </p>
2846 !! html/parsoid
2847 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2848 !! end
2849
2850 !! test
2851 Templates: Handle comments in the target
2852 !! wikitext
2853 {{echo
2854 <!-- should be ignored -->
2855 |foo}}
2856
2857 {{echo
2858 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2859 |foo}}
2860
2861 {{echo<!-- should be ignored -->
2862 |foo}}
2863
2864 {{echo<!-- should be ignored -->|foo}}
2865
2866 {{<!-- should be ignored -->echo|foo}}
2867 !! html/php
2868 <p>foo
2869 </p><p>foo
2870 </p><p>foo
2871 </p><p>foo
2872 </p><p>foo
2873 </p>
2874 !! html/parsoid
2875 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2876
2877 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2878
2879 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2880
2881 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2882
2883 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2884 !! end
2885
2886 !! test
2887 Templates: Handle comments in parameter names (T69657)
2888 !! wikitext
2889 {{echo|1
2890 <!-- should be ignored -->
2891 =foo}}
2892
2893 {{echo|
2894 <!-- should be ignored -->
2895 1 = foo}}
2896
2897 {{echo|1<!-- should be ignored -->=foo}}
2898
2899 {{echo|<!-- should be ignored -->1=foo}}
2900 !! html/php
2901 <p>foo
2902 </p><p>foo
2903 </p><p>foo
2904 </p><p>foo
2905 </p>
2906 !! html/parsoid
2907 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2908
2909 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2910
2911 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2912
2913 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2914 !! end
2915
2916 !! test
2917 Templates: Other wikitext in parameter names (T69657)
2918 !! wikitext
2919 {{echo|''1''=foo}}
2920 !! html/php
2921 <p>{{{1}}}
2922 </p>
2923 !! html/parsoid
2924 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2925 !! end
2926
2927 !! test
2928 Templates: With colons
2929 !! wikitext
2930 {{With: Colon}}
2931 !! html/php
2932 <p>Template with colon
2933 </p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
2936 !! end
2937
2938 #--------------------------------------------------------------------
2939 # Transclusion parameter escaping tests
2940 #--------------------------------------------------------------------
2941
2942 !! test
2943 Templates: Parsoid parameter escaping test 1
2944 !! wikitext
2945 {{echo|[foo]|{{echo|[bar]}}}}
2946 !! html/php+tidy
2947 <p>[foo]
2948 </p>
2949 !! html/parsoid
2950 <p about="#mwt1" typeof="mw:Transclusion"
2951 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2952 !! end
2953
2954 !! test
2955 Parsoid: Pipes in external links in template parameter
2956 !! wikitext
2957 {{echo|[{{echo|http://example.com}} link]}}
2958 !! html/php+tidy
2959 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2960 </p>
2961 !! html/parsoid
2962 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2963 !! end
2964
2965 !! test
2966 Parsoid: pipe in transclusion parameter
2967 !! wikitext
2968 {{echo|http://foo.com/a&#124;b}}
2969 !! html/php+tidy
2970 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2971 </p>
2972 !! html/parsoid
2973 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2974 !! end
2975
2976 !! test
2977 Parsoid: Pipe in external link target and content in template parameter
2978 !! options
2979 parsoid=html2wt,wt2wt
2980 !! wikitext
2981 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2982 !! html/php+tidy
2983 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2984 </p>
2985 !! html/parsoid
2986 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2987 typeof="mw:Transclusion"
2988 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2989 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2990 !! end
2991
2992 !! test
2993 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2994 !! options
2995 parsoid
2996 !! wikitext
2997 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2998 !! html
2999 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3000 !! end
3001
3002 !! test
3003 Templates: Don't escape already nowiki-escaped text in template parameters
3004 !! options
3005 parsoid=html2wt,wt2wt
3006 !! wikitext
3007 {{echo|foo<nowiki>|</nowiki>bar}}
3008 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3009 {{echo|<nowiki></nowiki>}}
3010 !! html/php+tidy
3011 <p>foo|bar
3012 &lt;div&gt;
3013
3014 </p>
3015 !! html/parsoid
3016 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3017 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3018 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3019 </p>
3020 !! end
3021
3022 ## T54824
3023 !! test
3024 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3025 !! options
3026 parsoid=html2wt,wt2wt
3027 !! wikitext
3028 {{echo|{{echo|1=bar}}}}
3029 !! html/php+tidy
3030 <p>bar
3031 </p>
3032 !! html/parsoid
3033 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3034 !! end
3035
3036 ## T58733
3037 !! test
3038 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3039 !! wikitext
3040 {{echo|a : b}}
3041 !! html/php+tidy
3042 <p>a&#160;: b
3043 </p>
3044 !! html/parsoid
3045 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3046 !! end
3047
3048 ## T73412
3049 !! test
3050 Templates: Preserve blank parameter names
3051 !! wikitext
3052 {{echo|=foo}}
3053 !! html/php+tidy
3054 <p>{{{1}}}
3055 </p>
3056 !! html/parsoid
3057 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3058 !! end
3059
3060 !! test
3061 Templates: Preserve blank parameter names in other positions
3062 !! wikitext
3063 {{blank_param|bar|=foo}}
3064 !! html/php+tidy
3065 <p>bar
3066 foo
3067 </p>
3068 !! html/parsoid
3069 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3070 foo</p>
3071 !! end
3072
3073 ###
3074 ### Parsoid-centric tests for testing RT edge cases for pre
3075 ###
3076
3077 !!test
3078 1a. Indent-Pre and Comments
3079 !! wikitext
3080 a
3081 <!--a-->
3082 c
3083 !! html
3084 <pre>a
3085 </pre>
3086 <p>c
3087 </p>
3088 !!end
3089
3090 !!test
3091 1b. Indent-Pre and Comments
3092 !! wikitext
3093 a
3094 <!--a-->
3095 c
3096 !! html
3097 <pre>a
3098 </pre>
3099 <p>c
3100 </p>
3101 !!end
3102
3103 !!test
3104 1c. Indent-Pre and Comments
3105 !! wikitext
3106 <!--a--> a
3107
3108 <!--a--> a
3109 !! html
3110 <pre> a
3111 </pre>
3112 <pre> a
3113 </pre>
3114 !!end
3115
3116 !!test
3117 1d. Indent-Pre and Comments
3118 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3119 !! wikitext
3120 <!--a--> a
3121
3122 <!--b-->b
3123 !! html
3124 <pre>a
3125 </pre>
3126 <pre>b
3127 </pre>
3128 !!end
3129
3130 !!test
3131 2a. Indent-Pre and tables
3132 !! wikitext
3133 {|
3134 |-
3135 !h1!!h2
3136 |foo||bar
3137 |}
3138 !! html
3139 <table>
3140
3141 <tr>
3142 <th>h1</th>
3143 <th>h2
3144 </th>
3145 <td>foo</td>
3146 <td>bar
3147 </td></tr></table>
3148
3149 !!end
3150
3151 !!test
3152 2b. Indent-Pre and tables
3153 !! wikitext
3154 {|
3155 |-
3156 |foo
3157 |}
3158 !! html
3159 <table>
3160
3161 <tr>
3162 <td>foo
3163 </td></tr></table>
3164
3165 !!end
3166
3167 !!test
3168 2c. Indent-Pre and tables (T44252)
3169 !! wikitext
3170 {|
3171 |+foo
3172 ! |bar
3173 |}
3174 !! html
3175 <table>
3176 <caption>foo
3177 </caption>
3178 <tr>
3179 <th>bar
3180 </th></tr></table>
3181
3182 !!end
3183
3184 !!test
3185 2d. Indent-Pre and tables
3186 !! wikitext
3187 a
3188 {|
3189 |b
3190 |}
3191 !! html/php
3192 <pre>a
3193 </pre>
3194 <table>
3195 <tr>
3196 <td>b
3197 </td></tr></table>
3198
3199 !! html/parsoid
3200 <pre>a</pre>
3201 <table>
3202 <tbody><tr><td> b</td></tr>
3203 </tbody></table>
3204 !!end
3205
3206 !!test
3207 2e. Indent-Pre and table-line syntax
3208 !! wikitext
3209 a
3210 | b
3211 | c
3212 !! html/php
3213 <pre>a
3214 | b
3215 | c
3216 </pre>
3217 !!end
3218
3219 !!test
3220 2f. Indent-pre started by table-line syntax
3221 !! wikitext
3222 a
3223 | b
3224 | c
3225 !! html/php
3226 <p>a
3227 </p>
3228 <pre>| b
3229 | c
3230 </pre>
3231 !! html/parsoid
3232 <p>a</p>
3233 <pre>
3234 | b
3235 | c</pre>
3236 !!end
3237
3238 !! test
3239 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3240 !! wikitext
3241 <table>
3242 <tr>
3243 <td>
3244 Text that should be rendered preformatted
3245 </td>
3246 </tr>
3247 </table>
3248 !! html
3249 <table>
3250 <tr>
3251 <td>
3252 <pre>Text that should be rendered preformatted
3253 </pre>
3254 </td>
3255 </tr>
3256 </table>
3257
3258 !! end
3259
3260 !!test
3261 3a. Indent-Pre and block tags (single-line html)
3262 !! wikitext
3263 a <p> foo </p>
3264 b <div> foo </div>
3265 c <blockquote> foo </blockquote>
3266 <span> foo </span>
3267 !! html
3268 a <p> foo </p>
3269 b <div> foo </div>
3270 c <blockquote> foo </blockquote>
3271 <pre><span> foo </span>
3272 </pre>
3273 !! html/parsoid
3274 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3275 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3276 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3277 <pre><span> foo </span>
3278 </pre>
3279 !! html/php+tidy
3280 <p> a </p><p> foo </p><p>
3281 b </p><div> foo </div><p>
3282 c </p><blockquote><p> foo </p></blockquote>
3283 <pre><span> foo </span>
3284 </pre>
3285 !! end
3286
3287 !!test
3288 3b. Indent-Pre and block tags (multi-line html)
3289 !! wikitext
3290 a <span>foo</span>
3291 b <div> foo </div>
3292 !! html
3293 <pre>a <span>foo</span>
3294 </pre>
3295 b <div> foo </div>
3296
3297 !! html/parsoid
3298 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3299 b <div data-parsoid='{"stx":"html"}'> foo </div>
3300 !! html/php+tidy
3301 <pre>a <span>foo</span>
3302 </pre><p>
3303 b </p><div> foo </div>
3304 !!end
3305
3306 !!test
3307 3c. Indent-Pre and block tags (pre-content on separate line)
3308 !! wikitext
3309 <p>
3310 foo
3311 </p>
3312
3313 <div>
3314 foo
3315 </div>
3316
3317 <center>
3318 foo
3319 </center>
3320
3321 <blockquote>
3322 foo
3323 </blockquote>
3324
3325 <blockquote>
3326 <pre>
3327 foo
3328 </pre>
3329 </blockquote>
3330
3331 <table><tr><td>
3332 foo
3333 </td></tr></table>
3334
3335 <ul><li>
3336 foo
3337 </li></ul>
3338
3339 !! html
3340 <p>
3341 foo
3342 </p>
3343 <div>
3344 <pre>foo
3345 </pre>
3346 </div>
3347 <center>
3348 <pre>foo
3349 </pre>
3350 </center>
3351 <blockquote>
3352 <p> foo
3353 </p>
3354 </blockquote>
3355 <blockquote>
3356 <pre>
3357 foo
3358 </pre>
3359 </blockquote>
3360 <table><tr><td>
3361 <pre>foo
3362 </pre>
3363 </td></tr></table>
3364 <ul><li>
3365 foo
3366 </li></ul>
3367
3368 !!end
3369
3370 !! test
3371 4. Indent-Pre and extension tags
3372 !! wikitext
3373 a <tag />
3374 !! html/php
3375 a <pre>
3376 NULL
3377 array (
3378 )
3379 </pre>
3380
3381 !! html/parsoid
3382 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3383 !! end
3384
3385 !! test
3386 5. Indent-Pre and html pre
3387 !! wikitext
3388 <pre class="123">hi</pre>
3389 !! html/php
3390 <pre class="123">hi</pre>
3391
3392 !! html/parsoid
3393 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3394 !! end
3395
3396 !!test
3397 Render paragraphs when indent-pre is suppressed in blocklevels
3398 !! wikitext
3399 <blockquote>
3400 foo
3401
3402 bar
3403 </blockquote>
3404 !! html
3405 <blockquote>
3406 <p> foo
3407 </p><p> bar
3408 </p>
3409 </blockquote>
3410
3411 !!end
3412
3413 !!test
3414 4. Multiple spaces at start-of-line
3415 !! wikitext
3416 <p> foo </p>
3417 foo
3418 {|
3419 |foo
3420 |}
3421 !! html
3422 <p> foo </p>
3423 <pre> foo
3424 </pre>
3425 <table>
3426 <tr>
3427 <td>foo
3428 </td></tr></table>
3429
3430 !!end
3431
3432 ## NOTE: the leading white-space chars on empty line are significant
3433 !! test
3434 5a. White-space in indent-pre
3435 !! wikitext
3436 a<br />
3437
3438 b
3439 !! html
3440 <pre>a<br />
3441
3442 b
3443 </pre>
3444 !! end
3445
3446 ## NOTE: the leading white-space chars on empty line are significant
3447 !! test
3448 5b. White-space in indent-pre
3449 !! wikitext
3450 a
3451
3452 b
3453
3454
3455 c
3456 !! html
3457 <pre>a
3458
3459 b
3460
3461
3462 c
3463 </pre>
3464 !! end
3465
3466 !! test
3467 5c. White-space in indent-pre
3468 !! wikitext
3469 ''a''
3470 ''b''
3471 ''c''
3472 !! html
3473 <pre><i>a</i>
3474 <i>b</i>
3475 <i>c</i>
3476 </pre>
3477 !! end
3478
3479 !! test
3480 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3481 !! wikitext
3482 a
3483
3484 <!-- continue -->
3485 b
3486
3487 c
3488
3489 d
3490 !! html
3491 <pre>a
3492
3493 b
3494 </pre>
3495 <pre>c
3496
3497 </pre>
3498 <p>d
3499 </p>
3500 !! end
3501
3502 !! test
3503 7a. Indent-pre and category links
3504 !! options
3505 parsoid=wt2html,wt2wt
3506 !! wikitext
3507 [[Category:foo]] <!-- No pre-wrapping -->
3508 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3509 !! html/php+tidy
3510 !! html/parsoid
3511 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3512 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3513 !! end
3514
3515 ## We used to, but no longer wt2wt this test since the default serializer
3516 ## will normalize all categories to serialize on their own line.
3517 ## This wikitext usage is going to be fairly uncommon in production and
3518 ## selser will take care of preserving formatting in those scenarios.
3519 !! test
3520 7b. Indent-pre and category links
3521 !! options
3522 parsoid=wt2html
3523 !! wikitext
3524 [[Category:foo]] a
3525 [[Category:foo]] {{echo|b}}
3526 !! html/parsoid
3527 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3528 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3529 !! end
3530
3531 !! test
3532 Indent-Pre: Newlines in comments shouldn't affect sol state
3533 !! wikitext
3534 a <!--
3535 foo
3536 --> b
3537 !! html/php+tidy
3538 <p>a b
3539 </p>
3540 !! html/parsoid
3541 <p>a <!--
3542 foo
3543 --> b</p>
3544 !! end
3545
3546 ###
3547 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3548 ###
3549
3550 !!test
3551 HTML-pre: 1. embedded newlines
3552 !! wikitext
3553 <pre>foo</pre>
3554
3555 <pre>
3556 foo
3557 </pre>
3558
3559 <pre>
3560
3561 foo
3562 </pre>
3563
3564 <pre>
3565
3566
3567 foo
3568 </pre>
3569 !! html/php+tidy
3570 <pre>foo</pre>
3571 <pre>foo
3572 </pre>
3573 <pre>
3574
3575 foo
3576 </pre>
3577 <pre>
3578
3579
3580 foo
3581 </pre>
3582 !! html/parsoid
3583 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3584
3585 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3586 </pre>
3587
3588 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3589
3590 foo
3591 </pre>
3592
3593 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3594
3595
3596 foo
3597 </pre>
3598 !!end
3599
3600 !! test
3601 HTML-pre: big spaces
3602 !! wikitext
3603 <pre>
3604
3605
3606
3607
3608 haha
3609
3610
3611
3612
3613 haha
3614
3615
3616
3617
3618 </pre>
3619 !! html/php+tidy
3620 <pre>
3621
3622
3623
3624
3625 haha
3626
3627
3628
3629
3630 haha
3631
3632
3633
3634
3635 </pre>
3636 !! html/parsoid
3637 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3638
3639
3640
3641
3642 haha
3643
3644
3645
3646
3647 haha
3648
3649
3650
3651
3652 </pre>
3653 !! end
3654
3655 !!test
3656 HTML-pre: 2: indented text
3657 !! wikitext
3658 <pre>
3659 foo
3660 </pre>
3661 !! html
3662 <pre>
3663 foo
3664 </pre>
3665
3666 !!end
3667
3668 !!test
3669 HTML-pre: 3: other wikitext
3670 !! wikitext
3671 <pre>
3672 * foo
3673 # bar
3674 = no-h =
3675 '' no-italic ''
3676 [[ NoLink ]]
3677 </pre>
3678 !! html/php
3679 <pre>
3680 * foo
3681 # bar
3682 = no-h =
3683 '' no-italic ''
3684 [[ NoLink ]]
3685 </pre>
3686
3687 !! html/parsoid
3688 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3689 # bar
3690 = no-h =
3691 '' no-italic ''
3692 [[ NoLink ]]
3693 </pre>
3694 !!end
3695
3696 ###
3697 ### Definition lists
3698 ###
3699 !! test
3700 Simple definition
3701 !! wikitext
3702 ;name :Definition
3703 !! html
3704 <dl><dt>name&#160;</dt>
3705 <dd>Definition</dd></dl>
3706
3707 !! end
3708
3709 !! test
3710 Definition list for indentation only
3711 !! wikitext
3712 :Indented text
3713 !! html
3714 <dl><dd>Indented text</dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition list with no space
3720 !! wikitext
3721 ;name:Definition
3722 !! html
3723 <dl><dt>name</dt>
3724 <dd>Definition</dd></dl>
3725
3726 !!end
3727
3728 !! test
3729 Definition list with URL link
3730 !! wikitext
3731 ;http://example.com/ :definition
3732 !! html
3733 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3734 <dd>definition</dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition list with bracketed URL link
3740 !! wikitext
3741 ;[http://www.example.com/ Example]:Something about it
3742 !! html
3743 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3744 <dd>Something about it</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition list with wikilink containing colon
3750 !! wikitext
3751 ; [[Help:FAQ]]:The least-read page on Wikipedia
3752 !! html
3753 <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3754 <dd>The least-read page on Wikipedia</dd></dl>
3755
3756 !! end
3757
3758 # At Brion's and JeLuF's insistence... :)
3759 !! test
3760 Definition list with news link containing colon
3761 !! wikitext
3762 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3763 !! html/php
3764 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3765 <dd>This isn't even a real newsgroup!</dd></dl>
3766
3767 !! html/parsoid
3768 <dl><dt> <a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
3769 !! end
3770
3771 !! test
3772 Malformed definition list with colon
3773 !! wikitext
3774 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3775 !! html
3776 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3777
3778 !! end
3779
3780 !! test
3781 Definition lists: colon in external link text
3782 !! wikitext
3783 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3784 !! html
3785 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3786 <dd>OK, I made that up</dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition lists: colon in HTML attribute
3792 !! wikitext
3793 ;<b style="display: inline">bold</b>
3794 !! html
3795 <dl><dt><b style="display: inline">bold</b></dt></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition lists: self-closed tag
3801 !! wikitext
3802 ;one<br/>two :two-line fun
3803 !! html
3804 <dl><dt>one<br />two&#160;</dt>
3805 <dd>two-line fun</dd></dl>
3806
3807 !! end
3808
3809 !! test
3810 Definition lists: ignore colons inside tags
3811 !! wikitext
3812 ;one <b>two : tag <i>fun:</i>:</b>:def
3813 !! html
3814 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3815 <dd>def</dd></dl>
3816
3817 !! end
3818
3819 !! test
3820 Definition lists: excess closed tags
3821 !! wikitext
3822 ;one</b>two :bad tag fun
3823 !! html/php+tidy
3824 <dl><dt>onetwo&#160;</dt>
3825 <dd>bad tag fun</dd></dl>
3826 !! html/parsoid
3827 <dl>
3828 <dt>onetwo</dt>
3829 <dd>bad tag fun</dd>
3830 </dl>
3831 !! end
3832
3833 !! test
3834 T13748: Literal closing tags
3835 !! wikitext
3836 <dl>
3837 <dt>test 1</dt>
3838 <dd>test test test test test</dd>
3839 <dt>test 2</dt>
3840 <dd>test test test test test</dd>
3841 </dl>
3842 !! html
3843 <dl>
3844 <dt>test 1</dt>
3845 <dd>test test test test test</dd>
3846 <dt>test 2</dt>
3847 <dd>test test test test test</dd>
3848 </dl>
3849
3850 !! end
3851
3852 !! test
3853 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3854 !! wikitext
3855 <ul><li>
3856 ;term :description
3857 *unordered
3858 </li></ul>
3859 !! html
3860 <ul><li>
3861 <dl><dt>term&#160;</dt>
3862 <dd>description</dd></dl>
3863 <ul><li>unordered</li></ul>
3864 </li></ul>
3865
3866 !! end
3867
3868 !! test
3869 Definition list with empty definition and following paragraph
3870 !! wikitext
3871 ;term:
3872 Paragraph text
3873 !! html
3874 <dl><dt>term</dt>
3875 <dd></dd></dl>
3876 <p>Paragraph text
3877 </p>
3878 !! end
3879
3880 !! test
3881 Nested definition lists using html syntax
3882 !! wikitext
3883 <dl><dt>x</dt>
3884 <dd>a</dd>
3885 <dd>b</dd></dl>
3886 !! html
3887 <dl><dt>x</dt>
3888 <dd>a</dd>
3889 <dd>b</dd></dl>
3890
3891 !! end
3892
3893 !! test
3894 Definition Lists: No nesting: Multiple dd's
3895 !! wikitext
3896 ;x
3897 :a
3898 :b
3899 !! html
3900 <dl><dt>x</dt>
3901 <dd>a</dd>
3902 <dd>b</dd></dl>
3903
3904 !! end
3905
3906 !! test
3907 Definition Lists: Indentation: Regular
3908 !! wikitext
3909 :i1
3910 ::i2
3911 :::i3
3912 !! html
3913 <dl><dd>i1
3914 <dl><dd>i2
3915 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3916
3917 !! end
3918
3919 !! test
3920 Definition Lists: Indentation: Missing 1st level
3921 !! wikitext
3922 ::i2
3923 :::i3
3924 !! html
3925 <dl><dd><dl><dd>i2
3926 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3927
3928 !! end
3929
3930 !! test
3931 Definition Lists: Indentation: Multi-level indent
3932 !! wikitext
3933 :::i3
3934 !! html
3935 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3936
3937 !! end
3938
3939 !! test
3940 Definition Lists: Hacky use to indent tables
3941 !! wikitext
3942 ::{|
3943 |foo
3944 |bar
3945 |}
3946 this text
3947 should be left alone
3948 !! html
3949 <dl><dd><dl><dd><table>
3950 <tr>
3951 <td>foo
3952 </td>
3953 <td>bar
3954 </td></tr></table></dd></dl></dd></dl>
3955 <p>this text
3956 should be left alone
3957 </p>
3958 !! end
3959
3960 !! test
3961 Definition Lists: Hacky use to indent tables, with comments (T65979)
3962 !! wikitext
3963 <!-- foo -->
3964 ::{|
3965 |foo
3966 |bar
3967 |}<!-- bar -->
3968 this text
3969 should be left alone
3970 !! html/parsoid
3971 <!-- foo -->
3972 <dl><dd><dl><dd><table><tr>
3973 <td>foo</td>
3974 <td>bar</td>
3975 </tr></table><!-- bar --></dd></dl></dd></dl>
3976 <p>this text
3977 should be left alone</p>
3978 !! end
3979
3980 !! test
3981 Definition Lists: Hacky use to indent tables, with comment before table
3982 !! wikitext
3983 ::<!-- foo -->{|
3984 |foo
3985 |}
3986 !! html/parsoid
3987 <dl><dd><dl><dd><!-- foo --><table><tr>
3988 <td>foo</td>
3989 </tr></table></dd></dl></dd></dl>
3990 !! end
3991
3992 # The trailing whitespace in this test is to catch a regression in
3993 # Parsoid after T54473.
3994 !! test
3995 Definition Lists: Hacky use to indent tables (WS-insensitive)
3996 !! wikitext
3997 : {|
3998 |a
3999 |}
4000 !! html/php
4001 <dl><dd><table>
4002 <tr>
4003 <td>a
4004 </td></tr></table></dd></dl>
4005
4006 !! html/parsoid
4007 <dl><dd> <table>
4008 <tbody><tr><td>a</td></tr>
4009 </tbody></table> </dd></dl>
4010 !! end
4011
4012 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4013 ## as an empty dt item. It also ignores all but the last ";" when followed
4014 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4015 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4016 ## ";"s.
4017 ##
4018 ## Ex: ";;t2 ::d2" is transformed into:
4019 ##
4020 ## <dl>
4021 ## <dt>t2 </dt>
4022 ## <dd>
4023 ## <dl>
4024 ## <dt></dt>
4025 ## <dd>d2</dd>
4026 ## </dl>
4027 ## </dd>
4028 ## </dl>
4029 ##
4030 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4031 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4032 ##
4033 ## <dl>
4034 ## <dt>
4035 ## <dl>
4036 ## <dt>t2 </dt>
4037 ## <dd>:d2</dd>
4038 ## </dl>
4039 ## </dt>
4040 ## </dl>
4041 ##
4042 ## All Parsoid only definition list tests have this difference.
4043 ##
4044 ## See also: https://phabricator.wikimedia.org/T8569
4045 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4046
4047 !! test
4048 Table / list interaction: indented table with lists in table contents
4049 !! wikitext
4050 :{|
4051 |-
4052 |a
4053 *b
4054 |-
4055 |c
4056 *d
4057 |}
4058 !! html
4059 <dl><dd><table>
4060
4061 <tr>
4062 <td>a
4063 <ul><li>b</li></ul>
4064 </td></tr>
4065 <tr>
4066 <td>c
4067 <ul><li>d</li></ul>
4068 </td></tr></table></dd></dl>
4069
4070 !! end
4071
4072 !!test
4073 Table / list interaction: lists nested in tables nested in indented lists
4074 !! wikitext
4075 :{|
4076 |
4077 :a
4078 :b
4079 |
4080 *c
4081 *d
4082 |}
4083
4084 *e
4085 *f
4086 !! html
4087 <dl><dd><table>
4088 <tr>
4089 <td>
4090 <dl><dd>a</dd>
4091 <dd>b</dd></dl>
4092 </td>
4093 <td>
4094 <ul><li>c</li>
4095 <li>d</li></ul>
4096 </td></tr></table></dd></dl>
4097 <ul><li>e</li>
4098 <li>f</li></ul>
4099
4100 !!end
4101
4102 !! test
4103 Definition Lists: Nesting: Multi-level (Parsoid only)
4104 !! wikitext
4105 ;t1 :d1
4106 ;;t2 ::d2
4107 ;;;t3 :::d3
4108 !! html/parsoid
4109 <dl>
4110 <dt>t1 </dt>
4111 <dd>d1</dd>
4112 <dt>
4113 <dl>
4114 <dt>t2 </dt>
4115 <dd>:d2</dd>
4116 <dt>
4117 <dl>
4118 <dt>t3 </dt>
4119 <dd>::d3</dd>
4120 </dl>
4121 </dt>
4122 </dl>
4123 </dt>
4124 </dl>
4125
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Nesting: Test 2
4132 !! wikitext
4133 ;t1
4134 ::d2
4135 !! html+tidy
4136 <dl><dt>t1</dt>
4137 <dd>
4138 <dl><dd>d2</dd></dl></dd></dl>
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Nesting: Test 3
4144 !! wikitext
4145 :;t1
4146 ::::d2
4147 !! html+tidy
4148 <dl><dd><dl><dt>t1</dt>
4149 <dd>
4150 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Nesting: Test 4
4156 !! wikitext
4157 ::;t3
4158 :::d3
4159 !! html
4160 <dl><dd><dl><dd><dl><dt>t3</dt>
4161 <dd>d3</dd></dl></dd></dl></dd></dl>
4162
4163 !! end
4164
4165
4166 ## The Parsoid team believes the following three test exposes a
4167 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4168 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4169 ## It also exposes a "misfeature" in tidy, which doesn't like
4170 ## <dl> tags with a single <dt> child; it converts the <dt> into
4171 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4172 !! test
4173 Definition Lists: Mixed Lists: Test 1
4174 !! wikitext
4175 :;*foo
4176 ::*bar
4177 :;baz
4178 !! html/php
4179 <dl><dd><dl><dt><ul><li>foo</li>
4180 <li>bar</li></ul></dt></dl>
4181 <dl><dt>baz</dt></dl></dd></dl>
4182
4183 !! html/php+tidy
4184 <dl><dd><dl><dt><ul><li>foo</li>
4185 <li>bar</li></ul></dt></dl>
4186 <dl><dt>baz</dt></dl></dd></dl>
4187 !! html/parsoid
4188 <dl>
4189 <dd><dl>
4190 <dt><ul>
4191 <li>foo
4192 </li>
4193 </ul></dt>
4194 <dd><ul>
4195 <li>bar
4196 </li>
4197 </ul></dd>
4198 <dt>baz</dt>
4199 </dl></dd>
4200 </dl>
4201 !! end
4202
4203 !! test
4204 Definition Lists: Mixed Lists: Test 2
4205 !! wikitext
4206 *:d1
4207 *:d2
4208 !! html
4209 <ul><li><dl><dd>d1</dd>
4210 <dd>d2</dd></dl></li></ul>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 3
4217 !! wikitext
4218 *:::d1
4219 *:::d2
4220 !! html
4221 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4222 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4223
4224 !! end
4225
4226
4227 !! test
4228 Definition Lists: Mixed Lists: Test 4
4229 !! wikitext
4230 *;d1 :d2
4231 *;d3 :d4
4232 !! html
4233 <ul><li><dl><dt>d1&#160;</dt>
4234 <dd>d2</dd>
4235 <dt>d3&#160;</dt>
4236 <dd>d4</dd></dl></li></ul>
4237
4238 !! end
4239
4240
4241 !! test
4242 Definition Lists: Mixed Lists: Test 5
4243 !! wikitext
4244 *:d1
4245 *::d2
4246 !! html
4247 <ul><li><dl><dd>d1
4248 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 6
4255 !! wikitext
4256 #*:d1
4257 #*:::d3
4258 !! html
4259 <ol><li><ul><li><dl><dd>d1
4260 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4261
4262 !! end
4263
4264
4265 !! test
4266 Definition Lists: Mixed Lists: Test 7
4267 !! wikitext
4268 :*d1
4269 :*d2
4270 !! html
4271 <dl><dd><ul><li>d1</li>
4272 <li>d2</li></ul></dd></dl>
4273
4274 !! end
4275
4276
4277 !! test
4278 Definition Lists: Mixed Lists: Test 8
4279 !! wikitext
4280 :*d1
4281 ::*d2
4282 !! html
4283 <dl><dd><ul><li>d1</li></ul>
4284 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4285
4286 !! end
4287
4288
4289 !! test
4290 Definition Lists: Mixed Lists: Test 9
4291 !! wikitext
4292 *;foo :bar
4293 !! html
4294 <ul><li><dl><dt>foo&#160;</dt>
4295 <dd>bar</dd></dl></li></ul>
4296
4297 !! end
4298
4299
4300 !! test
4301 Definition Lists: Mixed Lists: Test 10
4302 !! wikitext
4303 *#;foo :bar
4304 !! html
4305 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4306 <dd>bar</dd></dl></li></ol></li></ul>
4307
4308 !! end
4309
4310 # The Parsoid team disagrees with the PHP parser's seemingly-random
4311 # rules regarding dd/dt on the next few tests. Parsoid is more
4312 # consistent, and recognizes the shared nesting and keeps the
4313 # still-open tags around until the nesting is complete.
4314
4315 # This is a regression test for T175099
4316 !! test
4317 Definition Lists: Mixed Lists: Test 11
4318 !! wikitext
4319 ;a
4320 :*b
4321 !! html/php
4322 <dl><dt>a</dt>
4323 <dd>
4324 <ul><li>b</li></ul></dd></dl>
4325
4326 !! html/parsoid
4327 <dl><dt>a
4328 <dd><ul><li>b</li></ul></dd></dl>
4329 !! end
4330
4331 # FIXME: Maybe get rid of this test?
4332 !! test
4333 Definition Lists: Mixed Lists: Test 12
4334 !! wikitext
4335 *#*#;*;;foo :bar
4336 *#*#;boo :baz
4337 !! html/php
4338 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4339 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4340 <dl><dt>boo&#160;</dt>
4341 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4342
4343 !! html/php+tidy
4344 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4345 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4346 <dl><dt>boo&#160;</dt>
4347 <dd>baz</dd></dl></li></ol></li></ul>
4348 !! html/parsoid
4349 <ul>
4350 <li>
4351 <ol>
4352 <li>
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dt>
4363 <dl>
4364 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4365 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4366 </dl></dt>
4367 </dl></li>
4368 </ul></dt>
4369 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4370 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4371 </dl></li>
4372 </ol></li>
4373 </ul></li>
4374 </ol></li>
4375 </ul>
4376 !! end
4377
4378 # FIXME: Maybe get rid of this test?
4379 # From whitelist:
4380 # * The test is wrong, there are two colons where there should be :;
4381 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4382 !! test
4383 Definition Lists: Weird Ones: Test 1
4384 !! wikitext
4385 *#;*::;;foo :bar (who uses this?)
4386 !! html/php+tidy
4387 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4388 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4389 !! html/parsoid
4390 <ul>
4391 <li>
4392 <ol>
4393 <li>
4394 <dl>
4395 <dt>
4396 <ul>
4397 <li>
4398 <dl>
4399 <dd>
4400 <dl>
4401 <dd>
4402 <dl>
4403 <dt>
4404 <dl>
4405 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4406 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4407 </dl></dt>
4408 </dl></dd>
4409 </dl></dd>
4410 </dl></li>
4411 </ul></dt>
4412 </dl></li>
4413 </ol></li>
4414 </ul>
4415 !! end
4416
4417 !! test
4418 Definition Lists: colons occurring in tags
4419 !! wikitext
4420 ;a:b
4421 ;'''a:b'''
4422 ;<i>a:b</i>
4423 ;<span>a:b</span>
4424 ;<div>a:b</div>
4425 ;<div>a
4426 :b</div>
4427 ;{{echo|a:b}}
4428 ;{{echo|''a:b''}}
4429 ;;;''a:b''
4430 !! html+tidy
4431 <dl><dt>a</dt>
4432 <dd>b</dd>
4433 <dt><b>a:b</b></dt>
4434 <dt><i>a:b</i></dt>
4435 <dt><span>a:b</span></dt>
4436 <dt><div>a:b</div></dt>
4437 <dt><div>a</div></dt>
4438 <dd>b</dd>
4439 <dt>a</dt>
4440 <dd>b</dd>
4441 <dt><i>a:b</i></dt></dl>
4442 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4443 !! html/parsoid
4444 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4445 <dt><b>a:b</b></dt>
4446 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4447 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4448 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4449 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4450 <dd>b</dd>
4451 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4452 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4453 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4454 !! end
4455
4456 # Parsoid's output differs here again because it shares
4457 # nesting between the two lists unlike the PHP parser.
4458 # Unsure which is more desirable.
4459 !! test
4460 Definition Lists: colons and tables 1
4461 !! wikitext
4462 :{|
4463 |x
4464 |}
4465 :{|
4466 |y
4467 |}
4468 !! html/php
4469 <dl><dd><table>
4470 <tr>
4471 <td>x
4472 </td></tr></table></dd></dl>
4473 <dl><dd><table>
4474 <tr>
4475 <td>y
4476 </td></tr></table></dd></dl>
4477
4478 !! html/parsoid
4479 <dl><dd><table>
4480 <tr>
4481 <td>x
4482 </td></tr></table></dd>
4483 <dd><table>
4484 <tr>
4485 <td>y
4486 </td></tr></table></dd></dl>
4487 !! end
4488
4489 # FIXME: Does this need a html/php section?
4490 !! test
4491 Definition Lists: template interaction
4492 !! wikitext
4493 ::{{definition_list}}
4494
4495 :one
4496 ::{{definition_list}}
4497 :::two
4498 :::three
4499 ::four
4500 !! html/parsoid
4501 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4502 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4503
4504 <dl><dd data-parsoid='{}'>one
4505 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4506 </span><dd about="#mwt2">two
4507 <dl><dd>two</dd>
4508 <dd>three</dd></dl></dd>
4509 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4510 !! end
4511
4512
4513 ###
4514 ### External links
4515 ###
4516 !! test
4517 External links: non-bracketed
4518 !! wikitext
4519 Non-bracketed: http://example.com
4520 !! html
4521 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4522 </p>
4523 !! end
4524
4525 # parsoid doesn't explicitly mark autonumbered links, see T55505
4526 !! test
4527 External links: numbered
4528 !! wikitext
4529 Numbered: [http://example.com]
4530 Numbered: [http://example.net]
4531 Numbered: [http://example.com]
4532 !! html/php
4533 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4534 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4535 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4536 </p>
4537 !! html/parsoid
4538 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4539 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4540 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4541 !!end
4542
4543 !! test
4544 External links: specified text
4545 !! wikitext
4546 Specified text: [http://example.com link]
4547 !! html
4548 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4549 </p>
4550 !!end
4551
4552 !! test
4553 External links: trail
4554 !! wikitext
4555 Linktrails should not work for external links: [http://example.com link]s
4556 !! html
4557 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: dollar sign in URL
4563 !! wikitext
4564 http://example.com/1$2345
4565 !! html
4566 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4567 </p>
4568 !! end
4569
4570 # parsoid doesn't explicitly mark autonumbered links, see T55505
4571 !! test
4572 External links: dollar sign in URL (autonumber)
4573 !! wikitext
4574 [http://example.com/1$2345]
4575 !! html/php
4576 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4577 </p>
4578 !! html/parsoid
4579 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4580 !!end
4581
4582 !! test
4583 External links: open square bracket forbidden in URL (T6377)
4584 !! options
4585 parsoid=wt2html,wt2wt,html2html
4586 !! wikitext
4587 http://example.com/1[2345
4588 !! html/php
4589 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4590 </p>
4591 !! html/parsoid
4592 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4593 !! end
4594
4595 !! test
4596 External links: open square bracket forbidden in URL (named) (T6377)
4597 !! options
4598 parsoid=wt2html,html2html
4599 !! wikitext
4600 [http://example.com/1[2345]
4601 !! html/php
4602 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4603 </p>
4604 !! html/parsoid
4605 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4606 !!end
4607
4608 # parsoid adds a space before the link name
4609 !! test
4610 External links: open square bracket forbidden in URL (named) (T6377)
4611 Parsoid variant.
4612 !! wikitext
4613 [http://example.com/1 [2345]
4614 !! html
4615 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: nowiki in URL link text (T8230)
4621 !! wikitext
4622 [http://example.com/ <nowiki>''example site''</nowiki>]
4623 !! html
4624 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: newline forbidden in text (T8230 regression check)
4630 !! wikitext
4631 [http://example.com/ first
4632 second]
4633 !! html
4634 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4635 second]
4636 </p>
4637 !!end
4638
4639 !! test
4640 External links: Pipe char between url and text
4641 !! wikitext
4642 [http://example.com | link]
4643 !! html
4644 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 External links: protocol-relative URL in brackets
4650 !! wikitext
4651 [//example.com/ Test]
4652 !! html
4653 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4654 </p>
4655 !! end
4656
4657 # parsoid doesn't explicitly mark autonumbered links, see T55505
4658 !! test
4659 External links: protocol-relative URL in brackets without text
4660 !! wikitext
4661 [//example.com]
4662 !! html/php
4663 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4667 !! end
4668
4669 !! test
4670 External links: protocol-relative URL in free text is left alone
4671 !! wikitext
4672 //example.com/Foo
4673 !! html
4674 <p>//example.com/Foo
4675 </p>
4676 !!end
4677
4678 !! test
4679 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4680 !! wikitext
4681 foo//example.com/Foo
4682 !! html
4683 <p>foo//example.com/Foo
4684 </p>
4685 !! end
4686
4687 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4688 !! test
4689 External links: with no contents
4690 !! options
4691 parsoid=wt2html,wt2wt
4692 !! wikitext
4693 [http://en.wikipedia.org/wiki/Foo]
4694
4695 [[wikipedia:Foo|Bar]]
4696
4697 [[wikipedia:Foo|<span>Bar</span>]]
4698 !! html/php
4699 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4701 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4702 </p>
4703 !! html/parsoid
4704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4705 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4706 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4707 !! end
4708
4709 !! test
4710 External links: Free with trailing punctuation
4711 !! wikitext
4712 http://example.com,
4713 http://example.com;
4714 http://example.com\
4715 http://example.com.
4716 http://example.com:
4717 http://example.com!
4718 http://example.com?
4719 http://example.com)
4720 http://example.com/url_with_(brackets)
4721 (http://example.com/url_without_brackets)
4722 http://example.com/url_with_entity&amp;
4723 http://example.com/url_with_entity&#x26;
4724 http://example.com/url_with_entity&#038;
4725 http://example.com/url_with_entity&nbsp;
4726 http://example.com/url_with_entity&#xA0;
4727 http://example.com/url_with_entity&#160;
4728 http://example.com/url_with_entity&lt;
4729 http://example.com/url_with_entity&#x3C;
4730 http://example.com/url_with_entity&#60;
4731 !! html/php
4732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4739 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4741 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4750 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4751 </p>
4752 !! html/parsoid
4753 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4754 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4755 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4756 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4757 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4758 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4759 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4760 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4761 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4762 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4763 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4766 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4767 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4768 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4769 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4770 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4771 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4772 !! end
4773
4774 !! test
4775 External links: tricky Parsoid html2html case
4776 !! options
4777 parsoid=wt2html,wt2wt,html2html
4778 !! wikitext
4779 http://example.com/url_with_entity&amp;amp;
4780 !! html/php
4781 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4782 </p>
4783 !! html/parsoid
4784 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4785 !! end
4786
4787 !! test
4788 External links: Free with trailing quotes (T113666)
4789 !! wikitext
4790 '''News:''' Stuff here
4791
4792 news:'a'b''c''d e
4793 !! html/php
4794 <p><b>News:</b> Stuff here
4795 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4796 </p>
4797 !! html/parsoid
4798 <p><b>News:</b> Stuff here</p>
4799 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4800 !! end
4801
4802 !! test
4803 External links: with entity
4804 !! wikitext
4805 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4806 !! html/php
4807 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4808 </p>
4809 !! html/parsoid
4810 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4811 !! end
4812
4813 !! test
4814 External links: Lone protocols are never linked (T105697)
4815 !! wikitext
4816 http://
4817 http://;
4818 (http://)
4819 bitcoin:
4820 bitcoin:;
4821 (bitcoin:)
4822 !! html
4823 <p>http://
4824 http://;
4825 (http://)
4826 bitcoin:
4827 bitcoin:;
4828 (bitcoin:)
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: No preceding word characters allowed (T67278)
4834 !! wikitext
4835 NOPEhttp://example.com
4836 N0http://example.com
4837 ok:http://example.com
4838 ok-http://example.com
4839 !! html
4840 <p>NOPEhttp://example.com
4841 N0http://example.com
4842 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4843 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: nofollow domain exception
4849 !! wikitext
4850 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4851 !! html
4852 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4853 </p>
4854 !!end
4855
4856 !! test
4857 External image
4858 !! wikitext
4859 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image from https
4867 !! wikitext
4868 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4869 !! html
4870 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External image (when not allowed)
4876 !! options
4877 wgAllowExternalImages=0
4878 !! wikitext
4879 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4880 !! html
4881 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4882 </p>
4883 !! end
4884
4885 !! test
4886 Link to non-http image, no img tag
4887 !! wikitext
4888 Link to non-http image, no img tag: ftp://example.com/test.jpg
4889 !! html
4890 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: terminating separator
4896 !! wikitext
4897 Terminating separator: http://example.com/thing,
4898 !! html
4899 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: intervening separator
4905 !! wikitext
4906 Intervening separator: http://example.com/1,2,3
4907 !! html
4908 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old bug with URL in query
4914 !! wikitext
4915 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4916 !! html
4917 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: old URL-in-URL bug, mixed protocols
4923 !! wikitext
4924 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4925 !! html
4926 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4927 </p>
4928 !!end
4929
4930 # Since Parsoid is starting to emit canonical wikitext for links,
4931 # [http://example.com http://example.com] will not RT back to that
4932 # form anymore.
4933 !! test
4934 External links: URL in text
4935 !! options
4936 parsoid=wt2html
4937 !! wikitext
4938 URL in text: [http://example.com http://example.com]
4939 !! html/php
4940 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4941 </p>
4942 !! html/parsoid
4943 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4944 !! end
4945
4946 !! test
4947 External links: Clickable images
4948 !! wikitext
4949 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4950 !! html/php
4951 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4952 </p>
4953 !! html/parsoid
4954 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4955 !! end
4956
4957 !! test
4958 External links: raw ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&y
4961 !! html
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: encoded ampersand
4968 !! wikitext
4969 Old &amp; use: http://x&amp;y
4970 !! html/php
4971 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4972 </p>
4973 !! html/parsoid
4974 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
4975 !! end
4976
4977 !! test
4978 External links: encoded equals (T8102)
4979 !! wikitext
4980 http://example.com/?foo&#61;bar
4981 !! html/php
4982 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4983 </p>
4984 !! html/parsoid
4985 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4986 !! end
4987
4988 ##
4989 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4990 ## does it number them. As discussed in T55505, we can identify
4991 ## autonumbered links via CSS.
4992 ##
4993
4994 !! test
4995 External links: [raw ampersand]
4996 !! wikitext
4997 Old &amp; use: [http://x&y]
4998 !! html/php
4999 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5000 </p>
5001 !! html/parsoid
5002 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5003 !! end
5004
5005 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5006 # mode will return the [raw ampersand] wikitext
5007 !! test
5008 External links: [encoded ampersand]
5009 !! options
5010 parsoid=wt2html,wt2wt,html2html
5011 !! wikitext
5012 Old &amp; use: [http://x&amp;y]
5013 !! html/php
5014 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5015 </p>
5016 !! html/parsoid
5017 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5018 !! end
5019
5020 !! test
5021 External links: [raw equals]
5022 !! wikitext
5023 [http://example.com/?foo=bar]
5024 !! html/php
5025 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5026 </p>
5027 !! html/parsoid
5028 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5029 !! end
5030
5031 # note that parsoid html is identical to [raw equals] case; so html2wt
5032 # mode will return the [raw equals] wikitext
5033 !! test
5034 External links: [encoded equals] (T8102)
5035 !! options
5036 parsoid=wt2html,wt2wt,html2html
5037 !! wikitext
5038 [http://example.com/?foo&#61;bar]
5039 !! html/php
5040 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5041 </p>
5042 !! html/parsoid
5043 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5044 !! end
5045
5046 # xxx parsoid strips the IDN character, so the round-trip tests will
5047 # obviously fail and are disabled. --cscott
5048 !! test
5049 External links: [IDN ignored character reference in hostname; strip it right off]
5050 !! options
5051 parsoid=wt2html,wt2wt,html2html
5052 !! wikitext
5053 [http://e&zwnj;xample.com/]
5054 !! html/php
5055 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5056 </p>
5057 !! html/parsoid
5058 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5059 !! end
5060
5061 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5062 # Where an external link could easily circumvent the sanitization of the text of
5063 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5064 # test demands a higher standard. That's a bit strange.
5065 #
5066 # Example:
5067 #
5068 # http://e‌xample.com -> [http://example.com|http://example.com]
5069 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5070 #
5071 # The first example is sanitized, but the second is not. Any security benefits
5072 # from this production are trivial to circumvent. Either remove this test and
5073 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5074 # the test accordingly.
5075 #
5076 # All our love,
5077 # The Parsoid team.
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: IDN ignored character reference in hostname; strip it right off
5082 !! options
5083 parsoid=wt2html,html2html
5084 !! wikitext
5085 http://e&zwnj;xample.com/
5086 !! html/php
5087 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5091 !! end
5092
5093 !! test
5094 External links: www.jpeg.org (T2554)
5095 !! wikitext
5096 http://www.jpeg.org
5097 !! html
5098 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5099 </p>
5100 !! end
5101
5102 # parsoid doesn't explicitly mark autonumbered links, see T55505
5103 !! test
5104 External links: URL within URL (T2002)
5105 !! wikitext
5106 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5107 !! html/php
5108 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5109 </p>
5110 !! html/parsoid
5111 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5112 !! end
5113
5114 !! test
5115 T2361: URL inside bracketed URL
5116 !! wikitext
5117 [http://www.example.com/foo http://www.example.com/bar]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 T2361: URL within URL, not bracketed
5125 !! wikitext
5126 http://www.example.com/foo?=http://www.example.com/bar
5127 !! html
5128 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5129 </p>
5130 !! end
5131
5132 !! test
5133 T2289: ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<hello>
5136 !! html
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5138 </p>
5139 !!end
5140
5141 !! test
5142 T2289: literal ">"-token in URL-tail
5143 !! wikitext
5144 http://www.example.com/<b>html</b>
5145 !! html/php
5146 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5150 !! end
5151
5152 !! test
5153 T2289: ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<hello> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 T2289: literal ">"-token in bracketed URL
5163 !! wikitext
5164 [http://www.example.com/<b>html</b> stuff]
5165 !! html
5166 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5167 </p>
5168 !!end
5169
5170 !! test
5171 T2289: literal double quote at end of URL
5172 !! wikitext
5173 http://www.example.com/"hello"
5174 !! html
5175 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5176 </p>
5177 !!end
5178
5179 !! test
5180 T2289: literal double quote in bracketed URL
5181 !! wikitext
5182 [http://www.example.com/"hello" stuff]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5185 </p>
5186 !!end
5187
5188 !! test
5189 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5190 !! wikitext
5191 [http://www.example.com test]
5192 !! html
5193 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 External links: link text with spaces
5199 !! wikitext
5200 [http://www.example.com a b c]
5201 [http://www.example.com ''a'' ''b'']
5202 !! html
5203 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5204 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5205 </p>
5206 !! end
5207
5208 # Note edge case difference between PHP and Parsoid here.
5209 !! test
5210 External links: wiki links within external link (T5695)
5211 !! options
5212 parsoid=wt2html,html2html
5213 !! wikitext
5214 [http://example.com [[wikilink]] embedded in ext link]
5215
5216 [http://example.com test [[wikilink]] embedded in ext link]
5217 !! html/php
5218 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5219 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5220 </p>
5221 !! html/parsoid
5222 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5223 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5224 !! end
5225
5226 !! test
5227 T2787: Links with one slash after the url protocol are invalid
5228 !! wikitext
5229 http:/example.com
5230
5231 [http:/example.com title]
5232 !! html
5233 <p>http:/example.com
5234 </p><p>[http:/example.com title]
5235 </p>
5236 !! end
5237
5238 !! test
5239 Bracketed external links with template-generated invalid target
5240 !! wikitext
5241 [{{echo|http:/example.com}} title]
5242 !! html
5243 <p>[http:/example.com title]
5244 </p>
5245 !! end
5246
5247 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5248 !! test
5249 Broken wikilinks (but not external links) prevent templates from closing
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 [http://example.com x
5254
5255 {{echo|[http://example.com x}}
5256
5257 [[Foo
5258
5259 {{echo|[[Foo}}
5260 !! html/php
5261 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5262 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5263 </p><p>[[Foo
5264 </p><p>{{echo|[[Foo}}
5265 </p>
5266 !! html/parsoid
5267 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5268 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5269 <p>[[Foo</p>
5270 <p>{{echo|[[Foo}}</p>
5271 !! end
5272
5273 !! test
5274 Wikilinks with embedded newlines are not broken
5275 !! wikitext
5276 {{echo|[[ Foo
5277 B
5278 C]]}}
5279 !! html/php
5280 <p>[[ Foo
5281 B
5282 C]]
5283 </p>
5284 !! html/parsoid
5285 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5286 !! end
5287
5288 !! test
5289 Broken templates
5290 !! options
5291 parsoid=wt2html
5292 !! wikitext
5293 {{echo|[[Foo|}}]]
5294
5295 [[Foo|{{echo|]]}}
5296 !! html/php
5297 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5298 </p><p>[[Foo|]]
5299 </p>
5300 !! html/parsoid
5301 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5302 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5303 !! end
5304
5305 !! test
5306 T4702: Mismatched <i>, <b> and <a> tags are invalid
5307 !! wikitext
5308 ''[http://example.com text'']
5309 [http://example.com '''text]'''
5310 ''Something [http://example.com in italic'']
5311 ''Something [http://example.com mixed''''', even bold]'''
5312 '''''Now [http://example.com both''''']
5313 !! html
5314 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5315 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5316 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5317 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5318 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5319 </p>
5320 !! end
5321
5322
5323 !! test
5324 T6781: %26 in URL
5325 !! wikitext
5326 http://www.example.com/?title=AT%26T
5327 !! html/php
5328 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5329 </p>
5330 !! html/parsoid
5331 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5332 !! end
5333
5334 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5335 # % is actually legal in HTML5. Any change in output would need testing though.
5336 !! test
5337 T6781, T7267: %25 in URL
5338 !! wikitext
5339 http://www.example.com/?title=100%25_Bran
5340 !! html/php
5341 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5345 !! end
5346
5347 !! test
5348 T6781, T7267: %28, %29 in URL
5349 !! wikitext
5350 http://www.example.com/?title=Ben-Hur_%281959_film%29
5351 !! html/php
5352 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5353 </p>
5354 !! html/parsoid
5355 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5356 !! end
5357
5358
5359 !! test
5360 T6781: %26 in autonumber URL
5361 !! wikitext
5362 [http://www.example.com/?title=AT%26T]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5368 !! end
5369
5370 !! test
5371 T6781, T7267: %26 in autonumber URL
5372 !! wikitext
5373 [http://www.example.com/?title=100%25_Bran]
5374 !! html/php
5375 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5379 !! end
5380
5381 !! test
5382 T6781, T7267: %28, %29 in autonumber URL
5383 !! wikitext
5384 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5390 !! end
5391
5392
5393 !! test
5394 T6781: %26 in bracketed URL
5395 !! wikitext
5396 [http://www.example.com/?title=AT%26T link]
5397 !! html/php
5398 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5399 </p>
5400 !! html/parsoid
5401 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5402 !! end
5403
5404 !! test
5405 T6781, T7267: %25 in bracketed URL
5406 !! wikitext
5407 [http://www.example.com/?title=100%25_Bran link]
5408 !! html
5409 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5410 </p>
5411 !! end
5412
5413 !! test
5414 T6781, T7267: %28, %29 in bracketed URL
5415 !! wikitext
5416 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5422 !! end
5423
5424 !! test
5425 External link containing a period in the anchor. (T65947)
5426 !! wikitext
5427 [//foo.org/bar#baz. bang]
5428
5429 [//foo.org/bar. bang]
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5432 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5436 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5437 !! end
5438
5439 !! test
5440 External link containing a single quote. (T65947)
5441 !! wikitext
5442 [//foo.org/bar'baz]
5443
5444 [//foo.org/bar'baz bang]
5445 !! html/php
5446 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5447 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5451 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5452 !! end
5453
5454 !! test
5455 External link containing double-single-quotes in text '' (T6598 sanity check)
5456 !! wikitext
5457 Some [http://example.com/ pretty ''italics'' and stuff]!
5458 !! html
5459 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5460 </p>
5461 !! end
5462
5463 !! test
5464 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5465 !! wikitext
5466 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5467 !! html
5468 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5469 </p>
5470 !! end
5471
5472 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5473 !! test
5474 External link containing double-single-quotes with no space separating the url from text in italics
5475 !! wikitext
5476 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5477 !! html/php+tidy
5478 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5482 !! end
5483
5484 !! test
5485 External link with comments in link text
5486 !! wikitext
5487 [http://www.google.com Google <!-- comment -->]
5488 !! html/php
5489 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5493 !! end
5494
5495 !! test
5496 External link to bare IPv4 address
5497 !! wikitext
5498 [http://192.168.0.1 Link]
5499 !! html/php
5500 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5504 !! end
5505
5506 !! test
5507 URL-encoding in URL functions (single parameter)
5508 !! wikitext
5509 {{localurl:Some page|amp=&}}
5510 !! html
5511 <p>/index.php?title=Some_page&amp;amp=&amp;
5512 </p>
5513 !! end
5514
5515 !! test
5516 URL-encoding in URL functions (multiple parameters)
5517 !! wikitext
5518 {{localurl:Some page|q=?&amp=&}}
5519 !! html
5520 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5521 </p>
5522 !! end
5523
5524 !! test
5525 Brackets in urls
5526 !! wikitext
5527 http://example.com/index.php?foozoid%5B%5D=bar
5528
5529 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5530 !! html/php
5531 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5532 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5536
5537 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5538 !! end
5539
5540 !! test
5541 IPv6 urls, autolink format (T23261)
5542 !! wikitext
5543 http://[2404:130:0:1000::187:2]/index.php
5544
5545 Examples from RFC 2373, section 2.2:
5546 *http://[1080::8:800:200C:417A]/unicast
5547 *http://[FF01::101]/multicast
5548 *http://[::1]/loopback
5549 *http://[::]/unspecified
5550 *http://[::13.1.68.3]/ipv4compat
5551 *http://[::FFFF:129.144.52.38]/ipv4compat
5552
5553 Examples from RFC 2732, section 2:
5554 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5555 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5556 *http://[3ffe:2a00:100:7031::1]
5557 *http://[1080::8:800:200C:417A]/foo
5558 *http://[::192.9.5.5]/ipng
5559 *http://[::FFFF:129.144.52.38]:80/index.html
5560 *http://[2010:836B:4179::836B:4179]
5561
5562 !! html/php
5563 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5564 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5565 </p>
5566 <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5567 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5568 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5569 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5570 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5571 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5572 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5573 </p>
5574 <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5575 <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5576 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5577 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5578 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5579 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5580 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5581
5582 !! html/parsoid
5583 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5584
5585 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5586 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5587 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5588 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5589 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5590 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5591 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5592
5593 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5594 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5595 <li><a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5596 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5597 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5598 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5599 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5600 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5601 !! end
5602
5603 !! test
5604 IPv6 urls, bracketed format (T23261)
5605 !! wikitext
5606 [http://[2404:130:0:1000::187:2]/index.php test]
5607
5608 Examples from RFC 2373, section 2.2:
5609 *[http://[1080::8:800:200C:417A] unicast]
5610 *[http://[FF01::101] multicast]
5611 *[http://[::1]/ loopback]
5612 *[http://[::] unspecified]
5613 *[http://[::13.1.68.3] ipv4compat]
5614 *[http://[::FFFF:129.144.52.38] ipv4compat]
5615
5616 Examples from RFC 2732, section 2:
5617 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5618 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5619 *[http://[3ffe:2a00:100:7031::1] 3]
5620 *[http://[1080::8:800:200C:417A]/foo 4]
5621 *[http://[::192.9.5.5]/ipng 5]
5622 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5623 *[http://[2010:836B:4179::836B:4179] 7]
5624
5625 !! html/php
5626 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5627 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5628 </p>
5629 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5630 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5631 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5632 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5633 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5634 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5635 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5636 </p>
5637 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5638 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5639 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5640 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5641 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5642 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5643 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5644
5645 !! html/parsoid
5646 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5647
5648 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5649 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5650 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5651 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5652 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5653 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5654 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5655
5656 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5657 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5658 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5659 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5660 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5661 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5662 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5663 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5664 !! end
5665
5666 !! test
5667 Non-extlinks in brackets
5668 !! wikitext
5669 [foo]
5670 [foo bar]
5671 [foo ''bar'']
5672 [fool's] errand
5673 [fool's errand]
5674 [{{echo|foo}}]
5675 [{{echo|foo}} bar]
5676 [{{echo|foo}} ''bar'']
5677 [{{echo|foo}}l's] errand
5678 [{{echo|foo}}l's errand]
5679 [url={{echo|foo}}]
5680 [url=http://example.com]
5681 [http:// bare protocols don't count]
5682 !! html/php
5683 <p>[foo]
5684 [foo bar]
5685 [foo <i>bar</i>]
5686 [fool's] errand
5687 [fool's errand]
5688 [foo]
5689 [foo bar]
5690 [foo <i>bar</i>]
5691 [fool's] errand
5692 [fool's errand]
5693 [url=foo]
5694 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5695 [http:// bare protocols don't count]
5696 </p>
5697 !! html/parsoid
5698 <p>[foo]
5699 [foo bar]
5700 [foo <i>bar</i>]
5701 [fool's] errand
5702 [fool's errand]
5703 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5704 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
5705 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
5706 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
5707 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
5708 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5709 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5710 [http:// bare protocols don't count]</p>
5711 !! end
5712
5713 !! test
5714 Percent encoding in external links
5715 !! wikitext
5716 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5717 !! html/php
5718 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5719 </p>
5720 !! html/parsoid
5721 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5722 !! end
5723
5724 !! test
5725 Use url link syntax for links where the content is equal the link target
5726 !! wikitext
5727 http://example.com
5728 !! html/php
5729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5733 !! end
5734
5735 !! test
5736 Parenthesis in external links, especially URL links
5737 !! wikitext
5738 http://example.com)
5739
5740 http://example.com/test)
5741
5742 http://example.com/(test)
5743
5744 http://example.com/((test)
5745
5746 (http://example.com/(test))
5747
5748 (http://example.com/(test)))))
5749
5750 http://example.com/a)b
5751
5752 [http://example.com) foo]
5753 !! html/php
5754 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5755 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5756 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5757 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5758 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5759 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5760 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5761 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5762 </p>
5763 !! html/parsoid
5764 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5765 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5766 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5767 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5768 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5769 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5770 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5771 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5772 !! end
5773
5774 !! test
5775 Parenthesis in external links, w/ transclusion or comment
5776 !! wikitext
5777 (http://example.com/{{echo|hi}})
5778
5779 (http://example.com<!-- hi -->)
5780 !! html/php
5781 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5782 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5783 </p>
5784 !! html/parsoid
5785 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5786
5787 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5788 !! end
5789
5790 !! test
5791 Serialize <a> tags with invalid link targets as plain text
5792 !! options
5793 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5794 !! html/parsoid
5795 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5796 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5797 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5798 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5799 !! wikitext
5800 text
5801 <nowiki>*</nowiki>text
5802 <nowiki>[[foo]]</nowiki>
5803 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5804 !! end
5805
5806 !! test
5807 mw:ExtLink -vs- mw:WikiLink (T94723)
5808 !! options
5809 parsoid=html2wt
5810 !! html/parsoid
5811 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5812 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5813 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5814 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5815 <p>
5816 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5817 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5818 </p>
5819 !! wikitext
5820 [[Foo|Bar]]
5821 [[Foo|Bar]]
5822 [[:en:Foo|Bar]]
5823 [[:en:Foo|Bar]]
5824
5825 [[:en:European_Robin|European Robin]]
5826 [[:en:European_Robin|European Robin]]
5827 !! end
5828
5829 !! test
5830 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5831 !! options
5832 parsoid=wt2wt
5833 !! wikitext
5834 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5835 !! html/parsoid
5836 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5837 !! end
5838
5839
5840 ###
5841 ### Quotes
5842 ###
5843
5844 !! test
5845 Quotes
5846 !! wikitext
5847 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5848
5849 Normal text. '''''Bold italic text.''''' Normal text.
5850 !! html
5851 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5852 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5853 </p>
5854 !! end
5855
5856
5857 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5858 # parser strips. The wikitext contains just the first half of the bold
5859 # quote pair.
5860 !! test
5861 Unclosed and unmatched quotes
5862 !! wikitext
5863 '''''Bold italic text '''with bold deactivated''' in between.'''''
5864
5865 '''''Bold italic text ''with italic deactivated'' in between.'''''
5866
5867 '''Bold text..
5868
5869 ..spanning two paragraphs (should not work).'''
5870
5871 '''Bold tag left open
5872
5873 ''Italic tag left open
5874
5875 Normal text.
5876
5877 <!-- Unmatching number of opening, closing tags: -->
5878 '''This year''''s election ''should'' beat '''last year''''s.
5879
5880 ''Tom'''s car is bigger than ''Susan'''s.
5881
5882 Plain ''italic'''s plain
5883 !! html/php
5884 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5885 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5886 </p><p><b>Bold text..</b>
5887 </p><p>..spanning two paragraphs (should not work).
5888 </p><p><b>Bold tag left open</b>
5889 </p><p><i>Italic tag left open</i>
5890 </p><p>Normal text.
5891 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5892 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5893 </p><p>Plain <i>italic'</i>s plain
5894 </p>
5895 !! html/parsoid
5896 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5897 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5898 </p><p><b>Bold text..</b>
5899 </p><p>..spanning two paragraphs (should not work).<b></b>
5900 </p><p><b>Bold tag left open</b>
5901 </p><p><i>Italic tag left open</i>
5902 </p><p>Normal text.
5903 </p>
5904 <!-- Unmatching number of opening, closing tags: -->
5905 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5906 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5907 </p><p>Plain <i>italic'</i>s plain
5908 </p>
5909 !! end
5910
5911 ###
5912 ### Tables
5913 ###
5914 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5915 ###
5916
5917 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5918 # is the bare minimum required by the spec, see:
5919 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5920 # Parsoid team replies: empty table tags are legal in HTML5
5921 !! test
5922 A table with no data.
5923 !! options
5924 parsoid=wt2html
5925 !! wikitext
5926 {||}
5927 !! html/php
5928
5929 !! html/parsoid
5930 <table></table>
5931
5932 !! end
5933
5934 !! test
5935 A table with stray table end tags on start tag line (wt2html)
5936 !! options
5937 parsoid=wt2html
5938 !! wikitext
5939 {|style="color: red;"|}
5940
5941 {|style="color: red;" |}
5942 |foo
5943 |}
5944
5945 {|style="color: red;"|} id="foo"
5946 |foo
5947 |}
5948
5949 {|style="color: red;" |} id="foo"
5950 |foo
5951 |}
5952 !! html
5953 <table style="color: red;"></table>
5954
5955 <table style="color: red;">
5956 <tbody><tr>
5957 <td>foo</td>
5958 </tr></tbody>
5959 </table>
5960
5961 <table style="color: red;" id="foo">
5962 <tbody><tr>
5963 <td>foo</td>
5964 </tr></tbody>
5965 </table>
5966
5967 <table style="color: red;" id="foo">
5968 <tbody><tr>
5969 <td>foo</td>
5970 </tr></tbody>
5971 </table>
5972
5973 !! end
5974
5975 !! test
5976 A table with no data (take 2)
5977 !! wikitext
5978 {|
5979 |}
5980 !! html/parsoid
5981 <table></table>
5982 !! end
5983
5984 # A table with nothing but a caption is invalid XHTML, we might want to render
5985 # this as <p>caption</p>
5986 # Parsoid team replies: table with only a caption is legal in HTML5
5987 !! test
5988 A table with nothing but a caption
5989 !! wikitext
5990 {|
5991 |+caption
5992 |}
5993 !! html/php
5994 <table>
5995 <caption>caption
5996 </caption><tr><td></td></tr></table>
5997
5998 !! html/parsoid
5999 <table><caption>caption</caption></table>
6000 !! end
6001
6002 !! test
6003 A table with caption with default-spaced attributes and a table row
6004 !! wikitext
6005 {|
6006 |+ style="color: red;" | caption1
6007 |-
6008 |foo
6009 |}
6010 !! html
6011 <table>
6012 <caption style="color: red;">caption1
6013 </caption>
6014 <tr>
6015 <td>foo
6016 </td></tr></table>
6017
6018 !! end
6019
6020 !! test
6021 A table with captions with non-default spaced attributes and a table row
6022 !! wikitext
6023 {|
6024 |+style="color: red;"|caption2
6025 |+ style="color: red;"|caption3
6026 |-
6027 |foo
6028 |}
6029 !! html
6030 <table>
6031 <caption style="color: red;">caption2
6032 </caption>
6033 <caption style="color: red;">caption3
6034 </caption>
6035 <tr>
6036 <td>foo
6037 </td></tr></table>
6038
6039 !! end
6040
6041 !! test
6042 Table td-cell syntax variations
6043 !! wikitext
6044 {|
6045 |foo bar foo|baz
6046 |foo bar foo||baz
6047 |style='color:red;'|baz
6048 |style='color:red;'||baz
6049 |}
6050 !! html
6051 <table>
6052 <tr>
6053 <td>baz
6054 </td>
6055 <td>foo bar foo</td>
6056 <td>baz
6057 </td>
6058 <td style="color:red;">baz
6059 </td>
6060 <td>style='color:red;'</td>
6061 <td>baz
6062 </td></tr></table>
6063
6064 !! end
6065
6066 !! test
6067 Simple table
6068 !! wikitext
6069 {|
6070 |1||2
6071 |-
6072 |3||4
6073 |}
6074 !! html
6075 <table>
6076 <tr>
6077 <td>1</td>
6078 <td>2
6079 </td></tr>
6080 <tr>
6081 <td>3</td>
6082 <td>4
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 Simple table but with multiple dashes for row wikitext
6089 !! wikitext
6090 {|
6091 |foo
6092 |-----
6093 |bar
6094 |}
6095 !! html
6096 <table>
6097 <tr>
6098 <td>foo
6099 </td></tr>
6100 <tr>
6101 <td>bar
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !! test
6107 Multiplication table
6108 !! wikitext
6109 {| border="1" cellpadding="2"
6110 |+Multiplication table
6111 |-
6112 !&times;!!1!!2!!3
6113 |-
6114 !1
6115 |1||2||3
6116 |-
6117 !2
6118 |2||4||6
6119 |-
6120 !3
6121 |3||6||9
6122 |-
6123 !4
6124 |4||8||12
6125 |-
6126 !5
6127 |5||10||15
6128 |}
6129 !! html
6130 <table border="1" cellpadding="2">
6131 <caption>Multiplication table
6132 </caption>
6133 <tr>
6134 <th>&#215;</th>
6135 <th>1</th>
6136 <th>2</th>
6137 <th>3
6138 </th></tr>
6139 <tr>
6140 <th>1
6141 </th>
6142 <td>1</td>
6143 <td>2</td>
6144 <td>3
6145 </td></tr>
6146 <tr>
6147 <th>2
6148 </th>
6149 <td>2</td>
6150 <td>4</td>
6151 <td>6
6152 </td></tr>
6153 <tr>
6154 <th>3
6155 </th>
6156 <td>3</td>
6157 <td>6</td>
6158 <td>9
6159 </td></tr>
6160 <tr>
6161 <th>4
6162 </th>
6163 <td>4</td>
6164 <td>8</td>
6165 <td>12
6166 </td></tr>
6167 <tr>
6168 <th>5
6169 </th>
6170 <td>5</td>
6171 <td>10</td>
6172 <td>15
6173 </td></tr></table>
6174
6175 !! end
6176
6177 !! test
6178 Accept "||" in table headings
6179 !! wikitext
6180 {|
6181 !h1||h2
6182 |}
6183 !! html
6184 <table>
6185 <tr>
6186 <th>h1</th>
6187 <th>h2
6188 </th></tr></table>
6189
6190 !! end
6191
6192 !! test
6193 Accept "!!" in table data
6194 !! wikitext
6195 {|
6196 |Foo!!||
6197 |}
6198 !! html
6199 <table>
6200 <tr>
6201 <td>Foo!!</td>
6202 <td>
6203 </td></tr></table>
6204
6205 !! html/parsoid
6206 <table>
6207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6208 </tbody></table>
6209 !! end
6210
6211 !! test
6212 Accept "||" in indented table headings
6213 !! wikitext
6214 :{|
6215 !h1||h2
6216 |}
6217 !! html
6218 <dl><dd><table>
6219 <tr>
6220 <th>h1</th>
6221 <th>h2
6222 </th></tr></table></dd></dl>
6223
6224 !! end
6225
6226 !! test
6227 Accept "!!" in templates
6228 !! wikitext
6229 {|
6230 !a {{echo|b!!c}}
6231 |}
6232 !! html/php
6233 <table>
6234 <tr>
6235 <th>a b</th>
6236 <th>c
6237 </th></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6242 !! end
6243
6244 !! test
6245 Accept "!!" in table headings after newline
6246 !! wikitext
6247 {|
6248 !a
6249 b!!c
6250 |}
6251 !! html/php
6252 <table>
6253 <tr>
6254 <th>a
6255 <p>b!!c
6256 </p>
6257 </th></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><th>a
6262 <p>b!!c</p></th></tr>
6263 </tbody></table>
6264 !! end
6265
6266 !! test
6267 Accept "!!" in table data of mixed wikitext / html syntax
6268 !! wikitext
6269 {|
6270 !a
6271 <tr><td>b!!c</td></tr>
6272 |}
6273 !! html/php+tidy
6274 <table>
6275 <tbody><tr>
6276 <th>a
6277 </th></tr><tr><td>b!!c</td></tr>
6278 </tbody></table>
6279 !! html/parsoid
6280 <table>
6281 <tbody><tr><th>a</th></tr>
6282 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6283 </tbody></table>
6284 !! end
6285
6286 !! test
6287 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6288 !! wikitext
6289 {|
6290 !| h1
6291 || a
6292 |}
6293 !! html
6294 <table>
6295 <tr>
6296 <th>h1
6297 </th>
6298 <td>a
6299 </td></tr></table>
6300
6301 !! end
6302
6303 !!test
6304 Accept "| !" at start of line in tables (ignore !-attribute)
6305 !! wikitext
6306 {|
6307 |-
6308 |!style="color:red"|bar
6309 |}
6310 !! html
6311 <table>
6312
6313 <tr>
6314 <td>bar
6315 </td></tr></table>
6316
6317 !!end
6318
6319 !!test
6320 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6321 !! wikitext
6322 {|
6323 |-
6324 |style='color:red;'|+1
6325 |style='color:blue;'|-1
6326 |-
6327 |1||2||3
6328 |1||+2||-3
6329 |-
6330 | +1
6331 | -1
6332 |}
6333 !! html
6334 <table>
6335
6336 <tr>
6337 <td style="color:red;">+1
6338 </td>
6339 <td style="color:blue;">-1
6340 </td></tr>
6341 <tr>
6342 <td>1</td>
6343 <td>2</td>
6344 <td>3
6345 </td>
6346 <td>1</td>
6347 <td>+2</td>
6348 <td>-3
6349 </td></tr>
6350 <tr>
6351 <td>+1
6352 </td>
6353 <td>-1
6354 </td></tr></table>
6355
6356 !!end
6357
6358 !! test
6359 Table rowspan
6360 !! wikitext
6361 {| border=1
6362 |Cell 1, row 1
6363 |rowspan=2|Cell 2, row 1 (and 2)
6364 |Cell 3, row 1
6365 |-
6366 |Cell 1, row 2
6367 |Cell 3, row 2
6368 |}
6369 !! html
6370 <table border="1">
6371 <tr>
6372 <td>Cell 1, row 1
6373 </td>
6374 <td rowspan="2">Cell 2, row 1 (and 2)
6375 </td>
6376 <td>Cell 3, row 1
6377 </td></tr>
6378 <tr>
6379 <td>Cell 1, row 2
6380 </td>
6381 <td>Cell 3, row 2
6382 </td></tr></table>
6383
6384 !! end
6385
6386 !! test
6387 Nested table
6388 !! wikitext
6389 {| border=1
6390 | &alpha;
6391 |
6392 {| bgcolor=#ABCDEF border=2
6393 |nested
6394 |-
6395 |table
6396 |}
6397 |the original table again
6398 |}
6399 !! html
6400 <table border="1">
6401 <tr>
6402 <td>&#945;
6403 </td>
6404 <td>
6405 <table bgcolor="#ABCDEF" border="2">
6406 <tr>
6407 <td>nested
6408 </td></tr>
6409 <tr>
6410 <td>table
6411 </td></tr></table>
6412 </td>
6413 <td>the original table again
6414 </td></tr></table>
6415
6416 !! end
6417
6418 !! test
6419 Invalid attributes in table cell (T3830)
6420 !! wikitext
6421 {|
6422 |Cell:|broken
6423 |}
6424 !! html
6425 <table>
6426 <tr>
6427 <td>broken
6428 </td></tr></table>
6429
6430 !! end
6431
6432 !! test
6433 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6434 !! wikitext
6435 {|
6436 | title="foo" |bar
6437 | title="foo<nowiki>|</nowiki>" |bar
6438 | title="foo<nowiki>|</nowiki>" bar
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td title="foo">bar
6444 </td>
6445 <td title="foo&#124;">bar
6446 </td>
6447 <td>title="foo|" bar
6448 </td></tr></table>
6449
6450 !! html/parsoid
6451 <table>
6452 <tbody><tr><td title="foo">bar</td>
6453 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6454 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6455 </tbody></table>
6456 !! end
6457
6458 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6459 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6460 # *2wt modes will fail.
6461 !! test
6462 Table security: embedded pipes
6463 !! options
6464 parsoid=wt2html,html2html
6465 !! wikitext
6466 {|
6467 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6468 !! html/php
6469 <table>
6470 <tr>
6471 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6472 <td>]" onmouseover="alert(document.cookie)"&gt;test
6473 </td>
6474 </tr>
6475 </table>
6476
6477 !! html/parsoid
6478 <table><tbody>
6479 <tr>
6480 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6481 !! end
6482
6483 !! test
6484 Element attributes with double ! should not be broken up by <th>
6485 !! wikitext
6486 {|
6487 !hi <div class="!!">ha</div> ho
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th>hi <div class="!!">ha</div> ho
6493 </th></tr></table>
6494
6495 !! html/parsoid
6496 <table>
6497 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 ! and || in element attributes should not be parsed as <th>/<td>
6503 !! wikitext
6504 {|
6505 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6506 |}
6507 !! html/php
6508 <table>
6509 <tr>
6510 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6516 </tbody></table>
6517 !! end
6518
6519 # FIXME: The output seems broken. Filed as T110268.
6520 !! test
6521 ! and || in td attributes should not be parsed as <th>/<td>
6522 !! options
6523 parsoid=wt2html
6524 !! wikitext
6525 {|
6526 |style="color: red !important;" data-contrived="put this here ||"|foo
6527 |}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <td>style="color: red !important;" data-contrived="put this here</td>
6532 <td>foo
6533 </td></tr></table>
6534
6535 !! html/parsoid
6536 <table>
6537 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Break on | in element attribute in template
6543 !! options
6544 parsoid=wt2html,html2html
6545 !! wikitext
6546 {{echo|1=<div class="hi|ho">ha</div>}}
6547 !! html/php
6548 <p>ho"&gt;ha&lt;/div&gt;
6549 </p>
6550 !! html/parsoid
6551 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6552 !! end
6553
6554 !! test
6555 Break on | in element attribute name in template
6556 !! wikitext
6557 {{echo|<div cla|ss="hiho">ha</div>}}
6558 !! html/parsoid
6559 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6560 !! end
6561
6562 !! test
6563 Don't break on | in extension attribute in template
6564 !! wikitext
6565 {{echo|<ref name="hi|ho">ha</ref>}}
6566
6567 <references />
6568 !! html/parsoid
6569 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6570
6571 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6572 !! end
6573
6574 ## We don't support roundtripping of these attributes in Parsoid.
6575 ## Selective serialization takes care of preventing dirty diffs.
6576 ## But, on edits, we dirty-diff the invalid attribute text.
6577 !! test
6578 Invalid text in table attributes should be discarded
6579 !! options
6580 parsoid=wt2html
6581 !! wikitext
6582 {| <span>boo</span> style='border:1px solid black'
6583 | <span>boo</span> style='color:blue' |1
6584 |<span>boo</span> style='color:blue'|2
6585 |}
6586 !! html/php
6587 <table style="border:1px solid black">
6588 <tr>
6589 <td style="color:blue">1
6590 </td>
6591 <td style="color:blue">2
6592 </td></tr></table>
6593
6594 !! html/parsoid
6595 <table style="border:1px solid black">
6596 <tr>
6597 <td style="color:blue">1</td>
6598 <td style="color:blue">2</td>
6599 </tr>
6600 </table>
6601 !! end
6602
6603 !! test
6604 Invalid text in table attributes should be preserved by selective serializer
6605 !! options
6606 parsoid={
6607 "modes": ["selser"],
6608 "changes": [
6609 ["td:first-child", "text", "abc"],
6610 ["td + td", "text", "xyz"]
6611 ]
6612 }
6613 !! wikitext
6614 {| <span>boo</span> style='border:1px solid black'
6615 | <span>boo</span> style='color:blue' | 1
6616 |<span>boo</span> style='color:blue'| 2
6617 |}
6618 !! wikitext/edited
6619 {| <span>boo</span> style='border:1px solid black'
6620 | <span>boo</span> style='color:blue' |abc
6621 |<span>boo</span> style='color:blue'|xyz
6622 |}
6623 !! end
6624
6625 !! test
6626 1. Template-generated table cell attributes and cell content
6627 !! wikitext
6628 {|
6629 |{{table_attribs}}
6630 | {{table_attribs}}
6631 || {{table_attribs_5}}
6632 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6633 |align=center {{table_attribs}}
6634 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6635 |}
6636 !! html
6637 <table>
6638 <tr>
6639 <td style="color:red;">Foo
6640 </td>
6641 <td style="color:red;">Foo
6642 </td>
6643 <td>style="color:red;"</td>
6644 <td>Bar
6645 </td>
6646 <td style="color:red;">Foo
6647 </td>
6648 <td align="center" style="color:red;">Foo
6649 </td>
6650 <td align="center" style="color:red;">Foo
6651 </td></tr></table>
6652
6653 !! end
6654
6655 !! test
6656 2. Template-generated table cell attributes and cell content
6657 !! wikitext
6658 {|
6659 |{{table_attribs_2}}
6660 |}
6661 !! html/php
6662 <table>
6663 <tr>
6664 <td style="color:red;">Foo
6665 </td>
6666 <td>Bar</td>
6667 <td>Baz
6668 </td></tr></table>
6669
6670 !! html/parsoid
6671 <table>
6672 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6673 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6674 </tbody></table>
6675 !! end
6676
6677 !! test
6678 3. Template-generated table cell attributes and cell content
6679 !! wikitext
6680 {|
6681 !align=center {{table_header_cells}}
6682 |-
6683 |align=center {{table_cells}}
6684 |}
6685 !! html/php
6686 <table>
6687 <tr>
6688 <th align="center" style="color:red;">Foo</th>
6689 <th style="color:red;"><i>Bar</i></th>
6690 <th style="color:brown;"><i>Foo</i> and Baz
6691 </th></tr>
6692 <tr>
6693 <td align="center" style="color:red;">Foo</td>
6694 <td style="color:red;"><i>Bar</i></td>
6695 <td style="color:brown;"><i>Foo</i> and Baz
6696 </td></tr></table>
6697
6698 !! html/parsoid
6699 <table>
6700 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6701 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6702 </tbody></table>
6703 !! end
6704
6705 !! test
6706 4. Template-generated table cell attributes and cell content inside a templated table
6707 !! wikitext
6708 {{tbl-start}}
6709 !align=center {{table_header_cells}}
6710 |-
6711 |align=center {{table_cells}}
6712 {{tbl-end}}
6713 !! html/php
6714 <table>
6715 <tr>
6716 <th align="center" style="color:red;">Foo</th>
6717 <th style="color:red;"><i>Bar</i></th>
6718 <th style="color:brown;"><i>Foo</i> and Baz
6719 </th></tr>
6720 <tr>
6721 <td align="center" style="color:red;">Foo</td>
6722 <td style="color:red;"><i>Bar</i></td>
6723 <td style="color:brown;"><i>Foo</i> and Baz
6724 </td></tr></table>
6725
6726 !! html/parsoid
6727 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6728 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6729 <tr>
6730 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6731 </tbody></table>
6732 !! end
6733
6734 ## Edge case fix to prevent future regressions
6735 !! test
6736 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6737 !! wikitext
6738 {|
6739 |{{table_attribs_7}}
6740 |}
6741 <references />
6742 !! html/parsoid
6743 <table>
6744 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
6745 </tbody></table>
6746 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6747 !! end
6748
6749 !! test
6750 Table with row followed by newlines and table heading
6751 !! options
6752 parsoid=wt2html,html2html
6753 !! wikitext
6754 {|
6755 |-
6756
6757 !foo
6758 |}
6759 !! html/*
6760 <table>
6761
6762
6763 <tr>
6764 <th>foo
6765 </th></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Table with empty line following the start tag
6771 !! options
6772 parsoid=wt2html,html2html
6773 !! wikitext
6774 {|
6775
6776 |-
6777 |foo
6778 |}
6779 !! html/*
6780 <table>
6781
6782
6783 <tr>
6784 <td>foo
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table attributes with empty value
6791 !! options
6792 parsoid=wt2html,html2html
6793 !! wikitext
6794 {|
6795 | style=|hello
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td style="">hello
6801 </td></tr></table>
6802
6803 !! html/parsoid
6804 <table>
6805 <tbody><tr><td style="">hello</td></tr>
6806 </tbody></table>
6807 !! end
6808
6809 !! test
6810 Wikitext table with a lot of comments
6811 !! wikitext
6812 {|
6813 <!-- c0 -->
6814 |foo
6815 <!-- c1 -->
6816 |-<!-- c2 -->
6817 <!-- c3 -->
6818 |<!-- c4 -->
6819 <!-- c5 -->
6820 |}
6821 !! html
6822 <table>
6823 <tr>
6824 <td>foo
6825 </td></tr>
6826 <tr>
6827 <td>
6828 </td></tr></table>
6829
6830 !! end
6831
6832 !! test
6833 Wikitext table comments represented in parsoid dom
6834 !! wikitext
6835 {|<!--c1--><!--c2-->
6836 |-<!--c3-->
6837 |x
6838 |}
6839 !! html/php+tidy
6840 <table>
6841
6842 <tbody><tr>
6843 <td>x
6844 </td></tr></tbody></table>
6845 !! html/parsoid
6846 <table><!--c1--><!--c2-->
6847 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6848 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
6849 </tbody></table>
6850 !! end
6851
6852 !! test
6853 Wikitext table with double-line table cell
6854 !! wikitext
6855 {|
6856 |a
6857 b
6858 |}
6859 !! html
6860 <table>
6861 <tr>
6862 <td>a
6863 <p>b
6864 </p>
6865 </td></tr></table>
6866
6867 !! end
6868
6869 !! test
6870 Table cell with a single comment
6871 !! wikitext
6872 {|
6873 | <!-- c1 -->
6874 |a
6875 |}
6876 !! html
6877 <table>
6878 <tr>
6879 <td>
6880 </td>
6881 <td>a
6882 </td></tr></table>
6883
6884 !! end
6885
6886 !! test
6887 Table-cell after a comment-only-empty-line
6888 !! wikitext
6889 {|
6890 |a
6891 <!--c1-->
6892 <!--c2-->|b
6893 |}
6894 !! html
6895 <table>
6896 <tr>
6897 <td>a
6898 </td>
6899 <td>b
6900 </td></tr></table>
6901
6902 !! html/parsoid
6903 <table>
6904 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6905 <!--c1-->
6906 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
6907 </tbody></table>
6908
6909 !! end
6910
6911 !! test
6912 Build table with {{!}}
6913 !! wikitext
6914 {{{!}} class="wikitable"
6915 !header
6916 !second header
6917 {{!}}- style="color:red;"
6918 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
6919 {{!}}}
6920 !! html
6921 <table class="wikitable">
6922 <tr>
6923 <th>header
6924 </th>
6925 <th>second header
6926 </th></tr>
6927 <tr style="color:red;">
6928 <td>data</td>
6929 <td style="color:red;">second data
6930 </td></tr></table>
6931
6932 !! end
6933
6934 !! test
6935 Build table with pipe as data
6936 !! wikitext
6937 {| class="wikitable"
6938 !header
6939 !second header
6940 |- style="color:red;"
6941 |data|| style="color:red;" |second data
6942 |-
6943 | style="color:red;" |data with | || style="color:red;" | second data with |
6944 |-
6945 ||data with | |||second data with |
6946 |}
6947 !! html
6948 <table class="wikitable">
6949 <tr>
6950 <th>header
6951 </th>
6952 <th>second header
6953 </th></tr>
6954 <tr style="color:red;">
6955 <td>data</td>
6956 <td style="color:red;">second data
6957 </td></tr>
6958 <tr>
6959 <td style="color:red;">data with |</td>
6960 <td style="color:red;">second data with |
6961 </td></tr>
6962 <tr>
6963 <td>data with |</td>
6964 <td>second data with |
6965 </td></tr></table>
6966
6967 !! end
6968
6969 !! test
6970 Build table with wikilink
6971 !! wikitext
6972 {| class="wikitable"
6973 !header||second header
6974 |- style="color:red;"
6975 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
6976 |-
6977 |data||second data [[Main Page|link|text with pipe]]
6978 |}
6979 !! html
6980 <table class="wikitable">
6981 <tr>
6982 <th>header</th>
6983 <th>second header
6984 </th></tr>
6985 <tr style="color:red;">
6986 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
6987 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6988 </td></tr>
6989 <tr>
6990 <td>data</td>
6991 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6992 </td></tr></table>
6993
6994 !! end
6995
6996 # The expected HTML structure in this test is debatable. The PHP parser does
6997 # not parse this kind of table at all. The main focus for Parsoid is on
6998 # round-tripping, so this output is ok for now. TODO: revisit!
6999 !! test
7000 Wikitext table with html-syntax row
7001 !! wikitext
7002 {|
7003 |-
7004 <td>foo</td>
7005 |}
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr>
7010 <td>foo</td></tr></tbody></table>
7011 !! end
7012
7013 !! test
7014 Fostered content in tables: Plain text
7015 !! options
7016 parsoid=wt2html,html2html
7017 !! wikitext
7018 {|
7019 |-
7020 a
7021 |}
7022 !! html/php
7023 <table>
7024
7025 a
7026 </table>
7027
7028 !! html/php+tidy
7029
7030
7031 a
7032 <table></table>
7033 !! html/parsoid
7034 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7035 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7036
7037 </tr></tbody></table>
7038 !! end
7039
7040 !! test
7041 Fostered content in tables: Lists
7042 !! options
7043 parsoid=wt2html,html2html
7044 !! wikitext
7045 {|
7046 |-
7047 *a
7048 |}
7049 !! html/php
7050 <table>
7051
7052 <ul><li>a</li></ul>
7053 </table>
7054
7055 !! html/php+tidy
7056 <ul><li>a</li></ul><table>
7057
7058
7059 </table>
7060 !! html/parsoid
7061 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7062 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7063
7064 </tr></tbody></table>
7065 !! end
7066
7067 !! test
7068 Template generated table cell with attributes
7069 !! wikitext
7070 {|
7071 |-
7072 {{table_attribs_4}} ||a||b
7073 |}
7074 !! html/php+tidy
7075 <table>
7076
7077 <tbody><tr>
7078 <td style="background-color:#DC241f;" width="10px"></td>
7079 <td>a</td>
7080 <td>b
7081 </td></tr></tbody></table>
7082 !! html/parsoid
7083 <table>
7084 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7085 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7086 !! end
7087
7088 !! test
7089 Parsoid: Round-trip tables directly followed by content (T53219)
7090 !! options
7091 parsoid=wt2html,wt2wt
7092 !! wikitext
7093 {|
7094 |foo
7095 |} bar
7096
7097 {|
7098 |baz
7099 |}<b>quux</b>
7100 !! html+tidy
7101 <table>
7102 <tbody><tr>
7103 <td>foo
7104 </td></tr></tbody></table><p> bar
7105 </p><table>
7106 <tbody><tr>
7107 <td>baz
7108 </td></tr></tbody></table><p><b>quux</b>
7109 </p>
7110 !! end
7111
7112 !! test
7113 Parsoid: Default to a newline after tables in new content (T53219)
7114 !! options
7115 parsoid=html2wt
7116 !! html/parsoid
7117 <table><tbody>
7118 <tr><td>foo</td></tr></tbody></table> bar
7119 <table><tbody>
7120 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7121 !! wikitext
7122 {|
7123 |foo
7124 |}
7125 <nowiki> </nowiki>bar
7126 {|
7127 |baz
7128 |}
7129 '''quux'''
7130 !! end
7131
7132 !! test
7133 Parsoid: newline inducing block nodes don't suppress <nowiki>
7134 !! options
7135 parsoid=html2wt
7136 !! html/parsoid
7137 a<h1>foo</h1>
7138 !! wikitext
7139 <nowiki> </nowiki>a
7140
7141 = foo =
7142 !! end
7143
7144 !! test
7145 Parsoid: Row-syntax table headings followed by comment & table cells
7146 !! options
7147 parsoid=wt2html,wt2wt
7148 !! wikitext
7149 {|
7150 !foo||bar
7151 <!-- foo --> ||baz||quux
7152 |}
7153 !! html/php
7154 <table>
7155 <tr>
7156 <th>foo</th>
7157 <th>bar
7158 </th>
7159 <td>baz</td>
7160 <td>quux
7161 </td></tr></table>
7162
7163 !! html/parsoid
7164 <table>
7165 <tbody><tr><th> foo </th><th> bar
7166 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7167 </tbody></table>
7168 !! end
7169
7170 !!test
7171 Parsoid: Recover better from broken table attributes
7172 !!options
7173 parsoid=wt2html
7174 !!wikitext
7175 {| class="foo
7176 | class="bar" |
7177 foo
7178 |}
7179 !!html/php+tidy
7180 <table class="foo">
7181 <tbody><tr>
7182 <td class="bar">
7183 <p>foo
7184 </p>
7185 </td></tr></tbody></table>
7186 !!html/parsoid
7187 <table class="foo">
7188 <tr>
7189 <td class="bar">
7190 <p>foo</p></td></tr>
7191 </tbody></table>
7192 !!end
7193
7194 !! test
7195 Tables: Digest broken attributes on table and tr tag
7196 !! options
7197 parsoid=wt2html
7198 !! wikitext
7199 {| || |} ++
7200 |- || || ++ --
7201 |- > [
7202 |}
7203 !! html
7204 <table>
7205 <tbody>
7206 <tr class='mw-empty-elt'></tr>
7207 <tr class='mw-empty-elt'></tr>
7208 </tbody></table>
7209 !! end
7210
7211 # T137406: Whitespace in the HTML
7212 !! test
7213 1. Generate correct wikitext for tables with thead/tbody/tfoot
7214 !! options
7215 parsoid=html2wt
7216 !! html/parsoid
7217 <table>
7218 <caption>Test</caption>
7219 <thead>
7220 <tr>
7221 <th>Month</th>
7222 <th>Savings</th>
7223 </tr>
7224 </thead>
7225 <tbody>
7226 <tr>
7227 <td>January</td>
7228 <td>$100</td>
7229 </tr>
7230 <tr>
7231 <td>February</td>
7232 <td>$80</td>
7233 </tr>
7234 </tbody>
7235 <tfoot>
7236 <tr>
7237 <td>Sum</td>
7238 <td>$180</td>
7239 </tr>
7240 </tfoot>
7241 </table>
7242 !! wikitext
7243 {|
7244 |+Test
7245 !Month
7246 !Savings
7247 |-
7248 |January
7249 |$100
7250 |-
7251 |February
7252 |$80
7253 |-
7254 |Sum
7255 |$180
7256 |}
7257 !! html/php+tidy
7258 <table>
7259 <caption>Test
7260 </caption>
7261 <tbody><tr>
7262 <th>Month
7263 </th>
7264 <th>Savings
7265 </th></tr>
7266 <tr>
7267 <td>January
7268 </td>
7269 <td>$100
7270 </td></tr>
7271 <tr>
7272 <td>February
7273 </td>
7274 <td>$80
7275 </td></tr>
7276 <tr>
7277 <td>Sum
7278 </td>
7279 <td>$180
7280 </td></tr></tbody></table>
7281 !! end
7282
7283 # T137406: No whitespace in the HTML
7284 !! test
7285 2. Generate correct wikitext for tables with thead/tbody/tfoot
7286 !! options
7287 parsoid=html2wt
7288 !! html/parsoid
7289 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7290 !! wikitext
7291 {|
7292 !heading
7293 |-
7294 |foo
7295 |}
7296 !! end
7297
7298 !! test
7299 Testing serialization after deletion in references
7300 !! options
7301 parsoid={
7302 "modes": ["wt2wt"],
7303 "changes": [
7304 ["#x", "remove"]
7305 ]
7306 }
7307 !! wikitext
7308 hi <ref><div id="x">ho</div></ref>
7309
7310 <references />
7311 !! wikitext/edited
7312 hi <ref></ref>
7313
7314 <references />
7315 !! end
7316
7317 !!test
7318 Testing serialization after deletion of table cells
7319 !!options
7320 parsoid={
7321 "modes": ["wt2wt", "selser"],
7322 "changes": [
7323 ["#x", "remove"]
7324 ]
7325 }
7326 !!wikitext
7327 {|
7328 !h1 !!h2 !!h3
7329 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7330 |}
7331 !! wikitext/edited
7332 {|
7333 !h1 !!h2 !!h3
7334 |c2 |||c3
7335 |}
7336 !!end
7337
7338 !! test
7339 Testing selser after addition of new row before first row (T125419)
7340 !! options
7341 parsoid={
7342 "modes": ["wt2wt", "selser"],
7343 "changes": [
7344 [ "tr", "before", "<tr><td>X</td></tr>" ]
7345 ]
7346 }
7347 !! wikitext
7348 {|
7349 |a
7350 |}
7351 !! wikitext/edited
7352 {|
7353 |X
7354 |-
7355 |a
7356 |}
7357 !! end
7358
7359 !! test
7360 Serialize new table rows in a HTML table using HTML tags
7361 !! options
7362 parsoid={
7363 "modes": ["wt2wt", "selser"],
7364 "changes": [
7365 [ "tr", "before", "<tr><td>X</td></tr>" ]
7366 ]
7367 }
7368 !! wikitext
7369 <table><tr><td>a</td></tr></table>
7370 !! wikitext/edited
7371 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7372 !! end
7373
7374 !! test
7375 Serialize new table cells in a HTML row using HTML tags
7376 !! options
7377 parsoid={
7378 "modes": ["wt2wt", "selser"],
7379 "changes": [
7380 [ "td", "before", "<td>X</td>" ]
7381 ]
7382 }
7383 !! wikitext
7384 <table><tr><td>a</td></tr></table>
7385 !! wikitext/edited
7386 <table><tr><td>X</td><td>a</td></tr></table>
7387 !! end
7388
7389 !! test
7390 Wikitext tables can be nested inside HTML tables
7391 !! options
7392 parsoid=html2wt
7393 !! html
7394 <table data-parsoid='{"stx":"html"}'>
7395 <tr><td>
7396 <table>
7397 <tr><td>foo</td></tr>
7398 </table>
7399 </td></tr>
7400 </table>
7401 !! wikitext
7402 <table>
7403 <tr><td>
7404 {|
7405 |foo
7406 |}
7407 </td></tr>
7408 </table>
7409 !! end
7410
7411 !! test
7412 Serialize wikitext list items as HTML list items when embedded in a HTML list
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{}'>a</li>
7418 <li>b</li>
7419 </ul>
7420 !! wikitext
7421 <ul>
7422 <li>a</li>
7423 <li>b</li>
7424 </ul>
7425 !! end
7426
7427 # SSS FIXME: Is this actually a good thing given the
7428 # odd nested list output that is generated by MW?
7429 # <ul><li>foo<ul>..</ul></li></ul> instead of
7430 # <ul><li>foo</li><ul>..</ul></ul>
7431 !! test
7432 Wikitext lists can be nested inside HTML lists
7433 !! options
7434 parsoid=html2wt
7435 !! html
7436 <ul data-parsoid='{"stx": "html"}'>
7437 <li data-parsoid='{"stx": "html"}'>a
7438 <ul><li>b</li></ul>
7439 </li>
7440 </ul>
7441
7442 <ul data-parsoid='{"stx": "html"}'>
7443 <li>x
7444 <ul><li>y</li></ul>
7445 </li>
7446 </ul>
7447 !! wikitext
7448 <ul>
7449 <li>a
7450 * b
7451 </li>
7452 </ul>
7453
7454 <ul>
7455 <li>x
7456 * y
7457 </li>
7458 </ul>
7459 !! end
7460
7461 ###
7462 ### Internal links
7463 ###
7464 !! test
7465 Plain link, capitalized
7466 !! wikitext
7467 [[Main Page]]
7468 !! html
7469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7470 </p>
7471 !! end
7472
7473 !! test
7474 Plain link, uncapitalized
7475 !! wikitext
7476 [[main Page]]
7477 !! html
7478 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7479 </p>
7480 !! end
7481
7482 !! test
7483 Piped link
7484 !! wikitext
7485 [[Main Page|The Main Page]]
7486 !! html
7487 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Piped link with comment in link text
7493 !! wikitext
7494 [[Main Page|The Main<!--front--> Page]]
7495 !! html
7496 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Piped link with multiple pipe characters in link text
7502 !! wikitext
7503 [[Main Page||The|Main|Page|]]
7504 !! html/php
7505 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7506 </p>
7507 !! html/parsoid
7508 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7509 !! end
7510
7511 !! test
7512 Piped link with no link text
7513 !! wikitext
7514 [[Thomas Bek (bishop of St David's)|]]
7515 !! html/php
7516 <p>[[Thomas Bek (bishop of St David's)|]]
7517 </p>
7518 !! html/parsoid
7519 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7520 !! end
7521
7522 !! test
7523 Piped link with empty link text
7524 !! wikitext
7525 [[Main Page|<nowiki/>]] - empty nowiki
7526 [[Main Page| ]] - empty space
7527 [[Main Page|&nbsp;]] - empty non breaking space
7528 !! html/php
7529 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7530 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7531 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7532 </p>
7533 !! html/parsoid
7534 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7535 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7536 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7537 !! end
7538
7539 !! test
7540 Broken link
7541 !! wikitext
7542 [[Zigzagzogzagzig]]
7543 !! html
7544 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7545 </p>
7546 !! end
7547
7548 !! test
7549 Broken link with fragment
7550 !! wikitext
7551 [[Zigzagzogzagzig#zug]]
7552 !! html
7553 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Special page link with fragment
7559 !! wikitext
7560 [[Special:Version#anchor]]
7561 !! html
7562 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7563 </p>
7564 !! end
7565
7566 !! test
7567 Nonexistent special page link with fragment
7568 !! wikitext
7569 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7570 !! html
7571 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Link with prefix
7577 !! wikitext
7578 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7579 !! html
7580 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Link with suffix
7586 !! wikitext
7587 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7588 !! html
7589 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7590 </p>
7591 !! end
7592
7593 !! article
7594 prefixed article
7595 !! text
7596 Some text
7597 !! endarticle
7598
7599 !! test
7600 T45661: Piped links with identical prefixes
7601 !! wikitext
7602 [[prefixed article|prefixed articles with spaces]]
7603
7604 [[prefixed article|prefixed articlesaoeu]]
7605
7606 [[Main Page|Main Page test]]
7607 !! html
7608 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7609 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7610 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7611 </p>
7612 !! end
7613
7614
7615 !! test
7616 Link with HTML entity in suffix / tail
7617 !! wikitext
7618 [[Main Page]]&quot;, [[Main Page]]&#97;
7619 !! html/php
7620 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7621 </p>
7622 !! html/parsoid
7623 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7624 !! end
7625
7626 !! test
7627 Link with 3 brackets
7628 !! wikitext
7629 [[[Main Page]]]
7630 Foo [[[Main Page]]]
7631 !! html
7632 <p>[[[Main Page]]]
7633 Foo [[[Main Page]]]
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with 4 brackets
7639 !! wikitext
7640 [[[[Main Page]]]]
7641 !! html
7642 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7643 </p>
7644 !! end
7645
7646 !! test
7647 Piped link with 3 brackets
7648 !! wikitext
7649 [[[main page|the main page]]]
7650 !! html
7651 <p>[[[main page|the main page]]]
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link with extlink-like text
7657 !! wikitext
7658 [[Main Page|[bar]]]
7659 [[Main Page|This is a [bar]]]
7660 [[Main Page|[bar]]
7661 !! html/php
7662 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7663 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7664 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7665 </p>
7666 !! html/parsoid
7667 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7668 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7669 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7670 !! end
7671
7672 !! test
7673 Link with multiple pipes
7674 !! wikitext
7675 [[Main Page|The|Main|Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Anchor containing a #. (T65430)
7683 !! config
7684 wgFragmentMode=[ 'html5', 'legacy' ]
7685 !! wikitext
7686 [[Main Page#And#Link]]
7687 !! html/php
7688 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7689 </p>
7690 !! html/parsoid
7691 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7692 !! end
7693
7694 !! test
7695 Link to namespaces
7696 !! wikitext
7697 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7698 !! html
7699 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Link with space in namespace
7705 !! wikitext
7706 [[User talk:Foo bar]]
7707 !! html
7708 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7709 </p>
7710 !! end
7711
7712 !! article
7713 MemoryAlpha:AlphaTest
7714 !! text
7715 This is an article in the MemoryAlpha namespace
7716 (which shadows the memoryalpha interwiki link).
7717 !! endarticle
7718
7719 !! test
7720 Namespace takes precedence over interwiki link (T53680)
7721 !! wikitext
7722 [[MemoryAlpha:AlphaTest]]
7723 !! html
7724 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7725 </p>
7726 !! end
7727
7728 # The previous test doesn't work correctly in html2*, due to not recognizing the
7729 # link as an internal one. This one checks for the correct behavior.
7730 !! test
7731 Link to namespace preferred over interwiki with correct rel attribute
7732 !! options
7733 parsoid=html2wt,html2html
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7736 !! wikitext
7737 [[MemoryAlpha:AlphaTest]]
7738 !! end
7739
7740 !! test
7741 Piped link to namespace
7742 !! wikitext
7743 [[Meta:Disclaimers|The disclaimers]]
7744 !! html
7745 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7746 </p>
7747 !! end
7748
7749 !! test
7750 Link containing }
7751 !! wikitext
7752 [[Usually caused by a typo (oops}]]
7753 !! html
7754 <p>[[Usually caused by a typo (oops}]]
7755 </p>
7756 !! end
7757
7758 !! article
7759 7% Solution
7760 !! text
7761 Just a test of an article title containing a percent.
7762 !! endarticle
7763
7764 !! test
7765 Link containing % (not as a hex sequence)
7766 !! wikitext
7767 [[7% Solution]]
7768 [[7% Solution|7%25 Solution]]
7769 !! html/php
7770 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7771 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7775 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7776 !! end
7777
7778 # note that the parsoid HTML is identical to the previous test output,
7779 # so the previous test ensures that the html2wt mode will generate the
7780 # "not as a hex sequence" wikitext.
7781 !! test
7782 Link containing % as a single hex sequence interpreted to char
7783 !! options
7784 parsoid=wt2wt,wt2html,html2html
7785 !! wikitext
7786 [[7%25 Solution]]
7787 [[7%25 Solution|7%25 Solution]]
7788 !! html/php
7789 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7790 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7791 </p>
7792 !! html/parsoid
7793 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7794 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7795 !!end
7796
7797 !! test
7798 Link containing % as a double hex sequence interpreted to hex sequence
7799 !! wikitext
7800 [[7%2525 Solution]]
7801 !! html
7802 <p>[[7%2525 Solution]]
7803 </p>
7804 !!end
7805
7806 ## Example for such a section: == < ==
7807 !! test
7808 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7809 !! config
7810 wgFragmentMode=[ 'html5', 'legacy' ]
7811 !! wikitext
7812 [[%23%3c]][[%23%3e]]
7813 !! html/php
7814 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7818 !! end
7819
7820 ## Example for such a section: == < ==
7821 !! test
7822 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7823 !! config
7824 wgFragmentMode=[ 'legacy' ]
7825 !! wikitext
7826 [[%23%3c]][[%23%3e]]
7827 !! html/php
7828 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Link containing "<#" and ">#" as a hex sequences
7834 !! wikitext
7835 [[%3c%23]][[%3e%23]]
7836 !! html
7837 <p>[[%3c%23]][[%3e%23]]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Link containing an equals sign
7843 !! wikitext
7844 [[Special:BookSources/isbn=4-00-026157-6]]
7845 !! html/php
7846 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7847 </p>
7848 !! html/parsoid
7849 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7850 !! end
7851
7852 !! article
7853 Foo~bar
7854 !! text
7855 Just a test of an article title containing a tilde.
7856 !! endarticle
7857
7858 # note that links containing signatures, like [[Foo~~~~]], are
7859 # massaged by the pre-save transform (PST) and so the tildes are never
7860 # seen by the parser.
7861 !! test
7862 Link containing a tilde
7863 !! wikitext
7864 [[Foo~bar]]
7865 !! html/php
7866 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7867 </p>
7868 !! html/parsoid
7869 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' (T6598)
7874 !! wikitext
7875 [[Lista d''e paise d''o munno]]
7876 !! html/php
7877 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
7878 </p>
7879 !! html/parsoid
7880 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7881 !! end
7882
7883 !! test
7884 Link containing double quotes and spaces
7885 !! wikitext
7886 [[Cool "Gator"]]
7887 !! html/php
7888 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7892 !! end
7893
7894 !! test
7895 File containing double quotes and spaces
7896 !! wikitext
7897 [[File:Cool "Gator".png]]
7898 !! html/parsoid
7899 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
7900 !! end
7901
7902 !! test
7903 Redirect containing double quotes and spaces
7904 !! wikitext
7905 #REDIRECT [[Cool "Gator"]]
7906 !! html/parsoid
7907 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7908 !! end
7909
7910 !! test
7911 Link containing double-single-quotes '' in text (T6598 sanity check)
7912 !! wikitext
7913 Some [[Link|pretty ''italics'' and stuff]]!
7914 !! html/php
7915 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7916 </p>
7917 !! html/parsoid
7918 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7919 !! end
7920
7921 !! test
7922 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7923 !! wikitext
7924 ''Some [[Link|pretty ''italics'' and stuff]]!''
7925 !! html
7926 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link with double quotes in title part (literal) and alternate part (interpreted)
7932 !! wikitext
7933 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7934
7935 [[''Pentecoste'']]
7936
7937 [[''Pentecoste''|Pentecoste]]
7938
7939 [[''Pentecoste''|''Pentecoste'']]
7940 !! html/php
7941 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7942 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
7943 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
7944 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
7945 </p>
7946 !! html/parsoid
7947 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
7948 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7949 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7950 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7951 !! end
7952
7953 !! test
7954 Broken image links with HTML captions (T41700)
7955 !! wikitext
7956 [[File:Nonexistent|<script></script>]]
7957 [[File:Nonexistent|100x100px|<script></script>]]
7958 [[File:Nonexistent|&lt;]]
7959 [[File:Nonexistent|a<i>b</i>c]]
7960 !! html/php
7961 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7962 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7963 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7964 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7965 </p>
7966 !! html/parsoid
7967 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7968 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7969 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7970 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
7971 !! end
7972
7973 !! test
7974 Plain link to URL
7975 !! wikitext
7976 [[http://www.example.com]]
7977 !! html/php
7978 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7979 </p>
7980 !! html/parsoid
7981 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
7982 !! end
7983
7984 !! test
7985 Plain link to URL with link text
7986 !! wikitext
7987 [[http://www.example.com Link text]]
7988 !! html
7989 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Plain link to protocol-relative URL
7995 !! wikitext
7996 [[//www.example.com]]
7997 !! html/php
7998 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7999 </p>
8000 !! html/parsoid
8001 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8002 !! end
8003
8004 !! test
8005 Plain link to protocol-relative URL with link text
8006 !! wikitext
8007 [[//www.example.com Link text]]
8008 !! html
8009 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8010 </p>
8011 !! end
8012
8013 !! test
8014 Plain link to page with question mark in title
8015 !! wikitext
8016 [[A?b]]
8017
8018 [[A?b|Baz]]
8019 !! html
8020 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8021 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8022 </p>
8023 !! end
8024
8025 # I'm fairly sure the expected result here is wrong.
8026 # We want these to be URL links, not pseudo-pages with URLs for titles....
8027 # However the current output is also pretty screwy.
8028 #
8029 # ----
8030 # I'm changing it to match the current output--it arguably makes more
8031 # sense in the light of the test above. Old expected result was:
8032 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8033 #</p>
8034 # But I think this test is bordering on "garbage in, garbage out" anyway.
8035 # -- wtm
8036 !! test
8037 Piped link to URL
8038 !! wikitext
8039 Piped link to URL: [[http://www.example.com|an example URL]]
8040 !! html/php
8041 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8042 </p>
8043 !! html/parsoid
8044 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8045 !! end
8046
8047 !! test
8048 Plain link in template argument
8049 !! options
8050 parsoid=wt2html
8051 !! wikitext
8052 {{echo|[http://www.example.com |123]}}
8053
8054 {{echo|[[http://www.example.com |123]]}}
8055
8056 {{echo|[[http://www.example.com |123]}}
8057
8058 {{echo|[http://www.example.com |123]]}}
8059 !! html/php
8060 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8061 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8062 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8063 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8064 </p>
8065 !! html/parsoid
8066 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8067
8068 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8069
8070 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8071
8072 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8073 !! end
8074
8075 !! test
8076 T2002: [[page|http://url/]] should link to page, not http://url/
8077 !! wikitext
8078 [[Main Page|http://url/]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8084 !! end
8085
8086 # Parsoid does not mark self-links, by design.
8087 !! test
8088 T2337: Escaped self-links should be bold
8089 !! options
8090 title=[[Bug462]]
8091 !! wikitext
8092 [[Bu&#103;462]] [[Bug462]]
8093 !! html/php+tidy
8094 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8095 </p>
8096 !! html/parsoid
8097 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8098 !! end
8099
8100 !! test
8101 Self-link to section should not be bold
8102 !! options
8103 title=[[Main Page]]
8104 !! wikitext
8105 [[Main Page#section]]
8106 !! html
8107 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8108 </p>
8109 !! end
8110
8111 !! article
8112 00
8113 !! text
8114 This is 00.
8115 !! endarticle
8116
8117 !!test
8118 Self-link to numeric title
8119 !!options
8120 title=[[0]]
8121 !! wikitext
8122 [[0]]
8123 !! html
8124 <p><a class="mw-selflink selflink">0</a>
8125 </p>
8126 !!end
8127
8128 !!test
8129 Link to numeric-equivalent title
8130 !!options
8131 title=[[0]]
8132 !! wikitext
8133 [[00]]
8134 !! html
8135 <p><a href="/wiki/00" title="00">00</a>
8136 </p>
8137 !!end
8138
8139 !! test
8140 <nowiki> inside a link
8141 !! wikitext
8142 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8143 !! html
8144 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8145 </p>
8146 !! end
8147
8148 !! test
8149 Non-breaking spaces in title
8150 !! wikitext
8151 [[&nbsp; Main &nbsp; Page &nbsp;]]
8152 !! html
8153 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8154 </p>
8155 !!end
8156
8157 # Add new article for the test below so that it doesn't red-link
8158 !! article
8159 Foo bar baz
8160 !! text
8161 boo
8162 !! endarticle
8163
8164 !! test
8165 Multiple spaces in titles should normalize to a single underscore
8166 !! options
8167 parsoid=wt2html,wt2wt
8168 !! wikitext
8169 [[Foo bar baz|x]]
8170 [[Foo bar baz|x]]
8171 [[Foo bar baz|x]]
8172 !! html/php
8173 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8174 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8175 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8179 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8180 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8186 !! options
8187 language=ca
8188 !! wikitext
8189 '''[[Main Page]]'''
8190 !! html
8191 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8197 !! options
8198 language=ca
8199 !! wikitext
8200 ''[[Main Page]]''
8201 !! html
8202 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8203 </p>
8204 !! end
8205
8206 !! test
8207 Internal link with en linktrail: no apostrophes (T29473)
8208 !! options
8209 language=en
8210 !! wikitext
8211 [[Something]]'nice
8212 !! html
8213 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8214 </p>
8215 !! end
8216
8217 !! test
8218 Internal link with ca linktrail with apostrophes (T29473)
8219 !! options
8220 language=ca
8221 !! wikitext
8222 [[Something]]'nice
8223 !! html
8224 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8225 </p>
8226 !! end
8227
8228 !! test
8229 Internal link with kaa linktrail with apostrophes (T29473)
8230 !! options
8231 language=kaa
8232 !! wikitext
8233 [[Something]]'nice
8234 !! html
8235 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Link with multiple ":" in a subpage-supporting namespace (T65636)
8241 !! wikitext
8242 [[User:Foo/Test/63636:Bar|Test]]
8243 !! html/php
8244 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8245 </p>
8246 !! html/parsoid
8247 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8248 !! end
8249
8250 ## Mainly a sanity check for Parsoid
8251 !! test
8252 Handle title parsing for subpages
8253 !! options
8254 title=[[/123123]]
8255 subpage
8256 !! wikitext
8257 123
8258 !! html/php
8259 <p>123
8260 </p>
8261 !! html/parsoid
8262 <p>123</p>
8263 !! end
8264
8265 !! article
8266 User:Test/123
8267 !! text
8268 test 123
8269 !! endarticle
8270
8271 !! test
8272 Link to a subpage from a namespace other than main
8273 !! options
8274 title=[[User:Test]]
8275 subpage
8276 !! wikitext
8277 [[/123]]
8278 !! html/php
8279 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8280 </p>
8281 !! html/parsoid
8282 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8283 !! end
8284
8285 !! test
8286 Ensure that transclusion titles are not url-decoded
8287 !! options
8288 subpage title=[[Test]]
8289 parsoid=wt2html
8290 !! wikitext
8291 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8292 !! html/php
8293 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8294 </p>
8295 !! html/parsoid
8296 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8297 !! end
8298
8299 !! test
8300 Purely hash wikilink
8301 !! options
8302 title=[[User:Test/123]]
8303 subpage
8304 !! wikitext
8305 [[#a|b]]
8306 !! html/php
8307 <p><a href="#a">b</a>
8308 </p>
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8311 !! end
8312
8313 !! test
8314 Serialization of purely hash wikilink
8315 !! options
8316 title=[[User:Test/123]]
8317 subpage
8318 parsoid=html2wt
8319 !! html/parsoid
8320 <p><a href="#a">[[</a></p>
8321 !! wikitext
8322 [[#a|<nowiki>[[</nowiki>]]
8323 !! html/php
8324 <p><a href="#a">[[</a>
8325 </p>
8326 !! end
8327
8328 !! test
8329 1. Interaction of linktrail and template encapsulation
8330 !! wikitext
8331 {{echo|[[Foo]]}}l
8332 !! html/parsoid
8333 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8334 !! end
8335
8336 !! test
8337 2. Interaction of linktrail and template encapsulation
8338 !! options
8339 parsoid
8340 !! wikitext
8341 {{echo|Some [[Fool]]}}s
8342 !! html
8343 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8344 !! end
8345
8346 !! test
8347 3. Interaction of linktrail and template encapsulation
8348 !! options
8349 parsoid
8350 !! wikitext
8351 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8352 !! html
8353 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8354 !! end
8355
8356 !! article
8357 Söfnuður
8358 !! text
8359 Test.
8360 !! endarticle
8361
8362 !! test
8363 Internal link with is link prefix
8364 !! options
8365 language=is
8366 !! wikitext
8367 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8368 !! html
8369 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8370 </p>
8371 !! end
8372
8373 !! article
8374 Mótmælendatrú
8375 !! text
8376 Test.
8377 !! endarticle
8378
8379 !! test
8380 Internal link with is link trail and link prefix
8381 !! options
8382 language=is
8383 !! wikitext
8384 [[mótmælendatrú|xxx]]ar
8385 [[mótmælendatrú]]ar
8386 mótmælenda[[söfnuður]]
8387 mótmælenda[[söfnuður|söfnuðir]]
8388 mótmælenda[[söfnuður|söfnuðir]]xxx
8389 !! html
8390 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8391 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8392 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8393 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8394 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid link trail escaping
8400 !! options
8401 parsoid=html2wt,html2html
8402 !! html/parsoid
8403 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8404 !! wikitext
8405 [[apple]]<nowiki/>s
8406 !! end
8407
8408 !! test
8409 Parsoid link prefix escaping
8410 !! options
8411 language=is
8412 parsoid=html2wt,html2html
8413 !! html/parsoid
8414 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8415 !! wikitext
8416 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8417 !! end
8418
8419 !! test
8420 Parsoid link bracket escaping
8421 !! options
8422 parsoid=html2wt,html2html
8423 !! html/parsoid
8424 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8425 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8426 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8427 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8428 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8429 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8430 !! wikitext
8431 [[Test]]
8432
8433 [<nowiki/>[[Test]]]
8434
8435 [[[[Test]]]]
8436
8437 [[[<nowiki/>[[Test]]]]]
8438
8439 [[[[[[Test]]]]]]
8440
8441 [[[[[<nowiki/>[[Test]]]]]]]
8442 !! end
8443
8444 !! test
8445 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8446 !! wikitext
8447 [[Foo| bar]]
8448
8449 [[Foo| ''bar'']]
8450
8451 [http://wp.org foo]
8452
8453 [http://wp.org ''foo'']
8454 !! html
8455 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8456 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8457 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8458 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8459 </p>
8460 !! end
8461
8462 !! test
8463 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8464 !! wikitext
8465 [[Foo|{{echo|a}} b {{echo|c}}]]
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8468 !! end
8469
8470 !! test
8471 Link with angle bracket after anchor
8472 !! config
8473 wgFragmentMode=[ 'html5', 'legacy' ]
8474 !! wikitext
8475 [[Foo#<bar>]]
8476 !! html/php
8477 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8478 </p>
8479 !! html/parsoid
8480 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8481 !! end
8482
8483 !! test
8484 Link with angle bracket after anchor (legacy)
8485 !! config
8486 wgFragmentMode=[ 'legacy' ]
8487 !! wikitext
8488 [[Foo#<bar>]]
8489 !! html/php
8490 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8491 </p>
8492 !! end
8493
8494 ###
8495 ### Interwiki links (see maintenance/interwiki.sql)
8496 ###
8497
8498 !! test
8499 Inline interwiki link
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[MeatBall:SoftSecurity]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8509 !! end
8510
8511 !! test
8512 Inline interwiki link with empty title (T4372)
8513 !! options
8514 parsoid=wt2html,wt2wt,html2html
8515 !! wikitext
8516 [[MeatBall:]]
8517 !! html/php
8518 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8522 !! end
8523
8524 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8525 !! test
8526 Interwiki link encoding conversion (T3636)
8527 !! options
8528 parsoid=wt2html,wt2wt
8529 !! wikitext
8530 *[[Wikipedia:ro:Olteni&#0355;a]]
8531 *[[Wikipedia:ro:Olteni&#355;a]]
8532 !! html
8533 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8534 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8535
8536 !! html/php+tidy
8537 <ul>
8538 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8539 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8540 </ul>
8541 !! html/parsoid
8542 <ul>
8543 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8544 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8545 </ul>
8546 !! end
8547
8548 !! test
8549 Interwiki link with fragment (T4130)
8550 !! wikitext
8551 [[MeatBall:SoftSecurity#foo]]
8552 !! html
8553 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8554 </p>
8555 !! end
8556
8557 !! test
8558 Link scenarios with escaped fragments
8559 !! config
8560 wgFragmentMode=[ 'html5', 'legacy' ]
8561 !! wikitext
8562 [[#Is this great?]]
8563 [[Foo#Is this great?]]
8564 [[meatball:Foo#Is this great?]]
8565 !! html/php
8566 <p><a href="#Is_this_great?">#Is this great?</a>
8567 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8568 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8572 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8573 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8574 !! end
8575
8576 !! test
8577 Link scenarios with escaped fragments (legacy)
8578 !! config
8579 wgFragmentMode=[ 'legacy' ]
8580 !! wikitext
8581 [[#Is this great?]]
8582 [[Foo#Is this great?]]
8583 [[meatball:Foo#Is this great?]]
8584 !! html/php
8585 <p><a href="#Is_this_great.3F">#Is this great?</a>
8586 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8587 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8588 </p>
8589 !! end
8590
8591 # Ideally the wikipedia: prefix here should be proto-relative too
8592 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8593 # define the 'en' prefix, and originally the test used 'wikipedia',
8594 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8595 # article.
8596 !! test
8597 Different interwiki prefixes mapping to the same URL
8598 !! wikitext
8599 [[:en:Foo]]
8600
8601 [[:en:Foo|Foo]]
8602
8603 [[wikipedia:Foo]]
8604
8605 [[:wikipedia:Foo|Foo]]
8606
8607 [[wikipedia:en:Foo]]
8608
8609 [[:wikipedia:en:Foo]]
8610
8611 [[ wikiPEdia :Foo]]
8612 !! html/parsoid
8613 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8614
8615 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8616
8617 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8618
8619 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8620
8621 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8622
8623 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8624
8625 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8626 !! end
8627
8628 !! test
8629 Interwiki links that cannot be represented in wiki syntax
8630 !! wikitext
8631 [[meatball:ok]]
8632 [[meatball:ok#foo|ok with fragment]]
8633 [[meatball:ok_as_well?|ok ending with ? mark]]
8634 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8635 [http://de.wikipedia.org/wiki/#foo is just fragment]
8636
8637 !! html/php
8638 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8639 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8640 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8641 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8642 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8643 </p>
8644 !! html/parsoid
8645 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8646 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8647 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8648 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8649 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8650 !! end
8651
8652 !! test
8653 Interwiki links: trail
8654 !! wikitext
8655 [[wikipedia:Foo|Ba]]r
8656 !! html/php
8657 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8658 </p>
8659 !! html/parsoid
8660 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8661 !! end
8662
8663 !! test
8664 Local interwiki link
8665 !! options
8666 parsoid=wt2html,wt2wt,html2html
8667 !! wikitext
8668 [[local:Template:Foo]]
8669 !! html/php
8670 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8671 </p>
8672 !! html/parsoid
8673 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8674 !! end
8675
8676 # Parsoid does not mark self-links, by design.
8677 !! test
8678 Local interwiki link: self-link to current page
8679 !! options
8680 title=[[Main Page]]
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 [[local:Main Page]]
8684 !! html/php
8685 <p><a class="mw-selflink selflink">local:Main Page</a>
8686 </p>
8687 !! html/parsoid
8688 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8689 !! end
8690
8691 !! test
8692 Local interwiki link: prefix only (T66167)
8693 !! options
8694 parsoid=wt2html,wt2wt,html2html
8695 !! wikitext
8696 [[local:]]
8697 !! html/php
8698 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8699 </p>
8700 !! html/parsoid
8701 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8702 !! end
8703
8704 !! test
8705 Local interwiki link: with additional interwiki prefix (T63357)
8706 !! options
8707 parsoid=wt2html,wt2wt,html2html
8708 !! wikitext
8709 [[local:meatball:Hello]]
8710 !! html/php
8711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8712 </p>
8713 !! html/parsoid
8714 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8715 !! end
8716
8717 !! test
8718 Multiple local interwiki link prefixes
8719 !! wikitext
8720 [[local:local:local:local:mi:local:Foo]]
8721 !! options
8722 parsoid=wt2html,wt2wt,html2html
8723 !! html/php
8724 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8725 </p>
8726 !! html/parsoid
8727 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8728 !! end
8729
8730 ###
8731 ### Interlanguage links
8732 ### Language links (so that searching for '### language' matches..)
8733 ###
8734
8735 !! test
8736 Interlanguage link
8737 !! wikitext
8738 Blah blah blah
8739 [[zh:Chinese]]
8740 !! html/php
8741 <p>Blah blah blah
8742 </p>
8743 !! html/parsoid
8744 <p>Blah blah blah</p>
8745 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8746 !! end
8747
8748 ## parsoid html2wt will lose the space variations
8749 !! test
8750 Interlanguage link with spacing
8751 !! options
8752 parsoid=wt2html,wt2wt,html2html
8753 !! wikitext
8754 Blah blah blah
8755 [[ zh : Chinese ]]
8756 !! html/php
8757 <p>Blah blah blah
8758 </p>
8759 !! html/parsoid
8760 <p>Blah blah blah</p>
8761 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8762 !! end
8763
8764 !! test
8765 Double interlanguage link
8766 !! wikitext
8767 Blah blah blah
8768 [[es:Spanish]]
8769 [[zh:Chinese]]
8770 !! html/php
8771 <p>Blah blah blah
8772 </p>
8773 !! html/parsoid
8774 <p>Blah blah blah</p>
8775 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8776 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8777 !! end
8778
8779 ## parsoid html2wt will lose the space variations
8780 !! test
8781 Interlanguage link variations
8782 !! options
8783 parsoid=wt2html,wt2wt,html2html
8784 !! wikitext
8785 Blah blah blah
8786 [[ es :Spanish]]
8787 [[ ZH :Chinese]]
8788 [[es:Foo_bar]]
8789 !! html/php
8790 <p>Blah blah blah
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah</p>
8794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8797 !! end
8798
8799 !! test
8800 Escaping of interlanguage links (T129218, T156308)
8801 !! wikitext
8802 Blah blah blah
8803 [[:es:Spanish]]
8804 [[ : zh : Chinese ]]
8805 !! html/php
8806 <p>Blah blah blah
8807 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8808 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8809 </p>
8810 !! html/parsoid
8811 <p>Blah blah blah
8812 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8813 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8814 !! end
8815
8816 !! test
8817 Multiple colons escaping interlanguage links
8818 !! options
8819 parsoid=wt2html
8820 !! wikitext
8821 [[:es:Spanish]]
8822 [[::es:Spanish]]
8823 [[:::es:Spanish]]
8824 !! html/php
8825 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8826 [[::es:Spanish]]
8827 [[:::es:Spanish]]
8828 </p>
8829 !! html/parsoid
8830 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8831 [[::es:Spanish]]
8832 [[:::es:Spanish]]</p>
8833 !! end
8834
8835 ## parsoid html2wt will normalize the space to _
8836 !! test
8837 Space and question mark encoding in interlanguage links (T95473)
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 Blah blah blah
8842 [[es:Foo bar?]]
8843 !! html/php
8844 <p>Blah blah blah
8845 </p>
8846 !! html/parsoid
8847 <p>Blah blah blah</p>
8848 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8849 !! end
8850
8851 !! test
8852 Interlanguage link, with prefix links
8853 !! options
8854 language=ln
8855 !! wikitext
8856 Blah blah blah
8857 [[zh:Chinese]]
8858 !! html/php
8859 <p>Blah blah blah
8860 </p>
8861 !! html/parsoid
8862 <p>Blah blah blah</p>
8863 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8864 !! end
8865
8866 !! test
8867 Double interlanguage link, with prefix links (T10897)
8868 !! options
8869 language=ln
8870 !! wikitext
8871 Blah blah blah
8872 [[es:Spanish]]
8873 [[zh:Chinese]]
8874 !! html/php
8875 <p>Blah blah blah
8876 </p>
8877 !! html/parsoid
8878 <p>Blah blah blah</p>
8879 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8880 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8881 !! end
8882
8883 !! test
8884 "Extra" interlanguage links (T34189 / gerrit 111390)
8885 !! wikitext
8886 Blah blah blah
8887 [[mul:Article]]
8888 !! html/php
8889 <p>Blah blah blah
8890 </p>
8891 !! html/parsoid
8892 <p>Blah blah blah</p>
8893 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8894 !! end
8895
8896 ## PHP parser tests script needs an update
8897 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8898 !! test
8899 Language links render as inline links if $wgInterwikiMagic=false
8900 !! options
8901 wgInterwikiMagic=false
8902 parsoid=wt2html,wt2wt,html2html
8903 !! wikitext
8904 Blah blah blah
8905 [[zh:Chinese]]
8906 !! html/parsoid
8907 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8908 !! end
8909
8910 ## PHP parser tests script needs an update
8911 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8912 !! test
8913 Language links render as inline links in the Talk namespace
8914 !! options
8915 title=Talk:Foo
8916 parsoid=wt2html,wt2wt,html2html
8917 !! wikitext
8918 Blah blah blah
8919 [[zh:Chinese]]
8920 !! html/parsoid
8921 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8922 !! end
8923
8924 !! test
8925 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8926 !! options
8927 language=ln
8928 !! wikitext
8929 [[WW&nbsp;II]]
8930 !! html
8931 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8932 </p>
8933 !! end
8934
8935 !! test
8936 Parsoid T55221: Wikilinks should be properly entity-escaped
8937 !! options
8938 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8939 !! html/parsoid
8940 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8941 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8942 !! wikitext
8943 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8944
8945 He&amp;nbsp;llo He&amp;nbsp;llo
8946 !! html/php
8947 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8948 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8949 </p>
8950 !! end
8951
8952 # html2wt will fail because of title normalization without data-parsoid
8953 !! test
8954 Parsoid: handle constructor well
8955 !! options
8956 parsoid=wt2html,wt2wt
8957 !! wikitext
8958 [[constructor]]
8959
8960 [[constructor:foo]]
8961 !! html/php
8962 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8963 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8964 </p>
8965 !! html/parsoid
8966 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8967
8968 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8969 !! end
8970
8971 !! article
8972 ko:
8973 !! text
8974 Test.
8975 !! endarticle
8976
8977 # Note that `ko` isn't a known interlanguage prefix
8978 !! test
8979 Parsoid: recognize interlanguage links without a target page
8980 !! options
8981 ill
8982 !! wikitext
8983 [[es:]]
8984
8985 [[ko:]]
8986 !! html/php
8987 es:
8988 !! html/parsoid
8989 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8990
8991 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8992 !! end
8993
8994 # Note that `ko` isn't a known interwiki prefix
8995 !! test
8996 Parsoid: recognize interwiki links without a target page
8997 !! options
8998 parsoid=wt2html,wt2wt,html2html
8999 !! wikitext
9000 [[:es:]]
9001
9002 [[:ko:]]
9003 !! html/php
9004 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9005 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9006 </p>
9007 !! html/parsoid
9008 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9009 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9010 !! end
9011
9012 !! test
9013 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9014 !! wikitext
9015 [[mi:Foo]]
9016 !! html/php
9017 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9018 </p>
9019 !! html/parsoid
9020 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9021 !! end
9022
9023 !! test
9024 Interlanguage link with preceding local interwiki link (T70085)
9025 !! options
9026 parsoid=wt2html,wt2wt,html2html
9027 !! wikitext
9028 Blah blah blah
9029 [[local:es:Spanish]]
9030 !! html/php
9031 <p>Blah blah blah
9032 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9033 </p>
9034 !! html/parsoid
9035 <p>Blah blah blah
9036 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9037 !! end
9038
9039 !! test
9040 Looks like an interlanguage link, but is actually a local interwiki
9041 !! options
9042 parsoid=wt2html,wt2wt,html2html
9043 !! wikitext
9044 Blah blah blah
9045 [[mi:Template:Foo]]
9046 !! html/php
9047 <p>Blah blah blah
9048 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9049 </p>
9050 !! html/parsoid
9051 <p>Blah blah blah
9052 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9053 !! end
9054
9055 ###
9056 ### Redirects, Parsoid-only
9057 ###
9058
9059 !! test
9060 1. Simple redirect to page
9061 !! wikitext
9062 #REDIRECT [[Main Page]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9065 !! end
9066
9067 !! test
9068 2. Other redirect variants
9069 !! wikitext
9070 #REDIRECT [[Main_Page]]
9071 !! html/parsoid
9072 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9073 !! end
9074
9075 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9076 # This tests the Parsoid bail-out code.
9077 !! test
9078 3. Other redirect variants
9079 !! options
9080 parsoid=wt2html
9081 !! wikitext
9082 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9083 !! html/parsoid
9084 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9085 !! end
9086
9087 !! test
9088 4. Redirect to a templated destination
9089 !! wikitext
9090 #REDIRECT [[{{echo|Foo}}bar]]
9091 !! html/parsoid
9092 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9093 !! end
9094
9095 !! test
9096 Empty redirect
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 #REDIRECT [[]]
9101 !! html/parsoid
9102 <ol>
9103 <li>REDIRECT [[]]</li></ol>
9104 !! end
9105
9106 !! test
9107 Optional colon in #REDIRECT
9108 !! options
9109 # the colon is archaic syntax. we support it for wt2html, but we
9110 # don't care that it roundtrips back to the modern syntax.
9111 parsoid=wt2html,html2html
9112 !! wikitext
9113 #REDIRECT:[[Main Page]]
9114 !! html/parsoid
9115 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9116 !! end
9117
9118 !! test
9119 Whitespace in #REDIRECT with optional colon
9120 !! options
9121 # the colon and gratuitous whitespace is archaic syntax. we support
9122 # it for wt2html, but we don't care that it roundtrips back to the
9123 # modern syntax (without extra whitespace)
9124 parsoid=wt2html,html2html
9125 !! wikitext
9126
9127 #REDIRECT
9128 :
9129 [[Main Page]]
9130 !! html/parsoid
9131 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9132 !! end
9133
9134 !! test
9135 Piped link in #REDIRECT
9136 !! options
9137 # content after piped link is ignored. we support this syntax,
9138 # but don't care that the piped link is lost when we roundtrip this.
9139 parsoid=wt2html
9140 !! wikitext
9141 #REDIRECT [[Main Page|bar]]
9142 !! html/parsoid
9143 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9144 !! end
9145
9146 !! test
9147 Redirect to category (T104502)
9148 !! options
9149 parsoid=wt2html,wt2wt
9150 !! wikitext
9151 #REDIRECT [[Category:Foo]]
9152 !! html/parsoid
9153 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9154 !! end
9155
9156 !! test
9157 Redirect to category with URL encoding (T104502)
9158 !! options
9159 parsoid=wt2html
9160 !! wikitext
9161 #REDIRECT [[Category%3AFoo]]
9162 !! html/parsoid
9163 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9164 !! end
9165
9166 !! test
9167 Redirect to category page
9168 !! wikitext
9169 #REDIRECT [[:Category:Foo]]
9170 !! html/parsoid
9171 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9172 !! end
9173
9174 !! test
9175 Redirect to image page (1)
9176 !! wikitext
9177 #REDIRECT [[File:Wiki.png]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9180 !! end
9181
9182 !! test
9183 Redirect to image page (2)
9184 !! wikitext
9185 #REDIRECT [[Image:Wiki.png]]
9186 !! html/parsoid
9187 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9188 !! end
9189
9190 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9191 # Next test confirms this.
9192 !! test
9193 Redirect to language (1) (T104918)
9194 !! options
9195 parsoid=wt2html,wt2wt,html2html
9196 !! wikitext
9197 #REDIRECT [[en:File:Wiki.png]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9200 !! end
9201
9202 !! test
9203 Redirect to language (2) (T104918)
9204 !! wikitext
9205 #REDIRECT [[:en:File:Wiki.png]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9208 !! end
9209
9210 !! test
9211 Redirect to interwiki (T104918)
9212 !! wikitext
9213 #REDIRECT [[meatball:File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Non-English #REDIRECT
9220 !! options
9221 language=is
9222 !! wikitext
9223 #TILVÍSUN [[Main Page]]
9224 !! html/parsoid
9225 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9226 !! end
9227
9228 !! test
9229 Redirect syntax under text isn't considered a redirect
9230 !! wikitext
9231 some text
9232 #redirect [[Main Page]]
9233 !! html/parsoid
9234 <p>some text</p>
9235 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9236 !! end
9237
9238 !! test
9239 New redirect
9240 !! options
9241 parsoid=html2wt
9242 !! html/parsoid
9243 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9244 !! wikitext
9245 #REDIRECT [[Foo]]
9246 Foo
9247 !! end
9248
9249 !! test
9250 Redirect followed by block on the same line
9251 !! options
9252 parsoid=wt2html
9253 !! wikitext
9254 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9257 !! end
9258
9259 !! test
9260 Redirect followed by a newline
9261 !! wikitext
9262 #REDIRECT [[Main Page]]
9263 A newline
9264 !! html/parsoid
9265 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9266 <p>A newline</p>
9267 !! end
9268
9269 !! test
9270 Redirect followed by multiple newlines
9271 !! wikitext
9272 #REDIRECT [[Main Page]]
9273
9274
9275 A newline
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9278
9279 <p><br/>
9280 A newline</p>
9281 !! end
9282
9283 !! test
9284 Drop duplicate redirects
9285 !! options
9286 parsoid=html2wt
9287 !! html/parsoid
9288 <link rel="mw:PageProp/redirect" href="./Foo"/>
9289 <link rel="mw:PageProp/redirect" href="./Bar"/>
9290 <link rel="mw:PageProp/redirect" href="./Baz"/>
9291 !! wikitext
9292 #REDIRECT [[Foo]]
9293 !! end
9294
9295 ##
9296 ## XHTML tidiness
9297 ###
9298
9299 !! test
9300 <br> to <br />
9301 !! wikitext
9302 1<br>2<br />3
9303 !! html
9304 <p>1<br />2<br />3
9305 </p>
9306 !! end
9307
9308 !! test
9309 Broken br tag sanitization
9310 !! wikitext
9311 </br>
9312 !! html/php
9313 <p>&lt;/br&gt;
9314 </p>
9315 !! end
9316
9317 # TODO: Fix html2html mode (T53055)!
9318 !! test
9319 Parsoid: Broken br tag recognition
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 </br>
9324
9325 <br/ >
9326 !! html+tidy
9327 <p><br />
9328 </p><p><br />
9329 </p>
9330 !! end
9331
9332 !! test
9333 Incorrecly removing closing slashes from correctly formed XHTML
9334 !! wikitext
9335 <br style="clear:both;" />
9336 !! html
9337 <p><br style="clear:both;" />
9338 </p>
9339 !! end
9340
9341 !! test
9342 Failing to transform badly formed HTML into correct XHTML
9343 !! wikitext
9344 <br style="clear: left;">
9345 <br style="clear: right;">
9346 <br style="clear: both;">
9347 !! html
9348 <p><br style="clear: left;" />
9349 <br style="clear: right;" />
9350 <br style="clear: both;" />
9351 </p>
9352 !!end
9353
9354 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9355 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9356 !! test
9357 Handling html with a div self-closing tag
9358 !! wikitext
9359 <div title />
9360 <div title/>
9361 <div title/ >
9362 <div title=bar />
9363 <div title=bar/>
9364 <div title=bar/ >
9365 !! html/php
9366 <p>&lt;div title /&gt;
9367 &lt;div title/&gt;
9368 </p>
9369 <div>
9370 <p>&lt;div title=bar /&gt;
9371 &lt;div title=bar/&gt;
9372 </p>
9373 <div title="bar/"></div>
9374 </div>
9375
9376 !! html/parsoid
9377 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9378 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9379 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9380 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9381 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9382 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9383 !! end
9384
9385 !! test
9386 Handling html with a br self-closing tag
9387 !! wikitext
9388 <br title />
9389 <br title/>
9390 <br title/ >
9391 <br title=bar />
9392 <br title=bar/>
9393 <br title=bar/ >
9394 !! html/php
9395 <p><br title="" />
9396 <br title="" />
9397 <br />
9398 <br title="bar" />
9399 <br title="bar" />
9400 <br title="bar/" />
9401 </p>
9402 !! html/parsoid
9403 <p><br title="" />
9404 <br title="" />
9405 <br title="" />
9406 <br title="bar" />
9407 <br title="bar" />
9408 <br title="bar/" />
9409 </p>
9410 !! end
9411
9412 !! test
9413 Horizontal ruler (should it add that extra space?)
9414 !! wikitext
9415 <hr>
9416 <hr >
9417 foo <hr
9418 > bar
9419 !! html+tidy
9420 <hr />
9421 <hr /><p>
9422 foo </p><hr /><p> bar
9423 </p>
9424 !! end
9425
9426 !! test
9427 Horizontal ruler -- 4+ dashes render hr
9428 !! wikitext
9429 ----
9430 !! html
9431 <hr />
9432
9433 !! end
9434
9435 !! test
9436 Horizontal ruler -- eats additional dashes on the same line
9437 !! wikitext
9438 ---------
9439 !! html
9440 <hr />
9441
9442 !! end
9443
9444 !! test
9445 Horizontal ruler -- does not collapse dashes on consecutive lines
9446 !! wikitext
9447 ----
9448 ----
9449 !! html
9450 <hr />
9451 <hr />
9452
9453 !! end
9454
9455 !! test
9456 Horizontal ruler -- <4 dashes render as plain text
9457 !! wikitext
9458 ---
9459 !! html
9460 <p>---
9461 </p>
9462 !! end
9463
9464 !! test
9465 Horizontal ruler -- Supports content following dashes on same line
9466 !! wikitext
9467 ---- Foo
9468 !! html
9469 <hr /> Foo
9470
9471 !! html+tidy
9472 <hr /><p> Foo
9473 </p>
9474 !! end
9475
9476 ###
9477 ### Block-level elements
9478 ###
9479 !! test
9480 Common list
9481 !! wikitext
9482 *Common list
9483 *item 2
9484 *item 3
9485 !! html
9486 <ul><li>Common list</li>
9487 <li>item 2</li>
9488 <li>item 3</li></ul>
9489
9490 !! end
9491
9492 !! test
9493 Numbered list
9494 !! wikitext
9495 #Numbered list
9496 #item 2
9497 #item 3
9498 !! html
9499 <ol><li>Numbered list</li>
9500 <li>item 2</li>
9501 <li>item 3</li></ol>
9502
9503 !! end
9504
9505 !! test
9506 Mixed list
9507 !! wikitext
9508 *Mixed list
9509 *#with numbers
9510 **and bullets
9511 *#and numbers
9512 *bullets again
9513 **bullet level 2
9514 ***bullet level 3
9515 ***#Number on level 4
9516 **bullet level 2
9517 **#Number on level 3
9518 **#Number on level 3
9519 *#number level 2
9520 *Level 1
9521 ***Level 3
9522 #**Level 3, but ordered
9523 !! html
9524 <ul><li>Mixed list
9525 <ol><li>with numbers</li></ol>
9526 <ul><li>and bullets</li></ul>
9527 <ol><li>and numbers</li></ol></li>
9528 <li>bullets again
9529 <ul><li>bullet level 2
9530 <ul><li>bullet level 3
9531 <ol><li>Number on level 4</li></ol></li></ul></li>
9532 <li>bullet level 2
9533 <ol><li>Number on level 3</li>
9534 <li>Number on level 3</li></ol></li></ul>
9535 <ol><li>number level 2</li></ol></li>
9536 <li>Level 1
9537 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9538 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9539
9540 !! end
9541
9542 !! test
9543 1. Nested mixed wikitext and html list
9544 !! wikitext
9545 *hi
9546 *<ul><li>ho</li></ul>
9547 *hi
9548 **ho
9549 !! html/php
9550 <ul><li>hi</li>
9551 <li><ul><li>ho</li></ul></li>
9552 <li>hi
9553 <ul><li>ho</li></ul></li></ul>
9554
9555 !! html/parsoid
9556 <ul><li>hi</li>
9557 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9558 <li>hi
9559 <ul><li>ho</li></ul></li></ul>
9560 !! end
9561
9562 !! test
9563 2. Nested mixed wikitext and html list (incompatible)
9564 !! wikitext
9565 ;hi
9566 :{{echo|<li>ho</li>}}
9567 !! html/php
9568 <dl><dt>hi</dt>
9569 <dd><li>ho</li></dd></dl>
9570
9571 !! html/parsoid
9572 <dl><dt>hi</dt>
9573 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9574 !! end
9575
9576 !! test
9577 Nested lists 1
9578 !! wikitext
9579 *foo
9580 **bar
9581 !! html
9582 <ul><li>foo
9583 <ul><li>bar</li></ul></li></ul>
9584
9585 !! end
9586
9587 !! test
9588 Nested lists 2
9589 !! wikitext
9590 **foo
9591 *bar
9592 !! html
9593 <ul><li><ul><li>foo</li></ul></li>
9594 <li>bar</li></ul>
9595
9596 !! end
9597
9598 !! test
9599 Nested lists 3 (first element empty)
9600 !! wikitext
9601 *
9602 **bar
9603 !! html
9604 <ul><li>
9605 <ul><li>bar</li></ul></li></ul>
9606
9607 !! end
9608
9609 !! test
9610 Nested lists 4 (first element empty)
9611 !! wikitext
9612 **
9613 *bar
9614 !! html
9615 <ul><li><ul><li></li></ul></li>
9616 <li>bar</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 Nested lists 5 (both elements empty)
9622 !! wikitext
9623 **
9624 *
9625 !! html
9626 <ul><li><ul><li></li></ul></li>
9627 <li></li></ul>
9628
9629 !! end
9630
9631 !! test
9632 Nested lists 6 (both elements empty)
9633 !! wikitext
9634 *
9635 **
9636 !! html
9637 <ul><li>
9638 <ul><li></li></ul></li></ul>
9639
9640 !! end
9641
9642 !! test
9643 Nested lists 7 (skip initial nesting levels)
9644 !! wikitext
9645 ***foo
9646 !! html
9647 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9648
9649 !! end
9650
9651 !! test
9652 Nested lists 8 (multiple nesting transitions)
9653 !! wikitext
9654 *foo
9655 ***bar
9656 **baz
9657 *boo
9658 !! html
9659 <ul><li>foo
9660 <ul><li><ul><li>bar</li></ul></li>
9661 <li>baz</li></ul></li>
9662 <li>boo</li></ul>
9663
9664 !! end
9665
9666 !! test
9667 Nested lists 9 (extension interaction)
9668 !! options
9669 parsoid
9670 !! wikitext
9671 *<references />
9672 !! html/parsoid
9673 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9674 !! end
9675
9676 !! test
9677 1. Lists with start-of-line-transparent tokens before bullets: Comments
9678 !! wikitext
9679 *foo
9680 *<!--cmt-->bar
9681 <!--cmt-->*baz
9682 !! html
9683 <ul><li>foo</li>
9684 <li>bar</li>
9685 <li>baz</li></ul>
9686
9687 !! end
9688
9689 !! test
9690 2. Lists with start-of-line-transparent tokens before bullets: Template close
9691 !! wikitext
9692 *foo {{echo|bar
9693 }}*baz
9694 !! html
9695 <ul><li>foo bar</li>
9696 <li>baz</li></ul>
9697
9698 !! end
9699
9700 !! test
9701 List items are not parsed correctly following a <pre> block (T2785)
9702 !! wikitext
9703 *<pre>foo</pre>
9704 *<pre>bar</pre>
9705 *zar
9706 !! html/php
9707 <ul><li><pre>foo</pre></li>
9708 <li><pre>bar</pre></li>
9709 <li>zar</li></ul>
9710
9711 !! html/parsoid
9712 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9713 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9714 <li>zar</li></ul>
9715 !! end
9716
9717 # FIXME: Might benefit from a html/parsoid since this has a template
9718 !! test
9719 List items from template
9720 !! wikitext
9721
9722 {{inner list}}
9723 *item 2
9724
9725 *item 0
9726 {{inner list}}
9727 *item 2
9728
9729 *item 0
9730 *notSOL{{inner list}}
9731 *item 2
9732 !! html
9733 <ul><li>item 1</li>
9734 <li>item 2</li></ul>
9735 <ul><li>item 0</li>
9736 <li>item 1</li>
9737 <li>item 2</li></ul>
9738 <ul><li>item 0</li>
9739 <li>notSOL</li>
9740 <li>item 1</li>
9741 <li>item 2</li></ul>
9742
9743 !! end
9744
9745 !! test
9746 List interrupted by empty line or heading
9747 !! wikitext
9748 *foo
9749
9750 **bar
9751 ==A heading==
9752 *Another list item
9753 !! html
9754 <ul><li>foo</li></ul>
9755 <ul><li><ul><li>bar</li></ul></li></ul>
9756 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9757 <ul><li>Another list item</li></ul>
9758
9759 !!end
9760
9761 !!test
9762 Multiple list tags generated by templates
9763 !! wikitext
9764 {{echo|<li>}}a
9765 {{echo|<li>}}b
9766 {{echo|<li>}}c
9767 !! html
9768 <li>a
9769 <li>b
9770 <li>c</li>
9771 </li>
9772 </li>
9773
9774 !! html+tidy
9775 <li>a
9776 </li><li>b
9777 </li><li>c
9778 </li>
9779 !! html/parsoid
9780 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9781 </li><li about="#mwt1">b
9782 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9783 !!end
9784
9785 !!test
9786 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9787 !! wikitext
9788 *a
9789 <!--This line will NOT split the list-->
9790 *b
9791 <!--This line will NOT split the list either-->
9792 *c
9793 <!--foo--> <!----> <!--This line NOT split the list either-->
9794 *d
9795 !! html
9796 <ul><li>a</li>
9797 <li>b</li>
9798 <li>c</li>
9799 <li>d</li></ul>
9800
9801 !!end
9802
9803 !!test
9804 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9805 !! wikitext
9806 *a
9807 <!--This line will NOT split the list-->
9808 *b
9809 <!--This line will NOT split the list either-->
9810 *c
9811 <!--foo--> <!----> <!--This line NOT split the list
9812 either-->
9813 *d
9814 !! html
9815 <ul><li>a</li>
9816 <li>b</li>
9817 <li>c</li>
9818 <li>d</li></ul>
9819
9820 !!end
9821
9822 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9823 # That pass could possibly be removed.
9824 !!test
9825 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9826 !!options
9827 parsoid=wt2html,wt2wt
9828 !! wikitext
9829 *foo
9830 *<li>li-hack
9831 *{{echo|<li>templated li-hack}}
9832 *<!--foo--><li> unsupported li-hack with preceding comments
9833
9834 <ul>
9835 <li><li>not a li-hack
9836 </li>
9837 </ul>
9838 !! html+tidy
9839 <ul><li>foo</li>
9840 <li class="mw-empty-elt"></li><li>li-hack</li>
9841 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9842 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9843 <ul>
9844 <li class="mw-empty-elt"></li><li>not a li-hack
9845 </li>
9846 </ul>
9847 !! html/parsoid
9848 <ul><li> foo</li>
9849 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9850 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
9851 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9852
9853 <ul data-parsoid='{"stx":"html"}'>
9854 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9855 </li>
9856 </ul>
9857
9858 !!end
9859
9860 !! test
9861 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9862 !! options
9863 parsoid
9864 !! wikitext
9865 #foo
9866 ##bar
9867 *foo
9868 **bar
9869 :foo
9870 ::bar
9871 !! html
9872 <ol>
9873 <li>foo<ol>
9874 <li>bar</li>
9875 </ol></li>
9876 </ol><ul>
9877 <li>foo<ul>
9878 <li>bar</li>
9879 </ul></li>
9880 </ul><dl>
9881 <dd>foo<dl>
9882 <dd>bar</dd>
9883 </dl></dd>
9884 </dl>
9885 !! end
9886
9887 !! test
9888 Parsoid: Test of whitespace serialization with Templated bullets
9889 !! options
9890 parsoid
9891 !! wikitext
9892 * {{bullet}}
9893 !! html/parsoid
9894 <ul>
9895 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9896 </ul>
9897 !! end
9898
9899 # ------------------------------------------------------------------------
9900 # The next set of tests are about Parsoid's ability to handle badly nested
9901 # tags (parse, minimize scope of fixup, and roundtrip back)
9902 # ------------------------------------------------------------------------
9903
9904 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9905 # Parsoid's list handling is more aware of block structure.
9906 !! test
9907 Unbalanced closing block tags break a list
9908 !! wikitext
9909 <div>
9910 *a</div><div>
9911 *b</div>
9912 !! html+tidy
9913 <div>
9914 <ul><li>a</li></ul></div><div>
9915 <li>b</li></div>
9916 !! html/parsoid
9917 <div><ul>
9918 <li>a</li>
9919 </ul></div>
9920 <div><ul>
9921 <li>b</li>
9922 </ul></div>
9923 !! end
9924
9925 !! test
9926 Unbalanced closing non-block tags don't break a list
9927 !! wikitext
9928 <span>
9929 *a</span><span>
9930 *b</span>
9931 !! html/php+tidy
9932 <p><span>
9933 </span></p>
9934 <ul><li>a<span></span></li>
9935 <li>b</li></ul>
9936 !! html/parsoid
9937 <span>
9938 <ul>
9939 <li>a<span></span></li>
9940 <li>b</li>
9941 </ul>
9942 </span>
9943 !! end
9944
9945 # Parsoid does some post-dom-building cleanup
9946 # which is why its output differs from Remex.
9947 !! test
9948 Unclosed formatting tags that straddle lists are closed and reopened
9949 !! options
9950 parsoid=wt2html,wt2wt,html2html
9951 !! wikitext
9952 #<s> a
9953 #b </s>
9954 !! html/php+tidy
9955 <ol><li><s> a</s></li><s>
9956 </s><li><s>b </s></li></ol>
9957 !! html/parsoid
9958 <ol><li><s> a</s></li>
9959 <li><s>b </s></li></ol>
9960 !! end
9961
9962 # Output is ugly because of all the misnested tag fixups.
9963 # Remex is wrapping p-tags around empty elements.
9964 # Parsoid has special-case handling of this pattern of
9965 # wrapping lists in formatting tags.
9966 # FIXME: Should we remove this code from Parsoid? Or add
9967 # special support in Remex? If the latter, maybe just wait
9968 # for Parsoid to become the default parser.
9969 # See T70395.
9970 !!test
9971 1. List embedded in a formatting tag
9972 !! wikitext
9973 <small>
9974 *foo
9975 </small>
9976 !! html/php+tidy
9977 <p><small>
9978 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
9979 </p>
9980 !! html/parsoid
9981 <small>
9982 <ul>
9983 <li>foo</li>
9984 </ul>
9985 </small>
9986 !!end
9987
9988 # Output is ugly because of all the misnested tag fixups
9989 # Remex is wrapping p-tags around empty elements.
9990 # Parsoid has code that strips useless p-tags.
9991 !!test
9992 2. List embedded in a formatting tag in a misnested way
9993 !! wikitext
9994 <small>
9995 *a
9996 *b</small>
9997 !! html/php+tidy
9998 <p><small>
9999 </small></p><small></small><ul><small><li>a</li>
10000 </small><li><small>b</small></li></ul>
10001 !! html/parsoid
10002 <small></small>
10003 <ul><small>
10004 <li>a</li>
10005 </small>
10006 <li><small>b</small></li>
10007 </ul>
10008 !!end
10009
10010 !! test
10011 Table with missing opening <tr> tag
10012 !! options
10013 parsoid=wt2html,wt2wt
10014 !! wikitext
10015 <table>
10016 <td>foo</td>
10017 </tr>
10018 </table>
10019 !! html+tidy
10020 <table>
10021 <tbody><tr><td>foo</td>
10022 </tr>
10023 </tbody></table>
10024 !! end
10025
10026 ###
10027 ### Magic Words
10028 ###
10029
10030 # Note that the current date is hard-coded as
10031 # 1970-01-01T00:02:03Z (a Thursday)
10032 # when running parser tests. The timezone is also fixed to GMT, so
10033 # local date will be identical to current date.
10034
10035 !! test
10036 Magic Word: {{CURRENTDAY}}
10037 !! wikitext
10038 {{CURRENTDAY}}
10039 !! html
10040 <p>1
10041 </p>
10042 !! end
10043
10044 !! test
10045 Magic Word: {{CURRENTDAY2}}
10046 !! wikitext
10047 {{CURRENTDAY2}}
10048 !! html
10049 <p>01
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{CURRENTDAYNAME}}
10055 !! wikitext
10056 {{CURRENTDAYNAME}}
10057 !! html
10058 <p>Thursday
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{CURRENTDOW}}
10064 !! wikitext
10065 {{CURRENTDOW}}
10066 !! html
10067 <p>4
10068 </p>
10069 !! end
10070
10071 !! test
10072 Magic Word: {{CURRENTMONTH}}
10073 !! wikitext
10074 {{CURRENTMONTH}}
10075 !! html
10076 <p>01
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{CURRENTMONTH1}}
10082 !! wikitext
10083 {{CURRENTMONTH1}}
10084 !! html
10085 <p>1
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{CURRENTMONTHABBREV}}
10091 !! wikitext
10092 {{CURRENTMONTHABBREV}}
10093 !! html
10094 <p>Jan
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{CURRENTMONTHNAME}}
10100 !! wikitext
10101 {{CURRENTMONTHNAME}}
10102 !! html
10103 <p>January
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{CURRENTMONTHNAMEGEN}}
10109 !! wikitext
10110 {{CURRENTMONTHNAMEGEN}}
10111 !! html
10112 <p>January
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{CURRENTTIME}}
10118 !! wikitext
10119 {{CURRENTTIME}}
10120 !! html
10121 <p>00:02
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{CURRENTHOUR}}
10127 !! wikitext
10128 {{CURRENTHOUR}}
10129 !! html
10130 <p>00
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{CURRENTWEEK}} (T6594)
10136 !! wikitext
10137 {{CURRENTWEEK}}
10138 !! html
10139 <p>1
10140 </p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{CURRENTYEAR}}
10145 !! wikitext
10146 {{CURRENTYEAR}}
10147 !! html
10148 <p>1970
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{CURRENTTIMESTAMP}}
10154 !! wikitext
10155 {{CURRENTTIMESTAMP}}
10156 !! html
10157 <p>19700101000203
10158 </p>
10159 !! end
10160
10161 !! test
10162 Magic Words LOCAL (UTC)
10163 !! wikitext
10164 *{{LOCALMONTH}}
10165 *{{LOCALMONTH1}}
10166 *{{LOCALMONTHNAME}}
10167 *{{LOCALMONTHNAMEGEN}}
10168 *{{LOCALMONTHABBREV}}
10169 *{{LOCALDAY}}
10170 *{{LOCALDAY2}}
10171 *{{LOCALDAYNAME}}
10172 *{{LOCALYEAR}}
10173 *{{LOCALTIME}}
10174 *{{LOCALHOUR}}
10175 *{{LOCALWEEK}}
10176 *{{LOCALDOW}}
10177 *{{LOCALTIMESTAMP}}
10178 !! html
10179 <ul><li>01</li>
10180 <li>1</li>
10181 <li>January</li>
10182 <li>January</li>
10183 <li>Jan</li>
10184 <li>1</li>
10185 <li>01</li>
10186 <li>Thursday</li>
10187 <li>1970</li>
10188 <li>00:02</li>
10189 <li>00</li>
10190 <li>1</li>
10191 <li>4</li>
10192 <li>19700101000203</li></ul>
10193
10194 !! end
10195
10196 !! test
10197 Magic Word: {{FULLPAGENAME}}
10198 !! options
10199 title=[[User:Ævar Arnfjörð Bjarmason]]
10200 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10201 !! wikitext
10202 {{FULLPAGENAME}}
10203 !! html/*
10204 <p>User:Ævar Arnfjörð Bjarmason
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{FULLPAGENAMEE}}
10210 !! options
10211 title=[[User:Ævar Arnfjörð Bjarmason]]
10212 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10213 !! wikitext
10214 {{FULLPAGENAMEE}}
10215 !! html/*
10216 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10217 </p>
10218 !! end
10219
10220 !! test
10221 Magic Word: {{TALKSPACE}}
10222 !! options
10223 title=[[User:Ævar Arnfjörð Bjarmason]]
10224 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10225 !! wikitext
10226 {{TALKSPACE}}
10227 !! html/*
10228 <p>User talk
10229 </p>
10230 !! end
10231
10232 !! test
10233 Magic Word: {{TALKSPACE}}, same namespace
10234 !! options
10235 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10236 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10237 !! wikitext
10238 {{TALKSPACE}}
10239 !! html/*
10240 <p>User talk
10241 </p>
10242 !! end
10243
10244 !! test
10245 Magic Word: {{TALKSPACE}}, main namespace
10246 !! options
10247 title=[[Parser Test]]
10248 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10249 !! wikitext
10250 {{TALKSPACE}}
10251 !! html/*
10252 <p>Talk
10253 </p>
10254 !! end
10255
10256 !! test
10257 Magic Word: {{TALKSPACEE}}
10258 !! options
10259 title=[[User:Ævar Arnfjörð Bjarmason]]
10260 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10261 !! wikitext
10262 {{TALKSPACEE}}
10263 !! html/*
10264 <p>User_talk
10265 </p>
10266 !! end
10267
10268 !! test
10269 Magic Word: {{SUBJECTSPACE}}
10270 !! options
10271 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10272 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10273 !! wikitext
10274 {{SUBJECTSPACE}}
10275 !! html/*
10276 <p>User
10277 </p>
10278 !! end
10279
10280 !! test
10281 Magic Word: {{SUBJECTSPACE}}, same namespace
10282 !! options
10283 title=[[User:Ævar Arnfjörð Bjarmason]]
10284 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10285 !! wikitext
10286 {{SUBJECTSPACE}}
10287 !! html/*
10288 <p>User
10289 </p>
10290 !! end
10291
10292 !! test
10293 Magic Word: {{SUBJECTSPACE}}, main namespace
10294 !! options
10295 title=[[Parser Test]]
10296 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10297 !! wikitext
10298 {{SUBJECTSPACE}}
10299 !! html/*
10300
10301 !! end
10302
10303 !! test
10304 Magic Word: {{SUBJECTSPACEE}}
10305 !! options
10306 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10307 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10308 !! wikitext
10309 {{SUBJECTSPACEE}}
10310 !! html/*
10311 <p>User
10312 </p>
10313 !! end
10314
10315 !! test
10316 Magic Word: {{NAMESPACE}}
10317 !! options
10318 title=[[User:Ævar Arnfjörð Bjarmason]]
10319 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10320 !! wikitext
10321 {{NAMESPACE}}
10322 !! html/*
10323 <p>User
10324 </p>
10325 !! end
10326
10327 !! test
10328 Magic Word: {{NAMESPACEE}}
10329 !! options
10330 title=[[User:Ævar Arnfjörð Bjarmason]]
10331 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10332 !! wikitext
10333 {{NAMESPACEE}}
10334 !! html/*
10335 <p>User
10336 </p>
10337 !! end
10338
10339 !! test
10340 Magic Word: {{NAMESPACENUMBER}}
10341 !! options
10342 title=[[User:Ævar Arnfjörð Bjarmason]]
10343 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10344 !! wikitext
10345 {{NAMESPACENUMBER}}
10346 !! html/*
10347 <p>2
10348 </p>
10349 !! end
10350
10351 !! test
10352 Magic Word: {{SUBPAGENAME}}
10353 !! options
10354 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10355 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10356 !! wikitext
10357 {{SUBPAGENAME}}
10358 !! html/*
10359 <p>sub ö
10360 </p>
10361 !! end
10362
10363 !! test
10364 Magic Word: {{SUBPAGENAMEE}}
10365 !! options
10366 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10367 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10368 !! wikitext
10369 {{SUBPAGENAMEE}}
10370 !! html/*
10371 <p>sub_%C3%B6
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{ROOTPAGENAME}}
10377 !! options
10378 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10379 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10380 !! wikitext
10381 {{ROOTPAGENAME}}
10382 !! html/*
10383 <p>Ævar Arnfjörð Bjarmason
10384 </p>
10385 !! end
10386
10387 !! test
10388 Magic Word: {{ROOTPAGENAMEE}}
10389 !! options
10390 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10391 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10392 !! wikitext
10393 {{ROOTPAGENAMEE}}
10394 !! html/*
10395 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10396 </p>
10397 !! end
10398
10399 !! test
10400 Magic Word: {{BASEPAGENAME}}
10401 !! options
10402 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10403 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10404 !! wikitext
10405 {{BASEPAGENAME}}
10406 !! html/*
10407 <p>Ævar Arnfjörð Bjarmason
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{BASEPAGENAMEE}}
10413 !! options
10414 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10415 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10416 !! wikitext
10417 {{BASEPAGENAMEE}}
10418 !! html/*
10419 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10420 </p>
10421 !! end
10422
10423 !! test
10424 Magic Word: {{TALKPAGENAME}}
10425 !! options
10426 title=[[User:Ævar Arnfjörð Bjarmason]]
10427 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10428 !! wikitext
10429 {{TALKPAGENAME}}
10430 !! html/*
10431 <p>User talk:Ævar Arnfjörð Bjarmason
10432 </p>
10433 !! end
10434
10435 !! test
10436 Magic Word: {{TALKPAGENAMEE}}
10437 !! options
10438 title=[[User:Ævar Arnfjörð Bjarmason]]
10439 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10440 !! wikitext
10441 {{TALKPAGENAMEE}}
10442 !! html/*
10443 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{SUBJECTPAGENAME}}
10449 !! options
10450 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{SUBJECTPAGENAME}}
10454 !! html/*
10455 <p>User:Ævar Arnfjörð Bjarmason
10456 </p>
10457 !! end
10458
10459 !! test
10460 Magic Word: {{SUBJECTPAGENAMEE}}
10461 !! options
10462 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10463 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10464 !! wikitext
10465 {{SUBJECTPAGENAMEE}}
10466 !! html/*
10467 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10468 </p>
10469 !! end
10470
10471 !! test
10472 Magic Word: {{NUMBEROFFILES}}
10473 !! options
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{NUMBEROFFILES}}
10477 !! html/*
10478 <p>7
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{PAGENAME}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{PAGENAME}}
10489 !! html/*
10490 <p>Ævar Arnfjörð Bjarmason
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{PAGENAME}} with metacharacters
10496 !! options
10497 title=[['foo & bar = baz']]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 ''{{PAGENAME}}''
10501 !! html+tidy
10502 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10508 !! options
10509 title=[[*RFC 1234 http://example.com/]]
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{PAGENAME}}
10513 !! html+tidy
10514 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{PAGENAMEE}}
10520 !! options
10521 title=[[User:Ævar Arnfjörð Bjarmason]]
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{PAGENAMEE}}
10525 !! html/*
10526 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10532 !! options
10533 title=[[*RFC 1234 http://example.com/]]
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{PAGENAMEE}}
10537 !! html+tidy
10538 <p>&#42;RFC_1234_http&#58;//example.com/
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{REVISIONID}}
10544 !! options
10545 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10546 showflags
10547 !! wikitext
10548 {{REVISIONID}}
10549 !! html/*
10550 <p>1337
10551 </p>
10552 flags=vary-revision-id
10553 !! end
10554
10555 !! test
10556 Magic Word: {{SCRIPTPATH}}
10557 !! options
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SCRIPTPATH}}
10561 !! html/*
10562
10563 !! end
10564
10565 !! test
10566 Magic Word: {{STYLEPATH}}
10567 !! options
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{STYLEPATH}}
10571 !! html/*
10572 <p>/skins
10573 </p>
10574 !! end
10575
10576 !! test
10577 Magic Word: {{SERVER}}
10578 !! options
10579 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10580 !! wikitext
10581 {{SERVER}}
10582 !! html/*
10583 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10584 </p>
10585 !! end
10586
10587 !! test
10588 Magic Word: {{SERVERNAME}}
10589 !! options
10590 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10591 !! wikitext
10592 {{SERVERNAME}}
10593 !! html/*
10594 <p>example.org
10595 </p>
10596 !! end
10597
10598 !! test
10599 Magic Word: {{SITENAME}}
10600 !! options
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{SITENAME}}
10604 !! html/*
10605 <p>MediaWiki
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{PAGELANGUAGE}}
10611 !! options
10612 language=fr
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{PAGELANGUAGE}}
10616 !! html/*
10617 <p>fr
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10623 !! options
10624 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10625 !! wikitext
10626 {{PAGELANGUAGE}}
10627 !! html/*
10628 <p>en
10629 </p>
10630 !! end
10631
10632 !! test
10633 Case-sensitive magic words, when cased differently, should just be template transclusions
10634 !! wikitext
10635 {{CurrentMonth}}
10636 {{currentday}}
10637 {{cURreNTweEK}}
10638 {{currentHour}}
10639 !! html
10640 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10641 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10642 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10643 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10644 </p>
10645 !! end
10646
10647 !! test
10648 Case-insensitive magic words should still work with weird casing.
10649 !! wikitext
10650 {{sErVeRNaMe}}
10651 {{LCFirst:AOEU}}
10652 {{ucFIRST:aoeu}}
10653 {{SERver}}
10654 !! html
10655 <p>example.org
10656 aOEU
10657 Aoeu
10658 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10659 </p>
10660 !! end
10661
10662 # From plwiki:PLOS_ONE
10663 !! test
10664 Parsoid: Page property magic word with magic word contents
10665 !! wikitext
10666 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10667 !! html/parsoid
10668 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10669 !! end
10670
10671 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10672 # But, this is a limitation of our representation and is documented in
10673 # TemplateHandler.js in processSpecialMagicWord
10674 !! test
10675 Parsoid: Template-generated DISPLAYTITLE
10676 !! wikitext
10677 {{{{echo|DISPLAYTITLE}}:Foo}}
10678 !! options
10679 showtitle
10680 !! config
10681 wgAllowDisplayTitle=true
10682 wgRestrictDisplayTitle=false
10683 !! html/php
10684 Foo
10685
10686 !! html/parsoid
10687 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10688 !! end
10689
10690 !! test
10691 Namespace 1 {{ns:1}}
10692 !! wikitext
10693 {{ns:1}}
10694 !! html
10695 <p>Talk
10696 </p>
10697 !! end
10698
10699 !! test
10700 Namespace 1 {{ns:01}}
10701 !! wikitext
10702 {{ns:01}}
10703 !! html
10704 <p>Talk
10705 </p>
10706 !! end
10707
10708 !! test
10709 Namespace 0 {{ns:0}} (T6783)
10710 !! wikitext
10711 {{ns:0}}
10712 !! html
10713
10714 !! end
10715
10716 !! test
10717 Namespace 0 {{ns:00}} (T6783)
10718 !! wikitext
10719 {{ns:00}}
10720 !! html
10721
10722 !! end
10723
10724 !! test
10725 Namespace -1 {{ns:-1}}
10726 !! wikitext
10727 {{ns:-1}}
10728 !! html
10729 <p>Special
10730 </p>
10731 !! end
10732
10733 !! test
10734 Namespace User {{ns:User}}
10735 !! wikitext
10736 {{ns:User}}
10737 !! html
10738 <p>User
10739 </p>
10740 !! end
10741
10742 !! test
10743 Namespace User talk {{ns:User_talk}}
10744 !! wikitext
10745 {{ns:User_talk}}
10746 !! html
10747 <p>User talk
10748 </p>
10749 !! end
10750
10751 !! test
10752 Namespace User talk {{ns:uSeR tAlK}}
10753 !! wikitext
10754 {{ns:uSeR tAlK}}
10755 !! html
10756 <p>User talk
10757 </p>
10758 !! end
10759
10760 !! test
10761 Namespace File {{ns:File}}
10762 !! wikitext
10763 {{ns:File}}
10764 !! html
10765 <p>File
10766 </p>
10767 !! end
10768
10769 !! test
10770 Namespace File {{ns:Image}}
10771 !! wikitext
10772 {{ns:Image}}
10773 !! html
10774 <p>File
10775 </p>
10776 !! end
10777
10778 !! test
10779 Namespace (lang=de) Benutzer {{ns:User}}
10780 !! options
10781 language=de
10782 !! wikitext
10783 {{ns:User}}
10784 !! html
10785 <p>Benutzer
10786 </p>
10787 !! end
10788
10789 !! test
10790 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10791 !! options
10792 language=de
10793 !! wikitext
10794 {{ns:3}}
10795 !! html
10796 <p>Benutzer Diskussion
10797 </p>
10798 !! end
10799
10800 !! test
10801 Urlencode
10802 !! wikitext
10803 {{urlencode:hi world?!}}
10804 {{urlencode:hi world?!|WIKI}}
10805 {{urlencode:hi world?!|PATH}}
10806 {{urlencode:hi world?!|QUERY}}
10807 !! html/php
10808 <p>hi+world%3F%21
10809 hi_world%3F!
10810 hi%20world%3F%21
10811 hi+world%3F%21
10812 </p>
10813 !! end
10814
10815 !! test
10816 Magic Word: prioritize type info over data-parsoid
10817 !! options
10818 parsoid=html2wt
10819 !! html/parsoid
10820 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10821 !! wikitext
10822 __FORCETOC__
10823 !! end
10824
10825 !! test
10826 Magic Word: serialize on separate line (parsoid)
10827 !! options
10828 parsoid=wt2wt,html2wt
10829 !! wikitext
10830 foo
10831 __NOTOC__
10832 bar
10833 !! html/parsoid
10834 foo<meta property="mw:PageProp/notoc"/>bar
10835 !! end
10836
10837 !! test
10838 Magic Word: rt non-english wikis
10839 !! options
10840 parsoid=wt2wt
10841 language=de
10842 !! wikitext
10843 __NOEDITSECTION__
10844 !! html/parsoid
10845 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10846 !! end
10847
10848 !!test
10849 __proto__ is treated as normal wikitext (T105997)
10850 !!wikitext
10851 __proto__
10852 !!html
10853 <p>__proto__
10854 </p>
10855 !!end
10856
10857 ###
10858 ### Magic links
10859 ###
10860 !! test
10861 Magic links: internal link to RFC (T2479)
10862 !! wikitext
10863 [[RFC 123]]
10864 !! html/php
10865 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10866 </p>
10867 !! html/parsoid
10868 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10869 !! end
10870
10871 !! test
10872 Magic links: RFC (T2479)
10873 !! wikitext
10874 RFC 822
10875 !! html/php
10876 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10877 </p>
10878 !! html/parsoid
10879 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10880 !! end
10881
10882 !! test
10883 Magic links: RFC (T67278)
10884 !! wikitext
10885 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10886 !! html/php
10887 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10888 </p>
10889 !! html/parsoid
10890 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10891 !! end
10892
10893 !! test
10894 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10895 !! wikitext
10896 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10897 RFC
10898 822
10899 !! html/php
10900 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10901 RFC
10902 822
10903 </p>
10904 !! html/parsoid
10905 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10906 RFC
10907 822</p>
10908 !! end
10909
10910 !! test
10911 Magic links: ISBN (T3937)
10912 !! wikitext
10913 ISBN 0-306-40615-2
10914 !! html/php
10915 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10916 </p>
10917 !! html/parsoid
10918 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10919 !! end
10920
10921 !! test
10922 Magic links: ISBN (T67278)
10923 !! wikitext
10924 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10925 !! html/php
10926 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10927 </p>
10928 !! html/parsoid
10929 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10930 !! end
10931
10932 !! test
10933 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10934 !! wikitext
10935 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10936 ISBN
10937 9780316098113
10938 ISBN 978
10939 0316098113
10940 !! html/php
10941 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10942 ISBN
10943 9780316098113
10944 ISBN 978
10945 0316098113
10946 </p>
10947 !! html/parsoid
10948 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10949 ISBN
10950 9780316098113
10951 ISBN 978
10952 0316098113</p>
10953 !! end
10954
10955 !! test
10956 Magic links: PMID incorrectly converts space to underscore
10957 !! wikitext
10958 PMID 1234
10959 !! html/php
10960 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10961 </p>
10962 !! html/parsoid
10963 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10964 !! end
10965
10966 !! test
10967 Magic links: PMID (T67278)
10968 !! wikitext
10969 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10970 !! html/php
10971 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10972 </p>
10973 !! html/parsoid
10974 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10975 !! end
10976
10977 !! test
10978 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10979 !! wikitext
10980 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10981 PMID
10982 1234
10983 !! html/php
10984 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10985 PMID
10986 1234
10987 </p>
10988 !! html/parsoid
10989 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10990 PMID
10991 1234</p>
10992 !! end
10993
10994 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10995 # since these are ExtLinkText, not MagicLinkText
10996 !! test
10997 Magic links: use appropriate serialization for "almost" magic links.
10998 !! wikitext
10999 X[[Special:BookSources/0978739256|foo]]
11000
11001 X[https://tools.ietf.org/html/rfc1234 foo]
11002 !! html/php
11003 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11004 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11005 </p>
11006 !! html/parsoid
11007 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11008 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11009 !! end
11010
11011 !! test
11012 Magic links: All disabled (T47942)
11013 !! options
11014 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11015 !! wikitext
11016 ISBN 0-306-40615-2
11017 PMID 1234
11018 RFC 4321
11019 !! html/php
11020 <p>ISBN 0-306-40615-2
11021 PMID 1234
11022 RFC 4321
11023 </p>
11024 !! end
11025
11026 ###
11027 ### Templates
11028 ####
11029
11030 !! test
11031 Nonexistent template
11032 !! wikitext
11033 {{thistemplatedoesnotexist}}
11034 !! html
11035 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11036 </p>
11037 !! end
11038
11039 !! test
11040 Template with invalid target containing tags
11041 !! wikitext
11042 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11043 !! html
11044 <p>{{a<b>b</b>|foo|a=b|a = b}}
11045 </p>
11046 !! end
11047
11048 !! test
11049 Template with invalid target containing unclosed tag
11050 !! wikitext
11051 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11052 !! html
11053 <p>{{a<b>|foo|a=b|a = b}}</b>
11054 </p>
11055 !! end
11056
11057 !! test
11058 Template with invalid target containing wikilink
11059 !! wikitext
11060 {{[[Main Page]]}}
11061 !! html/php
11062 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11063 </p>
11064 !! html/parsoid
11065 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11066 !! end
11067
11068 !! test
11069 Template with just whitespace in it, T70421
11070 !! wikitext
11071 {{echo|{{ }}}}
11072 !! html/parsoid
11073 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11074 !! end
11075
11076 !! article
11077 Template:test
11078 !! text
11079 This is a test template
11080 !! endarticle
11081
11082 !! test
11083 Simple template
11084 !! wikitext
11085 {{test}}
11086 !! html
11087 <p>This is a test template
11088 </p>
11089 !! end
11090
11091 !! test
11092 Template with explicit namespace
11093 !! wikitext
11094 {{Template:test}}
11095 !! html
11096 <p>This is a test template
11097 </p>
11098 !! end
11099
11100
11101 !! article
11102 Template:paramtest
11103 !! text
11104 This is a test template with parameter {{{param}}}
11105 !! endarticle
11106
11107 !! test
11108 Template parameter
11109 !! wikitext
11110 {{paramtest|param=foo}}
11111 !! html
11112 <p>This is a test template with parameter foo
11113 </p>
11114 !! end
11115
11116 !! article
11117 Template:paramtestnum
11118 !! text
11119 [[{{{1}}}|{{{2}}}]]
11120 !! endarticle
11121
11122 !! test
11123 Template unnamed parameter
11124 !! wikitext
11125 {{paramtestnum|Main Page|the main page}}
11126 !! html
11127 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11128 </p>
11129 !! end
11130
11131 !! article
11132 Template:templatesimple
11133 !! text
11134 (test)
11135 !! endarticle
11136
11137 !! article
11138 Template:templateredirect
11139 !! text
11140 #redirect [[Template:templatesimple]]
11141 !! endarticle
11142
11143 !! article
11144 Template:templateasargtestnum
11145 !! text
11146 {{{{{1}}}}}
11147 !! endarticle
11148
11149 !! article
11150 Template:templateasargtest
11151 !! text
11152 {{template{{{templ}}}}}
11153 !! endarticle
11154
11155 !! article
11156 Template:templateasargtest2
11157 !! text
11158 {{{{{templ}}}}}
11159 !! endarticle
11160
11161 !! test
11162 Template with template name as unnamed argument
11163 !! wikitext
11164 {{templateasargtestnum|templatesimple}}
11165 !! html
11166 <p>(test)
11167 </p>
11168 !! end
11169
11170 !! test
11171 Template with template name as argument
11172 !! wikitext
11173 {{templateasargtest|templ=simple}}
11174 !! html
11175 <p>(test)
11176 </p>
11177 !! end
11178
11179 !! test
11180 Template with template name as argument (2)
11181 !! wikitext
11182 {{templateasargtest2|templ=templatesimple}}
11183 !! html
11184 <p>(test)
11185 </p>
11186 !! end
11187
11188 !! article
11189 Template:templateasargtestdefault
11190 !! text
11191 {{{{{templ|templatesimple}}}}}
11192 !! endarticle
11193
11194 !! article
11195 Template:templa
11196 !! text
11197 '''templ'''
11198 !! endarticle
11199
11200 !! test
11201 Template with default value
11202 !! wikitext
11203 {{templateasargtestdefault}}
11204 !! html
11205 <p>(test)
11206 </p>
11207 !! end
11208
11209 !! test
11210 Template with default value (value set)
11211 !! wikitext
11212 {{templateasargtestdefault|templ=templa}}
11213 !! html
11214 <p><b>templ</b>
11215 </p>
11216 !! end
11217
11218 !! test
11219 Template redirect
11220 !! wikitext
11221 {{templateredirect}}
11222 !! html/php
11223 <p>(test)
11224 </p>
11225 !! html/parsoid
11226 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11227 !! end
11228
11229 !! test
11230 Template with argument in separate line
11231 !! wikitext
11232 {{ templateasargtest |
11233 templ = simple }}
11234 !! html
11235 <p>(test)
11236 </p>
11237 !! end
11238
11239 !! test
11240 Template with complex template as argument
11241 !! wikitext
11242 {{paramtest|
11243 param ={{ templateasargtest |
11244 templ = simple }}}}
11245 !! html
11246 <p>This is a test template with parameter (test)
11247 </p>
11248 !! end
11249
11250 !! test
11251 Templates with templated name
11252 !! wikitext
11253 {{{{echo|echo}}|foo}}
11254 {{{{echo|inner list}} }}
11255 !! html
11256 <p>foo
11257 </p>
11258 <ul><li>item 1</li></ul>
11259
11260 !! html/parsoid
11261 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11262 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11263 !! end
11264
11265 ## Regression test; the output here isn't really that interesting.
11266 !! test
11267 Templates with templated name and top level template args
11268 !! wikitext
11269 {{1{{2{{{3}}}|4=5}}}}
11270 !! html/parsoid
11271 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11272 !! end
11273
11274 # Parsoid markup is deliberate "broken". This is an edge case.
11275 # See long comment in TemplateHandler.js:convertAttribsToString.
11276 !! test
11277 Templates with invalid templated targets
11278 !! wikitext
11279 {{echo
11280 {{echo|foo}}
11281 }}
11282 !! html/php
11283 <p>{{echo
11284 foo
11285 }}
11286 </p>
11287 !! html/parsoid
11288 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11289 foo }}</p>
11290 !! end
11291
11292 !! test
11293 Template with thumb image (with link in description)
11294 !! wikitext
11295 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11296 !! html/php
11297 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11298
11299 !! html+tidy
11300 <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11301 !! html/parsoid
11302 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11303 !! end
11304
11305 !! article
11306 Template:complextemplate
11307 !! text
11308 {{{1}}} {{paramtest|
11309 param ={{{param}}}}}
11310 !! endarticle
11311
11312 !! test
11313 Template with complex arguments
11314 !! wikitext
11315 {{complextemplate|
11316 param ={{ templateasargtest |
11317 templ = simple }}|[[Template:complextemplate|link]]}}
11318 !! html
11319 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11320 </p>
11321 !! end
11322
11323 !! test
11324 T2553: link with two variables in a piped link
11325 !! wikitext
11326 {|
11327 |[[{{{1}}}|{{{2}}}]]
11328 |}
11329 !! html/php
11330 <table>
11331 <tr>
11332 <td>[[{{{1}}}|{{{2}}}]]
11333 </td></tr></table>
11334
11335 !! html/parsoid
11336 <table>
11337 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11338 </tbody></table>
11339 !! end
11340
11341 # See: T2553
11342 !! test
11343 Abort table cell attribute parsing on wikilink
11344 !! wikitext
11345 {|
11346 |testing [[one|two]] |three||four
11347 |testing one two |three||four
11348 |testing="[[one|two]]" |three||four
11349 |}
11350 !! html/php
11351 <table>
11352 <tr>
11353 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
11354 <td>four
11355 </td>
11356 <td>three</td>
11357 <td>four
11358 </td>
11359 <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
11360 <td>four
11361 </td></tr></table>
11362
11363 !! html/parsoid
11364 <table>
11365 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11366 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11367 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
11368 </tbody></table>
11369 !! end
11370
11371 !! test
11372 Don't abort table cell attribute parsing if wikilink is found in template arg
11373 !! wikitext
11374 {|
11375 |Test {{#tag:ref|One two "[[three]]" four}}
11376 |}
11377 !! html/parsoid
11378 <table>
11379 <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11380 </tbody></table>
11381 !! end
11382
11383 !! test
11384 Magic variable as template parameter
11385 !! wikitext
11386 {{paramtest|param={{SITENAME}}}}
11387 !! html
11388 <p>This is a test template with parameter MediaWiki
11389 </p>
11390 !! end
11391
11392 !! article
11393 Template:linktest
11394 !! text
11395 [[{{{param}}}|link]]
11396 !! endarticle
11397
11398 !! test
11399 Template parameter as link source
11400 !! wikitext
11401 {{linktest|param=Main Page}}
11402 !! html
11403 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11404 </p>
11405 !! end
11406
11407 !!article
11408 Template:paramtest2
11409 !! text
11410 including another template, {{paramtest|param={{{arg}}}}}
11411 !! endarticle
11412
11413 !! test
11414 Template passing argument to another template
11415 !! wikitext
11416 {{paramtest2|arg='hmm'}}
11417 !! html
11418 <p>including another template, This is a test template with parameter 'hmm'
11419 </p>
11420 !! end
11421
11422 !! article
11423 Template:Linktest2
11424 !! text
11425 Main Page
11426 !! endarticle
11427
11428 !! test
11429 Template as link source
11430 !! wikitext
11431 [[{{linktest2}}]]
11432
11433 [[{{linktest2}}|Main Page]]
11434
11435 [[{{linktest2}}]]Page
11436 !! html
11437 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11438 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11439 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11440 </p>
11441 !! end
11442
11443
11444 !! article
11445 Template:loop1
11446 !! text
11447 {{loop2}}
11448 !! endarticle
11449
11450 !! article
11451 Template:loop2
11452 !! text
11453 {{loop1}}
11454 !! endarticle
11455
11456 !! test
11457 Template infinite loop
11458 !! wikitext
11459 {{loop1}}
11460 !! html
11461 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11462 </p>
11463 !! end
11464
11465 !! test
11466 Template from main namespace
11467 !! wikitext
11468 {{:Main Page}}
11469 !! html
11470 <p>blah blah
11471 </p>
11472 !! end
11473
11474 !! article
11475 Template:table
11476 !! text
11477 {|
11478 | 1 || 2
11479 |-
11480 | 3 || 4
11481 |}
11482 !! endarticle
11483
11484 !! test
11485 T2529: Template with table, not included at beginning of line
11486 !! wikitext
11487 foo {{table}}
11488 !! html
11489 <p>foo
11490 </p>
11491 <table>
11492 <tr>
11493 <td>1</td>
11494 <td>2
11495 </td></tr>
11496 <tr>
11497 <td>3</td>
11498 <td>4
11499 </td></tr></table>
11500
11501 !! end
11502
11503 !! test
11504 T2523: Template shouldn't eat newline (or add an extra one before table)
11505 !! wikitext
11506 foo
11507 {{table}}
11508 !! html
11509 <p>foo
11510 </p>
11511 <table>
11512 <tr>
11513 <td>1</td>
11514 <td>2
11515 </td></tr>
11516 <tr>
11517 <td>3</td>
11518 <td>4
11519 </td></tr></table>
11520
11521 !! end
11522
11523 !! test
11524 T2041: Template parameters shown as broken links
11525 !! wikitext
11526 {{{parameter}}}
11527 !! html
11528 <p>{{{parameter}}}
11529 </p>
11530 !! end
11531
11532 !! test
11533 Template with targets containing wikilinks
11534 !! options
11535 parsoid=wt2html
11536 !! wikitext
11537 {{[[foo]]}}
11538
11539 {{[[{{echo|foo}}]]}}
11540
11541 {{{{echo|[[foo}}]]}}
11542 !! html/php
11543 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11544 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11545 </p><p>{{[[foo}}]]
11546 </p>
11547 !! html/parsoid
11548 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11549 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11550 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11551 !! end
11552
11553 !! article
11554 Template:''
11555 !! text
11556 bar
11557 !! endarticle
11558
11559 !! test
11560 Templates: Double quotes as template target
11561 !! wikitext
11562 foo {{''}} baz
11563 !! html/php
11564 <p>foo bar baz
11565 </p>
11566 !! html/parsoid
11567 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11568 </p>
11569 !! end
11570
11571 ## This test is about making sure Parsoid's data-mw is well formed in the
11572 ## face of multiple templates with intersecting and overlapping ranges. The
11573 ## wikitext itself is wretched.
11574 !! test
11575 Templates with intersecting and overlapping ranges
11576 !! wikitext
11577 {|{{echo|
11578 <p>ha</p>}}
11579 {|{{echo|
11580 <p>ho</p>}}
11581 {{echo|{{!}}hi}}
11582 |}
11583 !! html/php+tidy
11584 <p>ha</p><table>
11585
11586 </table><p>ho</p><table>
11587
11588 <tbody><tr>
11589 <td>hi
11590 </td></tr></tbody></table>
11591 !! html/parsoid
11592 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11593
11594 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11595
11596 <tbody><tr><td>hi</td></tr>
11597 </tbody></table>
11598 !! end
11599
11600 !! article
11601 Template:MSGNW test
11602 !! text
11603 ''None'' of '''this''' should be
11604 * interpreted
11605 but rather passed unmodified
11606 {{test}}
11607 <gallery>
11608 File:Foobar.jpg
11609 </gallery>
11610 <!-- comment -->
11611 !! endarticle
11612
11613 # hmm, fix this or just deprecate msgnw and document its behavior?
11614 !! test
11615 msgnw keyword
11616 !! wikitext
11617 {{msgnw:MSGNW test}}
11618 !! html/php
11619 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11620 &#42; interpreted
11621 &#32;but rather passed unmodified
11622 &#123;&#123;test&#125;&#125;
11623 &#60;gallery&#62;
11624 File:Foobar.jpg
11625 &#60;/gallery&#62;
11626 &#60;!-- comment --&#62;
11627 </p>
11628 !! end
11629
11630 !! test
11631 int keyword
11632 !! wikitext
11633 {{int:youhavenewmessages|lots of money|not!}}
11634 !! html
11635 <p>You have lots of money (not!).
11636 </p>
11637 !! end
11638
11639 !! test
11640 int keyword - non-existing message
11641 !! wikitext
11642 {{int:var}}
11643 !! html
11644 <p>⧼var⧽
11645 </p>
11646 !! end
11647
11648 !! article
11649 Template:Includes
11650 !! text
11651 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11652 !! endarticle
11653
11654 !! test
11655 <includeonly> and <noinclude> being included
11656 !! wikitext
11657 {{Includes}}
11658 !! html
11659 <p>Foobar
11660 </p>
11661 !! end
11662
11663 !! article
11664 Template:Includes2
11665 !! text
11666 <onlyinclude>Foo</onlyinclude>bar
11667 !! endarticle
11668
11669 !! test
11670 <onlyinclude> being included
11671 !! wikitext
11672 {{Includes2}}
11673 !! html
11674 <p>Foo
11675 </p>
11676 !! end
11677
11678
11679 !! article
11680 Template:Includes3
11681 !! text
11682 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11683 !! endarticle
11684
11685 !! test
11686 <onlyinclude> and <includeonly> being included
11687 !! wikitext
11688 {{Includes3}}
11689 !! html
11690 <p>Foo
11691 </p>
11692 !! end
11693
11694 !! test
11695 <includeonly> and <noinclude> on a page
11696 !! wikitext
11697 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11698 !! html
11699 <p>Foozar
11700 </p>
11701 !! end
11702
11703 !! test
11704 Un-closed <noinclude>
11705 !! wikitext
11706 <noinclude>
11707 !! html
11708 !! end
11709
11710 !! test
11711 <onlyinclude> on a page
11712 !! wikitext
11713 <onlyinclude>Foo</onlyinclude>bar
11714 !! html
11715 <p>Foobar
11716 </p>
11717 !! end
11718
11719 !! test
11720 Un-closed <onlyinclude>
11721 !! wikitext
11722 <onlyinclude>
11723 !! html
11724 !! end
11725
11726 !!test
11727 Self-closed noinclude, includeonly, onlyinclude tags
11728 !! wikitext
11729 <noinclude />
11730 <includeonly />
11731 <onlyinclude />
11732 !! html
11733 <p><br />
11734 </p>
11735 !!end
11736
11737 !!test
11738 Unbalanced includeonly and noinclude tags
11739 !! wikitext
11740 {|
11741 |a</noinclude>
11742 |b</noinclude></noinclude>
11743 |c</noinclude></includeonly>
11744 |d</includeonly></includeonly>
11745 |}
11746 !! html
11747 <table>
11748 <tr>
11749 <td>a
11750 </td>
11751 <td>b
11752 </td>
11753 <td>c&lt;/includeonly&gt;
11754 </td>
11755 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11756 </td></tr></table>
11757
11758 !!end
11759
11760 !! article
11761 Template:Includeonly section
11762 !! text
11763 <includeonly>
11764 ==Includeonly section==
11765 </includeonly>
11766 ==Section T-1==
11767 !!endarticle
11768
11769 !! test
11770 T8563: Edit link generation for section shown by <includeonly>
11771 !! wikitext
11772 {{includeonly section}}
11773 !! html
11774 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11775 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11776
11777 !! end
11778
11779 # Uses same input as the contents of [[Template:Includeonly section]]
11780 !! test
11781 T8563: Section extraction for section shown by <includeonly>
11782 !! options
11783 section=T-2
11784 !! wikitext
11785 <includeonly>
11786 ==Includeonly section==
11787 </includeonly>
11788 ==Section T-2==
11789 !! html
11790 ==Section T-2==
11791 !! end
11792
11793 !! test
11794 T8563: Edit link generation for section suppressed by <includeonly>
11795 !! wikitext
11796 <includeonly>
11797 ==Includeonly section==
11798 </includeonly>
11799 ==Section 1==
11800 !! html
11801 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11802
11803 !! end
11804
11805 !! test
11806 T8563: Section extraction for section suppressed by <includeonly>
11807 !! options
11808 section=1
11809 !! wikitext
11810 <includeonly>
11811 ==Includeonly section==
11812 </includeonly>
11813 ==Section 1==
11814 !! html
11815 ==Section 1==
11816 !! end
11817
11818 !! test
11819 Un-closed <includeonly>
11820 !! wikitext
11821 <includeonly>
11822 !! html/php
11823 !! html/parsoid
11824 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11825 !! end
11826
11827 ## We used to, but no longer wt2wt this test since the default serializer
11828 ## will normalize the include directives to serialize on their own line.
11829 ## Selser will take care of preserving formatting in scenarios where they
11830 ## intermingled with other wikitext.
11831 !! test
11832 Includes and comments at SOL
11833 !! options
11834 parsoid=wt2html,html2html
11835 !! wikitext
11836 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11837
11838 <noinclude>
11839 some
11840 </noinclude>*stuff
11841 *here
11842
11843 <includeonly>can have stuff</includeonly>===here===
11844
11845 !! html/php
11846 <h2><span class="mw-headline" id="hu">hu</span></h2>
11847 <p>some
11848 </p>
11849 <ul><li>stuff</li>
11850 <li>here</li></ul>
11851 <h3><span class="mw-headline" id="here">here</span></h3>
11852
11853 !! html/parsoid
11854 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
11855
11856 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11857 <p>some</p>
11858 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11859 <li>here</li></ul>
11860
11861 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
11862
11863 !! end
11864
11865 # TODO: test with DOM fragment reuse!
11866 !! test
11867 Parsoid: DOM fragment reuse
11868 !! options
11869 parsoid=wt2wt,wt2html
11870 !! wikitext
11871 a{{echo|b<table></table>c}}d
11872
11873 a{{echo|b
11874 <table></table>
11875 c}}d
11876
11877 {{echo|a
11878
11879 <table></table>
11880
11881 b}}
11882 !! html
11883 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11884
11885 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11886 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11887 </span><p about="#mwt2">cd</p>
11888
11889 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11890
11891 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11892
11893 </span><p about="#mwt3">b</p>
11894 !! end
11895
11896 !! test
11897 Parsoid: Merge double tds (T52603)
11898 !! options
11899 parsoid
11900 !! wikitext
11901 {|
11902 |{{echo|{{!}} foo}}
11903 |}
11904 !! html
11905 <table><tbody>
11906 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11907 </tbody></table>
11908 !! end
11909
11910 !! test
11911 Parsoid: Merge double tds in nested transclusion content (T52603)
11912 !! options
11913 parsoid
11914 !! wikitext
11915 {{echo|<div>}}
11916 {|
11917 |{{echo|{{!}} foo}}
11918 |}
11919 {{echo|</div>}}
11920 !! html
11921 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11922 <table><tbody>
11923 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11924 </tbody></table>
11925 </div>
11926 !! end
11927
11928 ###
11929 ### <includeonly> and <noinclude> in attributes
11930 ###
11931 !!test
11932 0. includeonly around the entire attribute
11933 !! wikitext
11934 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11935 !! html
11936 <p><span id="v2">bar</span>
11937 </p>
11938 !!end
11939
11940 !!test
11941 1. includeonly in html attr key
11942 !! wikitext
11943 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11944 !! html
11945 <p><span id="foo">bar</span>
11946 </p>
11947 !!end
11948
11949 !!test
11950 2. includeonly in html attr value
11951 !! wikitext
11952 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11953 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11954 !! html
11955 <p><span id="v1">bar</span>
11956 <span id="v1">bar</span>
11957 </p>
11958 !!end
11959
11960 !!test
11961 3. includeonly in part of an attr value
11962 !! wikitext
11963 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11964 !! html
11965 <p><span style="color:red;">bar</span>
11966 </p>
11967 !!end
11968
11969 !!test
11970 4. includeonly in table attributes
11971 !! wikitext
11972 {|
11973 |- <noinclude>
11974 |-
11975 |a
11976 </noinclude>
11977 |- <includeonly>
11978 |-
11979 |b
11980 </includeonly>
11981 |}
11982 !! html
11983 <table>
11984
11985
11986 <tr>
11987 <td>a
11988 </td></tr>
11989 </table>
11990
11991 !!end
11992
11993 ###
11994 ### Preprocessor precedence tests
11995 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11996 ###
11997 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11998 !! test
11999 Preprocessor precedence 1: link is rightmost opening
12000 !! options
12001 parsoid=wt2html
12002 !! wikitext
12003 {{[[Foo|bar}}]]
12004
12005 But close-brace is not a valid character in a link title:
12006 {{[[Foo}}|bar]]
12007
12008 However, we can still tell this was handled as a link in the preprocessor:
12009 {{echo|[[Foo}}|bar]]|bat}}
12010 !! html/php
12011 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12012 </p><p>But close-brace is not a valid character in a link title:
12013 {{[[Foo}}|bar]]
12014 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12015 [[Foo}}|bar]]
12016 </p>
12017 !! html/parsoid
12018 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12019 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12020 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12021 !! end
12022
12023 !! test
12024 Preprocessor precedence 2: template is rightmost opening
12025 !! options
12026 language=zh
12027 !! wikitext
12028 -{{echo|foo}-}}-
12029 !! html/php
12030 <p>-foo}--
12031 </p>
12032 !! html/parsoid
12033 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12034 !! end
12035
12036 !! test
12037 Preprocessor precedence 3: language converter is rightmost opening
12038 !! options
12039 language=zh
12040 parsoid=wt2html
12041 !! wikitext
12042 {{echo|hi}}
12043
12044 {{-{R|echo|hi}}}-
12045
12046 [[-{R|raw]]}-
12047 !! html/php
12048 <p>hi
12049 </p><p>{{echo|hi}}
12050 </p><p>[[raw]]
12051 </p>
12052 !! html/parsoid
12053 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12054 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12055 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12056 !! end
12057
12058 !! test
12059 Preprocessor precedence 4: left-most angle bracket
12060 !! options
12061 language=zh
12062 !! wikitext
12063 <!--{raw}-->
12064 !! html/php
12065 !! html/parsoid
12066 <!--{raw}-->
12067 !! end
12068
12069 !! article
12070 Template:Precedence5
12071 !! text
12072 {{{{{1}}}}}
12073 !! endarticle
12074
12075 !! test
12076 Preprocessor precedence 5: tplarg takes precedence over template
12077 !! wikitext
12078 {{Precedence5|Bullet}}
12079 !! html/php
12080 <ul><li>Bar</li></ul>
12081
12082 !! html/parsoid
12083 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12084 !! end
12085
12086 !! test
12087 Preprocessor precedence 6: broken link is rightmost opening
12088 !! options
12089 parsoid=wt2html
12090 !! wikitext
12091 {{echo|[[Foo}}
12092
12093 {{echo|[[Foo|bar|bat=baz}}
12094 !! html/php
12095 <p>{{echo|[[Foo}}
12096 </p><p>{{echo|[[Foo|bar|bat=baz}}
12097 </p>
12098 !! html/parsoid
12099 <p>{{echo|[[Foo}}</p>
12100 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12101 !! end
12102
12103 # This next test exposes a difference between PHP and Parsoid:
12104 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12105 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12106 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12107 # outer `[[Foo` extends until the `y]]`
12108 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12109 # intermediate result (after template expansion), and link processing
12110 # happens on this intermediate result, which moves the wikilink
12111 # boundary leftward to `[[Foo|Bar]]`
12112 # 2b) Parsoid works in a single step, so it's going to keep the
12113 # wikilink as extending to the `y]]`
12114 # 3a) Then PHP does linktrail processing which slurps up the trailing
12115 # `xy` inside the link.
12116 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12117 # `z` inside the link.
12118 # This is "correct" behavior. Parsoid's basic worldview is that the
12119 # `]]` inside the template shouldn't be allowed to leak out to affect
12120 # the surrounding wikilink. PHP may match Parsoid (in the future)
12121 # if you use {{#balance}} (T114445).
12122
12123 !! test
12124 Preprocessor precedence 7: broken template is rightmost opening
12125 !! options
12126 parsoid=wt2html
12127 !! wikitext
12128 [[Foo|{{echo|Bar]]
12129
12130 [[Foo|{{echo|Bar]]-x}}-y]]-z
12131
12132 Careful: linktrails can move the end of the wikilink:
12133 [[Foo|{{echo|y']]a}}l]]l
12134 !! html/php
12135 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12136 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12137 </p><p>Careful: linktrails can move the end of the wikilink:
12138 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12139 </p>
12140 !! html/parsoid
12141 <p>[[Foo|{{echo|Bar]]</p>
12142 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12143 <p>Careful: linktrails can move the end of the wikilink:
12144 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12145 !! end
12146
12147 !! test
12148 Preprocessor precedence 8: broken language converter is rightmost opening
12149 !! options
12150 language=zh
12151 !! wikitext
12152 [[Foo-{R|raw]]
12153 !! html
12154 <p>[[Foo-{R|raw]]
12155 </p>
12156 !! end
12157
12158 !! article
12159 Template:Preprocessor_precedence_9
12160 !! text
12161 ;4: {{{{1}}}}
12162 ;5: {{{{{2}}}}}
12163 ;6: {{{{{{3}}}}}}
12164 ;7: {{{{{{{4}}}}}}}
12165 !! endarticle
12166
12167 !! test
12168 Preprocessor precedence 9: groups of braces
12169 !! wikitext
12170 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12171 !! html/php
12172 <dl><dt>4</dt>
12173 <dd>{Four}</dd>
12174 <dt>5</dt>
12175 <dd></dd></dl>
12176 <ul><li>Bar</li></ul>
12177 <dl><dt>6</dt>
12178 <dd>Four</dd>
12179 <dt>7</dt>
12180 <dd>{Bullet}</dd></dl>
12181
12182 !! html/parsoid
12183 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12184 <dt>4</dt>
12185 <dd>{Four}</dd>
12186 <dt>5</dt>
12187 <dd></dd>
12188 </dl><ul about="#mwt1">
12189 <li>Bar</li>
12190 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12191 <dt>6</dt>
12192 <dd>Four</dd>
12193 <dt>7</dt>
12194 <dd>{Bullet}</dd>
12195 </dl>
12196 !! end
12197
12198 !! article
12199 Template:Preprocessor_precedence_10
12200 !! text
12201 ;1: -{R|raw}-
12202 ;2: -{{Bullet}}-
12203 ;3: -{{{1}}}-
12204 ;4: -{{{{2}}}}-
12205 ;5: -{{{{{3}}}}}-
12206 ;6: -{{{{{{4}}}}}}-
12207 ;7: -{{{{{{{5}}}}}}}-
12208 !! endarticle
12209
12210 !! test
12211 Preprocessor precedence 10: groups of braces with leading dash
12212 !! options
12213 language=zh
12214 !! wikitext
12215 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12216 !! html/php
12217 <dl><dt>1</dt>
12218 <dd>raw</dd>
12219 <dt>2</dt>
12220 <dd>-</dd></dl>
12221 <ul><li>Bar-</li></ul>
12222 <dl><dt>3</dt>
12223 <dd>-Three-</dd>
12224 <dt>4</dt>
12225 <dd>raw2</dd>
12226 <dt>5</dt>
12227 <dd>-</dd></dl>
12228 <ul><li>Bar-</li></ul>
12229 <dl><dt>6</dt>
12230 <dd>-Three-</dd>
12231 <dt>7</dt>
12232 <dd>raw2</dd></dl>
12233
12234 !! html/parsoid
12235 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12236 <dt>1</dt>
12237 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12238 <dt>2</dt>
12239 <dd>-</dd>
12240 </dl><ul about="#mwt1">
12241 <li>Bar-</li>
12242 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12243 <dt>3</dt>
12244 <dd>-Three-</dd>
12245 <dt>4</dt>
12246 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12247 <dt>5</dt>
12248 <dd>-</dd>
12249 </dl><ul about="#mwt1">
12250 <li>Bar-</li>
12251 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12252 <dt>6</dt>
12253 <dd>-Three-</dd>
12254 <dt>7</dt>
12255 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12256 </dl>
12257 !! end
12258
12259 !! test
12260 Preprocessor precedence 11: found during visual diff testing
12261 !! wikitext
12262 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12263
12264 {{echo|-{{echo|-{{echo|x}}}}}}
12265
12266 {{echo|-{{echo|x}}}}
12267 !! html/php
12268 <p><span>-<span>-x</span></span>
12269 </p><p>--x
12270 </p><p>-x
12271 </p>
12272 !! html/parsoid
12273 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12274
12275 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12276
12277 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12278 !! end
12279
12280 !! test
12281 Preprocessor precedence 12: broken language converter closed by brace.
12282 !! options
12283 parsoid=wt2html
12284 !! wikitext
12285 This form breaks the template, which is unfortunate:
12286 *{{echo|foo-{bar}bat}}
12287
12288 But if the broken language converter markup is inside an extension
12289 tag, nothing bad happens:
12290 *<nowiki>foo-{bar}bat</nowiki>
12291 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12292 *<pre>foo-{bar}bat</pre>
12293 *{{echo|<pre>foo-{bar}bat</pre>}}
12294
12295 <tag>foo-{bar}bat</tag>
12296 {{echo|<tag>foo-{bar}bat</tag>}}
12297
12298 !! html/php+tidy
12299 <p>This form breaks the template, which is unfortunate:
12300 </p>
12301 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12302 <p>But if the broken language converter markup is inside an extension
12303 tag, nothing bad happens:
12304 </p>
12305 <ul><li>foo-&#123;bar}bat</li>
12306 <li>foo-&#123;bar}bat</li>
12307 <li><pre>foo-{bar}bat</pre></li>
12308 <li><pre>foo-{bar}bat</pre></li></ul>
12309 <pre>'foo-{bar}bat'
12310 array (
12311 )
12312 </pre>
12313 <pre>'foo-{bar}bat'
12314 array (
12315 )
12316 </pre>
12317 !! html/parsoid
12318 <p>This form breaks the template, which is unfortunate:</p>
12319 <ul>
12320 <li>{{echo|foo-{bar}bat}}</li>
12321 </ul>
12322 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12323 <ul>
12324 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12325 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12326 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12327 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12328 </ul>
12329 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12330 !! end
12331
12332 !! test
12333 Preprocessor precedence 13: broken language converter in external link
12334 !! options
12335 parsoid=wt2html
12336 !! wikitext
12337 *[http://example.com/-{foo Example in URL]
12338 *[http://example.com Example in -{link} description]
12339 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12340 !! html/php+tidy
12341 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12342 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12343 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12344 !! html/parsoid
12345 <ul>
12346 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12347 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12348 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12349 </ul>
12350 !! end
12351
12352 !! test
12353 Preprocessor precedence 14: broken language converter in comment
12354 !! wikitext
12355 *<!--{{foo}}-->...should be ok
12356 *<!---{{foo}}-->...extra dashes
12357 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12358 !! html/php+tidy
12359 <ul><li>...should be ok</li>
12360 <li>...extra dashes</li>
12361 <li>foobat...should be ok</li></ul>
12362 !! html/parsoid
12363 <ul>
12364 <li><!--{{foo}}-->...should be ok</li>
12365 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12366 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12367 </ul>
12368 !! end
12369
12370 !! test
12371 Preprocessor precedence 15: broken brace markup in headings
12372 !! config
12373 wgFragmentMode=[ 'html5', 'legacy' ]
12374 !! options
12375 parsoid=wt2html
12376 !! wikitext
12377 __NOTOC__ __NOEDITSECTION__
12378 ===1 foo[bar 1===
12379 1
12380 ===2 foo[[bar 2===
12381 2
12382 ===3 foo{bar 3===
12383 3
12384 ===4 foo{{bar 4===
12385 4
12386 ===5 foo{{{bar 5===
12387 5
12388 ===6 foo-{bar 6===
12389 6
12390 !! html/php+tidy
12391 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12392 <p>1
12393 </p>
12394 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12395 <p>2
12396 </p>
12397 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12398 <p>3
12399 </p>
12400 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12401 <p>4
12402 </p>
12403 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12404 <p>5
12405 </p>
12406 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12407 <p>6
12408 </p>
12409 !! html/parsoid
12410 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12411 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12412 <p>1</p>
12413 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12414 <p>2</p>
12415 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12416 <p>3</p>
12417 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12418 <p>4</p>
12419 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12420 <p>5</p>
12421 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12422 <p>6</p>
12423 !! end
12424
12425 !! test
12426 Preprocessor precedence 16: matching closing braces to opening braces
12427 !! options
12428 language=zh
12429 parsoid=wt2html
12430 !! wikitext
12431 -{{{echo|foo}}bar}-
12432 !! html/php
12433 <p>foobar
12434 </p>
12435 !! html/parsoid
12436 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12437 !! end
12438
12439 !! test
12440 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12441 !! options
12442 parsoid=wt2html
12443 !! wikitext
12444 {{echo|hi {{}}}}
12445 !! html/php
12446 <p>hi {{}}
12447 </p>
12448 !! html/parsoid
12449 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12450 !! end
12451
12452 ###
12453 ### Token Stream Patcher tests
12454 ###
12455 ### These tests won't always pass wt2wt and other modes because
12456 ### on serialization, the table will be output on a new line.
12457 ### For now, we are blacklisting them, and using this to test selser.
12458 ###
12459
12460 !!test
12461 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12462 !!options
12463 parsoid=wt2html,wt2wt
12464 !!wikitext
12465 {{echo|}}{| width = '100%'
12466 |foo
12467 |}
12468 !!html/parsoid
12469 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12470 <tbody><tr><td>foo</td></tr>
12471 </tbody></table>
12472 !!end
12473
12474 ## We used to, but no longer wt2wt this test since the default serializer
12475 ## will normalize the include directives to serialize on their own line.
12476 ## Selser will take care of preserving formatting in scenarios where they
12477 ## intermingled with other wikitext.
12478 !!test
12479 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12480 !!options
12481 parsoid=wt2html
12482 !!wikitext
12483 <includeonly>a</includeonly>{| {{{b}}}
12484 |c
12485 |}
12486 !!html/parsoid
12487 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12488 <tbody><tr><td>c</td></tr>
12489 </tbody></table>
12490 !!end
12491
12492 !! test
12493 Table wikitext syntax outside wiki-tables
12494 !! wikitext
12495 a
12496 |+ not a caption
12497 ! not a table heading
12498 |- not a table row
12499 | not a table cell
12500 | class="foo bar" | baz
12501 b
12502 |}
12503 |-
12504 c
12505 !! html
12506 <p>a
12507 |+ not a caption
12508 ! not a table heading
12509 |- not a table row
12510 | not a table cell
12511 | class="foo bar" | baz
12512 b
12513 |}
12514 |-
12515 c
12516 </p>
12517 !! end
12518
12519 ###
12520 ### Testing parsing of templates where a template arg
12521 ### has the same name as the template itself.
12522 ###
12523
12524 !! article
12525 Template:quote
12526 !! text
12527 {{{quote|{{{1}}}}}}
12528 !! endarticle
12529
12530 !!test
12531 Templates: Template Name/Arg clash: 1. Use of positional param
12532 !! wikitext
12533 {{quote|foo}}
12534 !! html
12535 <p>foo
12536 </p>
12537 !!end
12538
12539 !!test
12540 Templates: Template Name/Arg clash: 2. Use of named param
12541 !! wikitext
12542 {{quote|quote=foo}}
12543 !! html
12544 <p>foo
12545 </p>
12546 !!end
12547
12548 !!test
12549 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12550 !! wikitext
12551 {{quote|quote}}
12552 !! html
12553 <p>quote
12554 </p>
12555 !!end
12556
12557 ###
12558 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12559 ###
12560
12561 !!test
12562 Templates: 1. Simple use
12563 !! wikitext
12564 {{echo|Foo}}
12565 !! html
12566 <p>Foo
12567 </p>
12568 !!end
12569
12570 !!test
12571 Templates: 2. Inside a block tag
12572 !! wikitext
12573 <div>{{echo|Foo}}</div>
12574 <blockquote>{{echo|Foo}}</blockquote>
12575 !! html
12576 <div>Foo</div>
12577 <blockquote>Foo</blockquote>
12578
12579 !! html+tidy
12580 <div>Foo</div>
12581 <blockquote><p>Foo</p></blockquote>
12582 !!end
12583
12584 !!test
12585 Templates: P-wrapping: 1a. Templates on consecutive lines
12586 !! wikitext
12587 {{echo|Foo}}
12588 {{echo|bar}}
12589 !! html
12590 <p>Foo
12591 bar
12592 </p>
12593 !!end
12594
12595 !!test
12596 Templates: P-wrapping: 1b. Templates on consecutive lines
12597 !! wikitext
12598 Foo
12599
12600 {{echo|bar}}
12601 {{echo|baz}}
12602 !! html
12603 <p>Foo
12604 </p><p>bar
12605 baz
12606 </p>
12607 !!end
12608
12609 !!test
12610 Templates: P-wrapping: 1c. Templates on consecutive lines
12611 !! wikitext
12612 {{echo|Foo}}
12613 {{echo|bar}} <div>baz</div>
12614 !! html
12615 <p>Foo
12616 </p>
12617 bar <div>baz</div>
12618
12619 !! html+tidy
12620 <p>Foo
12621 </p><p>
12622 bar </p><div>baz</div>
12623 !! end
12624
12625 !!test
12626 Templates: P-wrapping: 1d. Template preceded by comment-only line
12627 !!options
12628 parsoid
12629 !! wikitext
12630 <!-- foo -->
12631 {{echo|Bar}}
12632 !! html
12633 <!-- foo -->
12634
12635 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12636 !!end
12637
12638 !!test
12639 Templates: Inline Text: 1. Multiple template uses
12640 !! wikitext
12641 {{echo|Foo}}bar{{echo|baz}}
12642 !! html
12643 <p>Foobarbaz
12644 </p>
12645 !!end
12646
12647 !!test
12648 Templates: Inline Text: 2. Back-to-back template uses
12649 !! wikitext
12650 {{echo|Foo}}{{echo|bar}}
12651 !! html
12652 <p>Foobar
12653 </p>
12654 !!end
12655
12656 !!test
12657 Templates: Block Tags: 1. Multiple template uses
12658 !! wikitext
12659 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12660 !! html
12661 <div>Foo</div><div>bar</div><div>baz</div>
12662
12663 !!end
12664
12665 !!test
12666 Templates: Block Tags: 2. Back-to-back template uses
12667 !! wikitext
12668 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12669 !! html
12670 <div>Foo</div><div>bar</div>
12671
12672 !!end
12673
12674 # This is an edge case relating to paragraph wrapping.
12675 !!test
12676 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12677 !! wikitext
12678 {{echo|a
12679 b</p>}}
12680 !! html/parsoid
12681 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
12682 b</p>
12683 !!end
12684
12685 !!test
12686 Templates: Links: 1. Simple example
12687 !! wikitext
12688 {{echo|[[Foo|bar]]}}
12689 !! html
12690 <p><a href="/wiki/Foo" title="Foo">bar</a>
12691 </p>
12692 !!end
12693
12694 !!test
12695 Templates: Links: 2. Generation of link href
12696 !! wikitext
12697 [[{{echo|Foo}}|bar]]
12698 !! html
12699 <p><a href="/wiki/Foo" title="Foo">bar</a>
12700 </p>
12701 !!end
12702
12703 !!test
12704 Templates: Links: 3. Generation of part of a link href
12705 !! wikitext
12706 [[Fo{{echo|o}}|bar]]
12707
12708 [[Foo{{echo|bar}}]]
12709
12710 [[Foo{{echo|bar}}baz]]
12711
12712 [[Foo{{echo|bar}}|bar]]
12713
12714 [[:Foo{{echo|bar}}]]
12715
12716 [[:Foo{{echo|bar}}|bar]]
12717 !! html
12718 <p><a href="/wiki/Foo" title="Foo">bar</a>
12719 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12720 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12721 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12722 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12723 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12724 </p>
12725 !!end
12726
12727 !!test
12728 Templates: Links: 4. Multiple templates generating link href
12729 !! wikitext
12730 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12731 !! html
12732 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12733 </p>
12734 !!end
12735
12736 !!test
12737 Templates: Links: 5. Generation of link text
12738 !! wikitext
12739 [[Foo|{{echo|bar}}]]
12740 !! html
12741 <p><a href="/wiki/Foo" title="Foo">bar</a>
12742 </p>
12743 !!end
12744
12745 !!test
12746 Templates: Links: 5. Nested templates (only outermost template should be marked)
12747 !! wikitext
12748 {{echo|[[{{echo|Foo}}|bar]]}}
12749 !! html
12750 <p><a href="/wiki/Foo" title="Foo">bar</a>
12751 </p>
12752 !!end
12753
12754 !!test
12755 Templates: HTML Tag: 1. Generation of HTML attr. key
12756 !! wikitext
12757 <div {{echo|style}}="color:red;">foo</div>
12758 !! html
12759 <div style="color:red;">foo</div>
12760
12761 !!end
12762
12763 !!test
12764 Templates: HTML Tag: 2. Generation of HTML attr. value
12765 !! wikitext
12766 <div style={{echo|'color:red;'}}>foo</div>
12767 !! html
12768 <div style="color:red;">foo</div>
12769
12770 !!end
12771
12772 !!test
12773 Templates: HTML Tag: 3. Generation of HTML attr key and value
12774 !! wikitext
12775 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12776 !! html
12777 <div style="color:red;">foo</div>
12778
12779 !!end
12780
12781 !!test
12782 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12783 !! wikitext
12784 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12785 !! html
12786 <div title="This is a long title with just one piece templated">foo</div>
12787
12788 !!end
12789
12790 !!test
12791 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12792 !! wikitext
12793 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12794 !! html
12795 <div title="This is a long title with just one piece templated">foo</div>
12796
12797 !!end
12798
12799 !!test
12800 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12801 !! wikitext
12802 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12803 !! html
12804 <div title="This is a long title with just one piece templated">foo</div>
12805
12806 !!end
12807
12808 # SSS FIXME: While it is great we added support for all this,
12809 # do we want to make this part of the spec? Maybe we want to
12810 # deprecate this kind of usage in the future?
12811 !!test
12812 Templates: HTML Tag: 7. Generation of partial attribute key string
12813 !! wikitext
12814 <div st{{echo|yle}}="color:red;">foo</div>
12815 !! html
12816 <div style="color:red;">foo</div>
12817
12818 !!end
12819
12820 !! test
12821 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12822 !! wikitext
12823 <div {{echo|1=id="v1"}}>bar</div>
12824 !! html
12825 <div id="v1">bar</div>
12826
12827 !!end
12828
12829 !! test
12830 Templates: HTML Tag: 9. Multiple template-generated attributes
12831 !! wikitext
12832 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12833 !! html
12834 <div id="v1" title="foo">bar</div>
12835
12836 !!end
12837
12838 !! test
12839 Templates: Support for templates generating attributes and content
12840 !! wikitext
12841 {| {{mixed_attr_content_template}}
12842 |-
12843 |bar
12844 |}
12845 !! html/php
12846 <table style="color:red;" title="T48811">
12847
12848 <tr>
12849 <td>foo
12850 </td></tr>
12851 <tr>
12852 <td>bar
12853 </td></tr></table>
12854
12855 !! html/parsoid
12856 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
12857 <tbody><tr>
12858 <td>foo</td></tr>
12859 <tr>
12860 <td>bar</td></tr>
12861 </tbody></table>
12862 !!end
12863
12864 !! test
12865 1. Entities and nowikis inside templated attributes should be handled correctly
12866 !! wikitext
12867 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12868 !! html/php
12869 <div style="background:#f9f9f9;">foo</div>
12870
12871 !! html/parsoid
12872 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
12873 !! end
12874
12875 !! test
12876 2. Entities and nowikis inside templated attributes should be handled correctly
12877 !! wikitext
12878 {|
12879 |{{table_attribs_3}}
12880 |}
12881 !! html/php
12882 <table>
12883 <tr>
12884 <td style="background:#f9f9f9;">Foo
12885 </td></tr></table>
12886
12887 !! html/parsoid
12888 <table>
12889 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
12890 </tbody></table>
12891 !! end
12892
12893 !! test
12894 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12895 !! wikitext
12896 {{tbl-start}}
12897 |{{table_attribs_3}}
12898 {{tbl-end}}
12899 !! html/php
12900 <table>
12901 <tr>
12902 <td style="background:#f9f9f9;">Foo
12903 </td></tr></table>
12904
12905 !! html/parsoid
12906 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
12907 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12908 </tbody></table>
12909 !! end
12910
12911 # T107622
12912 !! test
12913 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12914 !! wikitext
12915 {|
12916 |{{table_attribs_6}} hi
12917 |}
12918 !! html/php
12919 <table>
12920 <tr>
12921 <td style="background: red;">hi
12922 </td></tr></table>
12923
12924 !! html/parsoid
12925 <table>
12926 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
12927 </tbody></table>
12928 !! end
12929
12930 !!test
12931 Templates: HTML Tables: 1. Generating start of a HTML table
12932 !! wikitext
12933 {{echo|<table><tr><td>foo</td>}}</tr></table>
12934 !! html
12935 <table><tr><td>foo</td></tr></table>
12936
12937 !!end
12938
12939 !!test
12940 Templates: HTML Tables: 2a. Generating middle of a HTML table
12941 !! wikitext
12942 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12943 !! html
12944 <table><tr><td>foo</td></tr></table>
12945
12946 !!end
12947
12948 !!test
12949 Templates: HTML Tables: 2b. Generating middle of a HTML table
12950 !! wikitext
12951 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12952 !! html
12953 <table><tr><td>foo</td></tr></table>
12954
12955 !!end
12956
12957 !!test
12958 Templates: HTML Tables: 3. Generating end of a HTML table
12959 !! wikitext
12960 <table><tr>{{echo|<td>foo</td></tr></table>}}
12961 !! html
12962 <table><tr><td>foo</td></tr></table>
12963
12964 !!end
12965
12966 !!test
12967 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12968 !! wikitext
12969 {{echo|<table>}}<tr><td>foo</td></tr></table>
12970 !! html
12971 <table><tr><td>foo</td></tr></table>
12972
12973 !!end
12974
12975 !!test
12976 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12977 !! wikitext
12978 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12979 !! html
12980 <table><tr><td>foo</td></tr></table>
12981
12982 !!end
12983
12984 !!test
12985 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12986 !! wikitext
12987 <table><tr>{{echo|<td>}}foo</td></tr></table>
12988 !! html
12989 <table><tr><td>foo</td></tr></table>
12990
12991 !!end
12992
12993 !!test
12994 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12995 !! wikitext
12996 <table><tr><td>foo{{echo|</td>}}</tr></table>
12997 !! html
12998 <table><tr><td>foo</td></tr></table>
12999
13000 !!end
13001
13002 !!test
13003 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13004 !! wikitext
13005 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13006 !! html
13007 <table><tr><td>foo</td></tr></table>
13008
13009 !!end
13010
13011 !!test
13012 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13013 !! wikitext
13014 <table><tr><td>foo</td></tr>{{echo|</table>}}
13015 !! html
13016 <table><tr><td>foo</td></tr></table>
13017
13018 !!end
13019
13020 !!test
13021 Templates: HTML Tables: 5. Proper fostering of categories from inside
13022 !!options
13023 parsoid=wt2html,wt2wt
13024 !! wikitext
13025 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13026 <!--Two categories (T52330)-->
13027 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13028 !! html
13029 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13030 <!--Two categories (T52330)-->
13031 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
13032 !!end
13033
13034 !!test
13035 Templates: Wiki Tables: 1a. Fostering of entire template content
13036 !! wikitext
13037 {|
13038 {{echo|a}}
13039 |}
13040 !! html
13041 <table>
13042 a
13043 <tr><td></td></tr></table>
13044
13045 !! html/php+tidy
13046
13047 a
13048 <table><tbody><tr><td></td></tr></tbody></table>
13049 !! html/parsoid
13050 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13051
13052 </table>
13053 !! end
13054
13055 !!test
13056 Templates: Wiki Tables: 1b. Fostering of entire template content
13057 !! wikitext
13058 {|
13059 {{echo|<div>}}
13060 foo
13061 {{echo|</div>}}
13062 |}
13063 !! html
13064 <table>
13065 <div>
13066 <p>foo
13067 </p>
13068 </div>
13069 <tr><td></td></tr></table>
13070
13071 !! html/php+tidy
13072 <div>
13073 <p>foo
13074 </p>
13075 </div><table>
13076
13077 <tbody><tr><td></td></tr></tbody></table>
13078 !! html/parsoid
13079 <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
13080 <p>foo</p>
13081 </div><table about="#mwt3">
13082
13083 </table>
13084 !! end
13085
13086 !!test
13087 Templates: Wiki Tables: 2. Fostering of partial template content
13088 !! wikitext
13089 {|
13090 {{echo|a
13091 <div>b</div>}}
13092 |}
13093 !! html
13094 <table>
13095 a
13096 <div>b</div>
13097 <tr><td></td></tr></table>
13098
13099 !! html/php+tidy
13100
13101 a
13102 <div>b</div><table>
13103 <tbody><tr><td></td></tr></tbody></table>
13104 !! html/parsoid
13105 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13106
13107
13108 </table>
13109 !! end
13110
13111 !!test
13112 Templates: Wiki Tables: 3. td-content via multiple templates
13113 !! wikitext
13114 {|
13115 {{echo|{{pipe}}a}}{{echo|b}}
13116 |}
13117 !! html
13118 <table>
13119 <tr>
13120 <td>ab
13121 </td></tr></table>
13122
13123 !!end
13124
13125 !!test
13126 Templates: Wiki Tables: 4. Templated tags, no content
13127 !! wikitext
13128 {{tbl-start}}
13129 {{tbl-end}}
13130 !! html
13131 <table>
13132 <tr><td></td></tr></table>
13133
13134 !!end
13135
13136 !!test
13137 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13138 !! wikitext
13139 {{tbl-start}}
13140 |foo
13141 {{tbl-end}}
13142 !! html
13143 <table>
13144 <tr>
13145 <td>foo
13146 </td></tr></table>
13147
13148 !!end
13149
13150 !!test
13151 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13152 !! wikitext
13153 {{tbl-start}}
13154 {{!}}foo
13155 {{tbl-end}}
13156 !! html
13157 <table>
13158 <tr>
13159 <td>foo
13160 </td></tr></table>
13161
13162 !!end
13163
13164 ## This test case is very specific to Parsoid's internals
13165 ## and is hence only tested for Parsoid's code. Parsoid uses
13166 ## a <meta> marker tag for <ref> tags and they are expanded
13167 ## much later. We are verifying that this <meta> tag usage
13168 ## doesn't prevent foster parenting.
13169 !!test
13170 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13171 !!wikitext
13172 {{PartialTable}}<ref>foo</ref>
13173 |}
13174
13175 <references />
13176 !!html/parsoid
13177 <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
13178 <tbody>
13179 </tbody></table>
13180
13181 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13182 !!end
13183
13184 !! test
13185 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13186 !! wikitext
13187 {{echo|
13188 {{{!}}
13189 {{!}}-}}
13190 <onlyinclude>
13191 |foo
13192 </onlyinclude>
13193 {{!}}}
13194 !! html/parsoid
13195 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
13196 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13197 <tbody><tr>
13198
13199 <td>foo
13200 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13201 </tbody></table>
13202 !! end
13203
13204 !!test
13205 Templates: Lists: Multi-line list-items via templates
13206 !! wikitext
13207 *{{echo|a {{nonexistent|
13208 unused}}}}
13209 *{{echo|b {{nonexistent|
13210 unused}}}}
13211 !! html
13212 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
13213 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
13214
13215 !!end
13216
13217 !!test
13218 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13219 !! wikitext
13220 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13221 !! html
13222 <p><i>ab</i>c<i>d</i>e
13223 </p>
13224 !!end
13225
13226 !!test
13227 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13228 (PHP parser generates misnested html)
13229 !! wikitext
13230 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13231 !! html/parsoid
13232 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
13233 !!end
13234
13235 !!test
13236 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13237 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13238 !! options
13239 parsoid=wt2html,wt2wt
13240 !! wikitext
13241 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13242 !! html
13243 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
13244 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
13245 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
13246 !!end
13247
13248 !!test
13249 Templates: Ugly nesting: 4. Divs opened/closed across templates
13250 !! wikitext
13251 a<div>b{{echo|c</div>d}}e
13252 !! html
13253 a<div>bc</div>de
13254
13255 !! html+tidy
13256 <p>a</p><div>bc</div><p>de
13257 </p>
13258 !! end
13259
13260 !! test
13261 Templates: Ugly templates: 3. newline-only template parameter
13262 !! wikitext
13263 foo {{echo|
13264 }}
13265 !! html
13266 <p>foo
13267 </p>
13268 !! end
13269
13270 # This looks like a bug: a single newline triggers p/br for some reason.
13271 !! test
13272 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13273 !! wikitext
13274 {{echo|
13275 }}
13276 !! html
13277 <p><br />
13278 </p>
13279 !! end
13280
13281 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13282 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13283 !! test
13284 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13285 !! wikitext
13286 {{echo|<table>}}
13287 {{echo|<div>foo}}
13288 {{echo|</table>}}
13289 !! html/parsoid
13290 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
13291 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13292 </table>
13293 !! end
13294
13295 # T66017 -- ugly wikitext with fostered content generates two template ranges
13296 # that are "identical" and generate nesting cycles in the algorithm
13297 !! test
13298 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13299 !! wikitext
13300 {{echo|<table><tr><td><table>}}
13301 {{echo|<div>}}
13302 {{echo|</div>}}
13303 !! html/parsoid
13304 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
13305 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13306 </table></td></tr></tbody></table>
13307 !! end
13308
13309 !! test
13310 Templates: Parameters substituted at the top-level
13311 !! wikitext
13312 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13313
13314 {{{foo|bar|baz}}}
13315 !! html/php
13316 <p><i>who</i> me? <b>never!</b>
13317 </p><p>bar
13318 </p>
13319 !! html/parsoid
13320 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
13321
13322 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13323 !! end
13324
13325 !! test
13326 Templates: Param with empty arg in the final position
13327 !! wikitext
13328 {{{hi|}}}
13329 !! html/parsoid
13330 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13331 !! end
13332
13333 !!test
13334 Parser Functions: 1. Simple example
13335 !! wikitext
13336 {{uc:foo}}
13337 !! html
13338 <p>FOO
13339 </p>
13340 !!end
13341
13342 !!test
13343 Parser Functions: 2. Nested use (only outermost should be marked up)
13344 !! wikitext
13345 {{uc:{{lc:FOO}}}}
13346 !! html
13347 <p>FOO
13348 </p>
13349 !!end
13350
13351 ###
13352 ### Pre-save transform tests
13353 ###
13354 !! test
13355 pre-save transform: subst:
13356 !! options
13357 pst
13358 !! wikitext
13359 {{subst:test}}
13360 !! html/php
13361 This is a test template
13362 !! end
13363
13364 !! test
13365 pre-save transform: normal template
13366 !! options
13367 pst
13368 !! wikitext
13369 {{test}}
13370 !! html/php
13371 {{test}}
13372 !! end
13373
13374 !! test
13375 pre-save transform: nonexistent template
13376 !! options
13377 pst
13378 !! wikitext
13379 {{thistemplatedoesnotexist}}
13380 !! html/php
13381 {{thistemplatedoesnotexist}}
13382 !! end
13383
13384 !! test
13385 pre-save transform: subst magic variables
13386 !! options
13387 pst
13388 !! wikitext
13389 {{subst:SITENAME}}
13390 !! html/php
13391 MediaWiki
13392 !! end
13393
13394 # This is T2089, which I fixed. -- wtm
13395 !! test
13396 pre-save transform: subst: templates with parameters
13397 !! options
13398 pst
13399 !! wikitext
13400 {{subst:paramtest|param="something else"}}
13401 !! html/php
13402 This is a test template with parameter "something else"
13403 !! end
13404
13405 !! article
13406 Template:nowikitest
13407 !! text
13408 <nowiki>'''not wiki'''</nowiki>
13409 !! endarticle
13410
13411 !! test
13412 pre-save transform: nowiki in subst (T3188)
13413 !! options
13414 pst
13415 !! wikitext
13416 {{subst:nowikitest}}
13417 !! html/php
13418 <nowiki>'''not wiki'''</nowiki>
13419 !! end
13420
13421 !! article
13422 Template:commenttest
13423 !! text
13424 This template has <!-- a comment --> in it.
13425 !! endarticle
13426
13427 !! test
13428 pre-save transform: comment in subst (T3936)
13429 !! options
13430 pst
13431 !! wikitext
13432 {{subst:commenttest}}
13433 !! html/php
13434 This template has <!-- a comment --> in it.
13435 !! end
13436
13437 !! test
13438 pre-save transform: unclosed tag
13439 !! options
13440 pst
13441 !! wikitext
13442 <nowiki>'''not wiki'''
13443 !! html/php
13444 <nowiki>'''not wiki'''
13445 !! end
13446
13447 !! test
13448 pre-save transform: mixed tag case
13449 !! options
13450 pst
13451 !! wikitext
13452 <NOwiki>'''not wiki'''</noWIKI>
13453 !! html/php
13454 <NOwiki>'''not wiki'''</noWIKI>
13455 !! end
13456
13457 !! test
13458 pre-save transform: unclosed comment in <nowiki>
13459 !! options
13460 pst
13461 !! wikitext
13462 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13463 !! html/php
13464 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13465 !!end
13466
13467 # Leading @ in this template definition works around a limitation
13468 # in parsoid's parserTests which otherwise strips the <span> from the
13469 # result (confusing it for a template wrapper)
13470 !! article
13471 Template:dangerous
13472 !!text
13473 @<span onmouseover="alert('crap')">Oh no</span>
13474 !!endarticle
13475
13476 !!test
13477 (confirming safety of fix for subst T3936)
13478 !! wikitext
13479 {{Template:dangerous}}
13480 !! html
13481 <p>@<span>Oh no</span>
13482 </p>
13483 !! end
13484
13485 !! test
13486 pre-save transform: comment containing gallery (T7024)
13487 !! options
13488 pst
13489 !! wikitext
13490 <!-- <gallery>data</gallery> -->
13491 !! html/php
13492 <!-- <gallery>data</gallery> -->
13493 !!end
13494
13495 !! test
13496 pre-save transform: comment containing extension
13497 !! options
13498 pst
13499 !! wikitext
13500 <!-- <tag>data</tag> -->
13501 !! html/php
13502 <!-- <tag>data</tag> -->
13503 !!end
13504
13505 !! test
13506 pre-save transform: comment containing nowiki
13507 !! options
13508 pst
13509 !! wikitext
13510 <!-- <nowiki>data</nowiki> -->
13511 !! html/php
13512 <!-- <nowiki>data</nowiki> -->
13513 !!end
13514
13515 !! test
13516 pre-save transform: <noinclude> in subst (T5298)
13517 !! options
13518 pst
13519 !! wikitext
13520 {{subst:Includes}}
13521 !! html/php
13522 Foobar
13523 !! end
13524
13525 !! test
13526 pre-save transform: <onlyinclude> in subst (T5298)
13527 !! options
13528 pst
13529 !! wikitext
13530 {{subst:Includes2}}
13531 !! html/php
13532 Foo
13533 !! end
13534
13535 !! article
13536 Template:SubstTest
13537 !!text
13538 {{<includeonly>subst:</includeonly>Includes}}
13539 !! endarticle
13540
13541 !! article
13542 Template:SafeSubstTest
13543 !! text
13544 {{<includeonly>safesubst:</includeonly>Includes}}
13545 !! endarticle
13546
13547 !! test
13548 T24297: safesubst: works during PST
13549 !! options
13550 pst
13551 !! wikitext
13552 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13553 !! html/php
13554 FoobarFoobar
13555 !! end
13556
13557 !! test
13558 T24297: safesubst: works during normal parse
13559 !! wikitext
13560 {{SafeSubstTest}}
13561 !! html
13562 <p>Foobar
13563 </p>
13564 !! end
13565
13566 !! test
13567 subst: does not work during normal parse
13568 !! wikitext
13569 {{SubstTest}}
13570 !! html
13571 <p>{{subst:Includes}}
13572 </p>
13573 !! end
13574
13575 !! test
13576 pre-save transform: context links ("pipe trick")
13577 !! options
13578 pst
13579 !! wikitext
13580 [[Article (context)|]]
13581 [[Bar:Article|]]
13582 [[:Bar:Article|]]
13583 [[Bar:Article (context)|]]
13584 [[:Bar:Article (context)|]]
13585 [[|Article]]
13586 [[|Article (context)]]
13587 [[Bar:X (Y) Z|]]
13588 [[:Bar:X (Y) Z|]]
13589 !! html/php
13590 [[Article (context)|Article]]
13591 [[Bar:Article|Article]]
13592 [[:Bar:Article|Article]]
13593 [[Bar:Article (context)|Article]]
13594 [[:Bar:Article (context)|Article]]
13595 [[Article]]
13596 [[Article (context)]]
13597 [[Bar:X (Y) Z|X (Y) Z]]
13598 [[:Bar:X (Y) Z|X (Y) Z]]
13599 !! end
13600
13601 !! test
13602 pre-save transform: context links ("pipe trick") with interwiki prefix
13603 !! options
13604 pst
13605 !! wikitext
13606 [[interwiki:Article|]]
13607 [[:interwiki:Article|]]
13608 [[interwiki:Bar:Article|]]
13609 [[:interwiki:Bar:Article|]]
13610 !! html/php
13611 [[interwiki:Article|Article]]
13612 [[:interwiki:Article|Article]]
13613 [[interwiki:Bar:Article|Bar:Article]]
13614 [[:interwiki:Bar:Article|Bar:Article]]
13615 !! end
13616
13617 !! test
13618 pre-save transform: context links ("pipe trick") with parens in title
13619 !! options
13620 pst title=[[Somearticle (context)]]
13621 !! wikitext
13622 [[|Article]]
13623 !! html/php
13624 [[Article (context)|Article]]
13625 !! end
13626
13627 !! test
13628 pre-save transform: context links ("pipe trick") with comma in title
13629 !! options
13630 pst title=[[Someplace, Somewhere]]
13631 !! wikitext
13632 [[|Otherplace]]
13633 [[Otherplace, Elsewhere|]]
13634 [[Otherplace, Elsewhere, Anywhere|]]
13635 !! html/php
13636 [[Otherplace, Somewhere|Otherplace]]
13637 [[Otherplace, Elsewhere|Otherplace]]
13638 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13639 !! end
13640
13641 !! test
13642 pre-save transform: context links ("pipe trick") with parens and comma
13643 !! options
13644 pst title=[[Someplace (IGNORED), Somewhere]]
13645 !! wikitext
13646 [[|Otherplace]]
13647 [[Otherplace (place), Elsewhere|]]
13648 !! html/php
13649 [[Otherplace, Somewhere|Otherplace]]
13650 [[Otherplace (place), Elsewhere|Otherplace]]
13651 !! end
13652
13653 !! test
13654 pre-save transform: context links ("pipe trick") with comma and parens
13655 !! options
13656 pst title=[[Who, me? (context)]]
13657 !! wikitext
13658 [[|Yes, you.]]
13659 [[Me, Myself, and I (1937 song)|]]
13660 !! html/php
13661 [[Yes, you. (context)|Yes, you.]]
13662 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13663 !! end
13664
13665 !! test
13666 pre-save transform: context links ("pipe trick") with namespace
13667 !! options
13668 pst title=[[Ns:Somearticle]]
13669 !! wikitext
13670 [[|Article]]
13671 !! html/php
13672 [[Ns:Article|Article]]
13673 !! end
13674
13675 !! test
13676 pre-save transform: context links ("pipe trick") with namespace and parens
13677 !! options
13678 pst title=[[Ns:Somearticle (context)]]
13679 !! wikitext
13680 [[|Article]]
13681 !! html/php
13682 [[Ns:Article (context)|Article]]
13683 !! end
13684
13685 !! test
13686 pre-save transform: context links ("pipe trick") with namespace and comma
13687 !! options
13688 pst title=[[Ns:Somearticle, Context, Whatever]]
13689 !! wikitext
13690 [[|Article]]
13691 !! html/php
13692 [[Ns:Article, Context, Whatever|Article]]
13693 !! end
13694
13695 !! test
13696 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13697 !! options
13698 pst title=[[Ns:Somearticle, Context (context)]]
13699 !! wikitext
13700 [[|Article]]
13701 !! html/php
13702 [[Ns:Article (context)|Article]]
13703 !! end
13704
13705 !! test
13706 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13707 !! options
13708 pst title=[[Ns:Somearticle (IGNORED), Context]]
13709 !! wikitext
13710 [[|Article]]
13711 !! html/php
13712 [[Ns:Article, Context|Article]]
13713 !! end
13714
13715 !! test
13716 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13717 !! options
13718 pst
13719 !! wikitext
13720 [[Article(context)|]]
13721 [[Bar:Article(context)|]]
13722 [[:Bar:Article(context)|]]
13723 [[|Article(context)]]
13724 [[Bar:X(Y)Z|]]
13725 [[:Bar:X(Y)Z|]]
13726 !! html/php
13727 [[Article(context)|Article]]
13728 [[Bar:Article(context)|Article]]
13729 [[:Bar:Article(context)|Article]]
13730 [[Article(context)]]
13731 [[Bar:X(Y)Z|X(Y)Z]]
13732 [[:Bar:X(Y)Z|X(Y)Z]]
13733 !! end
13734
13735 !! test
13736 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13737 !! options
13738 pst
13739 !! wikitext
13740 [[Article (context)|]]
13741 [[Bar:Article (context)|]]
13742 [[:Bar:Article (context)|]]
13743 [[|Article (context)]]
13744 [[Bar:X (Y) Z|]]
13745 [[:Bar:X (Y) Z|]]
13746 !! html/php
13747 [[Article (context)|Article]]
13748 [[Bar:Article (context)|Article]]
13749 [[:Bar:Article (context)|Article]]
13750 [[Article (context)]]
13751 [[Bar:X (Y) Z|X (Y) Z]]
13752 [[:Bar:X (Y) Z|X (Y) Z]]
13753 !! end
13754
13755 !! test
13756 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13757 !! options
13758 pst
13759 !! wikitext
13760 [[Article(context)|]]
13761 [[Bar:Article(context)|]]
13762 [[:Bar:Article(context)|]]
13763 [[|Article(context)]]
13764 [[Bar:X(Y)Z|]]
13765 [[:Bar:X(Y)Z|]]
13766 !! html/php
13767 [[Article(context)|Article]]
13768 [[Bar:Article(context)|Article]]
13769 [[:Bar:Article(context)|Article]]
13770 [[Article(context)]]
13771 [[Bar:X(Y)Z|X(Y)Z]]
13772 [[:Bar:X(Y)Z|X(Y)Z]]
13773 !! end
13774
13775 !! test
13776 pre-save transform: context links ("pipe trick") with commas (T23660)
13777 !! options
13778 pst
13779 !! wikitext
13780 [[Article (context), context|]]
13781 [[Article (context),context|]]
13782 [[Bar:Article (context), context|]]
13783 [[Bar:Article (context),context|]]
13784 [[:Bar:Article (context), context|]]
13785 [[:Bar:Article (context),context|]]
13786 !! html/php
13787 [[Article (context), context|Article]]
13788 [[Article (context),context|Article]]
13789 [[Bar:Article (context), context|Article]]
13790 [[Bar:Article (context),context|Article]]
13791 [[:Bar:Article (context), context|Article]]
13792 [[:Bar:Article (context),context|Article]]
13793 !! end
13794
13795 !! test
13796 Parsoid: backwards pipe trick
13797 !! wikitext
13798 [[|'''bar''']]
13799 !! html/php
13800 <p>[[|<b>bar</b>]]
13801 </p>
13802 !! html/parsoid
13803 <p>[[|<b>bar</b>]]</p>
13804 !! end
13805
13806 !! test
13807 pre-save transform: trim trailing empty lines
13808 !! options
13809 pst
13810 !! wikitext
13811 Empty lines are trimmed
13812
13813
13814
13815
13816 !! html/php
13817 Empty lines are trimmed
13818 !! end
13819
13820 !! test
13821 pre-save transform: Signature expansion
13822 !! options
13823 pst
13824 !! wikitext
13825 * ~~~
13826 * ~~~~
13827 * ~~~~~
13828 * <noinclude>~~~</noinclude>
13829 * <includeonly>~~~</includeonly>
13830 * <onlyinclude>~~~</onlyinclude>
13831 !! html/php
13832 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13833 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13834 * 00:02, 1 January 1970 (UTC)
13835 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13836 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13837 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13838 !! end
13839
13840
13841 !! test
13842 ParserOutput flags from signature expansion (T84843)
13843 !! options
13844 pst
13845 showflags
13846 !! wikitext
13847 ~~~~
13848 !! html/php
13849 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13850 flags=user-signature
13851 !! end
13852
13853
13854 !! test
13855 pre-save transform: Signature expansion in nowiki tags (T2093)
13856 !! options
13857 pst disabled
13858 !! wikitext
13859 Shall not expand:
13860
13861 <nowiki>~~~~</nowiki>
13862
13863 <includeonly><nowiki>~~~~</nowiki></includeonly>
13864
13865 <noinclude><nowiki>~~~~</nowiki></noinclude>
13866
13867 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13868
13869 {{subst:Foo}} shall be converted to FOO
13870
13871 As well as inside noinclude/onlyinclude
13872 <noinclude>{{subst:Foo}}</noinclude>
13873 <onlyinclude>{{subst:Foo}}</onlyinclude>
13874
13875 But not inside includeonly
13876 <includeonly>{{subst:Foo}}</includeonly>
13877 !! html/php
13878 Shall not expand:
13879
13880 <nowiki>~~~~</nowiki>
13881
13882 <includeonly><nowiki>~~~~</nowiki></includeonly>
13883
13884 <noinclude><nowiki>~~~~</nowiki></noinclude>
13885
13886 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13887
13888 FOO shall be converted to FOO
13889
13890 As well as inside noinclude/onlyinclude
13891 <noinclude>FOO</noinclude>
13892 <onlyinclude>FOO</onlyinclude>
13893
13894 But not inside includeonly
13895 <includeonly>{{subst:Foo}}</includeonly>
13896 !! end
13897
13898 !! test
13899 Parsoid: Recognize nowiki with trailing space in tags
13900 !! options
13901 parsoid=wt2html
13902 !! wikitext
13903 <nowiki ><div>[[foo]]</nowiki >
13904
13905 a<nowiki / >b
13906
13907 c<nowiki />d
13908
13909 e<nowiki/ >f
13910 !! html
13911 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13912 <p>ab</p>
13913 <p>cd</p>
13914 <p>ef</p>
13915 !! end
13916
13917 !! test
13918 Parsoid: Recognize nowiki with odd capitalization
13919 !! options
13920 parsoid=wt2html
13921 !! wikitext
13922 <noWikI ><div>[[foo]]</Nowiki >
13923 !! html
13924 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13925 !! end
13926
13927
13928 !! test
13929 Parsoid: Escape nowiki with trailing space in tags
13930 !! options
13931 parsoid=html2wt
13932 !! html/parsoid
13933 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13934 <p>a&lt;nowiki /&gt;b</p>
13935 <p>c&lt;nowiki/ &gt;d</p>
13936 !! wikitext
13937 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13938
13939 a&lt;nowiki /&gt;b
13940
13941 c&lt;nowiki/ &gt;d
13942 !! end
13943
13944 !! test
13945 Parsoid: Escape weird noWikI capitalizations
13946 !! options
13947 parsoid=html2wt
13948 !! html/parsoid
13949 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13950 !! wikitext
13951 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13952 !! end
13953
13954 ###
13955 ### Message transform tests
13956 ###
13957 !! test
13958 message transform: magic variables
13959 !! options
13960 msg
13961 !! wikitext
13962 {{SITENAME}}
13963 !! html
13964 MediaWiki
13965 !! end
13966
13967 !! test
13968 message transform: should not transform wiki markup
13969 !! options
13970 msg
13971 !! wikitext
13972 ''test''
13973 !! html
13974 ''test''
13975 !! end
13976
13977 !! test
13978 message transform: <noinclude> in transcluded template (T6926)
13979 !! options
13980 msg
13981 !! wikitext
13982 {{Includes}}
13983 !! html
13984 Foobar
13985 !! end
13986
13987 !! test
13988 message transform: <onlyinclude> in transcluded template (T6926)
13989 !! options
13990 msg
13991 !! wikitext
13992 {{Includes2}}
13993 !! html
13994 Foo
13995 !! end
13996
13997 !! test
13998 {{#special:}} page name, known
13999 !! options
14000 msg
14001 !! wikitext
14002 {{#special:Recentchanges}}
14003 !! html
14004 Special:RecentChanges
14005 !! end
14006
14007 !! test
14008 {{#special:}} page name with subpage, known
14009 !! options
14010 msg
14011 !! wikitext
14012 {{#special:Recentchanges/param}}
14013 !! html
14014 Special:RecentChanges/param
14015 !! end
14016
14017 !! test
14018 {{#special:}} page name, unknown
14019 !! options
14020 msg
14021 !! wikitext
14022 {{#special:foobar nonexistent}}
14023 !! html
14024 Special:Foobar nonexistent
14025 !! end
14026
14027 !! test
14028 {{#speciale:}} page name, known
14029 !! options
14030 msg
14031 !! wikitext
14032 {{#speciale:Recentchanges}}
14033 !! html
14034 Special:RecentChanges
14035 !! end
14036
14037 !! test
14038 {{#speciale:}} page name with subpage, known
14039 !! options
14040 msg
14041 !! wikitext
14042 {{#speciale:Recentchanges/param}}
14043 !! html
14044 Special:RecentChanges/param
14045 !! end
14046
14047 !! test
14048 {{#speciale:}} page name, unknown
14049 !! options
14050 msg
14051 !! wikitext
14052 {{#speciale:foobar nonexistent}}
14053 !! html
14054 Special:Foobar_nonexistent
14055 !! end
14056
14057 ###
14058 ### Images
14059 ###
14060 ### For Parsoid-specific tests, see
14061 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14062
14063 !! test
14064 Simple image
14065 !! options
14066 parsoid=wt2html,wt2wt,html2html
14067 !! wikitext
14068 [[Image:foobar.jpg]]
14069 !! html/php
14070 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14071 </p>
14072 !! html/parsoid
14073 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14074 !! end
14075
14076 !! test
14077 Serialize simple image with span wrapper
14078 !! options
14079 parsoid=html2wt
14080 !! html/parsoid
14081 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14082 !! wikitext
14083 [[File:Foobar.jpg]]
14084 !! end
14085
14086 !! test
14087 Simple image (using File: namespace, now canonical)
14088 !! wikitext
14089 [[File:Foobar.jpg]]
14090 !! html/php
14091 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14092 </p>
14093 !! html/parsoid
14094 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14095 !! end
14096
14097 !! test
14098 Right-aligned image
14099 !! wikitext
14100 [[File:Foobar.jpg|right]]
14101 !! html/php
14102 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14103
14104 !! html/parsoid
14105 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14106 !! end
14107
14108 !! test
14109 Image with caption
14110 !! wikitext
14111 [[File:Foobar.jpg|right|Caption text]]
14112 !! html/php
14113 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14114
14115 !! html/parsoid
14116 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14117 !! end
14118
14119 !! test
14120 Image with caption, T55312 #1
14121 !! wikitext
14122 [[File:Foobar.jpg|right|Caption page stuff]]
14123 !! html/php
14124 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14125
14126 !! html/parsoid
14127 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
14128 !! end
14129
14130 !! test
14131 Image with caption, T55312 #2
14132 !! wikitext
14133 [[File:Foobar.jpg|right|Caption page=]]
14134 !! html/php
14135 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14136
14137 !! html/parsoid
14138 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
14139 !! end
14140
14141 !! test
14142 Image with caption, T55312 #3
14143 !! wikitext
14144 [[File:Foobar.jpg|right|Caption page=stuff]]
14145 !! html/php
14146 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14147
14148 !! html/parsoid
14149 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
14150 !! end
14151
14152 !! test
14153 Image caption with pipe entity
14154 !! wikitext
14155 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14156 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14157 !! html/php
14158 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one &#x7c; two</div></div></div>
14159 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14160
14161 !! html/parsoid
14162 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14163 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14164 !! end
14165
14166 !! test
14167 Allow empty links in image captions (T62753)
14168 !! options
14169 thumbsize=220
14170 !! wikitext
14171 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14172 [[]]
14173 [[Link2]]
14174 ]]
14175 !! html/php
14176 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
14177
14178 !! html/parsoid
14179 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
14180 [[]]
14181 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14182 </figcaption></figure>
14183 !! end
14184
14185 !! test
14186 Titles in unlinked images (T23454)
14187 !! wikitext
14188 [[File:Foobar.jpg|link=|stuff]]
14189 !! html/php
14190 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14191 </p>
14192 !! html/parsoid
14193 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"stuff"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
14194 !! end
14195
14196 !! test
14197 Link with empty target
14198 !! wikitext
14199 [[]]
14200 !! html
14201 <p>[[]]
14202 </p>
14203 !! end
14204
14205 !! test
14206 Image with link trail
14207 !! wikitext
14208 Linktrails should not work for images: [[File:Foobar.jpg]]s
14209 !! html/php
14210 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
14211 </p>
14212 !! html/parsoid
14213 <p>Linktrails should not work for images: <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>s</p>
14214 !! end
14215
14216 !! test
14217 Image with empty attribute
14218 !! options
14219 parsoid=wt2html,wt2wt,html2html
14220 !! wikitext
14221 [[File:Foobar.jpg|right||Caption text]]
14222 !! html/php
14223 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14224
14225 !! html/parsoid
14226 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14227 !! end
14228
14229 !! test
14230 1. Block image with individual attributes from templates
14231 !! wikitext
14232 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14233 !! html/php
14234 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14235
14236 !! html/parsoid
14237 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14238 !! end
14239
14240 !! test
14241 2. Block Image with individual attributes from templates
14242 !! wikitext
14243 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14244 !! html/php
14245 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14246
14247 !! html/parsoid
14248 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14249 !! end
14250
14251 !! test
14252 3. Inline image with individual attributes from templates
14253 !! wikitext
14254 [[File:Foobar.jpg|{{echo|50px}}]]
14255 !! html/php
14256 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14257 </p>
14258 !! html/parsoid
14259 <p><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14260 !! end
14261
14262 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14263 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14264 !! test
14265 Image with multiple attributes from the same template
14266 !! wikitext
14267 [[File:Foobar.jpg|{{image_attribs}}]]
14268 !! html/php
14269 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14270
14271 !! html/parsoid
14272 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14273 !! end
14274
14275 !! test
14276 Image with link tails
14277 !! options
14278 thumbsize=220
14279 !! wikitext
14280 123[[File:Foobar.jpg]]456
14281 123[[File:Foobar.jpg|right]]456
14282 123[[File:Foobar.jpg|thumb]]456
14283 !! html/php
14284 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14285 </p>
14286 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
14287 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
14288
14289 !! html/php+tidy
14290 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14291 </p><p>
14292 123</p><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div><p>456
14293 123</p><div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div><p>456
14294 </p>
14295 !! html/parsoid
14296 <p>123<figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>456</p>
14297 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
14298 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
14299 !! end
14300
14301 !! test
14302 Image with multiple captions -- only last one is accepted
14303 !! wikitext
14304 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14305 !! html/php
14306 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14307
14308 !! html/parsoid
14309 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
14310 !! end
14311
14312 !! test
14313 Image with multiple widths -- use last
14314 !! wikitext
14315 [[File:Foobar.jpg|200px|300px|caption]]
14316 !! html/php
14317 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
14318 </p>
14319 !! html/parsoid
14320 <p><figure-inline typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure-inline></p>
14321 !! end
14322
14323 !! test
14324 Image with multiple alignments -- use first (T50664)
14325 !! options
14326 thumbsize=220
14327 !! wikitext
14328 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14329
14330 [[File:Foobar.jpg|middle|text-top|caption]]
14331 !! html/php
14332 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14333 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
14334 </p>
14335 !! html/parsoid
14336 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14337 <p><figure-inline class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14338 !! end
14339
14340 !! test
14341 Image with width attribute at different positions
14342 !! wikitext
14343 [[File:Foobar.jpg|200px|right|Caption]]
14344 [[File:Foobar.jpg|right|200px|Caption]]
14345 [[File:Foobar.jpg|right|Caption|200px]]
14346 !! html/php
14347 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14348 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14349 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14350
14351 !! html/parsoid
14352 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14353 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14354 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14355 !! end
14356
14357 # a sad bit of backward-compatibility
14358 !! test
14359 Image with size specified with pxpx (T15500, T53628)
14360 !! options
14361 parsoid=wt2html,wt2wt,html2html
14362 !! wikitext
14363 [[File:Foobar.jpg|20pxpx]]
14364 [[File:Foobar.jpg|200x20pxpx]]
14365 !! html/php
14366 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
14367 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
14368 </p>
14369 !! html/parsoid
14370 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline> <figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></figure-inline></p>
14371 !! end
14372
14373 !! test
14374 Image with link parameter, wiki target
14375 !! wikitext
14376 [[File:Foobar.jpg|link=Main Page]]
14377 !! html/php
14378 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14379 </p>
14380 !! html/parsoid
14381 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14382 !! end
14383
14384 # parsoid T51293 (part 1)
14385 !! test
14386 Image with link parameter, URL target
14387 !! wikitext
14388 [[File:Foobar.jpg|link=http://example.com/]]
14389 !! html/php
14390 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14391 </p>
14392 !! html/parsoid
14393 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14394 !! end
14395
14396 # parsoid T51293 (part 2)
14397 !! test
14398 Image with link parameter, protocol-less URL target
14399 !! wikitext
14400 [[File:Foobar.jpg|link=//example.com/]]
14401 !! html/php
14402 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14403 </p>
14404 !! html/parsoid
14405 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14406 !! end
14407
14408 !! test
14409 Escaping non-block captions (T107435)
14410 !! options
14411 parsoid={
14412 "modes": ["wt2wt"],
14413 "changes": [
14414 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14415 ]
14416 }
14417 !! wikitext
14418 [[Image:Foobar.jpg|caption]]
14419 !! wikitext/edited
14420 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14421 !! end
14422
14423 # wgExternalLinkTarget not supported by Parsoid
14424 !! test
14425 Image with link parameter, wgExternalLinkTarget
14426 !! wikitext
14427 [[Image:foobar.jpg|link=http://example.com/]]
14428 !! config
14429 wgExternalLinkTarget='foobar'
14430 !! html/php
14431 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14432 </p>
14433 !! end
14434
14435 !! test
14436 Image with link parameter, wgNoFollowLinks set to false
14437 !! wikitext
14438 [[Image:foobar.jpg|link=http://example.com/]]
14439 !! config
14440 wgNoFollowLinks=false
14441 !! html/php
14442 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14443 </p>
14444 !! end
14445
14446 !! test
14447 Image with link parameter, wgNoFollowDomainExceptions
14448 !! wikitext
14449 [[Image:foobar.jpg|link=http://example.com/]]
14450 !! config
14451 wgNoFollowDomainExceptions='example.com'
14452 !! html/php
14453 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14454 </p>
14455 !! end
14456
14457 # wgExternalLinkTarget not supported by Parsoid
14458 !! test
14459 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14460 !! wikitext
14461 [[Image:foobar.jpg|link=http://example.com/|Title]]
14462 !! config
14463 wgExternalLinkTarget='foobar'
14464 !! html/php
14465 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14466 </p>
14467 !! end
14468
14469 !! test
14470 Image with empty link parameter
14471 !! wikitext
14472 [[File:Foobar.jpg|link=]]
14473 !! html/php
14474 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14475 </p>
14476 !! html/parsoid
14477 <p><figure-inline class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
14478 !! end
14479
14480 !! test
14481 Image with link parameter (wiki target) and unnamed parameter
14482 !! wikitext
14483 [[File:Foobar.jpg|link=Main_Page|Title]]
14484 !! html/php
14485 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14486 </p>
14487 !! html/parsoid
14488 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14489 !! end
14490
14491 !! test
14492 Image with link parameter (URL target) and unnamed parameter
14493 !! wikitext
14494 [[File:Foobar.jpg|link=http://example.com/|Title]]
14495 !! html/php
14496 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14497 </p>
14498 !! html/parsoid
14499 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14500 !! end
14501
14502 !! test
14503 Thumbnail image with link parameter
14504 !! options
14505 thumbsize=220
14506 parsoid=wt2html,wt2wt,html2html
14507 !! wikitext
14508 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14509 !! html/php
14510 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14511
14512 !! html/parsoid
14513 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
14514 !! end
14515
14516 !! test
14517 Manually-specified thumbnail image
14518 !! options
14519 thumbsize=220
14520 !! wikitext
14521 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14522 !! html/php
14523 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14524
14525 !! html/parsoid
14526 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14527 !! end
14528
14529 !! test
14530 Manually-specified thumbnail image with explicit link to wiki page
14531 !! options
14532 thumbsize=220
14533 parsoid=wt2html,wt2wt,html2html
14534 !! wikitext
14535 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14536 !! html/php
14537 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14538
14539 !! html/parsoid
14540 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14541 !! end
14542
14543 !! test
14544 Manually-specified thumbnail image with explicit link to url
14545 !! options
14546 thumbsize=220
14547 parsoid=wt2html,wt2wt,html2html
14548 !! wikitext
14549 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14550 !! html/php
14551 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14552
14553 !! html/parsoid
14554 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14555 !! end
14556
14557 !! test
14558 Manually-specified thumbnail image with explicit no link
14559 !! options
14560 thumbsize=220
14561 parsoid=wt2html,wt2wt,html2html
14562 !! wikitext
14563 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14564 !! html/php
14565 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14566
14567 !! html/parsoid
14568 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14569 !! end
14570
14571 !! test
14572 Manually-specified thumbnail image with explicit link and alt text
14573 !! options
14574 thumbsize=220
14575 parsoid=wt2html,wt2wt,html2html
14576 !! wikitext
14577 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14578 !! html/php
14579 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14580
14581 !! html/parsoid
14582 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14583 !! end
14584
14585 !! test
14586 Image with frame and link
14587 !! options
14588 parsoid=wt2html,wt2wt,html2html
14589 !! wikitext
14590 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14591 !! html/php
14592 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14593
14594 !! html/parsoid
14595 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14596 !! end
14597
14598 !! test
14599 Image with frame and link and explicit alt
14600 !! options
14601 parsoid=wt2html,wt2wt,html2html
14602 !! wikitext
14603 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14604 !! html/php
14605 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14606
14607 !! html/parsoid
14608 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14609 !! end
14610
14611 !! test
14612 Image with wiki markup in implicit alt
14613 !! wikitext
14614 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14615
14616 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14617 !! html/php
14618 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14619 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14620 </p>
14621 !! html/parsoid
14622 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14623
14624 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14625 !! end
14626
14627 !! test
14628 Alt image option should handle most kinds of wikitext without barfing
14629 !! wikitext
14630 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14631 !! html/php
14632 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
14633
14634 !! html/parsoid
14635 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
14636 !! end
14637
14638 !! test
14639 Image with table with attributes in caption
14640 !! options
14641 parsoid=wt2html,html2html
14642 !! wikitext
14643 [[File:Foobar.jpg|thumb|
14644 {| class="123" |
14645 |- class="456" |
14646 | ha
14647 |}
14648 ]]
14649 !! html/parsoid
14650 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
14651 <table class="123">
14652 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14653 <td> ha</td></tr>
14654 </tbody></table>
14655 </figcaption></figure>
14656 !! end
14657
14658 !! test
14659 Image with table with rows from templates in caption
14660 !! wikitext
14661 [[File:Foobar.jpg|thumb|
14662 {|
14663 {{echo|{{!}} hi}}
14664 |}
14665 ]]
14666 !! html/parsoid
14667 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
14668 <table>
14669 <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
14670 </tbody></table>
14671 </figcaption></figure>
14672 !! end
14673
14674 !! test
14675 Image with nested tables in caption
14676 !! wikitext
14677 [[File:Foobar.jpg|thumb|Foo<br />
14678 {|
14679 |
14680 {|
14681 |z
14682 |}
14683 |}
14684 ]]
14685 !! html/parsoid
14686 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
14687 <table>
14688 <tbody><tr><td>
14689 <table>
14690 <tbody><tr><td>z</td></tr>
14691 </tbody></table></td></tr>
14692 </tbody></table>
14693 </figcaption></figure>
14694 !! end
14695
14696 ###################
14697 # Conflicting image format options.
14698 # First option specified should 'win'.
14699 # All three cases in each test should be identical.
14700
14701 !! test
14702 Image with 'frameless' first.
14703 !! options
14704 parsoid=wt2html,wt2wt,html2html
14705 !! wikitext
14706 [[File:Foobar.jpg|frameless|caption]]
14707
14708 [[File:Foobar.jpg|frameless|frame|caption]]
14709
14710 [[File:Foobar.jpg|frameless|thumb|caption]]
14711 !! html/php
14712 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14713 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14714 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14715 </p>
14716 !! html/parsoid
14717 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
14718 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
14719 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
14720 !! end
14721
14722 !! test
14723 Image with 'frame' first.
14724 !! options
14725 parsoid=wt2html,wt2wt,html2html
14726 !! wikitext
14727 [[File:Foobar.jpg|frame|caption]]
14728 [[File:Foobar.jpg|frame|frameless|caption]]
14729 [[File:Foobar.jpg|frame|thumb|caption]]
14730 !! html/php
14731 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14732 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14733 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14734
14735 !! html/parsoid
14736 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14737 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14738 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14739 !! end
14740
14741 !! test
14742 Image with 'thumb' first.
14743 !! options
14744 parsoid=wt2html,wt2wt,html2html
14745 !! wikitext
14746 [[File:Foobar.jpg|thumb|caption]]
14747 [[File:Foobar.jpg|thumb|frameless|caption]]
14748 [[File:Foobar.jpg|thumb|frame|caption]]
14749 !! html/php
14750 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14751 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14752 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14753
14754 !! html/parsoid
14755 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14756 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14757 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14758 !! end
14759
14760 ###################
14761 # Image sizing.
14762 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14763 # and https://phabricator.wikimedia.org/T64258
14764 # Foobar has actual size of 1941x220
14765 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14766 # a scalable format.
14767 # 2. Framed images always ignore size options; always render at default size.
14768 # 3. "Unspecified format" and border are the only types which can be
14769 # enlarged.
14770
14771 !! test
14772 Image: unspecified format and border enlarge
14773 !! options
14774 parsoid=wt2html,wt2wt,html2html
14775 !! wikitext
14776 [[File:Foobar.jpg|2000px]]
14777
14778 [[File:Foobar.jpg|border|2000px]]
14779 !! html/php
14780 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
14781 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
14782 </p>
14783 !! html/parsoid
14784 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
14785 <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
14786 !! end
14787
14788 !! test
14789 Image: "unspecified format" and border reduce
14790 !! options
14791 parsoid=wt2html,wt2wt,html2html
14792 !! wikitext
14793 [[File:Foobar.jpg|1000px]]
14794
14795 [[File:Foobar.jpg|border|1000px]]
14796 !! html/php
14797 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14798 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
14799 </p>
14800 !! html/parsoid
14801 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
14802 <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
14803 !! end
14804
14805 !! test
14806 Image: thumbs reduce
14807 !! options
14808 parsoid=wt2html,wt2wt,html2html
14809 !! wikitext
14810 [[File:Foobar.jpg|thumb|50px]]
14811 !! html/php
14812 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14813
14814 !! html/parsoid
14815 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
14816 !! end
14817
14818 !! test
14819 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14820 !! options
14821 parsoid=wt2html,wt2wt,html2html
14822 !! wikitext
14823 [[File:Foobar.jpg|thumb|2000px]]
14824
14825 [[File:Foobar.svg|thumb|2000px]]
14826 !! html/php
14827 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14828 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
14829
14830 !! html/parsoid
14831 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14832 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
14833 !! end
14834
14835 !! test
14836 Image: frameless can reduce in size
14837 !! options
14838 parsoid=wt2html,wt2wt,html2html
14839 !! wikitext
14840 [[File:Foobar.jpg|frameless|50px]]
14841 !! html/php
14842 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14843 </p>
14844 !! html/parsoid
14845 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
14846 !! end
14847
14848 !! test
14849 Image: bitmap frameless can't be enlarged past original size, but vector can
14850 !! options
14851 parsoid=wt2html,wt2wt,html2html
14852 !! wikitext
14853 [[File:Foobar.jpg|frameless|2000px]]
14854
14855 [[File:Foobar.svg|frameless|2000px]]
14856 !! html/php
14857 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14858 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
14859 </p>
14860 !! html/parsoid
14861 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14862 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure-inline></p>
14863 !! end
14864
14865 !! test
14866 Image: framed images are always unscaled.
14867 !! options
14868 parsoid=wt2html,wt2wt,html2html
14869 !! wikitext
14870 [[File:Foobar.jpg|frame]]
14871
14872 [[File:Foobar.jpg|frame|50px]]
14873
14874 [[File:Foobar.jpg|frame|50x50px]]
14875
14876 [[File:Foobar.jpg|frame|2000px]]
14877 !! html/php
14878 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14879 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14880 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14881 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14882
14883 !! html/parsoid
14884 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14885 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14886 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14887 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14888 !! end
14889
14890 ###################
14891
14892 !! test
14893 Link to image page- image page normally doesn't exists, hence edit link
14894 Add test with existing image page
14895 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14896 !! wikitext
14897 [[:Image:test]]
14898 !! html
14899 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
14900 </p>
14901 !! end
14902
14903 !! test
14904 T20784 Link to non-existent image page with caption should use caption as link text
14905 !! wikitext
14906 [[:Image:test|caption]]
14907 !! html
14908 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
14909 </p>
14910 !! end
14911
14912 !! test
14913 Frameless image caption with a free URL
14914 !! wikitext
14915 [[File:Foobar.jpg|http://example.com]]
14916 !! html/php
14917 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14918 </p>
14919 !! html/parsoid
14920 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14921 !! end
14922
14923 !! test
14924 Thumbnail image caption with a free URL
14925 !! options
14926 thumbsize=220
14927 !! wikitext
14928 [[File:Foobar.jpg|thumb|http://example.com]]
14929 !! html/php
14930 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14931
14932 !! html/parsoid
14933 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
14934 !! end
14935
14936 !! test
14937 Thumbnail image caption with a free URL and explicit alt
14938 !! options
14939 thumbsize=220
14940 parsoid=wt2html,wt2wt,html2html
14941 !! wikitext
14942 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14943 !! html/php
14944 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
14945
14946 !! html/parsoid
14947 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
14948 !! end
14949
14950 !! test
14951 SVG thumbnails with no language set
14952 !! options
14953 !! wikitext
14954 [[File:Foobar.svg|thumb|caption]]
14955 !! html/php
14956 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14957
14958 !! html/parsoid
14959 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14960 !! end
14961
14962 !! test
14963 SVG thumbnails with language de
14964 !! options
14965 parsoid=wt2html,wt2wt,html2html
14966 !! wikitext
14967 [[File:Foobar.svg|thumb|caption|lang=de]]
14968 !! html/php
14969 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14970
14971 !! html/parsoid
14972 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
14973 !! end
14974
14975 !! test
14976 SVG thumbnails with invalid language code
14977 !! options
14978 parsoid=wt2html,wt2wt,html2html
14979 !! wikitext
14980 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
14981 !! html/php
14982 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid:language:code</div></div></div>
14983
14984 !! html/parsoid
14985 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
14986 !! end
14987
14988 !! test
14989 T3887: A ISBN with a thumbnail
14990 !! wikitext
14991 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14992 !! html/php
14993 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
14994
14995 !! html/parsoid
14996 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
14997 !! end
14998
14999 !! test
15000 T3887: A RFC with a thumbnail
15001 !! wikitext
15002 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15003 !! html/php
15004 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15005
15006 !! html/parsoid
15007 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink" class="external text">RFC 12354</a></figcaption></figure>
15008 !! end
15009
15010 !! test
15011 T3887: A mailto link with a thumbnail
15012 !! wikitext
15013 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15014 !! html/php
15015 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
15016
15017 !! html/parsoid
15018 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15019 !! end
15020
15021 # Pending resolution to T2368
15022 !! test
15023 T2648: Frameless image caption with a link
15024 !! wikitext
15025 [[File:Foobar.jpg|text with a [[link]] in it]]
15026 !! html/php
15027 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15028 </p>
15029 !! html/parsoid
15030 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15031 !! end
15032
15033 !! test
15034 T2648: Frameless image caption with a link (suffix)
15035 !! wikitext
15036 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15037 !! html/php
15038 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15039 </p>
15040 !! html/parsoid
15041 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15042 !! end
15043
15044 !! test
15045 T2648: Frameless image caption with an interwiki link
15046 !! wikitext
15047 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15048 !! html/php
15049 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15050 </p>
15051 !! html/parsoid
15052 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15053 !! end
15054
15055 !! test
15056 T2648: Frameless image caption with a piped interwiki link
15057 !! wikitext
15058 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15059 !! html/php
15060 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15061 </p>
15062 !! html/parsoid
15063 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15064 !! end
15065
15066 !! test
15067 T107474: Frameless image caption with <nowiki>
15068 !! wikitext
15069 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15070 !! html/parsoid
15071 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15072 !! end
15073
15074 !! test
15075 Escape HTML special chars in image alt text
15076 !! wikitext
15077 [[File:Foobar.jpg|& < > "]]
15078 !! html/php
15079 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15080 </p>
15081 !! html/parsoid
15082 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15083 !! end
15084
15085 !! test
15086 Escape HTML special chars in image alt text with LanguageConverter
15087 !! options
15088 language=zh
15089 !! wikitext
15090 [[File:Foobar.jpg|& < > "]]
15091 !! html/php
15092 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15093 </p>
15094 !! html/parsoid
15095 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15096 !! end
15097
15098 !! test
15099 Entities in file name and attributes
15100 !! wikitext
15101 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15102 !! html/php
15103 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15104 </p>
15105 !! html/parsoid
15106 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
15107 !! end
15108
15109 !! test
15110 T2499: Alt text should have &#1234;, not &amp;1234;
15111 !! wikitext
15112 [[File:Foobar.jpg|&#9792;]]
15113 !! html/php
15114 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15115 </p>
15116 !! html/parsoid
15117 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15118 !! end
15119
15120 !! test
15121 Broken image caption with link
15122 !! options
15123 parsoid=wt2html,wt2wt,html2html
15124 !! wikitext
15125 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15126 !! html/php
15127 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
15128 </p>
15129 !! html/parsoid
15130 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
15131 !! end
15132
15133 !! test
15134 Image caption containing another image
15135 !! wikitext
15136 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15137 !! html/php
15138 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
15139
15140 !! html/parsoid
15141 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></figure-inline> inside it!</figcaption></figure>
15142 !! end
15143
15144 !! test
15145 Image: caption containing a newline
15146 !! wikitext
15147 [[File:Foobar.jpg|This
15148 *is some text]]
15149 !! html/php
15150 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15151 </p>
15152 !! html/parsoid
15153 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15154 !!end
15155
15156 !!test
15157 Image: caption containing leading space
15158 (The leading space should not trigger nowiki escaping in wt2wt mode)
15159 !! wikitext
15160 [[File:Foobar.jpg|thumb| bar]]
15161 !! html/php
15162 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
15163
15164 !! html/parsoid
15165 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
15166 !!end
15167
15168 # html/php output not have newlines after table, td, th, etc. because
15169 # Linker::makeThumbLink2() replaces the newlines with spaces since
15170 # the table is inside a caption.
15171 # FIXME: Verify if that circa 2004 fix is still required.
15172 !! test
15173 Image: caption containing a table
15174 !! options
15175 parsoid=wt2html,wt2wt,html2html
15176 !! wikitext
15177 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15178 {|
15179 !Foo!!Bar
15180 |-
15181 |Foo1||Bar1
15182 |}
15183 and some more text.]]
15184 !! html/php
15185 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th>Foo</th> <th>Bar </th></tr> <tr> <td>Foo1</td> <td>Bar1 </td></tr></table> and some more text.</div></div></div>
15186
15187 !! html/parsoid
15188 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
15189 <table>
15190 <tbody>
15191 <tr><th>Foo</th><th>Bar</th></tr>
15192 <tr>
15193 <td>Foo1</td>
15194 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15195 !! end
15196
15197 !! test
15198 T5090: External links other than http: in image captions
15199 !! wikitext
15200 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15201 !! html/php
15202 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
15203
15204 !! html/parsoid
15205 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" class="external text" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" class="external text" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
15206 !! end
15207
15208 !! test
15209 Custom class
15210 !! options
15211 parsoid=wt2html,wt2wt,html2html
15212 !! wikitext
15213 [[Image:foobar.jpg|a|class=b]]
15214 !! html/php
15215 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
15216 </p>
15217 !! html/parsoid
15218 <p><figure-inline class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15219 !! end
15220
15221 !! test
15222 Localized image handling (1).
15223 !! options
15224 parsoid=wt2html,wt2wt,html2html
15225 language=es
15226 !! wikitext
15227 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15228 !! html/php
15229 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
15230
15231 !! html/parsoid
15232 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15233 !! end
15234
15235 !! test
15236 Localized image handling (2).
15237 !! options
15238 thumbsize=220
15239 parsoid=wt2html,wt2wt,html2html
15240 language=es
15241 !! wikitext
15242 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15243 !! html/php
15244 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
15245
15246 !! html/parsoid
15247 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15248 !! end
15249
15250 !! test
15251 Localized image handling (3).
15252 !! options
15253 language=fa
15254 parsoid=html2wt
15255 !! html/parsoid
15256 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
15257 !! wikitext
15258 [[File:Foobar.jpg|بندانگشتی]]
15259 !! end
15260
15261 !! test
15262 "border", "frameless" and "class" attributes on an image.
15263 !! options
15264 thumbsize=220
15265 parsoid=wt2html,wt2wt,html2html
15266 !! wikitext
15267 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15268 !! html/php
15269 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
15270 </p>
15271 !! html/parsoid
15272 <p><figure-inline class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15273 !! end
15274
15275 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15276 !! test
15277 Invalid image attributes (T64500)
15278 !! options
15279 thumbsize=220
15280 parsoid=wt2html,wt2wt,html2html
15281 !! wikitext
15282 [[File:Foobar.jpg|thumb|float|left|caption]]
15283
15284 [[File:Foobar.jpg|thumb|righ|caption]]
15285
15286 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15287 !! html/php
15288 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15289 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15290 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15291
15292 !! html/parsoid
15293 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15294 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15295 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15296 !! end
15297
15298 !! article
15299 File:Barfoo.jpg
15300 !! text
15301 #REDIRECT [[File:Barfoo.jpg]]
15302 !! endarticle
15303
15304 # FIXME: Parsoid should run this test -- but we'd need to teach the
15305 # mockAPI about the redirected Barfoo.jpg image.
15306 !! test
15307 Redirected image
15308 !! wikitext
15309 [[Image:Barfoo.jpg]]
15310 !! html/php
15311 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15312 </p>
15313 !! end
15314
15315 !! test
15316 Missing image with uploads disabled
15317 !! options
15318 wgEnableUploads=0
15319 !! wikitext
15320 [[File:Foobaz.jpg]]
15321 !! html/php
15322 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15323 </p>
15324 !! html/parsoid
15325 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></figure-inline></p>
15326 !! end
15327
15328 # Parsoid-specific testing for images
15329 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15330 # Currently imperfect due to a flaw in the Parsoid testrunner
15331 # Work in progress
15332 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15333 # image tests.
15334
15335 !! test
15336 Parsoid-specific image handling - simple image with size and middle alignment
15337 !! wikitext
15338 [[File:Foobar.jpg|middle|50px]]
15339 !! html/parsoid
15340 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15341 !! end
15342
15343 !! test
15344 Parsoid-specific image handling - simple image with size, middle alignment,
15345 non-standard namespace alias
15346 !! options
15347 parsoid=wt2wt,wt2html,html2html
15348 !! wikitext
15349 [[Image:Foobar.jpg|middle|50px]]
15350 !! html/parsoid
15351 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15352 !! end
15353
15354 !! test
15355 Parsoid-specific image handling - simple image with size and middle alignment
15356 (existing content)
15357 !! wikitext
15358 [[File:Foobar.jpg|50px|middle]]
15359 !! html/parsoid
15360 <p><figure-inline class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15361 !! end
15362
15363 !! test
15364 Parsoid-specific image handling - simple image with size and middle alignment
15365 and non-standard namespace name
15366 !! options
15367 parsoid=wt2html,wt2wt,html2html
15368 !! wikitext
15369 [[Image:Foobar.jpg|50px|middle]]
15370 !! html/parsoid
15371 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15372 !! end
15373
15374 !! test
15375 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15376 !! wikitext
15377 [[File:Foobar.jpg|500x10px|baseline|caption]]
15378 !! html/parsoid
15379 <p><figure-inline class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15380 !! end
15381
15382 !! test
15383 Parsoid-specific image handling - simple image with border and size spec
15384 !! wikitext
15385 [[File:Foobar.jpg|50px|border|caption]]
15386 !! html/parsoid
15387 <p><figure-inline class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15388 !! end
15389
15390 !! test
15391 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15392 !! wikitext
15393 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15394 !! html/parsoid
15395 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
15396 !! end
15397
15398 !! test
15399 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15400 (existing content)
15401 !! wikitext
15402 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15403 !! html/parsoid
15404 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
15405 !! end
15406
15407 !! test
15408 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15409 !! wikitext
15410 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15411 !! html/parsoid
15412 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
15413 !! end
15414
15415 !! test
15416 Parsoid-specific image handling - thumbnail with specific size, halign,
15417 valign, and caption (existing content)
15418 !! wikitext
15419 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15420 !! html/parsoid
15421 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
15422 !! end
15423
15424 !! test
15425 Parsoid-specific image handling - framed image with specific size and caption
15426 (size is ignored)
15427 !! options
15428 parsoid=wt2html,wt2wt,html2html
15429 !! wikitext
15430 [[File:Foobar.jpg|frame|500x50px|caption]]
15431 !! html/parsoid
15432 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15433 !! end
15434
15435 !! test
15436 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15437 (size is ignored)
15438 !! options
15439 parsoid=wt2html,wt2wt,html2html
15440 !! wikitext
15441 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15442 !! html/parsoid
15443 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15444 !! end
15445
15446 !! test
15447 Parsoid-specific image handling - frameless image with specific size, border, and caption
15448 !! wikitext
15449 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15450 !! html/parsoid
15451 <p><figure-inline class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15452 !! end
15453
15454 !! test
15455 Parsoid-specific image handling - simple image with a formatted caption
15456 !! wikitext
15457 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15458 !! html/parsoid
15459 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15460 !! end
15461
15462 !! test
15463 Parsoid-specific image handling - caption with a template in it
15464 !! wikitext
15465 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15466 !! html/parsoid
15467 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
15468 !! end
15469
15470 !! test
15471 Parsoid-specific image handling - caption with unbalanced tags in it
15472 !! options
15473 parsoid=wt2html,wt2wt,html2html
15474 !! wikitext
15475 foo
15476 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15477 bar
15478 !! html/parsoid
15479 <p>foo</p>
15480 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
15481 <p>bar</p>
15482 !! end
15483
15484 !! test
15485 Parsoid-specific image handling - empty caption (1)
15486 !! options
15487 parsoid=wt2html,wt2wt
15488 !! wikitext
15489 [[File:Foobar.jpg|thumb|]]
15490 !! html/parsoid
15491 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
15492 !! end
15493
15494 # empty captions don't get serialized unless we're in the "round trip" case
15495 !! test
15496 Parsoid-specific image handling - empty caption (2)
15497 !! options
15498 parsoid=html2wt
15499 !! html/parsoid
15500 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15501 <a href="./File:Foobar.jpg">
15502 <img resource="./File:Foobar.jpg"
15503 src="//example.com/images/3/3a/Foobar.jpg"
15504 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15505 height="25" width="220"/>
15506 </a>
15507 <figcaption></figcaption>
15508 </figure>
15509 !! wikitext
15510 [[File:Foobar.jpg|thumb]]
15511 !! end
15512
15513 !! test
15514 Parsoid-specific image handling - whitespace caption
15515 !! wikitext
15516 [[File:Foobar.jpg|thumb| ]]
15517 !! html/parsoid
15518 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
15519 !! end
15520
15521 !! test
15522 Parsoid-specific image handling - lang option
15523 !! wikitext
15524 foo
15525 [[File:Foobar.svg|lang=de|caption]]
15526 bar
15527 !! html/parsoid
15528 <p>foo
15529 <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></figure-inline>
15530 bar</p>
15531 !! end
15532
15533 ## Edge case bugs in Parsoid from T93580
15534 !! test
15535 T93580: 1. Templated <ref> inside block images
15536 !! wikitext
15537 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15538
15539 <references />
15540 !! html/parsoid
15541 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <sup about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
15542
15543 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15544 !! end
15545
15546 !! test
15547 T93580: 2. <ref> inside inline images
15548 !! wikitext
15549 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15550
15551 <references />
15552 !! html/parsoid
15553 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15554
15555 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15556 !! end
15557
15558 !! test
15559 T93580: 3. Templated <ref> inside inline images
15560 !! wikitext
15561 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15562
15563 <references />
15564 !! html/parsoid
15565 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15566
15567 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15568 !! end
15569
15570 ###
15571 ### Subpages
15572 ###
15573 !! article
15574 Subpage test/subpage
15575 !! text
15576 foo
15577 !! endarticle
15578
15579 !! test
15580 Subpage link
15581 !! options
15582 subpage title=[[Subpage test]]
15583 !! wikitext
15584 [[/subpage]]
15585 !! html
15586 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15587 </p>
15588 !! end
15589
15590 !! test
15591 Subpage noslash link
15592 !! options
15593 subpage title=[[Subpage test]]
15594 !! wikitext
15595 [[/subpage/]]
15596 !! html
15597 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15598 </p>
15599 !! end
15600
15601 !! article
15602 Subpage test/1/2/subpage
15603 !! text
15604 blah
15605 !! endarticle
15606
15607 !! test
15608 Relative subpage noslash link
15609 !! options
15610 parsoid=wt2wt,wt2html,html2html
15611 subpage title=[[Subpage test/1/2/3/4]]
15612 !! wikitext
15613 [[../../subpage/]]
15614
15615 [[../../subpage]]
15616 !! html/php
15617 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15618 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15619 </p>
15620 !! html/parsoid
15621 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15622 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15623 !! end
15624
15625 !! test
15626 Parsoid: dot-slash prefixed wikilinks
15627 !! wikitext
15628 [[./foo]]
15629
15630 [[././bar]]
15631
15632 [[././baz/]]
15633 !! html/php
15634 <p>[[./foo]]
15635 </p><p>[[././bar]]
15636 </p><p>[[././baz/]]
15637 </p>
15638 !! html/parsoid
15639 <p>[[./foo]]
15640 </p><p>[[././bar]]
15641 </p><p>[[././baz/]]
15642 </p>
15643 !! end
15644
15645 !! test
15646 Render invalid page names as plain text (T53090)
15647 !! wikitext
15648 [[./../foo|bar]]
15649 [[foo�|bar]]
15650 [[foo/.|bar]]
15651 [[foo/..|bar]]
15652 [[foo~~~bar]]
15653 [[foo>bar]]
15654 [[foo[bar]]
15655 [[.]]
15656 [[..]]
15657 [[foo././bar]]
15658 [[foo[http://example.com]xyz]]
15659
15660 [[{{echo|./../foo}}|bar]]
15661 [[{{echo|foo/.}}|bar]]
15662 [[{{echo|foo/..}}|bar]]
15663 [[{{echo|foo~~~~bar}}]]
15664 [[{{echo|foo>bar}}]]
15665 [[{{echo|foo././bar}}]]
15666 [[{{echo|foo{bar}}]]
15667 [[{{echo|foo}bar}}]]
15668 [[{{echo|foo[bar}}]]
15669 [[{{echo|foo]bar}}]]
15670 [[{{echo|foo<bar}}]]
15671 !!html/php
15672 <p>[[./../foo|bar]]
15673 [[foo�|bar]]
15674 [[foo/.|bar]]
15675 [[foo/..|bar]]
15676 [[foo~~~bar]]
15677 [[foo&gt;bar]]
15678 [[foo[bar]]
15679 [[.]]
15680 [[..]]
15681 [[foo././bar]]
15682 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15683 </p><p>[[./../foo|bar]]
15684 [[foo/.|bar]]
15685 [[foo/..|bar]]
15686 [[foo~~~~bar]]
15687 [[foo&gt;bar]]
15688 [[foo././bar]]
15689 [[foo{bar]]
15690 [[foo}bar]]
15691 [[foo[bar]]
15692 [[foo]bar]]
15693 [[foo&lt;bar]]
15694 </p>
15695 !!html/parsoid
15696 <p>[[./../foo|bar]]
15697 [[foo�|bar]]
15698 [[foo/.|bar]]
15699 [[foo/..|bar]]
15700 [[foo~~~bar]]
15701 [[foo>bar]]
15702 [[foo[bar]]
15703 [[.]]
15704 [[..]]
15705 [[foo././bar]]
15706 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15707
15708 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15709 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15710 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15711 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15712 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15713 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15714 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15715 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15716 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15717 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15718 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
15719 !!end
15720
15721 !! test
15722 Disabled subpages
15723 !! wikitext
15724 [[/subpage]]
15725 !! html
15726 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15727 </p>
15728 !! end
15729
15730 !! test
15731 T2561: {{/Subpage}}
15732 !! options
15733 subpage title=[[Page]]
15734 !! wikitext
15735 {{/Subpage}}
15736 !! html
15737 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
15738 </p>
15739 !! end
15740
15741 ###
15742 ### Categories
15743 ###
15744 !! article
15745 Category:MediaWiki User's Guide
15746 !! text
15747 blah
15748 !! endarticle
15749
15750 !! test
15751 Link to category
15752 !! wikitext
15753 [[:Category:MediaWiki User's Guide]]
15754 !! html
15755 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15756 </p>
15757 !! end
15758
15759 !! test
15760 Simple category
15761 !! options
15762 cat
15763 !! wikitext
15764 [[Category:MediaWiki User's Guide]]
15765 !! html/php
15766 cat=MediaWiki_User's_Guide sort=
15767 !! html/parsoid
15768 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15769 !! end
15770
15771 !! test
15772 PAGESINCATEGORY invalid title fatal (r33546 fix)
15773 !! wikitext
15774 {{PAGESINCATEGORY:<bogus>}}
15775 !! html
15776 <p>0
15777 </p>
15778 !! end
15779
15780 !! test
15781 Category with different sort key
15782 !! options
15783 cat
15784 !! wikitext
15785 [[Category:MediaWiki User's Guide|Foo]]
15786 !! html/php
15787 cat=MediaWiki_User's_Guide sort=Foo
15788 !! html/parsoid
15789 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15790 !! end
15791
15792 !! test
15793 Category with identical sort key
15794 !! options
15795 cat
15796 !! wikitext
15797 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15798 !! html/php
15799 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15800 !! html/parsoid
15801 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
15802 !! end
15803
15804 !! test
15805 Category with empty sort key
15806 !! options
15807 cat
15808 pst
15809 !! wikitext
15810 [[Category:MediaWiki User's Guide|]]
15811 !! html/php
15812 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15813 !! end
15814
15815 !! test
15816 Category with empty sort key and parentheses
15817 !! options
15818 cat
15819 pst
15820 !! wikitext
15821 [[Category:Foo (bar)|]]
15822 !! html/php
15823 [[Category:Foo (bar)|Foo]]
15824 !! end
15825
15826 !! test
15827 Category with link tail
15828 !! options
15829 cat
15830 pst
15831 !! wikitext
15832 123[[Category:Foo]]456
15833 !! html/php
15834 123[[Category:Foo]]456
15835 !! end
15836
15837 !! test
15838 Category with template
15839 !! options
15840 cat
15841 pst
15842 !! wikitext
15843 [[Category:{{echo|Foo}}]]
15844 !! html/php
15845 [[Category:{{echo|Foo}}]]
15846 !! end
15847
15848 !! test
15849 Category with template in sort key
15850 !! options
15851 cat
15852 pst
15853 !! wikitext
15854 [[Category:Foo|{{echo|Bar}}]]
15855 !! html/php
15856 [[Category:Foo|{{echo|Bar}}]]
15857 !! end
15858
15859 !! test
15860 Category with template in sort key and title
15861 !! options
15862 cat
15863 pst
15864 !! wikitext
15865 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15866 !! html/php
15867 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15868 !! end
15869
15870 ## We used to, but no longer wt2wt this test since the default serializer
15871 ## will normalize all categories to serialize on their own line.
15872 ## This wikitext usage is going to be fairly uncommon in production and
15873 ## selser will take care of preserving formatting in those scenarios.
15874 !! test
15875 Category / paragraph interactions
15876 !! options
15877 parsoid=wt2html
15878 !! wikitext
15879 Foo [[Category:Baz]] Bar
15880
15881 Foo [[Category:Baz]]
15882 Bar
15883
15884 Foo
15885 [[Category:Baz]]
15886 Bar
15887
15888 Foo
15889 [[Category:Baz]] Bar
15890
15891 Foo
15892 [[Category:Baz]]
15893 [[Category:Baz]]
15894 [[Category:Baz]]
15895 Bar
15896
15897 [[Category:Baz]]
15898 [[Category:Baz]]
15899 [[Category:Baz]]
15900
15901 [[Category:Baz]]
15902 {{echo|[[Category:Baz]]}}
15903 [[Category:Baz]]
15904 !! html/php
15905 <p>Foo Bar
15906 </p><p>Foo
15907 Bar
15908 </p><p>Foo
15909 Bar
15910 </p><p>Foo Bar
15911 </p><p>Foo
15912 Bar
15913 </p>
15914 !! html/parsoid
15915 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15916 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15917 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15918 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15919 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15920 <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/>
15921 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15922 !! end
15923
15924 ## We used to, but no longer wt2wt this test since the default serializer
15925 ## will normalize all categories to serialize on their own line.
15926 ## This wikitext usage is going to be fairly uncommon in production and
15927 ## selser will take care of preserving formatting in those scenarios.
15928 ##
15929 ## The whitespace on the empty line is part of the test. Please do not delete
15930 !! test
15931 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15932 !! options
15933 parsoid=wt2html
15934 !! wikitext
15935 This
15936
15937 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15938
15939 {{echo|[[Category:Foo]] and so should this!}}
15940 !! html/php
15941 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15942 </p>
15943 !! html/parsoid
15944 <p>This
15945
15946 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15947
15948 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
15949 !! end
15950
15951 ## Parsoid will not try to wt2wt this while preserving newlines because
15952 ## it suppresses excess newlines within list items -- and we don't want to
15953 ## introduce a special case just for categories, which is, in reality somewhat
15954 ## odd behavior -- categories are unlikely to be used in list items like this
15955 ## in top-level pages and are only likely to show up in template-generated
15956 ## list items where this RT-ing is a non-issue.
15957 ##
15958 ## The whitespace on the empty line is part of the test. Please do not delete
15959 !! test
15960 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15961 !! options
15962 parsoid=wt2html
15963 !! wikitext
15964 * This
15965
15966 [[Category:Foo]] and this should be part of the same list item
15967 * So should this
15968
15969 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15970 !! html
15971 <ul><li>This and this should be part of the same list item</li>
15972 <li>So should this and this should be part of the same list item</li></ul>
15973 !! html/parsoid
15974 <ul>
15975 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15976 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
15977 </ul>
15978 !! end
15979
15980 ## Newlines and categories that follow the last item of a list
15981 ## are treated differently because this (list followed by categories)
15982 ## is an extremely common pattern on wikis.
15983 !! test
15984 3. Categories and newlines: newline suppression for last list item should RT properly
15985 !! wikitext
15986 * a
15987 * b
15988
15989 [[Category:Foo]]
15990
15991 [[Category:Bar]]
15992 [[Category:Baz]]
15993 !! html/parsoid
15994 <ul><li> a</li>
15995 <li> b</li></ul>
15996
15997 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15998
15999 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16000 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16001 !! end
16002
16003 !! test
16004 4. Categories and newlines: newline suppression for last list item should RT properly
16005 !! wikitext
16006 * a
16007 **** b
16008
16009 [[Category:Foo]]
16010 !! html/parsoid
16011 <ul><li> a
16012 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16013
16014 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16015 !! end
16016
16017 ## only wt2html for this to make sure the algo only applies to the rightmost path
16018 !! test
16019 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16020 !! options
16021 parsoid=wt2html
16022 !! wikitext
16023 * a
16024 ** b
16025 [[Category:Foo]]
16026 * c
16027 ** d
16028 [[Category:Foo]]
16029 !! html/parsoid
16030 <ul><li> a
16031 <ul><li> b
16032 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16033 <li> c
16034 <ul><li> d</li></ul></li></ul>
16035 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16036 !! end
16037
16038 ## We used to, but no longer wt2wt this test since the default serializer
16039 ## will normalize all categories to serialize on their own line.
16040 ## This wikitext usage is going to be fairly uncommon in production and
16041 ## selser will take care of preserving formatting in those scenarios.
16042 !! test
16043 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16044 !! options
16045 parsoid=wt2html
16046 !! wikitext
16047 * a [[Category:Foo]]
16048 !! html/parsoid
16049 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16050 !! end
16051
16052 # This test also demonstrates because of newline+category tunneling
16053 # through the list hander, template wrapping doesn't expand to the
16054 # containing list when the list item swallows the category.
16055 !! test
16056 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16057 !! wikitext
16058 * {{echo|a
16059 [[Category:Foo]]}}
16060 !! html/parsoid
16061 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
16062 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16063 !! end
16064
16065 !! test
16066 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16067 !! wikitext
16068 * a
16069
16070 {{echo|[[Category:Foo]]
16071 [[Category:Bar]]}}
16072 [[Category:Baz]]
16073 !! html/parsoid
16074 <ul><li> a</li></ul>
16075
16076 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
16077 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16078 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16079 !! end
16080
16081 !! test
16082 9. Categories and newlines: should behave properly with linkprefix (T87753)
16083 !! options
16084 language=ar
16085 !! wikitext
16086 foo bar
16087 foo bar
16088 [[تصنيف:Foo]]
16089 [[تصنيف:Bar]]
16090 !! html/php
16091 <p>foo bar
16092 foo bar
16093 </p>
16094 !! html/parsoid
16095 <p>foo bar
16096 foo bar</p>
16097 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16098 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16099 !! end
16100
16101 !! test
16102 10. No regressions on internal links following category (T174639)
16103 !! options
16104 parsoid=wt2html,html2html
16105 !! wikitext
16106 [[Category:Foo]]<div>a
16107
16108 [[Foo]]</div>
16109 !! html/php
16110 <div>a
16111 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16112
16113 !! html/parsoid
16114 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16115
16116 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16117 !! end
16118
16119 # Note that Parsoid differs slightly from PHP due to T175421
16120 !! test
16121 11. Special case where only newlines separate links (T175416)
16122 !! options
16123 parsoid=wt2html,html2html
16124 !! wikitext
16125 [[Category:Foo]]
16126
16127 [[Foo]][[es:Alimento]]
16128
16129 [[Foo]]
16130 !! html/php
16131 <p><br />
16132 <a href="/wiki/Foo" title="Foo">Foo</a>
16133 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16134 </p>
16135 !! html/parsoid
16136 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16137
16138 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16139
16140 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16141 !! end
16142
16143 !! test
16144 Category links with multiple namespaces
16145 !! wikitext
16146 [[Category:Project:Foo]]
16147 !! html/parsoid
16148 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16149 !! end
16150
16151 !! test
16152 Parsoid: Serialize link to category page with colon escape
16153 !! options
16154 parsoid
16155 !! wikitext
16156
16157 [[:Category:Foo]]
16158 [[:Category:Foo|Bar]]
16159 !! html
16160 <p>
16161 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16162 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16163 </p>
16164 !! end
16165
16166 # We used to, but no longer wt2wt this test since the default serializer
16167 # will normalize all categories to serialize on their own line.
16168 # This wikitext usage is going to be fairly uncommon in production and
16169 # selser will take care of preventing whitespace insertion if this
16170 # occurs in an article.
16171 #
16172 # html2html disabled for the same reason (whitespace insertion between
16173 # x and y).
16174 #
16175 # html2wt disabled because it localizes the "Category" namespace.
16176 !! test
16177 Link prefix/suffixes aren't applied to category links
16178 !! options
16179 parsoid=wt2html
16180 language=is
16181 !! wikitext
16182 x[[Category:Foo]]y
16183 !! html/php
16184 <p>xy
16185 </p>
16186 !! html/parsoid
16187 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16188 !! end
16189
16190 !! test
16191 Link prefix/suffixes aren't applied to language links
16192 !! options
16193 parsoid=wt2html
16194 language=is
16195 !! wikitext
16196 x[[es:Foo]]y
16197 !! html/php
16198 <p>xy
16199 </p>
16200 !! html/parsoid
16201 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16202 !! end
16203
16204 !! test
16205 Parsoid: Serialize link to file page with colon escape
16206 !! options
16207 parsoid
16208 !! wikitext
16209
16210 [[:File:Foo.png]]
16211 [[:File:Foo.png|Bar]]
16212 !! html
16213 <p>
16214 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16215 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16216 </p>
16217 !! end
16218
16219 !! test
16220 Parsoid: Serialize a genuine category link without colon escape
16221 !! options
16222 parsoid
16223 !! wikitext
16224 [[Category:Foo]]
16225 [[Category:Foo|Bar]]
16226 !! html
16227 <link rel="mw:PageProp/Category" href="./Category:Foo">
16228 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16229 !! end
16230
16231 !! test
16232 Normalize hrefs properly before testing for invalid link targets (T72894)
16233 !! options
16234 parsoid=html2wt
16235 !! html/parsoid
16236 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16237 !! wikitext
16238 [[Category:Toxine bactérienne]]
16239 !! end
16240
16241 !! test
16242 Parsoid: Defaultsort
16243 !! wikitext
16244 {{DEFAULTSORT:Foo}}
16245 !! html/parsoid
16246 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16247 !! end
16248
16249 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16250 # But, this is a limitation of our representation and is documented in
16251 # TemplateHandler.js in processSpecialMagicWord
16252 !! test
16253 Parsoid: Defaultsort (template-generated)
16254 !! wikitext
16255 {{{{echo|DEFAULTSORT}}:Foo}}
16256 !! html/parsoid
16257 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
16258 !! end
16259
16260 ###
16261 ### Inter-language links
16262 ###
16263 !! test
16264 Interlanguage links
16265 !! options
16266 ill
16267 !! wikitext
16268 [[es:Alimento]]
16269 [[fr:Nourriture]]
16270 [[zh:食品]]
16271 !! html/php
16272 es:Alimento fr:Nourriture zh:食品
16273 !! html/parsoid
16274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16275 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16276 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16277 !! end
16278
16279 !! test
16280 Duplicate interlanguage links (T26502)
16281 !! options
16282 ill
16283 !! wikitext
16284 [[es:1]]
16285 [[es:2]]
16286 [[fr:1]]
16287 [[fr:2]]
16288 !! html/php
16289 es:1 fr:1
16290 !! html/parsoid
16291 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16292 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16293 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16294 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16295 !! end
16296
16297 ###
16298 ### Sections
16299 ###
16300 !! test
16301 Basic section headings
16302 !! wikitext
16303 ==Headline 1==
16304 Some text
16305
16306 ==Headline 2==
16307 More
16308 ===Smaller headline===
16309 Blah blah
16310 !! html
16311 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16312 <p>Some text
16313 </p>
16314 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16315 <p>More
16316 </p>
16317 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16318 <p>Blah blah
16319 </p>
16320 !! end
16321
16322 !! test
16323 Section headings with TOC
16324 !! wikitext
16325 ==Headline 1==
16326 ===Subheadline 1===
16327 =====Skipping a level=====
16328 ======Skipping a level======
16329
16330 ==Headline 2==
16331 Some text
16332 ===Another headline===
16333 !! html
16334 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16335 <ul>
16336 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16337 <ul>
16338 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16339 <ul>
16340 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
16341 <ul>
16342 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
16343 </ul>
16344 </li>
16345 </ul>
16346 </li>
16347 </ul>
16348 </li>
16349 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16350 <ul>
16351 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16352 </ul>
16353 </li>
16354 </ul>
16355 </div>
16356
16357 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16358 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16359 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
16360 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16361 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16362 <p>Some text
16363 </p>
16364 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16365
16366 !! end
16367
16368 !! test
16369 TOC anchors don't collide
16370 !! wikitext
16371 __FORCETOC__
16372 ==Headline 2==
16373 ==Headline==
16374 ==Headline 2==
16375 ==Headline==
16376 !! html/php
16377 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16378 <ul>
16379 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16380 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16381 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16382 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16383 </ul>
16384 </div>
16385
16386 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16387 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16388 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16389 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16390
16391 !! end
16392
16393 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16394 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16395 !! test
16396 Handling of sections up to level 6 and beyond
16397 !! options
16398 parsoid=wt2html
16399 !! wikitext
16400 =Level 1 Heading=
16401 ==Level 2 Heading==
16402 ===Level 3 Heading===
16403 ====Level 4 Heading====
16404 =====Level 5 Heading=====
16405 ======Level 6 Heading======
16406 =======Level 7 Heading=======
16407 ========Level 8 Heading========
16408 =========Level 9 Heading=========
16409 ==========Level 10 Heading==========
16410 !! html/php
16411 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16412 <ul>
16413 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16414 <ul>
16415 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
16416 <ul>
16417 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
16418 <ul>
16419 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
16420 <ul>
16421 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
16422 <ul>
16423 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
16424 <li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
16425 <li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
16426 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
16427 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">====Level 10 Heading====</span></a></li>
16428 </ul>
16429 </li>
16430 </ul>
16431 </li>
16432 </ul>
16433 </li>
16434 </ul>
16435 </li>
16436 </ul>
16437 </li>
16438 </ul>
16439 </div>
16440
16441 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16442 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16443 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16444 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16445 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
16446 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16447 <h6><span class="mw-headline" id=".3DLevel_7_Heading.3D">=Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: =Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16448 <h6><span class="mw-headline" id=".3D.3DLevel_8_Heading.3D.3D">==Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: ==Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16449 <h6><span class="mw-headline" id=".3D.3D.3DLevel_9_Heading.3D.3D.3D">===Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: ===Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16450 <h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D">====Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ====Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16451
16452 !! html/parsoid
16453 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16454 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16455 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16456 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16457 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16458 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16459 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16460 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16461 <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3D_Level_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
16462 <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
16463 !! end
16464
16465 !! test
16466 TOC regression (T11764)
16467 !! wikitext
16468 ==title 1==
16469 ===title 1.1===
16470 ====title 1.1.1====
16471 ===title 1.2===
16472 ==title 2==
16473 ===title 2.1===
16474 !! html
16475 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16476 <ul>
16477 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16478 <ul>
16479 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
16480 <ul>
16481 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
16482 </ul>
16483 </li>
16484 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
16485 </ul>
16486 </li>
16487 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16488 <ul>
16489 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
16490 </ul>
16491 </li>
16492 </ul>
16493 </div>
16494
16495 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16496 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16497 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16498 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16499 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16500 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16501
16502 !! end
16503
16504 !! test
16505 TOC for heading containing <span id="..."></span> (T96153)
16506 !! wikitext
16507 __FORCETOC__
16508 ==<span id="old-anchor"></span>New title==
16509 !! html/php
16510 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16511 <ul>
16512 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16513 </ul>
16514 </div>
16515
16516 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16517
16518 !! end
16519
16520 !! test
16521 TOC with wgMaxTocLevel=3 (T8204)
16522 !! options
16523 wgMaxTocLevel=3
16524 !! wikitext
16525 ==title 1==
16526 ===title 1.1===
16527 ====title 1.1.1====
16528 ===title 1.2===
16529 ==title 2==
16530 ===title 2.1===
16531 !! html
16532 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16533 <ul>
16534 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16535 <ul>
16536 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
16537 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
16538 </ul>
16539 </li>
16540 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16541 <ul>
16542 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
16543 </ul>
16544 </li>
16545 </ul>
16546 </div>
16547
16548 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16549 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16550 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16551 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16552 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16553 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16554
16555 !! end
16556
16557 !! test
16558 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16559 !! options
16560 wgMaxTocLevel=3
16561 !! wikitext
16562 ==Section 1==
16563 ===Section 1.1===
16564 ====Section 1.1.1====
16565 ====Section 1.1.1.1====
16566 ==Section 2==
16567 !! html
16568 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16569 <ul>
16570 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16571 <ul>
16572 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
16573 </ul>
16574 </li>
16575 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16576 </ul>
16577 </div>
16578
16579 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16580 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16581 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16582 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16583 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16584
16585 !! end
16586
16587
16588 !! test
16589 Resolving duplicate section names
16590 !! wikitext
16591 ==Foo bar==
16592 ==Foo bar==
16593 !! html
16594 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16595 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16596
16597 !! end
16598
16599 !! test
16600 Resolving duplicate section names with differing case (T12721)
16601 !! wikitext
16602 ==Foo bar==
16603 ==Foo Bar==
16604 !! html
16605 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16606 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16607
16608 !! end
16609
16610 !! article
16611 Template:sections
16612 !! text
16613 ===Section 1===
16614 ==Section 2==
16615 !! endarticle
16616
16617 !! test
16618 Template with sections, __NOTOC__
16619 !! wikitext
16620 __NOTOC__
16621 ==Section 0==
16622 {{sections}}
16623 ==Section 4==
16624 !! html
16625 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16626 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16627 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16628 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16629
16630 !! end
16631
16632 !! test
16633 __NOEDITSECTION__ keyword
16634 !! wikitext
16635 __NOEDITSECTION__
16636 ==Section 1==
16637 ==Section 2==
16638 !! html
16639 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16640 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16641
16642 !! end
16643
16644 !! test
16645 Link inside a section heading
16646 !! wikitext
16647 ==Section with a [[Main Page|link]] in it==
16648 !! html
16649 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16650
16651 !! end
16652
16653 !! test
16654 TOC regression (T14077)
16655 !! wikitext
16656 __TOC__
16657 ==title 1==
16658 ===title 1.1===
16659 ==title 2==
16660 !! html
16661 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16662 <ul>
16663 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16664 <ul>
16665 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
16666 </ul>
16667 </li>
16668 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16669 </ul>
16670 </div>
16671
16672 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16673 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16674 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16675
16676 !! end
16677
16678 !! test
16679 T3219 URL next to image (good)
16680 !! wikitext
16681 http://example.com [[File:Foobar.jpg]]
16682 !! html/php
16683 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
16684 </p>
16685 !! html/parsoid
16686 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
16687 !!end
16688
16689 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16690 !! test
16691 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16692 !! options
16693 parsoid=wt2html,html2html
16694 !! wikitext
16695 ===
16696 The line above must have a trailing space!
16697 === <!--
16698 --> <!-- -->
16699 But just in case it doesn't...
16700 !! html/php
16701 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16702 <p>The line above must have a trailing space!
16703 </p>
16704 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16705 <p>But just in case it doesn't...
16706 </p>
16707 !! html/parsoid
16708 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16709 <p>The line above must have a trailing space!</p>
16710 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16711 --> <!-- -->
16712 <p>But just in case it doesn't...</p>
16713 !! end
16714
16715 !! test
16716 Header with special characters (T27462)
16717 !! wikitext
16718 The tooltips shall not show entities to the user (ie. be double escaped)
16719
16720 ==text > text==
16721 section 1
16722
16723 ==text < text==
16724 section 2
16725
16726 ==text & text==
16727 section 3
16728
16729 ==text ' text==
16730 section 4
16731
16732 ==text " text==
16733 section 5
16734 !! html/php
16735 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16736 </p>
16737 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16738 <ul>
16739 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
16740 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
16741 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
16742 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16743 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16744 </ul>
16745 </div>
16746
16747 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16748 <p>section 1
16749 </p>
16750 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16751 <p>section 2
16752 </p>
16753 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16754 <p>section 3
16755 </p>
16756 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16757 <p>section 4
16758 </p>
16759 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16760 <p>section 5
16761 </p>
16762 !! html/parsoid
16763 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16764
16765 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16766 <p>section 1</p>
16767
16768 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16769 <p>section 2</p>
16770
16771 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16772 <p>section 3</p>
16773
16774 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16775 <p>section 4</p>
16776
16777 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16778 <p>section 5</p>
16779 !! end
16780
16781 !! test
16782 Header with space, plus and underscore as entity
16783 !! wikitext
16784 Id should not contain + for spaces
16785
16786 ==Space between Text==
16787 section 1
16788
16789 ==Space-Entity&#32;between&#32;Text==
16790 section 2
16791
16792 ==Plus+between+Text==
16793 section 3
16794
16795 ==Plus-Entity&#43;between&#43;Text==
16796 section 4
16797
16798 ==Underscore_between_Text==
16799 section 5
16800
16801 ==Underscore-Entity&#95;between&#95;Text==
16802 section 6
16803
16804 [[#Space between Text]]
16805 [[#Space-Entity&#32;between&#32;Text]]
16806 [[#Plus+between+Text]]
16807 [[#Plus-Entity&#43;between&#43;Text]]
16808 [[#Underscore_between_Text]]
16809 [[#Underscore-Entity&#95;between&#95;Text]]
16810 !! html/php
16811 <p>Id should not contain + for spaces
16812 </p>
16813 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16814 <ul>
16815 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
16816 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
16817 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
16818 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
16819 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
16820 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
16821 </ul>
16822 </div>
16823
16824 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16825 <p>section 1
16826 </p>
16827 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16828 <p>section 2
16829 </p>
16830 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16831 <p>section 3
16832 </p>
16833 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16834 <p>section 4
16835 </p>
16836 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16837 <p>section 5
16838 </p>
16839 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16840 <p>section 6
16841 </p><p><a href="#Space_between_Text">#Space between Text</a>
16842 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16843 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16844 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16845 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16846 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16847 </p>
16848 !! html/parsoid
16849 <p>Id should not contain + for spaces</p>
16850
16851 <h2 id="Space_between_Text">Space between Text</h2>
16852 <p>section 1</p>
16853
16854 <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>Text</h2>
16855 <p>section 2</p>
16856
16857 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16858 <p>section 3</p>
16859
16860 <h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>Text</h2>
16861 <p>section 4</p>
16862
16863 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16864 <p>section 5</p>
16865
16866 <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
16867 <p>section 6</p>
16868
16869 <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
16870 <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
16871 <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
16872 <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
16873 <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
16874 <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
16875 !! end
16876
16877 # Parsoid html2wt disabled because it adds padding spaces around =
16878 !! test
16879 Headers with excess '=' characters
16880 (Are similar tests necessary beyond the 1st level?)
16881 !! options
16882 parsoid=wt2html,wt2wt,html2html
16883 !! wikitext
16884 =foo==
16885 ==foo=
16886 =''italic'' heading==
16887 ==''italic'' heading=
16888 !! html/php
16889 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16890 <ul>
16891 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16892 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16893 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
16894 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
16895 </ul>
16896 </div>
16897
16898 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16899 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16900 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16901 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16902
16903 !! html/parsoid
16904 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16905 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16906 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16907 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16908 !! end
16909
16910 !! test
16911 HTML headers vs TOC (T25393)
16912 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16913 !! wikitext
16914 <h1>Header 1</h1>
16915 ==Header 1.1==
16916 ==Header 1.2==
16917
16918 <h1>Header 2
16919 </h1>
16920 ==Header 2.1==
16921 ==Header 2.2==
16922 __NOEDITSECTION__
16923 !! html/php
16924 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16925 <ul>
16926 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16927 <ul>
16928 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
16929 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
16930 </ul>
16931 </li>
16932 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16933 <ul>
16934 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
16935 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
16936 </ul>
16937 </li>
16938 </ul>
16939 </div>
16940
16941 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16942 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16943 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16944 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16945 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16946 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16947
16948 !! html/parsoid
16949 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16950 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
16951 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
16952
16953 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16954 </h1>
16955 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
16956 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
16957 <meta property="mw:PageProp/noeditsection"/>
16958 !! end
16959
16960 !! test
16961 Single-line or multiline-comments can follow headings
16962 !! options
16963 parsoid=wt2html,wt2wt
16964 !! wikitext
16965 ==foo==<!---->
16966 ==bar==<!--c1-->
16967 ==baz==<!--
16968 c2
16969 c3-->
16970 !! html/php
16971 <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>
16972 <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>
16973 <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>
16974
16975 !! html/parsoid
16976 <h2 id="foo">foo</h2><!---->
16977 <h2 id="bar">bar</h2><!--c1-->
16978 <h2 id="baz">baz</h2><!--
16979 c2
16980 c3-->
16981 !! end
16982
16983 !! test
16984 T3219 URL next to image (broken)
16985 !! wikitext
16986 http://example.com[[File:Foobar.jpg]]
16987 !! html/php
16988 <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>
16989 </p>
16990 !! html/parsoid
16991 <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>
16992 !!end
16993
16994 !! test
16995 T3186 news: in the middle of text
16996 !! wikitext
16997 http://en.wikinews.org/wiki/Wikinews:Workplace
16998 !! html
16999 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17000 </p>
17001 !!end
17002
17003
17004 !! test
17005 Namespaced link must have a title
17006 !! wikitext
17007 [[Project:]]
17008 !! html
17009 <p>[[Project:]]
17010 </p>
17011 !!end
17012
17013 !! test
17014 Namespaced link must have a title (bad fragment version)
17015 !! wikitext
17016 [[Project:#fragment]]
17017 !! html
17018 <p>[[Project:#fragment]]
17019 </p>
17020 !!end
17021
17022
17023 ###
17024 ### HTML tags and HTML attributes
17025 ###
17026
17027 !! test
17028 div with no attributes
17029 !! wikitext
17030 <div>HTML rocks</div>
17031 !! html
17032 <div>HTML rocks</div>
17033
17034 !! end
17035
17036 !! test
17037 div with double-quoted attribute
17038 !! wikitext
17039 <div id="rock">HTML rocks</div>
17040 !! html
17041 <div id="rock">HTML rocks</div>
17042
17043 !! end
17044
17045 !! test
17046 div with single-quoted attribute
17047 !! wikitext
17048 <div id='rock'>HTML rocks</div>
17049 !! html
17050 <div id="rock">HTML rocks</div>
17051
17052 !! end
17053
17054 !! test
17055 div with unquoted attribute
17056 !! wikitext
17057 <div id=rock>HTML rocks</div>
17058 !! html
17059 <div id="rock">HTML rocks</div>
17060
17061 !! end
17062
17063 !! test
17064 div with illegal double attributes
17065 !! wikitext
17066 <div id="a" id="b">HTML rocks</div>
17067 !! html
17068 <div id="b">HTML rocks</div>
17069
17070 !!end
17071
17072 !! test
17073 div with empty attribute value, space before equals
17074 !! options
17075 parsoid=wt2html,html2html
17076 !! wikitext
17077 <div class =>HTML rocks</div>
17078 !! html/php
17079 <div class="">HTML rocks</div>
17080
17081 !! html/parsoid
17082 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17083 !! end
17084
17085 !! test
17086 div with multiple empty attribute values
17087 !! config
17088 wgFragmentMode=[ 'html5', 'legacy' ]
17089 !! options
17090 parsoid=wt2html,html2html
17091 !! wikitext
17092 <div id= title=>HTML rocks</div>
17093 !! html/php
17094 <div id="title=">HTML rocks</div>
17095
17096 !! html/parsoid
17097 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17098 !! end
17099
17100 # FIXME Parsoid doesn't actually match PHP here.
17101 # Probably we should use the synthetic <foo /> or <indicator>
17102 # extensions for this test, which are enabled when running parser tests.
17103 !! test
17104 Extension tag in attribute value
17105 !! wikitext
17106 <span title="<translate>123</translate>">ok</span>
17107 !! html/php+disabled
17108 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17109 </p>
17110 !! html/parsoid
17111 <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>
17112 !! end
17113
17114 !! test
17115 table with multiple empty attribute values
17116 !! options
17117 parsoid=wt2html,html2html
17118 !! wikitext
17119 {| title= id=
17120 |hi
17121 |}
17122 !! html/php
17123 <table title="id=">
17124 <tr>
17125 <td>hi
17126 </td></tr></table>
17127
17128 !! html/parsoid
17129 <table title="id=">
17130 <tbody><tr><td>hi</td></tr>
17131 </tbody></table>
17132 !! end
17133
17134 !! test
17135 div with braces in attribute value
17136 !! wikitext
17137 <div title="{}">Foo</div>
17138 !! html/php
17139 <div title="&#123;&#125;">Foo</div>
17140
17141 !! html/parsoid
17142 <div title="{}">Foo</div>
17143 !! end
17144
17145 !! test
17146 div with empty attribute value, no space before equals
17147 !! options
17148 parsoid=wt2html,html2html
17149 !! wikitext
17150 <div class=>HTML rocks</div>
17151 !! html/php
17152 <div class="">HTML rocks</div>
17153
17154 !! html/parsoid
17155 <div class="">HTML rocks</div>
17156 !! end
17157
17158 !! test
17159 HTML multiple attributes correction
17160 !! wikitext
17161 <p class="error" class="awesome">Awesome!</p>
17162 !! html
17163 <p class="awesome">Awesome!</p>
17164
17165 !!end
17166
17167 !! test
17168 Table multiple attributes correction
17169 !! wikitext
17170 {|
17171 !+ class="error" class="awesome"|status
17172 |}
17173 !! html
17174 <table>
17175 <tr>
17176 <th class="awesome">status
17177 </th></tr></table>
17178
17179 !!end
17180
17181 !! test
17182 DIV IN UPPERCASE
17183 !! wikitext
17184 <DIV ID="x">HTML ROCKS</DIV>
17185 !! html
17186 <div id="x">HTML ROCKS</div>
17187
17188 !!end
17189
17190 !! test
17191 Non-ASCII pseudo-tags are rendered as text
17192 !! wikitext
17193 <khyô>
17194 !! html
17195 <p>&lt;khyô&gt;
17196 </p>
17197 !! end
17198
17199 !! test
17200 Pseudo-tag with URL 'name' renders as url link
17201 !! wikitext
17202 <http://example.com/>
17203 !! html
17204 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17205 </p>
17206 !! end
17207
17208 !! test
17209 text with amp in the middle of nowhere
17210 !! wikitext
17211 Remember AT&T?
17212 !! html
17213 <p>Remember AT&amp;T?
17214 </p>
17215 !! end
17216
17217 !! test
17218 text with character entity: eacute
17219 !! wikitext
17220 I always thought &eacute; was a cute letter.
17221 !! html+tidy
17222 <p>I always thought &#233; was a cute letter.
17223 </p>
17224 !! end
17225
17226 !! test
17227 text with entity-escaped character entity-like string: eacute
17228 !! wikitext
17229 I always thought &amp;eacute; was a cute letter.
17230 !! html
17231 <p>I always thought &amp;eacute; was a cute letter.
17232 </p>
17233 !! end
17234
17235 !! test
17236 text with undefined character entity: xacute
17237 !! wikitext
17238 I always thought &xacute; was a cute letter.
17239 !! html
17240 <p>I always thought &amp;xacute; was a cute letter.
17241 </p>
17242 !! end
17243
17244 !! test
17245 HTML5 tags
17246 !! wikitext
17247 <data value="5">five</data>
17248 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17249 <mark>This highlighted text</mark>
17250 !! html
17251 <p><data value="5">five</data>
17252 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17253 <mark>This highlighted text</mark>
17254 </p>
17255 !! end
17256
17257 !! test
17258 HTML tag with leading space is parsed as text
17259 !! wikitext
17260 < div>foo< /div>
17261 !! html
17262 <p>&lt; div&gt;foo&lt; /div&gt;
17263 </p>
17264 !! end
17265
17266 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17267 ## the HTML5 parsing spec.
17268 !! test
17269 Element with broken attribute syntax
17270 !! options
17271 parsoid=wt2html
17272 !! wikitext
17273 <div style=" style="123">hi</div>
17274 <div =>ho</div>
17275 !! html/php
17276 <div style="123">hi</div>
17277 <div>ho</div>
17278
17279 !! html/parsoid
17280 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17281 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17282 !! end
17283
17284 ###
17285 ### Nesting tests (see T43545, T52604, T53081)
17286 ###
17287
17288 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17289 # Note that html2wt is considerably more difficult if we use <b> in
17290 # the test case, instead of <small>
17291 !! test
17292 Ensure that HTML adoption agency algorithm is properly implemented.
17293 !! wikitext
17294 <small>X<small>Y</small>Z</small>
17295 !! html
17296 <p><small>X<small>Y</small>Z</small>
17297 </p>
17298 !! end
17299
17300 # This was T43545 in the PHP parser.
17301 !! test
17302 Nesting of <kbd>
17303 !! wikitext
17304 <kbd>X<kbd>Y</kbd>Z</kbd>
17305 !! html+tidy
17306 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17307 </p>
17308 !! end
17309
17310 # The following cases were T53081 in the PHP parser.
17311 # Note that there are some other nestable tags (b, i, etc) which are
17312 # not covered; see T53081 for discussion.
17313
17314 !! test
17315 Nesting of <em>
17316 !! wikitext
17317 <em>X<em>Y</em>Z</em>
17318 !! html+tidy
17319 <p><em>X<em>Y</em>Z</em>
17320 </p>
17321 !! end
17322
17323 !! test
17324 Nesting of <strong>
17325 !! wikitext
17326 <strong>X<strong>Y</strong>Z</strong>
17327 !! html+tidy
17328 <p><strong>X<strong>Y</strong>Z</strong>
17329 </p>
17330 !! end
17331
17332 !! test
17333 Nesting of <q>
17334 !! wikitext
17335 <q>X<q>Y</q>Z</q>
17336 !! html+tidy
17337 <p><q>X<q>Y</q>Z</q>
17338 </p>
17339 !! end
17340
17341 !! test
17342 Nesting of <ruby>
17343 !! wikitext
17344 <ruby>X<ruby>Y</ruby>Z</ruby>
17345 !! html
17346 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17347 </p>
17348 !! end
17349
17350 !! test
17351 Nesting of <bdo>
17352 !! wikitext
17353 <bdo>X<bdo>Y</bdo>Z</bdo>
17354 !! html
17355 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17356 </p>
17357 !! end
17358
17359
17360 ###
17361 ### Media links
17362 ###
17363
17364 !! test
17365 Media link
17366 !! wikitext
17367 [[Media:Foobar.jpg]]
17368 [[Media:Video.ogv]]
17369 [[:Media:Video.ogv]]
17370 !! html/php
17371 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17372 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17373 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17374 </p>
17375 !! html/parsoid
17376 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17377 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17378 <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>
17379 !! end
17380
17381 !! test
17382 Media link with text
17383 !! wikitext
17384 [[Media:Foobar.jpg|A neat file to look at]]
17385 !! html/php
17386 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17387 </p>
17388 !! html/parsoid
17389 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17390 !! end
17391
17392 # FIXME: this is still bad HTML tag nesting
17393 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17394 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17395 !! test
17396 Media link with nasty text
17397 !! wikitext
17398 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17399 !! html/php
17400 <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>
17401
17402 !! html/php+tidy
17403 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
17404 !! html/parsoid
17405 <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>
17406
17407 !! end
17408
17409 !! test
17410 Media link to nonexistent file (T3702)
17411 !! wikitext
17412 [[Media:No such.jpg]]
17413 [[Media:No_such file.jpg]]
17414 !! html/php
17415 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17416 <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>
17417 </p>
17418 !! html/parsoid
17419 <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>
17420 <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>
17421 !! end
17422
17423 !! test
17424 Image link to nonexistent file (T3850 - good)
17425 !! wikitext
17426 [[File:No_such.jpg]]
17427 !! html/php
17428 <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>
17429 </p>
17430 !! html/parsoid
17431 <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>
17432 !! end
17433
17434 !! test
17435 :Image link to nonexistent file (T3850 - bad)
17436 !! wikitext
17437 [[:Image:No such.jpg]]
17438 !! html/php
17439 <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>
17440 </p>
17441 !! html/parsoid
17442 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17443 !! end
17444
17445 !! test
17446 Character reference normalization in link text (T3938)
17447 !! wikitext
17448 [[Main Page|this&that]]
17449 !! html
17450 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17451 </p>
17452 !!end
17453
17454 !! article
17455 אַ
17456 !! text
17457 Test for unicode normalization
17458
17459 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17460 !! endarticle
17461
17462 !! test
17463 (T21451) Links should refer to the normalized form.
17464 !! wikitext
17465 [[&#xFB2E;]]
17466 [[&#x5d0;&#x5b7;]]
17467 [[&#x5d0;ַ]]
17468 [[א&#x5b7;]]
17469 [[אַ]]
17470 !! html
17471 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17472 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17473 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17474 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17475 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17476 </p>
17477 !! end
17478
17479 !! test
17480 Empty attribute crash test (T4067)
17481 !! wikitext
17482 <font color="">foo</font>
17483 !! html
17484 <p><font color="">foo</font>
17485 </p>
17486 !! end
17487
17488 !! test
17489 Empty attribute crash test single-quotes (T4067)
17490 !! wikitext
17491 <font color=''>foo</font>
17492 !! html
17493 <p><font color="">foo</font>
17494 </p>
17495 !! end
17496
17497 !! test
17498 Attribute test: equals, then nothing
17499 !! options
17500 parsoid=wt2html,html2html
17501 !! wikitext
17502 <font color=>foo</font>
17503 !! html/php
17504 <p><font color="">foo</font>
17505 </p>
17506 !! html/parsoid
17507 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17508 !! end
17509
17510 !! test
17511 Attribute test: unquoted value
17512 !! options
17513 parsoid=wt2html,html2html
17514 !! wikitext
17515 <font color=x>foo</font>
17516 !! html/php
17517 <p><font color="x">foo</font>
17518 </p>
17519 !! html/parsoid
17520 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17521 !! end
17522
17523 !! test
17524 Attribute test: unquoted but illegal value (hash)
17525 !! wikitext
17526 <font color=#x>foo</font>
17527 !! html
17528 <p><font color="#x">foo</font>
17529 </p>
17530 !! end
17531
17532 # Parsoid does not serialize to empty attribute syntax,
17533 # so wt2wt and html2wt cases are skipped
17534 !! test
17535 Attribute test: no value (T54330)
17536 !! options
17537 parsoid=wt2html,html2html
17538 !! wikitext
17539 <font color>foo</font>
17540 !! html/php
17541 <p><font color="">foo</font>
17542 </p>
17543 !! html/parsoid
17544 <p><font color="">foo</font></p>
17545 !! end
17546
17547 !! test
17548 T4095: link with three closing brackets
17549 !! wikitext
17550 [[Main Page]]]
17551 !! html/php
17552 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17553 </p>
17554 !! html/parsoid
17555 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17556 !! end
17557
17558 !! test
17559 T4095: link with pipe and three closing brackets
17560 !! wikitext
17561 [[Main Page|link]]]
17562 !! html/php
17563 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17564 </p>
17565 !! html/parsoid
17566 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17567 !! end
17568
17569 !! test
17570 T4095: link with pipe and three closing brackets, version 2
17571 !! wikitext
17572 [[Main Page|[http://example.com/]]]
17573 !! html/php
17574 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17575 </p>
17576 !! html/parsoid
17577 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17578 !! end
17579
17580
17581 ###
17582 ### Safety
17583 ###
17584
17585 !! article
17586 Template:Dangerous attribute
17587 !! text
17588 " onmouseover="alert(document.cookie)
17589 !! endarticle
17590
17591 !! article
17592 Template:Dangerous style attribute
17593 !! text
17594 border-size: expression(alert(document.cookie))
17595 !! endarticle
17596
17597 !! article
17598 Template:Div style
17599 !! text
17600 <div style="float: right; {{{1}}}">Magic div</div>
17601 !! endarticle
17602
17603 !! test
17604 T4304: HTML attribute safety (safe template; regression T4309)
17605 !! wikitext
17606 <div title="{{test}}"></div>
17607 !! html/php
17608 <div title="This is a test template"></div>
17609
17610 !! html/parsoid
17611 <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>
17612 !! end
17613
17614 # Parsoid has enough context to handle this case
17615 !! test
17616 T4304: HTML attribute safety (dangerous template; 2309)
17617 !! wikitext
17618 <div title="{{dangerous attribute}}"></div>
17619 !! html/php
17620 <div title=""></div>
17621
17622 !! html/parsoid
17623 <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>
17624 !! end
17625
17626 !! test
17627 T4304: HTML attribute safety (dangerous style template; 2309)
17628 !! wikitext
17629 <div style="{{dangerous style attribute}}"></div>
17630 !! html/php
17631 <div style="/* insecure input */"></div>
17632
17633 !! html/parsoid
17634 <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>
17635 !! end
17636
17637 !! test
17638 T4304: HTML attribute safety (safe parameter; 2309)
17639 !! wikitext
17640 {{div style|width: 200px}}
17641 !! html/php
17642 <div style="float: right; width: 200px">Magic div</div>
17643
17644 !! html/parsoid
17645 <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>
17646 !! end
17647
17648 !! test
17649 T4304: HTML attribute safety (unsafe parameter; 2309)
17650 !! wikitext
17651 {{div style|width: expression(alert(document.cookie))}}
17652 !! html/php
17653 <div style="/* insecure input */">Magic div</div>
17654
17655 !! html/parsoid
17656 <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>
17657 !! end
17658
17659 ## Parsoid output here differs; needs investigation.
17660 !! test
17661 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17662 !! wikitext
17663 {{div style|"><script>alert(document.cookie)</script>}}
17664 !! html
17665 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17666
17667 !! end
17668
17669 ## Parsoid output here differs; needs investigation.
17670 !! test
17671 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17672 !! wikitext
17673 {{div style|" ><script>alert(document.cookie)</script>}}
17674 !! html
17675 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17676
17677 !! end
17678
17679 !! test
17680 T4304: HTML attribute safety (link)
17681 !! wikitext
17682 <div title="[[Main Page]]"></div>
17683 !! html/php
17684 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17685
17686 !! html/parsoid
17687 <div title="[[Main Page]]"></div>
17688 !! end
17689
17690 !! test
17691 T4304: HTML attribute safety (italics)
17692 !! wikitext
17693 <div title="''foobar''"></div>
17694 !! html
17695 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17696
17697 !! end
17698
17699 !! test
17700 T4304: HTML attribute safety (bold)
17701 !! wikitext
17702 <div title="'''foobar'''"></div>
17703 !! html
17704 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17705
17706 !! end
17707
17708 !! test
17709 T4304: HTML attribute safety (ISBN)
17710 !! wikitext
17711 <div title="ISBN 1234567890"></div>
17712 !! html
17713 <div title="&#73;SBN 1234567890"></div>
17714
17715 !! end
17716
17717 !! test
17718 T4304: HTML attribute safety (RFC)
17719 !! wikitext
17720 <div title="RFC 1234"></div>
17721 !! html
17722 <div title="&#82;FC 1234"></div>
17723
17724 !! end
17725
17726 !! test
17727 T4304: HTML attribute safety (PMID)
17728 !! wikitext
17729 <div title="PMID 1234567890"></div>
17730 !! html
17731 <div title="&#80;MID 1234567890"></div>
17732
17733 !! end
17734
17735 !! test
17736 T4304: HTML attribute safety (web link)
17737 !! wikitext
17738 <div title="http://example.com/"></div>
17739 !! html
17740 <div title="http&#58;//example.com/"></div>
17741
17742 !! end
17743
17744 !! test
17745 T4304: HTML attribute safety (named web link)
17746 !! wikitext
17747 <div title="[http://example.com/ link]"></div>
17748 !! html/php
17749 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17750
17751 !! html/parsoid
17752 <div title="[http://example.com/ link]"></div>
17753 !! end
17754
17755 !! test
17756 T5244: HTML attribute safety (extension; safe)
17757 !! wikitext
17758 <div style="<nowiki>background:blue</nowiki>"></div>
17759 !! html/php
17760 <div style="background:blue"></div>
17761
17762 !! html/parsoid
17763 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17764 !! end
17765
17766 !! test
17767 T5244: HTML attribute safety (extension; unsafe)
17768 !! wikitext
17769 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17770 !! html/php
17771 <div style="/* insecure input */"></div>
17772
17773 !! html/parsoid
17774 <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>
17775 !! end
17776
17777 # More MSIE fun discovered by Tom Gilder
17778
17779 !! test
17780 MSIE CSS safety test: spurious slash
17781 !! wikitext
17782 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17783 !! html/php
17784 <div style="/* insecure input */">evil</div>
17785
17786 !! html/parsoid
17787 <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>
17788 !! end
17789
17790 !! test
17791 MSIE CSS safety test: hex code
17792 !! wikitext
17793 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17794 !! html/php
17795 <div style="/* insecure input */">evil</div>
17796
17797 !! html/parsoid
17798 <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>
17799 !! end
17800
17801 !! test
17802 MSIE CSS safety test: comment in url
17803 !! wikitext
17804 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17805 !! html/php
17806 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17807
17808 !! html/parsoid
17809 <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>
17810 !! end
17811
17812 !! test
17813 MSIE CSS safety test: comment in expression
17814 !! wikitext
17815 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17816 !! html/php
17817 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17818
17819 !! html/parsoid
17820 <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>
17821 !! end
17822
17823 !! test
17824 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17825 !! wikitext
17826 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17827 !! html/php
17828 <p style="/* invalid control char */">A</p>
17829
17830 !! html/parsoid
17831 <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>
17832 !! end
17833
17834 !! test
17835 MSIE 6 CSS safety test: Fullwidth (T57332)
17836 !! wikitext
17837 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17838 <div style="top:EXPRESSION(alert())">B</div>
17839 !! html/php
17840 <p style="/* insecure input */">A</p>
17841 <div style="/* insecure input */">B</div>
17842
17843 !! html/parsoid
17844 <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>
17845 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17846 !! end
17847
17848 !! test
17849 MSIE 6 CSS safety test: IPA extensions (T57332)
17850 !! wikitext
17851 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17852 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17853 !! html/php
17854 <div style="/* insecure input */">A</div>
17855 <p style="/* insecure input */">B</p>
17856
17857 !! html/parsoid
17858 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17859 <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>
17860 !! end
17861
17862 !! test
17863 MSIE 6 CSS safety test: sup/sub script (T57332)
17864 !! wikitext
17865 <div style="background-image:url⁽javascript:alert())">A</div>
17866 <div style="background-image:url₍javascript:alert())">B</div>
17867 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17868 !! html/php
17869 <div style="/* insecure input */">A</div>
17870 <div style="/* insecure input */">B</div>
17871 <p style="/* insecure input */">C</p>
17872
17873 !! html/parsoid
17874 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17875 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17876 <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>
17877 !! end
17878
17879 !! test
17880 Opera -o-link CSS
17881 !! options
17882 parsoid=wt2html,html2html
17883 !! wikitext
17884 <div
17885 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;"
17886 style="-o-link:attr(title);-o-link-source:current">X</div>
17887 !! html/php
17888 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17889
17890 !! html/parsoid
17891 <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>
17892 !! end
17893
17894 !! test
17895 MSIE 6 CSS safety test: Repetition markers (T57332)
17896 !! wikitext
17897 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17898 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17899 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17900 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17901 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17902 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17903 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17904 !! html/php
17905 <p style="/* insecure input */">A</p>
17906 <p style="/* insecure input */">B</p>
17907 <p style="/* insecure input */">C</p>
17908 <p style="/* insecure input */">D</p>
17909 <p style="/* insecure input */">E</p>
17910 <p style="/* insecure input */">F</p>
17911 <p style="/* insecure input */">G</p>
17912
17913 !! html/parsoid
17914 <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>
17915 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
17916 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
17917 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
17918 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
17919 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
17920 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
17921 !! end
17922
17923 !! test
17924 Table attribute legitimate extension
17925 !! wikitext
17926 {|
17927 !+ style="<nowiki>color:blue</nowiki>"|status
17928 |}
17929 !! html
17930 <table>
17931 <tr>
17932 <th style="color:blue">status
17933 </th></tr></table>
17934
17935 !!end
17936
17937 !! test
17938 Table attribute safety
17939 !! wikitext
17940 {|
17941 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
17942 |}
17943 !! html
17944 <table>
17945 <tr>
17946 <th style="/* insecure input */">status
17947 </th></tr></table>
17948
17949 !! end
17950
17951 !! test
17952 CSS line continuation 1
17953 !! wikitext
17954 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17955 !! html
17956 <div style="/* insecure input */"></div>
17957
17958 !! end
17959
17960 !! test
17961 CSS line continuation 2
17962 !! wikitext
17963 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17964 !! html
17965 <div style="/* invalid control char */"></div>
17966
17967 !! end
17968
17969 !! article
17970 Template:Identity
17971 !! text
17972 {{{1}}}
17973 !! endarticle
17974
17975 !! test
17976 Expansion of multi-line templates in attribute values (T8255)
17977 !! wikitext
17978 <div style="background: {{identity|#00FF00}}">-</div>
17979 !! html
17980 <div style="background: #00FF00">-</div>
17981
17982 !! end
17983
17984 !! test
17985 Expansion of multi-line templates in attribute values (T8255 sanity check)
17986 !! wikitext
17987 <div style="background:
17988 #00FF00">-</div>
17989 !! html/php
17990 <div style="background: #00FF00">-</div>
17991
17992 !! html/parsoid
17993 <div style="background:
17994 #00FF00">-</div>
17995 !! end
17996
17997 !! test
17998 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17999 !! wikitext
18000 <div style="background: &#10;#00FF00">-</div>
18001 !! html
18002 <div style="background: &#10;#00FF00">-</div>
18003
18004 !! end
18005
18006 !! test
18007 Tags which are hidden from tidiers cannot pass through the Sanitizer
18008 !! wikitext
18009 <mw:toc><script>alert();</script></mw:toc>
18010 !! html+tidy
18011 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18012 </p>
18013 !! end
18014
18015 ###
18016 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18017 ###
18018
18019 !! test
18020 Parser hook: empty input
18021 !! wikitext
18022 <tag></tag>
18023 !! html/php
18024 <pre>
18025 ''
18026 array (
18027 )
18028 </pre>
18029
18030 !! html/parsoid
18031 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18032 !! end
18033
18034 ## Don't expect parsoid to rt this form.
18035 !! test
18036 Parser hook: empty input using terminated empty elements
18037 !! options
18038 parsoid=wt2html,html2html
18039 !! wikitext
18040 <tag/>
18041 !! html/php
18042 <pre>
18043 NULL
18044 array (
18045 )
18046 </pre>
18047
18048 !! html/parsoid
18049 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18050 !! end
18051
18052 !! test
18053 Parser hook: empty input using terminated empty elements (space before)
18054 !! wikitext
18055 <tag />
18056 !! html/php
18057 <pre>
18058 NULL
18059 array (
18060 )
18061 </pre>
18062
18063 !! html/parsoid
18064 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18065 !! end
18066
18067 !! test
18068 Parser hook: basic input
18069 !! wikitext
18070 <tag>input</tag>
18071 !! html/php
18072 <pre>
18073 'input'
18074 array (
18075 )
18076 </pre>
18077
18078 !! html/parsoid
18079 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18080 !! end
18081
18082 ## Don't expect parsoid to rt this form.
18083 !! test
18084 Parser hook: case insensitive
18085 !! options
18086 parsoid=wt2html,html2html
18087 !! wikitext
18088 <TAG>input</TAG>
18089 !! html/php
18090 <pre>
18091 'input'
18092 array (
18093 )
18094 </pre>
18095
18096 !! html/parsoid
18097 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18098 !! end
18099
18100 ## Don't expect parsoid to rt this form.
18101 !! test
18102 Parser hook: case insensitive, redux
18103 !! options
18104 parsoid=wt2html,html2html
18105 !! wikitext
18106 <TaG>input</TAg>
18107 !! html/php
18108 <pre>
18109 'input'
18110 array (
18111 )
18112 </pre>
18113
18114 !! html/parsoid
18115 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18116 !! end
18117
18118 !! test
18119 Parser hook: nested tags
18120 !! wikitext
18121 <tag><tag></tag></tag>
18122 !! html/php
18123 <pre>
18124 '<tag>'
18125 array (
18126 )
18127 </pre>&lt;/tag&gt;
18128
18129 !! html/parsoid
18130 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18131 !! end
18132
18133 !! test
18134 Parser hook: basic arguments
18135 !! wikitext
18136 <tag width="200" height="100" depth="50" square=""></tag>
18137 !! html/php
18138 <pre>
18139 ''
18140 array (
18141 'width' => '200',
18142 'height' => '100',
18143 'depth' => '50',
18144 'square' => '',
18145 )
18146 </pre>
18147
18148 !! html/parsoid
18149 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18150 !! end
18151
18152 ## Don't expect parsoid to rt this form.
18153 !! test
18154 Parser hook: basic arguments, variations
18155 !! options
18156 parsoid=wt2html,html2html
18157 !! wikitext
18158 <tag width=200 height = "100" depth = '50' square></tag>
18159 !! html/php
18160 <pre>
18161 ''
18162 array (
18163 'width' => '200',
18164 'height' => '100',
18165 'depth' => '50',
18166 'square' => '',
18167 )
18168 </pre>
18169
18170 !! html/parsoid
18171 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18172 !! end
18173
18174 !! test
18175 Parser hook: argument containing a forward slash (T7344)
18176 !! wikitext
18177 <tag filename="/tmp/bla"></tag>
18178 !! html/php
18179 <pre>
18180 ''
18181 array (
18182 'filename' => '/tmp/bla',
18183 )
18184 </pre>
18185
18186 !! html/parsoid
18187 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18188 !! end
18189
18190 ## Don't expect parsoid to rt this form.
18191 !! test
18192 Parser hook: empty input using terminated empty elements (T4374)
18193 !! options
18194 parsoid=wt2html,html2html
18195 !! wikitext
18196 <tag foo=bar/>text
18197 !! html/php
18198 <pre>
18199 NULL
18200 array (
18201 'foo' => 'bar',
18202 )
18203 </pre>text
18204
18205 !! html/parsoid
18206 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18207 !! end
18208
18209 ## </tag> should be output literally since there is no matching tag that begins it
18210 ## Don't expect parsoid to rt this form.
18211 !! test
18212 Parser hook: basic arguments using terminated empty elements (T4374)
18213 !! options
18214 parsoid=wt2html
18215 !! wikitext
18216 <tag width=200 height = "100" depth = '50' square/>
18217 other stuff
18218 </tag>
18219 !! html/php
18220 <pre>
18221 NULL
18222 array (
18223 'width' => '200',
18224 'height' => '100',
18225 'depth' => '50',
18226 'square' => '',
18227 )
18228 </pre>
18229 <p>other stuff
18230 &lt;/tag&gt;
18231 </p>
18232 !! html/parsoid
18233 <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
18234 &lt;/tag></p>
18235 !! end
18236
18237 ## Don't expect parsoid to rt this form.
18238 !! test
18239 Parser hook: Don't allow unclosed extension tags
18240 !! options
18241 parsoid=wt2html
18242 !! wikitext
18243 test <tag>123
18244
18245 this is a '''test'''
18246 !! html/php
18247 <p>test &lt;tag&gt;123
18248 </p><p>this is a <b>test</b>
18249 </p>
18250 !! html/parsoid
18251 <p>test &lt;tag>123</p>
18252
18253 <p>this is a <b>test</b></p>
18254 !! end
18255
18256 ###
18257 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18258 ###
18259
18260 !! test
18261 Parser hook: static parser hook not inside a comment
18262 !! wikitext
18263 <statictag>hello, world</statictag>
18264
18265 <statictag action="flush" />
18266 !! html/php
18267 <p><br />
18268 hello, world
18269 </p>
18270 !! html/parsoid
18271 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18272 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18273 !! end
18274
18275 !! test
18276 Parser hook: static parser hook inside a comment
18277 !! wikitext
18278 <!-- <statictag>hello, world</statictag> -->
18279 <statictag action="flush" />
18280 !! html/php
18281 <p><br />
18282 </p>
18283 !! html/parsoid
18284 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18285 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18286 !! end
18287
18288 # Nested template calls; this case was broken by Parser.php rev 1.506,
18289 # since reverted.
18290
18291 !! article
18292 Template:One-parameter
18293 !! text
18294 (My parameter is: {{{1}}})
18295 !! endarticle
18296
18297 !! article
18298 Template:Map-one-parameter
18299 !! text
18300 {{{{{1}}}|{{{2}}}}}
18301 !! endarticle
18302
18303 !! test
18304 Nested template calls
18305 !! wikitext
18306 {{Map-one-parameter|One-parameter|param}}
18307 !! html
18308 <p>(My parameter is: param)
18309 </p>
18310 !! end
18311
18312
18313 ###
18314 ### Sanitizer
18315 ###
18316
18317 # Remex wraps empty tag runs with p-tags.
18318 # Parsoid strips them out during p-wrapping.
18319 !! test
18320 Sanitizer: Closing of open tags
18321 !! wikitext
18322 <s></s><table></table>
18323 !! html/php+tidy
18324 <p><s></s></p><table></table>
18325 !! html/parsoid
18326 <s></s><table></table>
18327 !! end
18328
18329 !! test
18330 Sanitizer: Closing of open but not closed tags
18331 !! wikitext
18332 <s>foo
18333 !! html
18334 <p><s>foo</s>
18335 </p>
18336 !! end
18337
18338 !! test
18339 Sanitizer: Closing of closed but not open tags
18340 !! options
18341 parsoid=wt2html
18342 !! wikitext
18343 </s>
18344 !! html/php+tidy
18345 <p class="mw-empty-elt">
18346 </p>
18347 !! html/parsoid
18348 !! end
18349
18350 !! test
18351 Sanitizer: Closing of closed but not open table tags
18352 !! options
18353 parsoid=wt2html
18354 !! wikitext
18355 Table not started</td></tr></table>
18356 !! html+tidy
18357 <p>Table not started
18358 </p>
18359 !! end
18360
18361 !! test
18362 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18363 !! config
18364 wgFragmentMode=[ 'html5', 'legacy' ]
18365 !! wikitext
18366 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18367 !! html/php
18368 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18369 </p>
18370 !! html/parsoid
18371 <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>
18372 !! end
18373
18374 !! test
18375 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18376 !! config
18377 wgFragmentMode=[ 'legacy' ]
18378 !! wikitext
18379 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18380 !! html/php
18381 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18382 </p>
18383 !! end
18384
18385 # In HTML5, the restrictions are that id must contain at least one character,
18386 # and must not contain any space characters.
18387 !! test
18388 Sanitizer: Validating the contents of the id attribute (T6515)
18389 !! options
18390 disabled
18391 !! wikitext
18392 <br id="" /><br id="a space" />
18393 !! html
18394 Something ...
18395 !! end
18396
18397 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18398 !! test
18399 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18400 !! options
18401 disabled
18402 !! wikitext
18403 <br id="foo" /><br id="foo" />
18404 !! html
18405 Something need to be done. foo-2 ?
18406 !! end
18407
18408 !! test
18409 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18410 !! wikitext
18411 <div itemscope>
18412 <meta itemprop="hello" content="world">
18413 <meta http-equiv="refresh" content="5">
18414 <meta itemprop="hello" http-equiv="refresh" content="5">
18415 <link itemprop="hello" href="{{SERVER}}">
18416 <link rel="stylesheet" href="{{SERVER}}">
18417 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18418 </div>
18419 !! html
18420 <div itemscope="">
18421 <p> <meta itemprop="hello" content="world" />
18422 &lt;meta http-equiv="refresh" content="5"&gt;
18423 <meta itemprop="hello" content="5" />
18424 <link itemprop="hello" href="http&#58;//example.org" />
18425 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18426 <link itemprop="hello" href="http&#58;//example.org" />
18427 </p>
18428 </div>
18429
18430 !! end
18431
18432 !! test
18433 Sanitizer: Strip comments from CSS attributes
18434 !! options
18435 parsoid=wt2html,wt2wt
18436 !! wikitext
18437 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18438 !! html/php
18439 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18440 </p>
18441 !! html/parsoid
18442 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18443 !! end
18444
18445 !! test
18446 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18447 !! wikitext
18448 [[meatball:Soft"Security]]
18449 !! html/php
18450 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18451 </p>
18452 !! html/parsoid
18453 <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>
18454 !! end
18455
18456 !! test
18457 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18458 !! wikitext
18459 [[meatball:Foo<Bar]]
18460 [[meatball:Foo>Bar]]
18461 [[meatball:Foo&lt;bar]]
18462 [[meatball:Foo&gt;bar]]
18463 !! html/php
18464 <p>[[meatball:Foo&lt;Bar]]
18465 [[meatball:Foo&gt;Bar]]
18466 [[meatball:Foo&lt;bar]]
18467 [[meatball:Foo&gt;bar]]
18468 </p>
18469 !! html/parsoid
18470 <p>[[meatball:Foo&lt;Bar]]
18471 [[meatball:Foo>Bar]]
18472 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18473 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18474 !! end
18475
18476 !! test
18477 Language converter: output gets cut off unexpectedly (T7757)
18478 !! options
18479 language=zh
18480 !! wikitext
18481 this bit is safe: }-
18482
18483 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18484
18485 then we get cut off here: }-
18486
18487 all additional text is vanished
18488 !! html/php
18489 <p>this bit is safe: }-
18490 </p><p>but if we add a conversion instance: xxx
18491 </p><p>then we get cut off here: }-
18492 </p><p>all additional text is vanished
18493 </p>
18494 !! html/parsoid
18495 <p>this bit is safe: }-</p>
18496 <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>
18497 <p>then we get cut off here: }-</p>
18498 <p>all additional text is vanished</p>
18499 !! end
18500
18501 !! test
18502 Language converter glossary rules inside attributes (T119158)
18503 !! options
18504 language=sr variant=sr-el
18505 !! wikitext
18506 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18507
18508 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18509 !! html/php
18510 <p>
18511 </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>
18512 </p>
18513 !! html/parsoid
18514 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18515
18516 <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>
18517 !! end
18518
18519 !! test
18520 Self closed html pairs (T7487)
18521 !! wikitext
18522 <center><font id="bug" />Centered text</center>
18523 <div><font id="bug2" />In div text</div>
18524 !! html+tidy
18525 <center><font id="bug"></font>Centered text</center>
18526 <div><font id="bug2"></font>In div text</div>
18527 !! end
18528
18529 !! test
18530 Punctuation: nbsp before exclamation
18531 !! wikitext
18532 C'est grave !
18533 !! html
18534 <p>C'est grave&#160;!
18535 </p>
18536 !! end
18537
18538 !! test
18539 Punctuation: CSS !important (T13874)
18540 !! wikitext
18541 <div style="width:50% !important">important</div>
18542 !! html
18543 <div style="width:50% !important">important</div>
18544
18545 !!end
18546
18547 !! test
18548 Punctuation: CSS ! important (T13874; with space after)
18549 !! wikitext
18550 <div style="width:50% ! important">important</div>
18551 !! html
18552 <div style="width:50% ! important">important</div>
18553
18554 !!end
18555
18556 !! test
18557 HTML bullet list, closed tags (T7497)
18558 !! wikitext
18559 <ul>
18560 <li>One</li>
18561 <li>Two</li>
18562 </ul>
18563 !! html/php
18564 <ul>
18565 <li>One</li>
18566 <li>Two</li>
18567 </ul>
18568
18569 !! html/parsoid
18570 <ul data-parsoid='{"stx":"html"}'>
18571 <li data-parsoid='{"stx":"html"}'>One</li>
18572 <li data-parsoid='{"stx":"html"}'>Two</li>
18573 </ul>
18574
18575 !! end
18576
18577 !! test
18578 HTML bullet list, unclosed tags (T7497)
18579 !! wikitext
18580 <ul>
18581 <li>One
18582 <li>Two
18583 </ul>
18584 !! html/php+tidy
18585 <ul>
18586 <li>One
18587 </li><li>Two
18588 </li></ul>
18589 !! html/parsoid
18590 <ul data-parsoid='{"stx":"html"}'>
18591 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18592 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18593 </ul>
18594
18595 !! end
18596
18597 !! test
18598 HTML ordered list, closed tags (T7497)
18599 !! wikitext
18600 <ol>
18601 <li>One</li>
18602 <li>Two</li>
18603 </ol>
18604 !! html/php
18605 <ol>
18606 <li>One</li>
18607 <li>Two</li>
18608 </ol>
18609
18610 !! html/parsoid
18611 <ol data-parsoid='{"stx":"html"}'>
18612 <li data-parsoid='{"stx":"html"}'>One</li>
18613 <li data-parsoid='{"stx":"html"}'>Two</li>
18614 </ol>
18615
18616 !! end
18617
18618 !! test
18619 HTML ordered list, unclosed tags (T7497)
18620 !! options
18621 !! wikitext
18622 <ol>
18623 <li>One
18624 <li>Two
18625 </ol>
18626 !! html/php+tidy
18627 <ol>
18628 <li>One
18629 </li><li>Two
18630 </li></ol>
18631 !! html/parsoid
18632 <ol data-parsoid='{"stx":"html"}'>
18633 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18634 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18635 </ol>
18636
18637 !! end
18638
18639 !! test
18640 HTML nested bullet list, closed tags (T7497)
18641 !! wikitext
18642 <ul>
18643 <li>One</li>
18644 <li>Two:
18645 <ul>
18646 <li>Sub-one</li>
18647 <li>Sub-two</li>
18648 </ul>
18649 </li>
18650 </ul>
18651 !! html/php
18652 <ul>
18653 <li>One</li>
18654 <li>Two:
18655 <ul>
18656 <li>Sub-one</li>
18657 <li>Sub-two</li>
18658 </ul>
18659 </li>
18660 </ul>
18661
18662 !! html/parsoid
18663 <ul data-parsoid='{"stx":"html"}'>
18664 <li data-parsoid='{"stx":"html"}'>One</li>
18665 <li data-parsoid='{"stx":"html"}'>Two:
18666 <ul data-parsoid='{"stx":"html"}'>
18667 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18668 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18669 </ul>
18670 </li>
18671 </ul>
18672 !! end
18673
18674 !! test
18675 HTML nested bullet list, open tags (T7497)
18676 !! wikitext
18677 <ul>
18678 <li>One
18679 <li>Two:
18680 <ul>
18681 <li>Sub-one
18682 <li>Sub-two
18683 </ul>
18684 </ul>
18685 !! html+tidy
18686 <ul>
18687 <li>One
18688 </li><li>Two:
18689 <ul>
18690 <li>Sub-one
18691 </li><li>Sub-two
18692 </li></ul>
18693 </li></ul>
18694 !! end
18695
18696 !! test
18697 HTML nested ordered list, closed tags (T7497)
18698 !! wikitext
18699 <ol>
18700 <li>One</li>
18701 <li>Two:
18702 <ol>
18703 <li>Sub-one</li>
18704 <li>Sub-two</li>
18705 </ol>
18706 </li>
18707 </ol>
18708 !! html
18709 <ol>
18710 <li>One</li>
18711 <li>Two:
18712 <ol>
18713 <li>Sub-one</li>
18714 <li>Sub-two</li>
18715 </ol>
18716 </li>
18717 </ol>
18718
18719 !! end
18720
18721 !! test
18722 HTML nested ordered list, open tags (T7497)
18723 !! wikitext
18724 <ol>
18725 <li>One
18726 <li>Two:
18727 <ol>
18728 <li>Sub-one
18729 <li>Sub-two
18730 </ol>
18731 </ol>
18732 !! html/php
18733 <ol>
18734 <li>One
18735 <li>Two:
18736 <ol>
18737 <li>Sub-one
18738 <li>Sub-two
18739 </ol>
18740 </ol>
18741
18742 !! html/parsoid
18743 <ol>
18744 <li>One
18745 </li>
18746 <li>Two:
18747 <ol>
18748 <li>Sub-one
18749 </li>
18750 <li>Sub-two
18751 </li>
18752 </ol>
18753 </li>
18754 </ol>
18755
18756 !! end
18757
18758 !! test
18759 HTML ordered list item with parameters oddity
18760 !! wikitext
18761 <ol><li id="fragment">One</li>
18762 </ol>
18763 !! html
18764 <ol><li id="fragment">One</li>
18765 </ol>
18766
18767 !! end
18768
18769 # parsoid doesn't explicitly mark autonumbered links, see T55505
18770 !!test
18771 T7918: autonumbering
18772 !! wikitext
18773 [http://first/] [http://second] [ftp://ftp]
18774
18775 ftp://inlineftp
18776
18777 [mailto:enclosed@mail.tld With target]
18778
18779 [mailto:enclosed@mail.tld]
18780
18781 mailto:inline@mail.tld
18782 !! html/php
18783 <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>
18784 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18785 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18786 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18787 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18788 </p>
18789 !! html/parsoid
18790 <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>
18791 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18792 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18793 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18794 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18795 !! end
18796
18797
18798 #
18799 # Security and HTML correctness
18800 # From Nick Jenkins' fuzz testing
18801 #
18802
18803 !! test
18804 Fuzz testing: Parser13
18805 !! wikitext
18806 {|
18807 | http://a|
18808 !! html
18809 <table>
18810 <tr>
18811 <td>
18812 </td>
18813 </tr>
18814 </table>
18815
18816 !! end
18817
18818 # Note that Parsoid output differs from the PHP parser here: the PHP
18819 # parser breaks the URL for the magic word, while in Parsoid the URL
18820 # production takes precedence.
18821 !! test
18822 Fuzz testing: Parser14
18823 !! wikitext
18824 ==onmouseover===
18825 http://__TOC__
18826 !! html/php
18827 <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>
18828 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18829 <ul>
18830 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18831 </ul>
18832 </div>
18833
18834
18835 !! html/php+tidy
18836 <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>
18837 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18838 <ul>
18839 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18840 </ul>
18841 </div>
18842 !! html/parsoid
18843 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18844 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18845 !! end
18846
18847 !! test
18848 Fuzz testing: Parser14-table
18849 !! options
18850 parsoid=wt2html,html2html
18851 !! wikitext
18852 ==a==
18853 {| STYLE=__TOC__
18854 !! html
18855 <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>
18856 <table style="&#95;_TOC&#95;_">
18857 <tr><td></td></tr>
18858 </table>
18859
18860 !! html+tidy
18861 <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>
18862 <table style="__TOC__">
18863 <tr>
18864 <td></td>
18865 </tr>
18866 </table>
18867 !! html/parsoid
18868 <h2 id="a">a</h2>
18869 <table style="__TOC__"></table>
18870 !! end
18871
18872 # Known to produce bogus xml (extra </td>)
18873 # Don't add the html/php section since it generates broken HTML
18874 !! test
18875 Fuzz testing: Parser16
18876 !! wikitext
18877 {|
18878 !https://||||||
18879 !! html+tidy
18880 <table>
18881 <tbody><tr>
18882 <th>https://</th>
18883 <th></th>
18884 <th></th>
18885 <th>
18886
18887 </th></tr>
18888 </tbody></table>
18889 !! end
18890
18891 !! test
18892 Fuzz testing: Parser21
18893 !! wikitext
18894 {|
18895 !irc://{{ftp://a" onmouseover="alert('hello world');"
18896 |
18897 !! html
18898 <table>
18899 <tr>
18900 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18901 </th>
18902 <td>
18903 </td>
18904 </tr>
18905 </table>
18906
18907 !! end
18908
18909 !! test
18910 Fuzz testing: Parser22
18911 !! wikitext
18912 http://===r:::https://b
18913
18914 {|
18915 !! html
18916 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18917 </p>
18918 <table>
18919 <tr><td></td></tr>
18920 </table>
18921
18922 !! end
18923
18924 # Known to produce bad XML for now
18925 !! test
18926 Fuzz testing: Parser24
18927 !! options
18928 parsoid=wt2html
18929 !! wikitext
18930 {|
18931 {{{|
18932 <u CLASS=
18933 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18934 <br style="onmouseover='alert(document.cookie);' " />
18935
18936 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18937 |
18938 !! html/php
18939 <table>
18940 {{{|
18941 <u class="&#124;">}}}} &gt;
18942 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18943
18944 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18945 <tr>
18946 <td></u>
18947 </td>
18948 </tr>
18949 </table>
18950
18951 !! html/parsoid
18952 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18953 <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>"}'/>}}}} >
18954 <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}'>
18955
18956
18957
18958 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18959 !! end
18960
18961 # Note: the current result listed for this is not what the original one was,
18962 # but the original bug was JavaScript injection, which is fixed in any case.
18963 # It's not clear that the original result listed was any more correct than the
18964 # current one. Original result:
18965 # <p>{{{|
18966 # </p>
18967 # <li class="&#124;&#124;">
18968 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18969 !!test
18970 Fuzz testing: Parser25 (T8055)
18971 !! wikitext
18972 {{{
18973 |
18974 <LI CLASS=||
18975 >
18976 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18977 !! html/php
18978 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18979 </p>
18980 !! html/parsoid
18981 <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"]}'>
18982 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18983 !! end
18984
18985 !!test
18986 Fuzz testing: URL adjacent extension (with space, clean)
18987 !! wikitext
18988 http://example.com <nowiki>junk</nowiki>
18989 !! html/php
18990 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18991 </p>
18992 !! html/parsoid
18993 <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>
18994 !! end
18995
18996 !!test
18997 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18998 !! wikitext
18999 http://example.com<nowiki>junk</nowiki>
19000 !! html/php
19001 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19002 </p>
19003 !! html/parsoid
19004 <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>
19005 !! end
19006
19007 !! test
19008 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19009 !! wikitext
19010 http://example.com<pre>junk</pre>
19011 !! html/php
19012 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19013
19014 !! html/php+tidy
19015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19016 !! html/parsoid
19017 <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>
19018 !! end
19019
19020 !! test
19021 Fuzz testing: image with bogus manual thumbnail
19022 !! wikitext
19023 [[Image:foobar.jpg|thumbnail= ]]
19024 !! html/php
19025 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19026
19027 !! html/parsoid
19028 <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>
19029 !! end
19030
19031 # Parsoid will emit the newline literally in wt2wt; see next test case.
19032 !! test
19033 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19034 !! options
19035 parsoid=wt2html
19036 !! wikitext
19037 <pre dir="&#10;"></pre>
19038 !! html/php
19039 <pre dir="&#10;"></pre>
19040
19041 !! html/parsoid
19042 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19043 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19044 !! end
19045
19046 !! test
19047 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19048 !! options
19049 parsoid=html2wt
19050 !! html/parsoid
19051 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19052 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19053 !! wikitext
19054 <pre dir="
19055 "></pre>
19056 !! html/php
19057 <pre dir=""></pre>
19058
19059 !! end
19060
19061 !! test
19062 Templates in extension attributes are not expanded
19063 !! wikitext
19064 <pre dir="{{echo|ltr}}"></pre>
19065 !! html/php
19066 <pre dir="{{echo|ltr}}"></pre>
19067
19068 !! html/parsoid
19069 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19070 !! end
19071
19072 !! test
19073 Parsing optional HTML elements (T8171)
19074 !! options
19075 !! wikitext
19076 <table>
19077 <tr>
19078 <td> Some tabular data</td>
19079 <td> More tabular data ...
19080 <td> And yet som tabular data</td>
19081 </tr>
19082 </table>
19083 !! html
19084 <table>
19085 <tr>
19086 <td> Some tabular data</td>
19087 <td> More tabular data ...
19088 </td><td> And yet som tabular data</td>
19089 </tr>
19090 </table>
19091
19092 !! end
19093
19094 !! test
19095 Correct handling of <td>, <tr> (T8171)
19096 !! options
19097 !! wikitext
19098 <table>
19099 <tr>
19100 <td> Some tabular data</td>
19101 <td> More tabular data ...</td>
19102 <td> And yet som tabular data</td>
19103 </tr>
19104 </table>
19105 !! html
19106 <table>
19107 <tr>
19108 <td> Some tabular data</td>
19109 <td> More tabular data ...</td>
19110 <td> And yet som tabular data</td>
19111 </tr>
19112 </table>
19113
19114 !! end
19115
19116
19117 !! test
19118 Parsing crashing regression (fr:JavaScript)
19119 !! wikitext
19120 </body></x>
19121 !! html
19122 <p>&lt;/body&gt;&lt;/x&gt;
19123 </p>
19124 !! end
19125
19126 !! test
19127 Inline wiki vs wiki block nesting
19128 !! wikitext
19129 '''Bold paragraph
19130
19131 New wiki paragraph
19132 !! html
19133 <p><b>Bold paragraph</b>
19134 </p><p>New wiki paragraph
19135 </p>
19136 !! end
19137
19138 # FIXME: The current php output is documented
19139 # and desired output is the parsoid target.
19140 !! test
19141 Inline HTML vs wiki block nesting
19142 !! wikitext
19143 <b>Bold paragraph
19144
19145 New wiki paragraph
19146 !! html/php
19147 <p><b>Bold paragraph
19148 </p><p>New wiki paragraph</b>
19149 </p>
19150 !! html/parsoid
19151 <p><b>Bold paragraph</b>
19152 </p><p>New wiki paragraph
19153 </p>
19154 !! end
19155
19156 # Original result was this:
19157 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19158 # </p>
19159 # While that might be marginally more intuitive, maybe, the six-apostrophe
19160 # construct is clearly pathological and the result stated here (which is what
19161 # the parser actually does) is about as reasonable as anything.
19162 !!test
19163 Mixing markup for italics and bold
19164 !! options
19165 !! wikitext
19166 '''bold''''''bold''bolditalics'''''
19167 !! html
19168 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19169 </p>
19170 !! end
19171
19172
19173 !! article
19174 Xyzzyx
19175 !! text
19176 Article for special page transclusion test
19177 !! endarticle
19178
19179 !! test
19180 Special page transclusion
19181 !! options
19182 !! wikitext
19183 {{Special:Prefixindex/Xyzzyx}}
19184 !! html
19185 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19186 </ul>
19187
19188 !! end
19189
19190 !! test
19191 Special page transclusion twice (T7021)
19192 !! options
19193 !! wikitext
19194 {{Special:Prefixindex/Xyzzyx}}
19195 {{Special:Prefixindex/Xyzzyx}}
19196 !! html
19197 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19198 </ul>
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 Transclusion of default MediaWiki message
19206 !! wikitext
19207 {{MediaWiki:Mainpage}}
19208 !! html
19209 <p>Main Page
19210 </p>
19211 !! end
19212
19213 !! test
19214 Transclusion of nonexistent MediaWiki message
19215 !! wikitext
19216 {{MediaWiki:Mainpagexxx}}
19217 !! html
19218 <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>
19219 </p>
19220 !! end
19221
19222 !! test
19223 Transclusion of MediaWiki message with underscore
19224 !! wikitext
19225 {{MediaWiki:history_short}}
19226 !! html
19227 <p>History
19228 </p>
19229 !! end
19230
19231 !! test
19232 Transclusion of MediaWiki message with space
19233 !! wikitext
19234 {{MediaWiki:history short}}
19235 !! html
19236 <p>History
19237 </p>
19238 !! end
19239
19240 !! test
19241 Invalid header with following text
19242 !! wikitext
19243 = x = y
19244 !! html
19245 <p>= x = y
19246 </p>
19247 !! end
19248
19249
19250 !! test
19251 Section extraction test (section 0)
19252 !! options
19253 section=0
19254 !! wikitext
19255 start
19256 ==a==
19257 ===aa===
19258 ====aaa====
19259 ==b==
19260 ===ba===
19261 ===bb===
19262 ====bba====
19263 ===bc===
19264 ==c==
19265 ===ca===
19266 !! html/php
19267 start
19268 !! end
19269
19270 !! test
19271 Section extraction test (section 1)
19272 !! options
19273 section=1
19274 !! wikitext
19275 start
19276 ==a==
19277 ===aa===
19278 ====aaa====
19279 ==b==
19280 ===ba===
19281 ===bb===
19282 ====bba====
19283 ===bc===
19284 ==c==
19285 ===ca===
19286 !! html/php
19287 ==a==
19288 ===aa===
19289 ====aaa====
19290 !! end
19291
19292 !! test
19293 Section extraction test (section 2)
19294 !! options
19295 section=2
19296 !! wikitext
19297 start
19298 ==a==
19299 ===aa===
19300 ====aaa====
19301 ==b==
19302 ===ba===
19303 ===bb===
19304 ====bba====
19305 ===bc===
19306 ==c==
19307 ===ca===
19308 !! html/php
19309 ===aa===
19310 ====aaa====
19311 !! end
19312
19313 !! test
19314 Section extraction test (section 3)
19315 !! options
19316 section=3
19317 !! wikitext
19318 start
19319 ==a==
19320 ===aa===
19321 ====aaa====
19322 ==b==
19323 ===ba===
19324 ===bb===
19325 ====bba====
19326 ===bc===
19327 ==c==
19328 ===ca===
19329 !! html/php
19330 ====aaa====
19331 !! end
19332
19333 !! test
19334 Section extraction test (section 4)
19335 !! options
19336 section=4
19337 !! wikitext
19338 start
19339 ==a==
19340 ===aa===
19341 ====aaa====
19342 ==b==
19343 ===ba===
19344 ===bb===
19345 ====bba====
19346 ===bc===
19347 ==c==
19348 ===ca===
19349 !! html/php
19350 ==b==
19351 ===ba===
19352 ===bb===
19353 ====bba====
19354 ===bc===
19355 !! end
19356
19357 !! test
19358 Section extraction test (section 5)
19359 !! options
19360 section=5
19361 !! wikitext
19362 start
19363 ==a==
19364 ===aa===
19365 ====aaa====
19366 ==b==
19367 ===ba===
19368 ===bb===
19369 ====bba====
19370 ===bc===
19371 ==c==
19372 ===ca===
19373 !! html/php
19374 ===ba===
19375 !! end
19376
19377 !! test
19378 Section extraction test (section 6)
19379 !! options
19380 section=6
19381 !! wikitext
19382 start
19383 ==a==
19384 ===aa===
19385 ====aaa====
19386 ==b==
19387 ===ba===
19388 ===bb===
19389 ====bba====
19390 ===bc===
19391 ==c==
19392 ===ca===
19393 !! html/php
19394 ===bb===
19395 ====bba====
19396 !! end
19397
19398 !! test
19399 Section extraction test (section 7)
19400 !! options
19401 section=7
19402 !! wikitext
19403 start
19404 ==a==
19405 ===aa===
19406 ====aaa====
19407 ==b==
19408 ===ba===
19409 ===bb===
19410 ====bba====
19411 ===bc===
19412 ==c==
19413 ===ca===
19414 !! html/php
19415 ====bba====
19416 !! end
19417
19418 !! test
19419 Section extraction test (section 8)
19420 !! options
19421 section=8
19422 !! wikitext
19423 start
19424 ==a==
19425 ===aa===
19426 ====aaa====
19427 ==b==
19428 ===ba===
19429 ===bb===
19430 ====bba====
19431 ===bc===
19432 ==c==
19433 ===ca===
19434 !! html/php
19435 ===bc===
19436 !! end
19437
19438 !! test
19439 Section extraction test (section 9)
19440 !! options
19441 section=9
19442 !! wikitext
19443 start
19444 ==a==
19445 ===aa===
19446 ====aaa====
19447 ==b==
19448 ===ba===
19449 ===bb===
19450 ====bba====
19451 ===bc===
19452 ==c==
19453 ===ca===
19454 !! html/php
19455 ==c==
19456 ===ca===
19457 !! end
19458
19459 !! test
19460 Section extraction test (section 10)
19461 !! options
19462 section=10
19463 !! wikitext
19464 start
19465 ==a==
19466 ===aa===
19467 ====aaa====
19468 ==b==
19469 ===ba===
19470 ===bb===
19471 ====bba====
19472 ===bc===
19473 ==c==
19474 ===ca===
19475 !! html/php
19476 ===ca===
19477 !! end
19478
19479 !! test
19480 Section extraction test (nonexistent section 11)
19481 !! options
19482 section=11
19483 !! wikitext
19484 start
19485 ==a==
19486 ===aa===
19487 ====aaa====
19488 ==b==
19489 ===ba===
19490 ===bb===
19491 ====bba====
19492 ===bc===
19493 ==c==
19494 ===ca===
19495 !! html/php
19496 !! end
19497
19498 !! test
19499 Section extraction test with bogus heading (section 1)
19500 !! options
19501 section=1
19502 !! wikitext
19503 ==a==
19504 ==bogus== not a legal section
19505 ==b==
19506 !! html/php
19507 ==a==
19508 ==bogus== not a legal section
19509 !! end
19510
19511 !! test
19512 Section extraction test with bogus heading (section 2)
19513 !! options
19514 section=2
19515 !! wikitext
19516 ==a==
19517 ==bogus== not a legal section
19518 ==b==
19519 !! html/php
19520 ==b==
19521 !! end
19522
19523 !! test
19524 Section extraction test with comment after heading (section 1)
19525 !! options
19526 section=1
19527 !! wikitext
19528 ==a==
19529 ==b== <!-- -->
19530 ==c==
19531 !! html/php
19532 ==a==
19533 !! end
19534
19535 !! test
19536 Section extraction test with comment after heading (section 2)
19537 !! options
19538 section=2
19539 !! wikitext
19540 ==a==
19541 ==b== <!-- -->
19542 ==c==
19543 !! html/php
19544 ==b== <!-- -->
19545 !! end
19546
19547 !! test
19548 Section extraction test with bogus <nowiki> heading (section 1)
19549 !! options
19550 section=1
19551 !! wikitext
19552 ==a==
19553 ==bogus== <nowiki>not a legal section</nowiki>
19554 ==b==
19555 !! html/php
19556 ==a==
19557 ==bogus== <nowiki>not a legal section</nowiki>
19558 !! end
19559
19560 !! test
19561 Section extraction test with bogus <nowiki> heading (section 2)
19562 !! options
19563 section=2
19564 !! wikitext
19565 ==a==
19566 ==bogus== <nowiki>not a legal section</nowiki>
19567 ==b==
19568 !! html/php
19569 ==b==
19570 !! end
19571
19572 # Formerly testing for T4587, now resolved by the use of unmarked sections
19573 # instead of respecting commented sections
19574 !! test
19575 Section extraction prefixed by comment (section 1)
19576 !! options
19577 section=1
19578 !! wikitext
19579 <!-- -->==sec1==
19580 ==sec2==
19581 !! html/php
19582 ==sec2==
19583 !!end
19584
19585 !! test
19586 Section extraction prefixed by comment (section 2)
19587 !! options
19588 section=2
19589 !! wikitext
19590 <!-- -->==sec1==
19591 ==sec2==
19592 !! html/php
19593
19594 !!end
19595
19596 # Formerly testing for T4607, now resolved by the use of unmarked sections
19597 # instead of respecting HTML-style headings
19598 !! test
19599 Section extraction, mixed wiki and html (section 1)
19600 !! options
19601 section=1
19602 !! wikitext
19603 <h2>unmarked</h2>
19604 unmarked
19605 ==1==
19606 one
19607 ==2==
19608 two
19609 !! html/php
19610 ==1==
19611 one
19612 !! end
19613
19614 !! test
19615 Section extraction, mixed wiki and html (section 2)
19616 !! options
19617 section=2
19618 !! wikitext
19619 <h2>unmarked</h2>
19620 unmarked
19621 ==1==
19622 one
19623 ==2==
19624 two
19625 !! html/php
19626 ==2==
19627 two
19628 !! end
19629
19630
19631 # Formerly testing for T5342
19632 !! test
19633 Section extraction, heading surrounded by <noinclude>
19634 !! options
19635 section=1
19636 !! wikitext
19637 <noinclude>==unmarked==</noinclude>
19638 ==marked==
19639 !! html/php
19640 ==marked==
19641 !!end
19642
19643 # Test behavior of T21910
19644 !! test
19645 Sectiion with all-equals
19646 !! options
19647 section=2
19648 !! wikitext
19649 ===
19650 The line above must have a trailing space
19651 === <!--
19652 --> <!-- -->
19653 But just in case it doesn't...
19654 !! html/php
19655 === <!--
19656 --> <!-- -->
19657 But just in case it doesn't...
19658 !! end
19659
19660 !! test
19661 Section replacement test (section 0)
19662 !! options
19663 replace=0,"xxx"
19664 !! wikitext
19665 start
19666 ==a==
19667 ===aa===
19668 ====aaa====
19669 ==b==
19670 ===ba===
19671 ===bb===
19672 ====bba====
19673 ===bc===
19674 ==c==
19675 ===ca===
19676 !! html/php
19677 xxx
19678
19679 ==a==
19680 ===aa===
19681 ====aaa====
19682 ==b==
19683 ===ba===
19684 ===bb===
19685 ====bba====
19686 ===bc===
19687 ==c==
19688 ===ca===
19689 !! end
19690
19691 !! test
19692 Section replacement test (section 1)
19693 !! options
19694 replace=1,"xxx"
19695 !! wikitext
19696 start
19697 ==a==
19698 ===aa===
19699 ====aaa====
19700 ==b==
19701 ===ba===
19702 ===bb===
19703 ====bba====
19704 ===bc===
19705 ==c==
19706 ===ca===
19707 !! html/php
19708 start
19709 xxx
19710
19711 ==b==
19712 ===ba===
19713 ===bb===
19714 ====bba====
19715 ===bc===
19716 ==c==
19717 ===ca===
19718 !! end
19719
19720 !! test
19721 Section replacement test (section 2)
19722 !! options
19723 replace=2,"xxx"
19724 !! wikitext
19725 start
19726 ==a==
19727 ===aa===
19728 ====aaa====
19729 ==b==
19730 ===ba===
19731 ===bb===
19732 ====bba====
19733 ===bc===
19734 ==c==
19735 ===ca===
19736 !! html/php
19737 start
19738 ==a==
19739 xxx
19740
19741 ==b==
19742 ===ba===
19743 ===bb===
19744 ====bba====
19745 ===bc===
19746 ==c==
19747 ===ca===
19748 !! end
19749
19750 !! test
19751 Section replacement test (section 3)
19752 !! options
19753 replace=3,"xxx"
19754 !! wikitext
19755 start
19756 ==a==
19757 ===aa===
19758 ====aaa====
19759 ==b==
19760 ===ba===
19761 ===bb===
19762 ====bba====
19763 ===bc===
19764 ==c==
19765 ===ca===
19766 !! html/php
19767 start
19768 ==a==
19769 ===aa===
19770 xxx
19771
19772 ==b==
19773 ===ba===
19774 ===bb===
19775 ====bba====
19776 ===bc===
19777 ==c==
19778 ===ca===
19779 !! end
19780
19781 !! test
19782 Section replacement test (section 4)
19783 !! options
19784 replace=4,"xxx"
19785 !! wikitext
19786 start
19787 ==a==
19788 ===aa===
19789 ====aaa====
19790 ==b==
19791 ===ba===
19792 ===bb===
19793 ====bba====
19794 ===bc===
19795 ==c==
19796 ===ca===
19797 !! html/php
19798 start
19799 ==a==
19800 ===aa===
19801 ====aaa====
19802 xxx
19803
19804 ==c==
19805 ===ca===
19806 !! end
19807
19808 !! test
19809 Section replacement test (section 5)
19810 !! options
19811 replace=5,"xxx"
19812 !! wikitext
19813 start
19814 ==a==
19815 ===aa===
19816 ====aaa====
19817 ==b==
19818 ===ba===
19819 ===bb===
19820 ====bba====
19821 ===bc===
19822 ==c==
19823 ===ca===
19824 !! html/php
19825 start
19826 ==a==
19827 ===aa===
19828 ====aaa====
19829 ==b==
19830 xxx
19831
19832 ===bb===
19833 ====bba====
19834 ===bc===
19835 ==c==
19836 ===ca===
19837 !! end
19838
19839 !! test
19840 Section replacement test (section 6)
19841 !! options
19842 replace=6,"xxx"
19843 !! wikitext
19844 start
19845 ==a==
19846 ===aa===
19847 ====aaa====
19848 ==b==
19849 ===ba===
19850 ===bb===
19851 ====bba====
19852 ===bc===
19853 ==c==
19854 ===ca===
19855 !! html/php
19856 start
19857 ==a==
19858 ===aa===
19859 ====aaa====
19860 ==b==
19861 ===ba===
19862 xxx
19863
19864 ===bc===
19865 ==c==
19866 ===ca===
19867 !! end
19868
19869 !! test
19870 Section replacement test (section 7)
19871 !! options
19872 replace=7,"xxx"
19873 !! wikitext
19874 start
19875 ==a==
19876 ===aa===
19877 ====aaa====
19878 ==b==
19879 ===ba===
19880 ===bb===
19881 ====bba====
19882 ===bc===
19883 ==c==
19884 ===ca===
19885 !! html/php
19886 start
19887 ==a==
19888 ===aa===
19889 ====aaa====
19890 ==b==
19891 ===ba===
19892 ===bb===
19893 xxx
19894
19895 ===bc===
19896 ==c==
19897 ===ca===
19898 !! end
19899
19900 !! test
19901 Section replacement test (section 8)
19902 !! options
19903 replace=8,"xxx"
19904 !! wikitext
19905 start
19906 ==a==
19907 ===aa===
19908 ====aaa====
19909 ==b==
19910 ===ba===
19911 ===bb===
19912 ====bba====
19913 ===bc===
19914 ==c==
19915 ===ca===
19916 !! html/php
19917 start
19918 ==a==
19919 ===aa===
19920 ====aaa====
19921 ==b==
19922 ===ba===
19923 ===bb===
19924 ====bba====
19925 xxx
19926
19927 ==c==
19928 ===ca===
19929 !!end
19930
19931 !! test
19932 Section replacement test (section 9)
19933 !! options
19934 replace=9,"xxx"
19935 !! wikitext
19936 start
19937 ==a==
19938 ===aa===
19939 ====aaa====
19940 ==b==
19941 ===ba===
19942 ===bb===
19943 ====bba====
19944 ===bc===
19945 ==c==
19946 ===ca===
19947 !! html/php
19948 start
19949 ==a==
19950 ===aa===
19951 ====aaa====
19952 ==b==
19953 ===ba===
19954 ===bb===
19955 ====bba====
19956 ===bc===
19957 xxx
19958 !! end
19959
19960 !! test
19961 Section replacement test (section 10)
19962 !! options
19963 replace=10,"xxx"
19964 !! wikitext
19965 start
19966 ==a==
19967 ===aa===
19968 ====aaa====
19969 ==b==
19970 ===ba===
19971 ===bb===
19972 ====bba====
19973 ===bc===
19974 ==c==
19975 ===ca===
19976 !! html/php
19977 start
19978 ==a==
19979 ===aa===
19980 ====aaa====
19981 ==b==
19982 ===ba===
19983 ===bb===
19984 ====bba====
19985 ===bc===
19986 ==c==
19987 xxx
19988 !! end
19989
19990 !! test
19991 Section replacement test with initial whitespace (T15728)
19992 !! options
19993 replace=2,"xxx"
19994 !! wikitext
19995 Preformatted initial line
19996 ==a==
19997 ===a===
19998 !! html/php
19999 Preformatted initial line
20000 ==a==
20001 xxx
20002 !! end
20003
20004
20005 !! test
20006 Section extraction, heading followed by pre with 20 spaces (T8398)
20007 !! options
20008 section=1
20009 !! wikitext
20010 ==a==
20011 a
20012 !! html/php
20013 ==a==
20014 a
20015 !! end
20016
20017 !! test
20018 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20019 !! options
20020 section=1
20021 !! wikitext
20022 ==a==
20023 a
20024 !! html/php
20025 ==a==
20026 a
20027 !! end
20028
20029
20030 !! test
20031 Section extraction, <pre> around bogus header (T12309)
20032 !! options
20033 section=2
20034 !! wikitext
20035 == Section One ==
20036 <pre>
20037 =======
20038 </pre>
20039
20040 == Section Two ==
20041 stuff
20042 !! html/php
20043 == Section Two ==
20044 stuff
20045 !! end
20046
20047 !! test
20048 Section replacement, <pre> around bogus header (T12309)
20049 !! options
20050 replace=2,"xxx"
20051 !! wikitext
20052 == Section One ==
20053 <pre>
20054 =======
20055 </pre>
20056
20057 == Section Two ==
20058 stuff
20059 !! html/php
20060 == Section One ==
20061 <pre>
20062 =======
20063 </pre>
20064
20065 xxx
20066 !! end
20067
20068 !! test
20069 Handling of &#x0A; in URLs
20070 !! wikitext
20071 *irc://&#x0A;a
20072 !! html/php
20073 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20074
20075 !! html/parsoid
20076 <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>
20077 !! end
20078
20079 !! test
20080 Handling of %0A in URLs
20081 !! wikitext
20082 *irc://%0Aa
20083 !! html/php
20084 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20085
20086 !! html/parsoid
20087 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20088 !! end
20089
20090 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20091 !! test
20092 5 quotes, code coverage +1 line
20093 !! options
20094 parsoid=wt2html
20095 !! wikitext
20096 '''''
20097 !! html/php
20098 !! html/parsoid
20099 <b><i></i></b>
20100 !! end
20101
20102 # same html as previous, but wikitext adjusted to match parsoid html2wt
20103 # note that wt2html and html2html will put the <i> before the <b>
20104 !! test
20105 5 quotes, code coverage +1 line w/ nowiki (1)
20106 !! options
20107 parsoid=wt2wt,html2wt
20108 !! wikitext
20109 '''''<nowiki/>'''''
20110 !! html/php
20111 <p><i></i>
20112 </p>
20113 !! html/parsoid
20114 <p><b><i></i></b></p>
20115 !! end
20116
20117 # same as previous, just swapping the <i> and <b>
20118 !! test
20119 5 quotes, code coverage +1 line w/ nowiki (2)
20120 !! wikitext
20121 '''''<nowiki/>'''''
20122 !! html/php
20123 <p><i></i>
20124 </p>
20125 !! html/parsoid
20126 <p><i><b></b></i></p>
20127 !! end
20128
20129 !! test
20130 Special:Search page linking.
20131 !! wikitext
20132 {{Special:search}}
20133 !! html
20134 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20135 </p>
20136 !! end
20137
20138 !! test
20139 {{!}} is a magic word
20140 !! wikitext
20141 {{!}} is a magic word there and {{!}} is still a magic word here
20142 | is not a magic word here but {{!}} is still a magic word here
20143 !! html/php
20144 <p>| is a magic word there and | is still a magic word here
20145 | is not a magic word here but | is still a magic word here
20146 </p>
20147 !! html/parsoid
20148 <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
20149 | 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>
20150 !! end
20151
20152 !! test
20153 Say the magic word
20154 !! options
20155 title=[[Parser test]]
20156 !! wikitext
20157 *{{PAGENAME}}
20158 *{{PAGENAMEE}}
20159 *{{FULLPAGENAME}}
20160 *{{FULLPAGENAMEE}}
20161 *{{BASEPAGENAME}}
20162 *{{BASEPAGENAMEE}}
20163 *{{SUBPAGENAME}}
20164 *{{SUBPAGENAMEE}}
20165 *{{ROOTPAGENAME}}
20166 *{{ROOTPAGENAMEE}}
20167 *{{TALKPAGENAME}}
20168 *{{TALKPAGENAMEE}}
20169 *{{SUBJECTPAGENAME}}
20170 *{{SUBJECTPAGENAMEE}}
20171 *{{NAMESPACEE}}
20172 *{{NAMESPACE}}
20173 *{{NAMESPACENUMBER}}
20174 *{{TALKSPACE}}
20175 *{{TALKSPACEE}}
20176 *{{SUBJECTSPACE}}
20177 *{{SUBJECTSPACEE}}
20178 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20179 !! html
20180 <ul><li>Parser test</li>
20181 <li>Parser_test</li>
20182 <li>Parser test</li>
20183 <li>Parser_test</li>
20184 <li>Parser test</li>
20185 <li>Parser_test</li>
20186 <li>Parser test</li>
20187 <li>Parser_test</li>
20188 <li>Parser test</li>
20189 <li>Parser_test</li>
20190 <li>Talk:Parser test</li>
20191 <li>Talk:Parser_test</li>
20192 <li>Parser test</li>
20193 <li>Parser_test</li>
20194 <li></li>
20195 <li></li>
20196 <li>0</li>
20197 <li>Talk</li>
20198 <li>Talk</li>
20199 <li></li>
20200 <li></li>
20201 <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>
20202
20203 !! end
20204 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20205
20206 !! test
20207 Gallery with valid attributes
20208 !! wikitext
20209 <gallery type="123" summary="345">
20210 File:File:Foobar.jpg
20211 </gallery>
20212 !! html/php
20213 <ul class="gallery mw-gallery-traditional" type="123">
20214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20215 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20216 <div class="gallerytext">
20217 </div>
20218 </div></li>
20219 </ul>
20220
20221 !! html/parsoid
20222 <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"}}'>
20223 <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>
20224 </ul>
20225 !! end
20226
20227 ## Parsoid thinks the "centre" here is a property, not a caption.
20228 !! test
20229 Gallery
20230 !! options
20231 parsoid={
20232 "modes": ["wt2html"],
20233 "nativeGallery": true
20234 }
20235 !! wikitext
20236 <gallery>
20237 image1.png |
20238 image2.gif|||||
20239
20240 image3|
20241 image4 |300px| centre
20242 image5.svg| http://///////
20243 [[x|xx]]]]
20244 * image6
20245 </gallery>
20246 !! html/php
20247 <ul class="gallery mw-gallery-traditional">
20248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20249 <div class="thumb" style="height: 150px;">Image1.png</div>
20250 <div class="gallerytext">
20251 </div>
20252 </div></li>
20253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20254 <div class="thumb" style="height: 150px;">Image2.gif</div>
20255 <div class="gallerytext">
20256 </div>
20257 </div></li>
20258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20259 <div class="thumb" style="height: 150px;">Image3</div>
20260 <div class="gallerytext">
20261 </div>
20262 </div></li>
20263 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20264 <div class="thumb" style="height: 150px;">Image4</div>
20265 <div class="gallerytext">
20266 <pre>centre
20267 </pre>
20268 </div>
20269 </div></li>
20270 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20271 <div class="thumb" style="height: 150px;">Image5.svg</div>
20272 <div class="gallerytext">
20273 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20274 </p>
20275 </div>
20276 </div></li>
20277 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20278 <div class="thumb" style="height: 150px;">* image6</div>
20279 <div class="gallerytext">
20280 </div>
20281 </div></li>
20282 </ul>
20283
20284 !! html/parsoid
20285 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20286 <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>
20287 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20288 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20289 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
20290 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20291 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20292 </ul>
20293 !! end
20294
20295 !! test
20296 Gallery (with options, html)
20297 !! options
20298 parsoid={
20299 "modes": ["wt2html", "html2html"],
20300 "nativeGallery": true
20301 }
20302 !! wikitext
20303 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20304 File:Nonexistent.jpg|caption
20305 File:Nonexistent.jpg
20306 image:foobar.jpg|some '''caption''' [[Main Page]]
20307 image:foobar.jpg
20308 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20309 </gallery>
20310 !! html/php
20311 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20312 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20313 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20314 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20315 <div class="gallerytext">
20316 <p>caption
20317 </p>
20318 </div>
20319 </div></li>
20320 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20321 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20322 <div class="gallerytext">
20323 </div>
20324 </div></li>
20325 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20326 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20327 <div class="gallerytext">
20328 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20329 </p>
20330 </div>
20331 </div></li>
20332 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20333 <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>
20334 <div class="gallerytext">
20335 </div>
20336 </div></li>
20337 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20338 <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>
20339 <div class="gallerytext">
20340 <p>blabla.
20341 </p>
20342 </div>
20343 </div></li>
20344 </ul>
20345
20346 !! html/parsoid
20347 <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":{}}'>
20348 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20349 <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>
20350 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20351 <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>
20352 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20353 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
20354 </ul>
20355 !! end
20356
20357 !! test
20358 Gallery (with options, extsrc)
20359 !! options
20360 parsoid={
20361 "nativeGallery": false
20362 }
20363 !! wikitext
20364 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20365 File:Nonexistent.jpg|caption
20366 File:Nonexistent.jpg
20367 image:foobar.jpg|some '''caption''' [[Main Page]]
20368 image:foobar.jpg
20369 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20370 </gallery>
20371 !! html/php
20372 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20373 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20374 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20375 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20376 <div class="gallerytext">
20377 <p>caption
20378 </p>
20379 </div>
20380 </div></li>
20381 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20382 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20383 <div class="gallerytext">
20384 </div>
20385 </div></li>
20386 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20387 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20388 <div class="gallerytext">
20389 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20390 </p>
20391 </div>
20392 </div></li>
20393 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20394 <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>
20395 <div class="gallerytext">
20396 </div>
20397 </div></li>
20398 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20399 <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>
20400 <div class="gallerytext">
20401 <p>blabla.
20402 </p>
20403 </div>
20404 </div></li>
20405 </ul>
20406
20407 !! html/parsoid
20408 <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"}}'>
20409 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20410 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20411 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20412 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20413 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20414 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img 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>
20415 </ul>
20416 !! end
20417
20418 !! test
20419 Gallery (without px units)
20420 !! wikitext
20421 <gallery widths="70" heights="40">
20422 File:Foobar.jpg
20423 </gallery>
20424 !! html/php
20425 <ul class="gallery mw-gallery-traditional">
20426 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20427 <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>
20428 <div class="gallerytext">
20429 </div>
20430 </div></li>
20431 </ul>
20432
20433 !! html/parsoid
20434 <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"}}'>
20435 <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>
20436 </ul>
20437 !! end
20438
20439 !! test
20440 Gallery (with invalid units)
20441 !! wikitext
20442 <gallery widths="70em" heights="40em">
20443 File:Foobar.jpg
20444 </gallery>
20445 !! html/php
20446 <ul class="gallery mw-gallery-traditional">
20447 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20448 <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>
20449 <div class="gallerytext">
20450 </div>
20451 </div></li>
20452 </ul>
20453
20454 !! html/parsoid
20455 <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"}}'>
20456 <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>
20457 </ul>
20458 !! end
20459
20460 !! test
20461 Gallery with link that has fragment
20462 !! options
20463 parsoid={
20464 "modes": ["wt2html", "html2html"],
20465 "nativeGallery": true
20466 }
20467 !! wikitext
20468 <gallery>
20469 image:foobar.jpg|link=Main_Page
20470 image:foobar.jpg|link=Main_Page#section
20471 image:foobar.jpg|link=Main Page#section|caption
20472 </gallery>
20473 !! html/php
20474 <ul class="gallery mw-gallery-traditional">
20475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20476 <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>
20477 <div class="gallerytext">
20478 </div>
20479 </div></li>
20480 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20481 <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>
20482 <div class="gallerytext">
20483 </div>
20484 </div></li>
20485 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20486 <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>
20487 <div class="gallerytext">
20488 <p>caption
20489 </p>
20490 </div>
20491 </div></li>
20492 </ul>
20493
20494 !! html/parsoid
20495 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20496 <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>
20497 <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>
20498 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20499 </ul>
20500 !! end
20501
20502 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20503 !! test
20504 Gallery with template inside caption
20505 !! options
20506 parsoid={
20507 "nativeGallery": true
20508 }
20509 !! wikitext
20510 <gallery caption="{{echo|hi}}">
20511 File:Foobar.jpg|{{echo|ho}}
20512 </gallery>
20513 !! html/php
20514 <ul class="gallery mw-gallery-traditional">
20515 <li class='gallerycaption'>{{echo|hi}}</li>
20516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20517 <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>
20518 <div class="gallerytext">
20519 <p>ho
20520 </p>
20521 </div>
20522 </div></li>
20523 </ul>
20524
20525 !! html/parsoid
20526 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20527 <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>
20528 <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>
20529 </ul>
20530 !! end
20531
20532 !! test
20533 Gallery with wikitext inside caption
20534 !! options
20535 parsoid={
20536 "nativeGallery": true
20537 }
20538 !! wikitext
20539 <gallery>
20540 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20541 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20542 </gallery>
20543 !! html/php
20544 <ul class="gallery mw-gallery-traditional">
20545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20546 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20547 <div class="gallerytext">
20548 <p><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>
20549 </p>
20550 </div>
20551 </div></li>
20552 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20553 <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>
20554 <div class="gallerytext">
20555 <p>This is a test template
20556 </p>
20557 </div>
20558 </div></li>
20559 </ul>
20560
20561 !! html/parsoid
20562 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20563 <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>
20564 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><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>
20565 </ul>
20566 !! end
20567
20568 !! test
20569 Gallery (with showfilename option)
20570 !! options
20571 parsoid={
20572 "nativeGallery": true
20573 }
20574 !! wikitext
20575 <gallery showfilename="">
20576 File:Nonexistent.jpg|caption
20577 File:Nonexistent.jpg
20578 File:Foobar.jpg|some '''caption''' [[Main Page]]
20579 File:Foobar.jpg
20580 </gallery>
20581 !! html/php
20582 <ul class="gallery mw-gallery-traditional">
20583 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20584 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20585 <div class="gallerytext">
20586 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20587 caption
20588 </p>
20589 </div>
20590 </div></li>
20591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20592 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20593 <div class="gallerytext">
20594 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20595 </p>
20596 </div>
20597 </div></li>
20598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20599 <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>
20600 <div class="gallerytext">
20601 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20602 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20603 </p>
20604 </div>
20605 </div></li>
20606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20607 <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>
20608 <div class="gallerytext">
20609 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20610 </p>
20611 </div>
20612 </div></li>
20613 </ul>
20614
20615 !! html/parsoid
20616 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20617 <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>
20618 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
20619 <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>
20620 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
20621 </ul>
20622 !! end
20623
20624 ## Should Parsoid be preserving these variations? See T151367
20625 !! test
20626 Gallery (with namespace-less filenames)
20627 !! options
20628 parsoid={
20629 "modes": ["wt2html", "html2html"],
20630 "nativeGallery": true
20631 }
20632 !! wikitext
20633 <gallery>
20634 File:Nonexistent.jpg
20635 Nonexistent.jpg
20636 image:foobar.jpg
20637 foobar.jpg
20638 </gallery>
20639 !! html/php
20640 <ul class="gallery mw-gallery-traditional">
20641 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20642 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20643 <div class="gallerytext">
20644 </div>
20645 </div></li>
20646 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20647 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20648 <div class="gallerytext">
20649 </div>
20650 </div></li>
20651 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20652 <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>
20653 <div class="gallerytext">
20654 </div>
20655 </div></li>
20656 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20657 <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>
20658 <div class="gallerytext">
20659 </div>
20660 </div></li>
20661 </ul>
20662
20663 !! html/parsoid
20664 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20665 <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>
20666 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20667 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw: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>
20668 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20669 </ul>
20670 !! end
20671
20672 !! test
20673 Gallery override link with wikilink (T36852)
20674 !! options
20675 parsoid={
20676 "nativeGallery": true
20677 }
20678 !! wikitext
20679 <gallery>
20680 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20681 </gallery>
20682 !! html/php
20683 <ul class="gallery mw-gallery-traditional">
20684 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20685 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
20686 <div class="gallerytext">
20687 </div>
20688 </div></li>
20689 </ul>
20690
20691 !! html/parsoid
20692 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20693 <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>
20694 </ul>
20695 !! end
20696
20697 !! test
20698 Gallery override link with absolute external link (T36852)
20699 !! options
20700 parsoid={
20701 "nativeGallery": true
20702 }
20703 !! wikitext
20704 <gallery>
20705 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20706 </gallery>
20707 !! html/php
20708 <ul class="gallery mw-gallery-traditional">
20709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20710 <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>
20711 <div class="gallerytext">
20712 </div>
20713 </div></li>
20714 </ul>
20715
20716 !! html/parsoid
20717 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20718 <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>
20719 </ul>
20720 !! end
20721
20722 !! test
20723 Gallery override link with absolute external link with LanguageConverter
20724 !! options
20725 language=zh
20726 !! wikitext
20727 <gallery>
20728 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20729 </gallery>
20730 !! html/php
20731 <ul class="gallery mw-gallery-traditional">
20732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20733 <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>
20734 <div class="gallerytext">
20735 <p>caption
20736 </p>
20737 </div>
20738 </div></li>
20739 </ul>
20740
20741 !! html/parsoid
20742 <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"}}'>
20743 <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>
20744 </ul>
20745 !! end
20746
20747 !! test
20748 Gallery override link with malicious javascript (T36852)
20749 !! options
20750 parsoid={
20751 "modes": ["wt2html", "html2html"],
20752 "nativeGallery": true
20753 }
20754 !! wikitext
20755 <gallery>
20756 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20757 </gallery>
20758 !! html/php
20759 <ul class="gallery mw-gallery-traditional">
20760 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20761 <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>
20762 <div class="gallerytext">
20763 </div>
20764 </div></li>
20765 </ul>
20766
20767 !! html/parsoid
20768 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20769 <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>
20770 </ul>
20771 !! end
20772
20773 # Note that parsoid uses the invalid link as a caption, PHP does not.
20774 !! test
20775 Gallery with invalid title as link (T45964)
20776 !! options
20777 parsoid={
20778 "modes": ["wt2html", "html2html"],
20779 "nativeGallery": true
20780 }
20781 !! wikitext
20782 <gallery>
20783 File:Foobar.jpg|link=<
20784 </gallery>
20785 !! html/php
20786 <ul class="gallery mw-gallery-traditional">
20787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20788 <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>
20789 <div class="gallerytext">
20790 </div>
20791 </div></li>
20792 </ul>
20793
20794 !! html/parsoid
20795 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20796 <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>
20797 </ul>
20798 !! end
20799
20800 !! test
20801 Serialize gallery without attrs in data-mw
20802 !! options
20803 parsoid={
20804 "modes": ["html2wt"],
20805 "nativeGallery": true
20806 }
20807 !! html/parsoid
20808 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20809 <li class="gallerycaption">123</li>
20810 <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>
20811 </ul>
20812 !! wikitext
20813 <gallery caption="123">
20814 File:Test.png
20815 </gallery>
20816 !! end
20817
20818 !! test
20819 Gallery with class and style attributes
20820 !! options
20821 parsoid={
20822 "nativeGallery": true
20823 }
20824 !! wikitext
20825 <gallery class="center" style="text-align: center;">
20826 File:Foobar.jpg
20827 </gallery>
20828 !! html/php
20829 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20831 <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>
20832 <div class="gallerytext">
20833 </div>
20834 </div></li>
20835 </ul>
20836
20837 !! html/parsoid
20838 <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":{}}'>
20839 <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>
20840 </ul>
20841 !! end
20842
20843 !! test
20844 Gallery in slideshow mode
20845 !! options
20846 parsoid={
20847 "nativeGallery": true
20848 }
20849 !! wikitext
20850 <gallery mode="slideshow" showthumbnails="">
20851 File:Foobar.jpg
20852 </gallery>
20853 !! html/php
20854 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20856 <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>
20857 <div class="gallerytext">
20858 </div>
20859 </div></li>
20860 </ul>
20861
20862 !! html/parsoid
20863 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20864 <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>
20865 </ul>
20866 !! end
20867
20868 !! test
20869 HTML Hex character encoding (spells the word "JavaScript")
20870 !! options
20871 parsoid=wt2html,wt2wt,html2html
20872 !! wikitext
20873 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20874 !! html/php
20875 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20876 </p>
20877 !! html/parsoid
20878 <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>
20879 !! end
20880
20881 !! test
20882 HTML Hex character encoding bogus encoding (T28437 regression check)
20883 !! wikitext
20884 &#xsee;&#XSEE;
20885 !! html
20886 <p>&amp;#xsee;&amp;#XSEE;
20887 </p>
20888 !! end
20889
20890 !! test
20891 HTML Hex character encoding mixed case
20892 !! options
20893 parsoid=wt2html,wt2wt,html2html
20894 !! wikitext
20895 &#xEE;&#Xee;
20896 !! html/php
20897 <p>&#xee;&#xee;
20898 </p>
20899 !! html/parsoid
20900 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20901 !! end
20902
20903 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20904 # Note that U+000C (form feed) is not a valid XML character, so
20905 # it is banned even though allowed in HTML5.
20906 !! test
20907 Illegal character references (T106578)
20908 !! wikitext
20909 ; Null: &#00;
20910 ; FF: &#xC;
20911 ; CR: &#xD;
20912 ; Control (low): &#8;
20913 ; Control (high): &#x7F; &#x9F;
20914 ; Surrogate: &#xD83D;&#xDCA9;
20915 ; This is an okay astral character: &#x1F4A9;
20916 !! html+tidy
20917 <dl><dt>Null</dt>
20918 <dd>&amp;#00;</dd>
20919 <dt>FF</dt>
20920 <dd>&amp;#xC;</dd>
20921 <dt>CR</dt>
20922 <dd>&amp;#xD;</dd>
20923 <dt>Control (low)</dt>
20924 <dd>&amp;#8;</dd>
20925 <dt>Control (high)</dt>
20926 <dd>&amp;#x7F; &amp;#x9F;</dd>
20927 <dt>Surrogate</dt>
20928 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20929 <dt>This is an okay astral character</dt>
20930 <dd>&#x1f4a9;</dd></dl>
20931 !! end
20932
20933 !! test
20934 __FORCETOC__ override
20935 !! wikitext
20936 __NEWSECTIONLINK__
20937 __FORCETOC__
20938 !! html/php
20939 <p><br />
20940 </p>
20941 !! end
20942
20943 !! test
20944 ISBN code coverage
20945 !! wikitext
20946 ISBN 978-0-1234-56&#x20;789
20947 !! html/php
20948 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20949 </p>
20950 !! html/parsoid
20951 <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>
20952 !! end
20953
20954 !! test
20955 ISBN followed by 5 spaces
20956 !! wikitext
20957 ISBN
20958 !! html
20959 <p>ISBN
20960 </p>
20961 !! end
20962
20963 !! test
20964 Double ISBN
20965 !! wikitext
20966 ISBN ISBN 1234567890
20967 !! html/php
20968 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20969 </p>
20970 !! html/parsoid
20971 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20972 !! end
20973
20974 # Uppercase X and lowercase x as well
20975 !! test
20976 ISBN with an X
20977 !! wikitext
20978 ISBN 3-462-04561-X
20979 ISBN 3-462-04561-x
20980 ISBN 080442957X
20981 ISBN 080442957x
20982 ISBN 978080442957X
20983 ISBN 978080442957x
20984 !! html/php
20985 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20986 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20987 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20988 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20989 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20990 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20991 </p>
20992 !! html/parsoid
20993 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20994 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20995 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20996 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20997 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20998 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20999 !! end
21000
21001 !! test
21002 ISBN with empty prefix (parsoid test)
21003 !! wikitext
21004 ISBN 1234567890
21005 !! html/php
21006 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21007 </p>
21008 !! html/parsoid
21009 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21010 !! end
21011
21012 !! test
21013 T24905: <abbr> followed by ISBN followed by </a>
21014 !! wikitext
21015 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21016 !! html/php
21017 <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>
21018 </p>
21019 !! html/parsoid
21020 <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>
21021 !! end
21022
21023 !! test
21024 Double RFC
21025 !! wikitext
21026 RFC RFC 1234
21027 !! html
21028 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21029 </p>
21030 !! end
21031
21032 !! test
21033 Double RFC with a wiki link
21034 !! wikitext
21035 RFC [[RFC 1234]]
21036 !! html
21037 <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>
21038 </p>
21039 !! end
21040
21041 !! test
21042 RFC code coverage
21043 !! wikitext
21044 RFC 983&#x20;987
21045 !! html/php
21046 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21047 </p>
21048 !! html/parsoid
21049 <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>
21050 !! end
21051
21052 !! test
21053 Centre-aligned image
21054 !! wikitext
21055 [[Image:foobar.jpg|centre]]
21056 !! html/php
21057 <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>
21058
21059 !! html/parsoid
21060 <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>
21061 !! end
21062
21063 !! test
21064 None-aligned image
21065 !! wikitext
21066 [[Image:foobar.jpg|none]]
21067 !! html/php
21068 <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>
21069
21070 !! html/parsoid
21071 <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>
21072 !! end
21073
21074 !! test
21075 Width + Height sized image (using px) (height is ignored)
21076 !! wikitext
21077 [[Image:foobar.jpg|640x480px]]
21078 !! html/php
21079 <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>
21080 </p>
21081 !! html/parsoid
21082 <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>
21083 !! end
21084
21085 !! test
21086 Width-sized image (using px, no following whitespace)
21087 !! wikitext
21088 [[Image:foobar.jpg|640px]]
21089 !! html/php
21090 <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>
21091 </p>
21092 !! html/parsoid
21093 <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>
21094 !! end
21095
21096 !! test
21097 Width-sized image (using px, with following whitespace - test regression from r39467)
21098 !! wikitext
21099 [[Image:foobar.jpg|640px ]]
21100 !! html/php
21101 <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>
21102 </p>
21103 !! html/parsoid
21104 <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>
21105 !!end
21106
21107 !! test
21108 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21109 !! wikitext
21110 [[Image:foobar.jpg| 640px]]
21111 !! html/php
21112 <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>
21113 </p>
21114 !! html/parsoid
21115 <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>
21116 !! end
21117
21118 !! test
21119 Image with page parameter
21120 !! options
21121 djvu
21122 !! wikitext
21123 [[File:LoremIpsum.djvu|page=2]]
21124 !! html/php
21125 <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>
21126 </p>
21127 !! html/parsoid
21128 <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>
21129 !! end
21130
21131 !! test
21132 Another italics / bold test
21133 !! wikitext
21134 ''' ''x'
21135 !! html
21136 <pre>'<i> </i>x'
21137 </pre>
21138 !!end
21139
21140 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21141 !! test
21142 dt/dd/dl test
21143 !! wikitext
21144 :;;;::
21145 !! html/php
21146 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21147
21148 !! html/parsoid
21149 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21150
21151 !!end
21152
21153 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21154 !! test
21155 Images with the "|" character in the comment
21156 !! wikitext
21157 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21158 !! html/php
21159 <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>
21160
21161 !! html/parsoid
21162 <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>
21163 !! end
21164
21165 !! test
21166 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21167 !! wikitext
21168 <html><script>alert(1);</script></html>
21169 !! html
21170 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21171 </p>
21172 !! end
21173
21174 !! test
21175 HTML with raw HTML ($wgRawHtml==true)
21176 !! options
21177 wgRawHtml=1
21178 !! wikitext
21179 <html><script>alert(1);</script></html>
21180 !! html/php
21181 <p><script>alert(1);</script>
21182 </p>
21183 !! end
21184
21185 !! test
21186 Parents of subpages, one level up
21187 !! options
21188 subpage title=[[Subpage test/L1/L2/L3]]
21189 !! wikitext
21190 [[../|L2]]
21191 !! html
21192 <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>
21193 </p>
21194 !! end
21195
21196
21197 !! test
21198 Parents of subpages, one level up, not named
21199 !! options
21200 subpage title=[[Subpage test/L1/L2/L3]]
21201 !! wikitext
21202 [[../]]
21203 !! html
21204 <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>
21205 </p>
21206 !! end
21207
21208
21209
21210 !! test
21211 Parents of subpages, two levels up
21212 !! options
21213 subpage title=[[Subpage test/L1/L2/L3]]
21214 !! wikitext
21215 [[../../|L1]]2
21216
21217 [[../../|L1]]l
21218 !! html
21219 <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
21220 </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>
21221 </p>
21222 !! end
21223
21224 !! test
21225 Parents of subpages, two levels up, without trailing slash or name.
21226 !! options
21227 subpage title=[[Subpage test/L1/L2/L3]]
21228 !! wikitext
21229 [[../..]]
21230 !! html
21231 <p>[[../..]]
21232 </p>
21233 !! end
21234
21235 !! test
21236 Parents of subpages, two levels up, with lots of extra trailing slashes.
21237 !! options
21238 subpage title=[[Subpage test/L1/L2/L3]]
21239 !! wikitext
21240 [[../../////]]
21241 !! html
21242 <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>
21243 </p>
21244 !! end
21245
21246 !! article
21247 Subpage test/L1/L2/L3Sibling
21248 !! text
21249 Sibling article
21250 !! endarticle
21251
21252 !! test
21253 Transclusion of a sibling page (one level up)
21254 !! options
21255 subpage title=[[Subpage test/L1/L2/L3]]
21256 !! wikitext
21257 {{../L3Sibling}}
21258 !! html
21259 <p>Sibling article
21260 </p>
21261 !! end
21262
21263 !! test
21264 Transclusion of a child page
21265 !! options
21266 subpage title=[[Subpage test/L1/L2]]
21267 !! wikitext
21268 {{/L3Sibling}}
21269 !! html
21270 <p>Sibling article
21271 </p>
21272 !! end
21273
21274 # This is wt2html only in Parsoid because we add <nowiki>
21275 # because of {{..}} and we don't expect to fix that to
21276 # eliminate the nowikis selective for {{..}} markup.
21277 !! test
21278 Non-transclusion because of too many up levels
21279 !! options
21280 subpage title=[[Subpage test/L1/L2/L3]]
21281 parsoid=wt2html
21282 !! wikitext
21283 {{../../../../More than parent}}
21284 !! html/php
21285 <p>{{../../../../More than parent}}
21286 </p>
21287 !! html/parsoid
21288 <p>{{../../../../More than parent}}</p>
21289 !! end
21290
21291 !! test
21292 Definition list code coverage
21293 !! wikitext
21294 ;title : def
21295 ;title : def
21296 ;title: def
21297 !! html/php
21298 <dl><dt>title &#160;</dt>
21299 <dd>def</dd>
21300 <dt>title&#160;</dt>
21301 <dd>def</dd>
21302 <dt>title</dt>
21303 <dd>def</dd></dl>
21304
21305 !! html/parsoid
21306 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21307 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21308 <dt>title</dt><dd> def</dd></dl>
21309 !! end
21310
21311 !! test
21312 Don't fall for the self-closing div
21313 !! wikitext
21314 <div>hello world</div/>
21315 !! html
21316 <div>hello world</div>
21317
21318 !! end
21319
21320 !! test
21321 MSGNW magic word
21322 !! wikitext
21323 {{MSGNW:msg}}
21324 !! html/php
21325 <p>&#91;&#91;:Template:Msg&#93;&#93;
21326 </p>
21327 !! end
21328
21329 !! test
21330 RAW magic word
21331 !! wikitext
21332 {{RAW:QUERTY}}
21333 !! html
21334 <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>
21335 </p>
21336 !! end
21337
21338 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21339 !! test
21340 Always escape literal '>' in output, not just after '<'
21341 !! wikitext
21342 ><>
21343 !! html
21344 <p>&gt;&lt;&gt;
21345 </p>
21346 !! end
21347
21348 !! test
21349 Template caching
21350 !! wikitext
21351 {{Test}}
21352 {{Test}}
21353 !! html
21354 <p>This is a test template
21355 This is a test template
21356 </p>
21357 !! end
21358
21359
21360 !! article
21361 MediaWiki:Fake
21362 !! text
21363 ==header==
21364 !! endarticle
21365
21366 !! test
21367 Inclusion of !userCanEdit() content
21368 !! wikitext
21369 {{MediaWiki:Fake}}
21370 !! html
21371 <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>
21372
21373 !! end
21374
21375
21376 !! test
21377 Out-of-order TOC heading levels
21378 !! wikitext
21379 ==2==
21380 ======6======
21381 ===3===
21382 =1=
21383 =====5=====
21384 ==2==
21385 !! html
21386 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21387 <ul>
21388 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21389 <ul>
21390 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21391 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21392 </ul>
21393 </li>
21394 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21395 <ul>
21396 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21397 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21398 </ul>
21399 </li>
21400 </ul>
21401 </div>
21402
21403 <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>
21404 <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>
21405 <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>
21406 <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>
21407 <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>
21408 <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>
21409
21410 !! end
21411
21412
21413 !! test
21414 ISBN with a dummy number
21415 !! wikitext
21416 ISBN ---
21417 !! html
21418 <p>ISBN ---
21419 </p>
21420 !! end
21421
21422
21423 !! test
21424 ISBN with space-delimited number
21425 !! wikitext
21426 ISBN 92 9017 032 8
21427 !! html/php
21428 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21429 </p>
21430 !! html/parsoid
21431 <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>
21432 !! end
21433
21434
21435 !! test
21436 ISBN with multiple spaces, no number
21437 !! wikitext
21438 ISBN foo
21439 !! html
21440 <p>ISBN foo
21441 </p>
21442 !! end
21443
21444
21445 !! test
21446 ISBN length
21447 !! wikitext
21448 ISBN 123456789
21449
21450 ISBN 1234567890
21451
21452 ISBN 12345678901
21453 !! html/php
21454 <p>ISBN 123456789
21455 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21456 </p><p>ISBN 12345678901
21457 </p>
21458 !! html/parsoid
21459 <p>ISBN 123456789</p>
21460
21461 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21462
21463 <p>ISBN 12345678901</p>
21464 !! end
21465
21466
21467 !! test
21468 ISBN with trailing year (T9110)
21469 !! wikitext
21470 ISBN 1-234-56789-0 - 2006
21471
21472 ISBN 1 234 56789 0 - 2006
21473 !! html/php
21474 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21475 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21476 </p>
21477 !! html/parsoid
21478 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21479
21480 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21481 !! end
21482
21483
21484 !! test
21485 anchorencode
21486 !! config
21487 wgFragmentMode=[ 'html5', 'legacy' ]
21488 !! wikitext
21489 {{anchorencode:foo bar©#%n}}
21490 !! html/php
21491 <p>foo_bar©#%n
21492 </p>
21493 !! html/parsoid
21494 <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>
21495 !! end
21496
21497 !! test
21498 anchorencode (legacy)
21499 !! config
21500 wgFragmentMode=[ 'legacy' ]
21501 !! wikitext
21502 {{anchorencode:foo bar©#%n}}
21503 !! html/php
21504 <p>foo_bar.C2.A9.23.25n
21505 </p>
21506 !! end
21507
21508 !! test
21509 anchorencode trims spaces
21510 !! config
21511 wgFragmentMode=[ 'html5', 'legacy' ]
21512 !! wikitext
21513 {{anchorencode: __pretty__please__}}
21514 !! html/php
21515 <p>pretty_please
21516 </p>
21517 !! html/parsoid
21518 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21519 !! end
21520
21521 !! test
21522 anchorencode deals with links
21523 !! config
21524 wgFragmentMode=[ 'html5', 'legacy' ]
21525 !! wikitext
21526 {{anchorencode: [[hello|world]] [[hi]]}}
21527 !! html/php
21528 <p>world_hi
21529 </p>
21530 !! html/parsoid
21531 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21532 !! end
21533
21534 !! test
21535 anchorencode deals with templates
21536 !! config
21537 wgFragmentMode=[ 'html5', 'legacy' ]
21538 !! wikitext
21539 {{anchorencode: {{Foo}} x}}
21540 !! html/php
21541 <p>FOO_x
21542 </p>
21543 !! html/parsoid
21544 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21545 !! end
21546
21547 !! test
21548 anchorencode encodes like the TOC generator: (T20431)
21549 !! config
21550 wgFragmentMode=[ 'html5', 'legacy' ]
21551 !! wikitext
21552 ===_ +:.3A%3A _ &&amp;]] x===
21553 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21554 __NOEDITSECTION__
21555 !! html/php
21556 <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>
21557 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21558 </p>
21559 !! html/parsoid
21560 <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>
21561 <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>
21562 <meta property="mw:PageProp/noeditsection"/>
21563 !! end
21564
21565 !! test
21566 anchorencode encodes like the TOC generator: (T20431) (legacy)
21567 !! config
21568 wgFragmentMode=[ 'legacy' ]
21569 !! wikitext
21570 ===_ +:.3A%3A&&amp;]]===
21571 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21572 __NOEDITSECTION__
21573 !! html/php
21574 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21575 <p>.2B:.3A.253A.26.26.5D.5D
21576 </p>
21577 !! end
21578
21579 !! test
21580 T8200: blockquotes and paragraph formatting
21581 !! wikitext
21582 <blockquote>
21583 foo
21584 </blockquote>
21585
21586 bar
21587
21588 baz
21589 !! html
21590 <blockquote>
21591 <p>foo
21592 </p>
21593 </blockquote>
21594 <p>bar
21595 </p>
21596 <pre>baz
21597 </pre>
21598 !! end
21599
21600 !! test
21601 T10293: Use of center tag ruins paragraph formatting
21602 !! wikitext
21603 <center>
21604 foo
21605 </center>
21606
21607 bar
21608
21609 baz
21610 !! html
21611 <center>
21612 <p>foo
21613 </p>
21614 </center>
21615 <p>bar
21616 </p>
21617 <pre>baz
21618 </pre>
21619 !! end
21620
21621 !!test
21622 Parsing of overlapping (improperly nested) inline html tags
21623 !! wikitext
21624 <span><s>x</span></s>
21625 !! html/php
21626 <p><span><s>x&lt;/span&gt;</s></span>
21627 </p>
21628 !! html/parsoid
21629 <p><span><s>x</s></span>
21630 </p>
21631 !!end
21632
21633 ###
21634 ### Language variants related tests
21635 ###
21636
21637 # Parsoid does not mark self-links.
21638 # Parsoid does not convert links; PHP will do any necessary redirects.
21639
21640 !! test
21641 Self-link in language variants
21642 !! options
21643 title=[[Dunav]] language=sr
21644 !! wikitext
21645 Both [[Dunav]] and [[Дунав]] are names for this river.
21646 !! html/php
21647 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21648 </p>
21649 !! html/parsoid
21650 <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>
21651 !! end
21652
21653 !! article
21654 Дуна
21655 !! text
21656 content
21657 !! endarticle
21658
21659 !! test
21660 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21661 !! options
21662 title=[[Duna]] language=sr
21663 !! wikitext
21664 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21665 !! html/php
21666 <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.
21667 </p>
21668 !! html/parsoid
21669 <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>
21670 !! end
21671
21672 !! test
21673 Link to a section of a variant of this title shouldn't be parsed as self-link
21674 !! options
21675 title=[[Duna]] language=sr
21676 !! wikitext
21677 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21678 !! html/php
21679 <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.
21680 </p>
21681 !! html/parsoid
21682 <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>
21683 !! end
21684
21685 !! test
21686 Link to pages in language variants
21687 !! options
21688 language=sr
21689 !! wikitext
21690 Main Page can be written as [[Маин Паге]]
21691 !! html/php
21692 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21693 </p>
21694 !! html/parsoid
21695 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21696 !! end
21697
21698
21699 !! test
21700 Multiple links to pages in language variants
21701 !! options
21702 language=sr
21703 !! wikitext
21704 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21705 !! html/php
21706 <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>.
21707 </p>
21708 !! html/parsoid
21709 <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>
21710 !! end
21711
21712
21713 !! test
21714 Simple template in language variants
21715 !! options
21716 language=sr
21717 !! wikitext
21718 {{тест}}
21719 !! html/php
21720 <p>This is a test template
21721 </p>
21722 !! end
21723
21724
21725 !! test
21726 Template with explicit namespace in language variants
21727 !! options
21728 language=sr
21729 !! wikitext
21730 {{Template:тест}}
21731 !! html/php
21732 <p>This is a test template
21733 </p>
21734 !! end
21735
21736
21737 !! test
21738 Basic test for template parameter in language variants
21739 !! options
21740 language=sr
21741 !! wikitext
21742 {{парамтест|param=foo}}
21743 !! html/php
21744 <p>This is a test template with parameter foo
21745 </p>
21746 !! end
21747
21748 !! test
21749 Simple category in language variants
21750 !! options
21751 language=sr cat
21752 !! wikitext
21753 [[Category:МедиаWики Усер'с Гуиде]]
21754 !! html/php
21755 cat=МедиаWики_Усер'с_Гуиде sort=
21756 !! html/parsoid
21757 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21758 !! end
21759
21760 !! article
21761 Category:分类
21762 !! text
21763 blah
21764 !! endarticle
21765
21766 !! article
21767 Category:分類
21768 !! text
21769 blah
21770 !! endarticle
21771
21772 ## We used to, but no longer wt2wt this test since the default serializer
21773 ## will normalize all categories to serialize on their own line.
21774 ## This wikitext usage is going to be fairly uncommon in production and
21775 ## selser will take care of preserving formatting in those scenarios.
21776 !! test
21777 Don't convert blue categorylinks to another variant (T35210)
21778 !! options
21779 cat
21780 language=zh
21781 parsoid=wt2html
21782 !! wikitext
21783 [[A]][[Category:分类]]
21784 !! html/php
21785 cat=分类 sort=
21786 !! html/parsoid
21787 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21788 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21789 !! end
21790
21791 !! test
21792 Stripping -{}- tags (language variants)
21793 !! options
21794 language=sr
21795 !! wikitext
21796 Latin proverb: -{Ne nuntium necare}-
21797 !! html/php
21798 <p>Latin proverb: Ne nuntium necare
21799 </p>
21800 !! html/parsoid
21801 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21802 !! end
21803
21804
21805 !! test
21806 Prevent conversion with -{}- tags (language variants)
21807 !! options
21808 language=sr variant=sr-ec
21809 !! wikitext
21810 Latinski: -{Ne nuntium necare}-
21811 !! html/php
21812 <p>Латински: Ne nuntium necare
21813 </p>
21814 !! html/parsoid
21815 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21816 !! end
21817
21818
21819 !! test
21820 Prevent conversion of text 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 links with -{}- tags (language variants)
21835 !! options
21836 language=sr variant=sr-ec
21837 !! wikitext
21838 -{[[Main Page]]}-
21839 !! html/php
21840 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21841 </p>
21842 !! html/parsoid
21843 <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>
21844 !! end
21845
21846
21847 !! test
21848 -{}- tags within headlines (within html for parserConvert())
21849 !! config
21850 wgFragmentMode=[ 'html5', 'legacy' ]
21851 !! options
21852 language=sr variant=sr-ec
21853 !! wikitext
21854 ==-{Naslov}-==
21855
21856 Note that even an unprotected headline ID is not affected by language
21857 conversion:
21858
21859 ==Latinski==
21860 !! html/php
21861 <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>
21862 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21863 цонверсион:
21864 </p>
21865 <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>
21866
21867 !! html/parsoid
21868 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21869
21870 <p>Note that even an unprotected headline ID is not affected by language
21871 conversion:</p>
21872
21873 <h2 id="Latinski">Latinski</h2>
21874 !! end
21875
21876 !! test
21877 Explicit definition of language variant alternatives
21878 !! options
21879 language=zh variant=zh-tw
21880 !! wikitext
21881 -{zh:China;zh-tw:Taiwan}-, not China
21882 !! html/php
21883 <p>Taiwan, not China
21884 </p>
21885 !! html/parsoid
21886 <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>
21887 !! end
21888
21889 !! test
21890 Filter syntax for language variants
21891 !! options
21892 language=zh variant=zh-tw
21893 !! wikitext
21894 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21895 !! html/php
21896 <p>fooblog, WEBJOURNAL, WEBLOGquux
21897 </p>
21898 !! html/parsoid
21899 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21900 !! end
21901
21902 # Note that Parsoid post-processing for language variants needs to
21903 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21904 !! test
21905 Conversion around HTML tags
21906 !! options
21907 language=sr variant=sr-ec
21908 !! wikitext
21909 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21910 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21911 !! html/php
21912 <p>
21913 <span title="ЛаCтин">ски</span>
21914 </p>
21915 !! html/parsoid
21916 <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"}]}'/>
21917 <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>
21918 !! end
21919
21920 !! test
21921 Explicit session-wise two-way language variant mapping (A flag and - flag)
21922 !! options
21923 language=zh variant=zh-tw
21924 !! wikitext
21925 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21926
21927 Taiwan is not China.
21928
21929 But -{A|zh:China; zh-tw:Taiwan}- is China,
21930
21931 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21932
21933 and -{China}- is China.
21934 !! html/php
21935 <p>This is Taiwan, but we'll forget that now.
21936 </p><p>Taiwan is not China.
21937 </p><p>But Taiwan is Taiwan,
21938 </p><p>(This should be stripped!)
21939 </p><p>and China is China.
21940 </p>
21941 !! html/parsoid
21942 <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>
21943 <p>Taiwan is not China.</p>
21944 <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>
21945 <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>
21946 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21947 !! end
21948
21949 !! test
21950 Explicit session-wise one-way language variant mapping (A flag and - flag)
21951 !! options
21952 language=zh variant=zh-tw
21953 !! wikitext
21954 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21955
21956 COUNTRY is China or Taiwan.
21957
21958 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21959
21960 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21961
21962 and -{COUNTRY}- is COUNTRY.
21963 !! html/php
21964 <p>This is Taiwan, but we'll forget that now.
21965 </p><p>COUNTRY is China or Taiwan.
21966 </p><p>But Taiwan is Taiwan,
21967 </p><p>(This should be stripped!)
21968 </p><p>and COUNTRY is COUNTRY.
21969 </p>
21970 !! html/parsoid
21971 <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>
21972 <p>COUNTRY is China or Taiwan.</p>
21973 <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>
21974 <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>
21975 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21976 !! end
21977
21978 !! test
21979 Explicit session-wise two-way language variant mapping (H flag for hide)
21980 !! options
21981 language=zh variant=zh-tw
21982 !! wikitext
21983 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21984
21985 Taiwan is China.
21986 !! html/php
21987 <p>(This should be stripped!)
21988 </p><p>Taiwan is Taiwan.
21989 </p>
21990 !! html/parsoid
21991 <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>
21992 <p>Taiwan is China.</p>
21993 !! end
21994
21995 !! test
21996 Explicit session-wise one-way language variant mapping (H flag for hide)
21997 !! options
21998 language=zh variant=zh-tw
21999 !! wikitext
22000 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22001
22002 COUNTRY is Taiwan or China.
22003 !! html/php
22004 <p>(This should be stripped!)
22005 </p><p>Taiwan is Taiwan or China.
22006 </p>
22007 !! html/parsoid
22008 <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>
22009 <p>COUNTRY is Taiwan or China.</p>
22010 !! end
22011
22012 ## Note that parsoid test runner does not support 'showtitle' option.
22013 !! test
22014 Adding explicit conversion rule for title (T flag)
22015 !! options
22016 language=zh variant=zh-tw showtitle
22017 !! wikitext
22018 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22019
22020 Taiwan is China.
22021 !! html/php
22022 Taiwan
22023 <p>Should be stripped!
22024 </p><p>Taiwan is China.
22025 </p>
22026 !! html/parsoid
22027 <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>
22028 <p>Taiwan is China.</p>
22029 !! end
22030
22031 !! test
22032 Code coverage: T combined with H flag
22033 !! options
22034 language=zh variant=zh-tw showtitle
22035 !! wikitext
22036 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22037
22038 Taiwan is China.
22039 !! html/php
22040 Taiwan
22041 <p>Should be stripped!
22042 </p><p>Taiwan is Taiwan.
22043 </p>
22044 !! html/parsoid
22045 <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>
22046 <p>Taiwan is China.</p>
22047 !! end
22048
22049 !! test
22050 Code coverage: T with no variants
22051 !! options
22052 language=zh variant=zh-tw showtitle
22053 !! wikitext
22054 -{H|zh:China; zh-tw:Taiwan}-
22055 Taiwan is China.-{T|Taiwan is China}-
22056 !! html/php
22057 Taiwan is China
22058 <p>
22059 Taiwan is Taiwan.
22060 </p>
22061 !! html/parsoid
22062 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22063 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22064 !! end
22065
22066 !! test
22067 Code coverage: rules with no variants
22068 !! options
22069 language=zh variant=zh-tw
22070 !! wikitext
22071 -{H|zh:China; zh-tw:Taiwan}-
22072 Taiwan is China.
22073 -{H|China}-
22074 Taiwan is China.
22075 !! html/php
22076 <p>
22077 Taiwan is Taiwan.
22078
22079 Taiwan is China.
22080 </p>
22081 !! html/parsoid
22082 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22083 Taiwan is China.
22084 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22085 Taiwan is China.</p>
22086 !! end
22087
22088
22089 !! test
22090 Code coverage: D flag for conversion rule
22091 !! options
22092 language=zh variant=zh-tw
22093 !! wikitext
22094 -{D|zh-cn:XA; zh-tw:YA}-
22095 -{A;D|zh-cn:XB; zh-tw:YB}-
22096 -{D;H|zh-cn:XC; zh-tw:YC}-
22097
22098 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22099
22100 -{D|0=>zh-tw:1}-
22101 -{A;D|2=>zh-tw:3}-
22102 -{D;H|4=>zh-tw:5}-
22103
22104 XA XB XC YA YB YC FOO BAR BAT 012345
22105 !! html/php
22106 <p>大陆:XA;台灣:YA;
22107
22108 大陆:XC;台灣:YC;
22109 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22110 </p><p>0⇒台灣:1;
22111
22112 4⇒台灣:5;
22113 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22114 </p>
22115 !! html/parsoid
22116 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22117 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22118 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22119 <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>
22120 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22121 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22122 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22123 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22124 !! end
22125
22126 !! test
22127 Code coverage: N flag for conversion rule
22128 !! options
22129 language=zh variant=zh-cn
22130 !! wikitext
22131 -{N|zh-cn}-
22132
22133 -{N|zh-tw}-
22134
22135 -{N|sr-ec}-
22136 !! html/php
22137 <p>大陆
22138 </p><p>台灣
22139 </p><p>српски (ћирилица)‎
22140 </p>
22141 !! html/parsoid
22142 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22143 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22144 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22145 !! end
22146
22147 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22148 !! test
22149 Code coverage: N flag for conversion rule (wt2html only)
22150 !! options
22151 language=zh variant=zh-cn
22152 parsoid=wt2html,html2html
22153 !! wikitext
22154 -{D;N|en}-
22155 !! html/php
22156 <p>English
22157 </p>
22158 !! html/parsoid
22159 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22160 !! end
22161
22162 !! test
22163 Testing that changing the language variant here in the tests actually works
22164 !! options
22165 language=zh variant=zh showtitle
22166 !! wikitext
22167 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22168 !! html/php
22169 China
22170 <p>Should be stripped!
22171 </p>
22172 !! html/parsoid
22173 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22174 !! end
22175
22176 !! test
22177 Recursive conversion of alt and title attrs shouldn't clear converter state
22178 !! options
22179 language=zh variant=zh-cn
22180 showtitle
22181 !! wikitext
22182 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22183 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22184 !! html/php
22185 China
22186 <p>
22187 Should be stripped<span title="Exclamation">!</span>
22188 </p>
22189 !! html/parsoid
22190 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22191 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>
22192 !! end
22193
22194 !! test
22195 T26072: more test on conversion rule for title
22196 !! options
22197 language=zh variant=zh-tw showtitle
22198 !! wikitext
22199 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22200
22201 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22202 !! html/php
22203 Taiwan
22204 <p>This should be stripped!
22205 </p><p>This won't take interferes with the title rule.
22206 </p>
22207 !! html/parsoid
22208 <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>
22209 <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>
22210 !! end
22211
22212 !! test
22213 Partly disable title conversion if variant == main language code
22214 !! options
22215 language=zh variant=zh title=[[ZH]] showtitle
22216 !! wikitext
22217 -{T|zh-cn:CN;zh-tw:TW}-
22218 !! html/php
22219 ZH
22220 <p>
22221 </p>
22222 !! html/parsoid
22223 <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>
22224 !! end
22225
22226 !! test
22227 Partly disable title conversion if variant == main language code, more
22228 !! options
22229 language=zh variant=zh title=[[ZH]] showtitle
22230 !! wikitext
22231 -{T|TW}-
22232 !! html/php
22233 ZH
22234 <p>
22235 </p>
22236 !! html/parsoid
22237 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22238 !! end
22239
22240 !! test
22241 Raw output of variant escape tags (R flag)
22242 !! options
22243 language=zh variant=zh-tw
22244 !! wikitext
22245 Raw: -{R|zh:China;zh-tw:Taiwan}-
22246 !! html/php
22247 <p>Raw: zh:China;zh-tw:Taiwan
22248 </p>
22249 !! html/parsoid
22250 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22251 !! end
22252
22253 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22254 !! test
22255 Raw output of variant escape tags (R flag) (wt2html only)
22256 !! options
22257 language=zh variant=zh-tw
22258 parsoid=wt2html,html2html
22259 !! wikitext
22260 -{Variant}- -{D|syntax}- -{D;R|options}-
22261 !! html/php
22262 <p>Variant syntax options
22263 </p>
22264 !! html/parsoid
22265 <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>
22266 !! end
22267
22268 !! test
22269 Nested markup inside raw output of variant escape tags (R flag)
22270 !! options
22271 language=zh variant=zh-tw
22272 !! wikitext
22273 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22274 !! html/php
22275 <p>Nested raw: nested Taiwan nested
22276 </p>
22277 !! html/parsoid
22278 <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>
22279 !! end
22280
22281 !! test
22282 Nested markup and spaces inside raw output of variant escape tags (R flag)
22283 !! options
22284 language=zh variant=zh-tw
22285 !! wikitext
22286 X-{ outer -{ inner }- outer }-X
22287 !! html/php
22288 <p>X outer inner outer X
22289 </p>
22290 !! html/parsoid
22291 <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>
22292 !! end
22293
22294 !! test
22295 Templates inside raw output of variant escape tags (R flag)
22296 !! options
22297 language=zh variant=zh-tw
22298 !! wikitext
22299 Nested raw: -{R|nested {{echo|hi}} templates}-
22300 !! html/php
22301 <p>Nested raw: nested hi templates
22302 </p>
22303 !! html/parsoid
22304 <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>
22305 !! end
22306
22307 !! test
22308 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22309 !! options
22310 language=zh variant=zh-cn
22311 !! wikitext
22312 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22313 !! html/php
22314 <p>0
22315 </p>
22316 !! html/parsoid
22317 <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>
22318 !! end
22319
22320 !! test
22321 Conversion rules from [numeric-only string] to [something else] (T48634)
22322 !! options
22323 language=zh variant=zh-cn
22324 !! wikitext
22325 -{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
22326 !! html/php
22327 <p>D12345EE12345
22328 </p>
22329 !! html/parsoid
22330 <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>
22331 !! end
22332
22333 !! test
22334 Two-way converter rule entries with an empty value should be ignored (T53551)
22335 !! options
22336 language=zh variant=zh-cn
22337 !! wikitext
22338 -{H|zh-cn:foo;zh-tw:;}-foobar
22339 !! html/php
22340 <p>foobar
22341 </p>
22342 !! html/parsoid
22343 <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>
22344 !! end
22345
22346 !! test
22347 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22348 !! options
22349 language=zh variant=zh-cn
22350 !! wikitext
22351 -{H|=>zh-cn:foo;}-foobar
22352 !! html/php
22353 <p>foobar
22354 </p>
22355 !! html/parsoid
22356 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22357 !! end
22358
22359 !! test
22360 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22361 !! options
22362 language=zh variant=zh-cn
22363 !! wikitext
22364 -{H|}-foobar
22365 !! html/php
22366 <p>foobar
22367 </p>
22368 !! html/parsoid
22369 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22370 !! end
22371
22372 !! test
22373 Nested using of manual convert syntax
22374 !! options
22375 language=zh variant=zh-hk
22376 !! wikitext
22377 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22378 !! html/php
22379 <p>Nested: Hello Hong Kong!
22380 </p>
22381 !! html/parsoid
22382 <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>
22383 !! end
22384
22385 !! test
22386 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22387 !! options
22388 language=zh variant=zh-cn
22389 !! wikitext
22390 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22391 !! html/php
22392 <p><span title="X">A</span>
22393 </p>
22394 !! html/parsoid
22395 <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>
22396 !! end
22397
22398 !! test
22399 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22400 !! options
22401 language=zh variant=zh-cn
22402 !! wikitext
22403 -{<span title="-{X}-">A</span>}-
22404 !! html/php+disabled
22405 <p><span title="X">A</span>
22406 </p>
22407 !! html/parsoid
22408 <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>
22409 !! end
22410
22411 # Parsoid and PHP disagree on how to parse this example: Parsoid
22412 # insists that the content of a language converter element be a valid
22413 # DOM fragment or attribute string
22414 !! test
22415 Language converter markup with block content
22416 !! options
22417 language=zh variant=zh-cn
22418 !! wikitext
22419 <span>a-{b<div>c}-d
22420
22421 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22422
22423 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22424 !! html/php+tidy
22425 <span>ab<div>cd
22426 <span>ab<div>cd
22427 <span>ad
22428 </span></div></span></div></span>
22429 !! html/parsoid
22430 <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>
22431
22432 <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>
22433
22434 <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>
22435 !! end
22436
22437 !! test
22438 LanguageConverter selser (1)
22439 !! options
22440 language=zh variant=zh-cn
22441 parsoid={
22442 "modes": ["wt2wt", "selser"],
22443 "changes": [
22444 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22445 ]
22446 }
22447 !! wikitext
22448 -{raw}-
22449 !! wikitext/edited
22450 -{edited}-
22451 !! end
22452
22453 !! test
22454 LanguageConverter selser (2)
22455 !! options
22456 language=zh variant=zh-cn
22457 parsoid={
22458 "modes": ["wt2wt", "selser"],
22459 "changes": [
22460 ["span[class='x']", "contents", "text", "-{foo}-"],
22461 ["a", "contents", "text", "-{"],
22462 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22463 ]
22464 }
22465 !! wikitext
22466 <span class="x">TEXT1</span>
22467 [http://example.com TEXT2]
22468 [[Foo|TEXT3]]
22469 {{echo|TEXT4}}
22470 !! wikitext/edited
22471 <span class="x"><nowiki>-{foo}-</nowiki></span>
22472 [http://example.com -{]
22473 [[Foo|<nowiki>-{</nowiki>]]
22474 {{1x|<nowiki>-{</nowiki>}}
22475 !! end
22476
22477 # Tests LanguageVariantText in ConstrainedText
22478 !! test
22479 LanguageConverter selser (3)
22480 !! options
22481 language=zh variant=zh-cn
22482 parsoid={
22483 "modes": ["wt2wt", "selser"],
22484 "changes": [
22485 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22486 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22487 ]
22488 }
22489 !! wikitext
22490 {|
22491 |-
22492 |<span>Foo</span>
22493 |}
22494 !! wikitext/edited
22495 {|
22496 |-
22497 |<nowiki/>-{edited}-
22498 |}
22499 !! end
22500
22501 # Tests LanguageVariantText._fromSelSer
22502 !! test
22503 LanguageConverter selser (4)
22504 !! options
22505 language=zh variant=zh-cn
22506 parsoid={
22507 "modes": ["wt2wt", "selser"],
22508 "changes": [
22509 ["td > span.x", "remove"]
22510 ]
22511 }
22512 !! wikitext
22513 {|
22514 |-
22515 |<span class="x">Foo</span>-{Bar}-
22516 ||<span class="x">Foo</span>-{Bar}-
22517 |}
22518 !! wikitext/edited
22519 {|
22520 |-
22521 |<nowiki/>-{Bar}-
22522 ||-{Bar}-
22523 |}
22524 !! end
22525
22526 # Since Parsoid is starting to emit canonical wikitext for links,
22527 # [http://example.com http://example.com] will not RT back to that
22528 # form anymore.
22529 # Parsoid does not language-convert links (it is done in a
22530 # post-processing step)
22531 !! test
22532 Proper conversion of text in external links
22533 !! options
22534 language=sr variant=sr-ec
22535 parsoid=wt2html
22536 !! wikitext
22537 http://www.google.com
22538 gopher://www.google.com
22539 [http://www.google.com http://www.google.com]
22540 [gopher://www.google.com gopher://www.google.com]
22541 [https://www.google.com irc://www.google.com]
22542 [ftp://www.google.com www.google.com/ftp://dir]
22543 [//www.google.com www.google.com]
22544 !! html/php
22545 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22546 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22547 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22548 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22549 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22550 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22551 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22552 </p>
22553 !! html/parsoid
22554 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22555 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22556 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22557 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22558 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22559 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22560 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22561 !! end
22562
22563 !! test
22564 Do not convert roman numbers to language variants
22565 !! options
22566 language=sr variant=sr-ec
22567 !! wikitext
22568 Fridrih IV je car.
22569 !! html/php
22570 <p>Фридрих IV је цар.
22571 </p>
22572 !! html/parsoid
22573 <p>Fridrih IV je car.</p>
22574 !! end
22575
22576 !! test
22577 Unclosed language converter markup "-{"
22578 !! options
22579 language=sr
22580 !! wikitext
22581 -{T|hello
22582 !! html
22583 <p>-{T|hello
22584 </p>
22585 !! end
22586
22587 !! test
22588 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22589 !! options
22590 language=sr
22591 !! wikitext
22592 -{R|=&gt;}-
22593 !! html/php
22594 <p>=&gt;
22595 </p>
22596 !! html/parsoid
22597 <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>
22598 !!end
22599
22600 !! test
22601 Don't break link parsing if language converter markup is in the caption.
22602 !! options
22603 language=sr variant=sr-ec
22604 !! wikitext
22605 [[Main Page|-{R|main page}-]]
22606 !! html/php
22607 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22608 </p>
22609 !! html/parsoid
22610 <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>
22611 !! end
22612
22613 !! test
22614 T146304: Don't break template parsing if language converter markup is in the parameter.
22615 !! options
22616 language=sr variant=sr-ec
22617 !! wikitext
22618 {{echo|-{R|foo}-}}
22619 !! html/php
22620 <p>foo
22621 </p>
22622 !! html/parsoid
22623 <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>
22624 !! end
22625
22626 !! test
22627 T146305: Don't break image parsing if language converter markup is in the caption.
22628 !! options
22629 language=sr
22630 !! wikitext
22631 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22632 !! html/php
22633 <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>
22634
22635 !! html/parsoid
22636 <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>
22637 !! end
22638
22639 !! test
22640 T146305: Don't break image parsing if nested language converter markup is in the caption.
22641 !! options
22642 language=zh variant=zh-cn
22643 !! wikitext
22644 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22645 !! html/php
22646 <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>
22647
22648 !! html/parsoid
22649 <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>
22650 !! end
22651
22652 # XXX html2wt disabled because rich markup in alt is not preserved.
22653 !! test
22654 Don't break gallery if language converter markup is inside.
22655 !! options
22656 language=zh
22657 !! wikitext
22658 <gallery>
22659 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22660 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22661 </gallery>
22662 !! html/php
22663 <ul class="gallery mw-gallery-traditional">
22664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22665 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
22666 <div class="gallerytext">
22667 <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>
22668 </p>
22669 </div>
22670 </div></li>
22671 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22672 <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>
22673 <div class="gallerytext">
22674 <p>This is a test template
22675 </p>
22676 </div>
22677 </div></li>
22678 </ul>
22679
22680 !! html/parsoid
22681 <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"}}'>
22682 <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>
22683 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="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>
22684 </ul>
22685 !! end
22686
22687 !! test
22688 T153135: Don't break list handling if language converter markup is in the item.
22689 !! options
22690 language=zh variant=zh-cn
22691 !! wikitext
22692 ;-{zh-cn:AAA;zh-tw:BBB}-
22693 ;-{R|foo:bar}-
22694 !! html/php
22695 <dl><dt>AAA</dt>
22696 <dt>foo:bar</dt></dl>
22697
22698 !! html/parsoid
22699 <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>
22700 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22701 </dl>
22702 !! end
22703
22704 // Note that parsoid does not protect colons unless language converter
22705 // markup is properly nested, because it is a backtracking parser.
22706 !! test
22707 T153135: Unclosed markup in definition list (code coverage)
22708 !! options
22709 language=zh variant=zh-cn
22710 !! wikitext
22711 ;<b>foo:bar
22712 ;-{zh-cn:AAA
22713 !! html/php+tidy
22714 <dl><dt><b>foo:bar</b></dt><b>
22715 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22716 </b></p>
22717 !! html/parsoid
22718 <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}'>
22719 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22720 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22721 </b></dl>
22722 !! end
22723
22724 !! test
22725 T153135: Nested language converter markup in definition list (code coverage)
22726 !! options
22727 language=zh variant=zh-cn
22728 !! wikitext
22729 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22730 !! html/php
22731 <dl><dt>AAA foo:bar bat:baz</dt>
22732 <dd>def</dd></dl>
22733
22734 !! html/parsoid
22735 <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>
22736 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22737 </dl>
22738 !! end
22739
22740 # html2wt mode disabled due to <nowiki> insertion.
22741 !! test
22742 T153140: Don't break table handling if language converter markup is in the cell.
22743 !! options
22744 language=sr variant=sr-ec
22745 parsoid=wt2html,wt2wt,html2html
22746 !! wikitext
22747 {|
22748 |-
22749 | -{R|B}-
22750 |}
22751 !! html/php
22752 <table>
22753
22754 <tr>
22755 <td>B
22756 </td></tr></table>
22757
22758 !! html/parsoid
22759 <table>
22760 <tbody>
22761 <tr>
22762 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22763 </tr>
22764 </tbody>
22765 </table>
22766 !! end
22767
22768 !! test
22769 Language converter tricky html2wt cases (1)
22770 !! options
22771 language=sr
22772 parsoid=html2wt,wt2wt
22773 !! html/parsoid
22774 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22775 !! wikitext
22776 -{<nowiki>}-</nowiki>}-
22777 !! html/php
22778 <p>&#125;-
22779 </p>
22780 !! end
22781
22782 !! test
22783 Language converter tricky html2wt cases (2)
22784 !! options
22785 language=sr
22786 parsoid=html2wt,wt2wt
22787 !! html/parsoid
22788 <p>-{foo}-</p>
22789 !! wikitext
22790 <nowiki>-{foo}-</nowiki>
22791 !! html/php
22792 <p>-&#123;foo&#125;-
22793 </p>
22794 !! end
22795
22796 !! test
22797 Language converter tricky html2wt cases (3)
22798 !! options
22799 language=sr
22800 parsoid=html2wt,wt2wt
22801 !! html/parsoid
22802 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22803 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22804 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22805 !! wikitext
22806 -{R||}-
22807
22808 -{R|R|raw}-
22809
22810 -{<nowiki>-{foo}-</nowiki>}-
22811 !! html/php
22812 <p>|
22813 </p><p>R|raw
22814 </p><p>-&#123;foo&#125;-
22815 </p>
22816 !! end
22817
22818 !! test
22819 Language converter tricky html2wt cases (4)
22820 !! options
22821 language=sr
22822 parsoid=html2wt,wt2wt
22823 !! html/parsoid
22824 <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>
22825 !! wikitext
22826 -{R|{{echo|hey}}}-
22827 !! html/php
22828 <p>hey
22829 </p>
22830 !! end
22831
22832 # Note that the <nowiki> escaping added by parsoid for source text,
22833 # destination text, and language names only works on the PHP side
22834 # for *destination text*. (HTML entity escaping wouldn't work
22835 # any better.) This is probably a bug, at least for source texts.
22836 # (For language names PHP uses a precise regexp based on the languages
22837 # it currently knows have variants, which is fragile since this set
22838 # can grow/shrink over time.)
22839 !! test
22840 Language converter tricky html2wt cases (5)
22841 !! options
22842 language=zh variant=zh-cn
22843 !! html/parsoid
22844 <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>
22845 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22846 <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>
22847 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22848 <p>a:b=>c xyz</p>
22849 !! wikitext
22850 -{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
22851
22852 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22853
22854 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22855
22856 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22857
22858 a:b=>c xyz
22859 !! html/php+disabled
22860 <p>foobat;xyz=&gt;zh-cn:abc
22861 </p><p>A
22862 </p><p>0;zh-tw:bar
22863 </p><p>abc
22864 </p><p>a:b=&gt;c 0;zh-tw:bar
22865 </p>
22866 !! end
22867
22868 !! test
22869 T179579: Nowiki and lc interaction
22870 !! options
22871 parsoid=wt2html
22872 language=sr
22873 !! wikitext
22874 -{</nowiki>123}-
22875
22876 -{123<nowiki>|</nowiki>456}-
22877 !! html/parsoid
22878 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22879
22880 <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>
22881 !! end
22882
22883 !! test
22884 T2529: Uncovered bullet
22885 !! wikitext
22886 *Foo {{bullet}}
22887 !! html
22888 <ul><li>Foo</li>
22889 <li>Bar</li></ul>
22890
22891 !! end
22892
22893 !! test
22894 T2529: Uncovered bullet in a deeply nested list
22895 !! wikitext
22896 *******Foo {{bullet}}
22897 !! html
22898 <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>
22899 <li>Bar</li></ul>
22900
22901 !! end
22902
22903 !! test
22904 T2529: Uncovered table already at line-start
22905 !! wikitext
22906 x
22907
22908 {{table}}
22909 y
22910 !! html
22911 <p>x
22912 </p>
22913 <table>
22914 <tr>
22915 <td>1</td>
22916 <td>2
22917 </td></tr>
22918 <tr>
22919 <td>3</td>
22920 <td>4
22921 </td></tr></table>
22922 <p>y
22923 </p>
22924 !! end
22925
22926 !! test
22927 T2529: Uncovered bullet in parser function result
22928 !! wikitext
22929 *Foo {{lc:{{bullet}} }}
22930 !! html
22931 <ul><li>Foo</li>
22932 <li>bar</li></ul>
22933
22934 !! end
22935
22936 !! test
22937 T7678: Double-parsed template argument
22938 !! wikitext
22939 {{lc:{{{1}}}|hello}}
22940 !! html
22941 <p>{{{1}}}
22942 </p>
22943 !! end
22944
22945 !! test
22946 T7678: Double-parsed template invocation
22947 !! wikitext
22948 {{lc:{{paramtest {{!}} param = hello }} }}
22949 !! html
22950 <p>{{paramtest | param = hello }}
22951 </p>
22952 !! end
22953
22954 !! test
22955 Case insensitivity of parser functions for non-ASCII characters (T10143)
22956 !! options
22957 language=cs
22958 title=[[Main Page]]
22959 !! wikitext
22960 {{PRVNÍVELKÉ:ěščř}}
22961 {{prvnívelké:ěščř}}
22962 {{PRVNÍMALÉ:ěščř}}
22963 {{prvnímalé:ěščř}}
22964 {{MALÁ:ěščř}}
22965 {{malá:ěščř}}
22966 {{VELKÁ:ěščř}}
22967 {{velká:ěščř}}
22968 !! html
22969 <p>Ěščř
22970 Ěščř
22971 ěščř
22972 ěščř
22973 ěščř
22974 ěščř
22975 ĚŠČŘ
22976 ĚŠČŘ
22977 </p>
22978 !! end
22979
22980 !! test
22981 Morwen/13: Unclosed link followed by heading
22982 !! wikitext
22983 [[link
22984 ==heading==
22985 !! html
22986 <p>[[link
22987 </p>
22988 <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>
22989
22990 !! end
22991
22992 !! test
22993 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22994 !! wikitext
22995 {{foo|
22996 =heading=
22997 !! html
22998 <p>{{foo|
22999 </p>
23000 <h1><span class="mw-headline" id="heading">heading</span></h1>
23001
23002 !! end
23003
23004 !! test
23005 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23006 !! wikitext
23007 {{foo|
23008 ==heading==
23009 !! html
23010 <p>{{foo|
23011 </p>
23012 <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>
23013
23014 !! end
23015
23016 !! test
23017 Tildes in comments
23018 !! options
23019 pst
23020 !! wikitext
23021 <!-- ~~~~ -->
23022 !! html/php
23023 <!-- ~~~~ -->
23024 !! end
23025
23026 !! test
23027 Paragraphs inside divs (no extra line breaks)
23028 !! wikitext
23029 <div>Line one
23030
23031 Line two</div>
23032 !! html
23033 <div>Line one
23034 Line two</div>
23035
23036 !! end
23037
23038 !! test
23039 Paragraphs inside divs (extra line break on open)
23040 !! wikitext
23041 <div>
23042 Line one
23043
23044 Line two</div>
23045 !! html
23046 <div>
23047 <p>Line one
23048 </p>
23049 Line two</div>
23050
23051 !! end
23052
23053 !! test
23054 Paragraphs inside divs (extra line break on close)
23055 !! wikitext
23056 <div>Line one
23057
23058 Line two
23059 </div>
23060 !! html
23061 <div>Line one
23062 <p>Line two
23063 </p>
23064 </div>
23065
23066 !! end
23067
23068 !! test
23069 Paragraphs inside divs (extra line break on open and close)
23070 !! wikitext
23071 <div>
23072 Line one
23073
23074 Line two
23075 </div>
23076 !! html
23077 <div>
23078 <p>Line one
23079 </p><p>Line two
23080 </p>
23081 </div>
23082
23083 !! end
23084
23085 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23086 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23087 !! test
23088 Nesting tags, paragraphs on lines which begin with <div>
23089 !! wikitext
23090 <div></div><strong>A
23091 B</strong>
23092 !! html/php+tidy
23093 <div></div><p><strong>A
23094 </strong></p><strong></strong><p><strong>B</strong>
23095 </p>
23096 !! html/parsoid
23097 <div></div>
23098 <p><strong>A
23099 B</strong>
23100 </p>
23101 !! end
23102
23103 # T8200: <blockquote> should behave like <div> with respect to line breaks
23104 !! test
23105 T8200: paragraphs inside blockquotes (no extra line breaks)
23106 !! wikitext
23107 <blockquote>Line one
23108
23109 Line two</blockquote>
23110 !! html
23111 <blockquote>Line one
23112 Line two</blockquote>
23113
23114 !! html+tidy
23115 <blockquote><p>Line one
23116 Line two</p></blockquote>
23117 !! end
23118
23119 !! test
23120 T8200: paragraphs inside blockquotes (extra line break on open)
23121 !! wikitext
23122 <blockquote>
23123 Line one
23124
23125 Line two</blockquote>
23126 !! html
23127 <blockquote>
23128 <p>Line one
23129 </p>
23130 Line two</blockquote>
23131
23132 !! html+tidy
23133 <blockquote>
23134 <p>Line one
23135 </p><p>
23136 Line two</p></blockquote>
23137 !! end
23138
23139 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23140 !! test
23141 T8200: paragraphs inside blockquotes (extra line break on close)
23142 !! wikitext
23143 <blockquote>Line one
23144
23145 Line two
23146 </blockquote>
23147 !! html
23148 <blockquote>Line one
23149 <p>Line two
23150 </p>
23151 </blockquote>
23152
23153 !! html+tidy
23154 <blockquote><p>Line one
23155 </p><p>Line two
23156 </p>
23157 </blockquote>
23158 !! end
23159
23160 !! test
23161 T8200: paragraphs inside blockquotes (extra line break on open and close)
23162 !! wikitext
23163 <blockquote>
23164 Line one
23165
23166 Line two
23167 </blockquote>
23168 !! html
23169 <blockquote>
23170 <p>Line one
23171 </p><p>Line two
23172 </p>
23173 </blockquote>
23174
23175 !! end
23176
23177 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23178 !! test
23179 Paragraphs inside blockquotes/divs (no extra line breaks)
23180 !! wikitext
23181 <blockquote><div>Line one
23182
23183 Line two</div></blockquote>
23184 !! html
23185 <blockquote><div>Line one
23186 Line two</div></blockquote>
23187
23188 !! end
23189
23190 !! test
23191 Paragraphs inside blockquotes/divs (extra line break on open)
23192 !! wikitext
23193 <blockquote><div>
23194 Line one
23195
23196 Line two</div></blockquote>
23197 !! html
23198 <blockquote><div>
23199 <p>Line one
23200 </p>
23201 Line two</div></blockquote>
23202
23203 !! end
23204
23205 !! test
23206 Paragraphs inside blockquotes/divs (extra line break on close)
23207 !! wikitext
23208 <blockquote><div>Line one
23209
23210 Line two
23211 </div></blockquote>
23212 !! html
23213 <blockquote><div>Line one
23214 <p>Line two
23215 </p>
23216 </div></blockquote>
23217
23218 !! end
23219
23220 !! test
23221 Paragraphs inside blockquotes/divs (extra line break on open and close)
23222 !! wikitext
23223 <blockquote><div>
23224 Line one
23225
23226 Line two
23227 </div></blockquote>
23228 !! html
23229 <blockquote><div>
23230 <p>Line one
23231 </p><p>Line two
23232 </p>
23233 </div></blockquote>
23234
23235 !! end
23236
23237 !! test
23238 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23239 !! options
23240 wgLinkHolderBatchSize=0
23241 !! wikitext
23242 [[meatball:1]]
23243 [[meatball:2]]
23244 [[meatball:3]]
23245 !! html
23246 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23247 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23248 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23249 </p>
23250 !! end
23251
23252 !! test
23253 Free external link invading image caption
23254 !! wikitext
23255 [[Image:Foobar.jpg|thumb|http://x|hello]]
23256 !! html/php
23257 <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>
23258
23259 !! html/parsoid
23260 <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>
23261 !! end
23262
23263 !! test
23264 T17196: localised external link numbers
23265 !! options
23266 language=fa
23267 !! wikitext
23268 [http://en.wikipedia.org/]
23269 !! html/php
23270 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23271 </p>
23272 !! html/parsoid
23273 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23274 !! end
23275
23276 !! test
23277 Multibyte character in padleft
23278 !! wikitext
23279 {{padleft:-Hello|7|Æ}}
23280 !! html/php
23281 <p>Æ-Hello
23282 </p>
23283 !! html/parsoid
23284 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23285 !! end
23286
23287 !! test
23288 Multibyte character in padright
23289 !! wikitext
23290 {{padright:Hello-|7|Æ}}
23291 !! html/php
23292 <p>Hello-Æ
23293 </p>
23294 !! html/parsoid
23295 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23296 !! end
23297
23298 !!test
23299 formatdate parser function
23300 !! wikitext
23301 {{#formatdate:2009-03-24}}
23302 !! html
23303 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23304 </p>
23305 !! end
23306
23307 !!test
23308 formatdate parser function, with default format
23309 !! wikitext
23310 {{#formatdate:2009-03-24|mdy}}
23311 !! html
23312 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23313 </p>
23314 !! end
23315
23316 !! test
23317 Spacing of numbers in formatted dates
23318 !! wikitext
23319 {{#formatdate:January 15}}
23320 !! html
23321 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23322 </p>
23323 !! end
23324
23325 !! test
23326 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
23327 !! options
23328 language=nl title=[[MediaWiki:Common.css]]
23329 !! wikitext
23330 {{#formatdate:2009-03-24|dmy}}
23331 !! html
23332 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23333 </p>
23334 !! end
23335
23336 #
23337 #
23338 #
23339
23340 #
23341 # Edit comments
23342 #
23343
23344 !! test
23345 Edit comment with link
23346 !! options
23347 comment
23348 !! wikitext
23349 I like the [[Main Page]] a lot
23350 !! html/php
23351 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23352 !!end
23353
23354 !! test
23355 Edit comment with link and link text
23356 !! options
23357 comment
23358 !! wikitext
23359 I like the [[Main Page|best pages]] a lot
23360 !! html/php
23361 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23362 !!end
23363
23364 !! test
23365 Edit comment with link and link text with suffix
23366 !! options
23367 comment
23368 !! wikitext
23369 I like the [[Main Page|best page]]s a lot
23370 !! html/php
23371 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23372 !!end
23373
23374 !! test
23375 Edit comment with section link (non-local, eg in history list)
23376 !! options
23377 comment title=[[Main Page]]
23378 !! wikitext
23379 /* External links */ removed bogus entries
23380 !! html/php
23381 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23382 !!end
23383
23384 !! test
23385 Edit comment with section link and text before it (non-local, eg in history list)
23386 !! options
23387 comment title=[[Main Page]]
23388 !! wikitext
23389 pre-comment text /* External links */ removed bogus entries
23390 !! html/php
23391 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>
23392 !!end
23393
23394 !! test
23395 Edit comment with section link (local, eg in diff view)
23396 !! options
23397 comment local title=[[Main Page]]
23398 !! wikitext
23399 /* External links */ removed bogus entries
23400 !! html/php
23401 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23402 !!end
23403
23404 !! test
23405 Edit comment with subpage link (T16080)
23406 !! options
23407 comment
23408 subpage
23409 title=[[Subpage test]]
23410 !! wikitext
23411 Poked at a [[/subpage]] here...
23412 !! html/php
23413 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23414 !!end
23415
23416 !! test
23417 Edit comment with subpage link and link text (T16080)
23418 !! options
23419 comment
23420 subpage
23421 title=[[Subpage test]]
23422 !! wikitext
23423 Poked at a [[/subpage|neat little page]] here...
23424 !! html/php
23425 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23426 !!end
23427
23428 !! test
23429 Edit comment with bogus subpage link in non-subpage NS (T16080)
23430 !! options
23431 comment
23432 title=[[Subpage test]]
23433 !! wikitext
23434 Poked at a [[/subpage]] here...
23435 !! html/php
23436 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...
23437 !!end
23438
23439 !! test
23440 Edit comment with bare anchor link (local, as on diff)
23441 !! options
23442 comment
23443 local
23444 title=[[Main Page]]
23445 !! wikitext
23446 [[#section]]
23447 !! html/php
23448 <a href="#section">#section</a>
23449 !! end
23450
23451 !! test
23452 Edit comment with bare anchor link (non-local, as on history)
23453 !! options
23454 comment
23455 title=[[Main Page]]
23456 !! wikitext
23457 [[#section]]
23458 !! html/php
23459 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23460 !! end
23461
23462 !! test
23463 Anchor starting with underscore
23464 !! options
23465 title=[[Foo]]
23466 !! wikitext
23467 [[#_ref|One]]
23468 !! html/php
23469 <p><a href="#_ref">One</a>
23470 </p>
23471 !! html/parsoid
23472 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23473 !! end
23474
23475 !! test
23476 Id starting with underscore
23477 !! wikitext
23478 <div id="_ref"></div>
23479 !! html/*
23480 <div id="_ref"></div>
23481
23482 !! end
23483
23484 !! test
23485 Edit comment with link with more than one pipe (T99346)
23486 !! options
23487 comment
23488 !! wikitext
23489 [[Main Page|Many|pipes]]
23490 !! html/php
23491 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23492 !! end
23493
23494 !! test
23495 Complex edit comment with link with more than one pipe (T99346)
23496 !! options
23497 comment
23498 !! wikitext
23499 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23500 !! html/php
23501 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;
23502 !! end
23503
23504 !! test
23505 Space normalisation on autocomment (T24784)
23506 !! options
23507 comment
23508 title=[[Main Page]]
23509 !! wikitext
23510 /* __hello__world__ */
23511 !! html/php
23512 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23513 !! end
23514
23515 !! test
23516 percent-encoding and + signs in comments (T28410)
23517 !! options
23518 comment
23519 !! wikitext
23520 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23521 !! html/php
23522 <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>
23523 !! end
23524
23525 # Parsoid doesn't support this yet: see T75581
23526 # but it *should* omit the 'src' attribute if the image is bad.
23527 # PHP side of tests was disabled in
23528 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23529 # because of issues in the PHP parserTests infrastructure
23530 # (but the output below is indeed what the PHP side emits)
23531 !! test
23532 Bad images - basic functionality
23533 !! wikitext
23534 [[File:Bad.jpg]]
23535 !! html/php+disabled
23536 !! html/parsoid
23537 <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>
23538 !! end
23539
23540 !! test
23541 Bad images - T18039: text after bad image disappears
23542 !! wikitext
23543 Foo bar
23544 [[File:Bad.jpg]]
23545 Bar foo
23546 !! html/php+disabled
23547 <p>Foo bar
23548 </p><p>Bar foo
23549 </p>
23550 !! html/parsoid
23551 <p>Foo bar
23552 <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>
23553 Bar foo</p>
23554 !! end
23555
23556 !! test
23557 Verify that displaytitle works (T24501) no displaytitle
23558 !! options
23559 showtitle
23560 !! config
23561 wgAllowDisplayTitle=true
23562 wgRestrictDisplayTitle=false
23563 !! wikitext
23564 this is not the the title
23565 !! html/php
23566 Parser test
23567 <p>this is not the the title
23568 </p>
23569 !! end
23570
23571 !! test
23572 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23573 !! options
23574 showtitle
23575 title=[[Screen]]
23576 !! config
23577 wgAllowDisplayTitle=true
23578 wgRestrictDisplayTitle=false
23579 !! wikitext
23580 this is not the the title
23581 {{DISPLAYTITLE:whatever}}
23582 !! html/php
23583 whatever
23584 <p>this is not the the title
23585 </p>
23586 !! end
23587
23588 !! test
23589 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23590 !! options
23591 showtitle
23592 title=[[Screen]]
23593 !! config
23594 wgAllowDisplayTitle=true
23595 wgRestrictDisplayTitle=true
23596 !! wikitext
23597 this is not the the title
23598 {{DISPLAYTITLE:whatever}}
23599 !! html/php
23600 Screen
23601 <p>this is not the the title
23602 </p>
23603 !! end
23604
23605 !! test
23606 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23607 !! options
23608 showtitle
23609 title=[[Screen]]
23610 !! config
23611 wgAllowDisplayTitle=true
23612 wgRestrictDisplayTitle=true
23613 !! wikitext
23614 this is not the the title
23615 {{DISPLAYTITLE:screen}}
23616 !! html/php
23617 screen
23618 <p>this is not the the title
23619 </p>
23620 !! end
23621
23622 !! test
23623 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23624 !! options
23625 showtitle
23626 title=[[Screen]]
23627 !! config
23628 wgAllowDisplayTitle=false
23629 !! wikitext
23630 this is not the the title
23631 {{DISPLAYTITLE:screen}}
23632 !! html/php
23633 Screen
23634 <p>this is not the the title
23635 <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>
23636 </p>
23637 !! end
23638
23639 !! test
23640 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23641 !! options
23642 showtitle
23643 title=[[Screen]]
23644 !! config
23645 wgAllowDisplayTitle=false
23646 !! wikitext
23647 this is not the the title
23648 !! html/php
23649 Screen
23650 <p>this is not the the title
23651 </p>
23652 !! end
23653
23654 !! test
23655 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23656 !! options
23657 showtitle
23658 title=[[Screen]]
23659 !! config
23660 wgAllowDisplayTitle=true
23661 wgRestrictDisplayTitle=true
23662 !! wikitext
23663 this is not the the title
23664 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23665 !! html/php
23666 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23667 <p>this is not the the title
23668 </p>
23669 !! end
23670
23671 !! test
23672 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23673 !! options
23674 showtitle
23675 title=[[Screen]]
23676 !! config
23677 wgAllowDisplayTitle=true
23678 wgRestrictDisplayTitle=true
23679 !! wikitext
23680 this is not the the title
23681 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23682 !! html/php
23683 <span style="color: red;">s</span>creen
23684 <p>this is not the the title
23685 </p>
23686 !! end
23687
23688 !! test
23689 Page status indicators: Empty name is invalid
23690 !! options
23691 showindicators
23692 !! wikitext
23693 <indicator name=" "></indicator>
23694 <indicator></indicator>
23695 !! html/php
23696 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23697 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23698 </p>
23699 !! end
23700
23701 !! test
23702 Page status indicators: Weird syntaxes that are okay
23703 !! options
23704 showindicators
23705 !! wikitext
23706 <indicator name="empty" />
23707 <indicator name="name"></indicator>
23708 !! html/php
23709 empty=
23710 name=
23711 <p><br />
23712 </p>
23713 !! end
23714
23715 !! test
23716 Page status indicators: Torture test
23717 !! options
23718 showindicators
23719 !! wikitext
23720 <indicator name="01">hello world</indicator>
23721 <indicator name="02">[[Main Page]]</indicator>
23722 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23723 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23724 <indicator name="05">*foo
23725 *bar</indicator>
23726 <indicator name="06"><nowiki>foo</nowiki></indicator>
23727 <indicator name="07"> Preformatted</indicator>
23728 <indicator name="08"><div>Broken tag</indicator>
23729 <indicator name="09">{| class=wikitable
23730 |cell
23731 |}</indicator>
23732 <indicator name="10">Two
23733
23734 paragraphs</indicator>
23735 !! html/php
23736 01=hello world
23737 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23738 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" />
23739 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>
23740 05=<ul><li>foo</li>
23741 <li>bar</li></ul>
23742
23743 06=foo
23744 07=<pre>Preformatted
23745 </pre>
23746 08=<div>Broken tag</div>
23747
23748 09=<table class="wikitable">
23749 <tr>
23750 <td>cell
23751 </td></tr></table>
23752
23753 10=<p>Two
23754 </p><p>paragraphs
23755 </p>
23756 <p><br />
23757 </p><p><br />
23758 </p><p><br />
23759 </p><p><br />
23760 </p><p><br />
23761 </p>
23762 !! end
23763
23764 !! test
23765 preload: check <noinclude> and <includeonly>
23766 !! options
23767 preload
23768 !! wikitext
23769 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23770 !! html/php
23771 Hello kind world.
23772 !! end
23773
23774 !! test
23775 preload: check <onlyinclude>
23776 !! options
23777 preload
23778 !! wikitext
23779 Goodbye <onlyinclude>Hello world</onlyinclude>
23780 !! html/php
23781 Hello world
23782 !! end
23783
23784 !! test
23785 preload: can pass tags through if we want to
23786 !! options
23787 preload
23788 !! wikitext
23789 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23790 !! html/php
23791 <includeonly>Hello world</includeonly>
23792 !! end
23793
23794 !! test
23795 preload: check that it doesn't try to do tricks
23796 !! options
23797 preload
23798 !! wikitext
23799 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23800 !! html/php
23801 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23802 !! end
23803
23804 !! test
23805 Play a bit with r67090 and T5158
23806 !! wikitext
23807 <div style="width:50% !important">&nbsp;</div>
23808 <div style="width:50%&nbsp;!important">&nbsp;</div>
23809 <div style="width:50%&#160;!important">&nbsp;</div>
23810 <div style="border : solid;">&nbsp;</div>
23811 !! html/php
23812 <div style="width:50% !important">&#160;</div>
23813 <div style="width:50% !important">&#160;</div>
23814 <div style="width:50% !important">&#160;</div>
23815 <div style="border&#160;: solid;">&#160;</div>
23816
23817 !! html/parsoid
23818 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23819 <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>
23820 <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>
23821 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23822
23823 !! end
23824
23825 !! test
23826 HTML5 data attributes
23827 !! wikitext
23828 <span data-foo="bar">Baz</span>
23829 <p data-abc-def_hij="">Quuz</p>
23830 !! html/php
23831 <p><span data-foo="bar">Baz</span>
23832 </p>
23833 <p data-abc-def_hij="">Quuz</p>
23834
23835 !! html/parsoid
23836 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23837 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23838 !! end
23839
23840 !! test
23841 Strip reserved data attributes
23842 !! wikitext
23843 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23844 !! html/php
23845 <div data-ok="fred">d</div>
23846
23847 !! html/parsoid
23848 <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>
23849 !! end
23850
23851 !! test
23852 percent-encoding and + signs in internal links (T28410)
23853 !! wikitext
23854 [[User:+%]] [[Page+title%]]
23855 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23856 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23857 [[%33%45]] [[%33%45+]]
23858 !! html/php
23859 <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>
23860 <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>
23861 <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>
23862 <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>
23863 </p>
23864 !! html/parsoid
23865 <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>
23866 <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>
23867 <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>
23868 <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>
23869 !! end
23870
23871 !! test
23872 Special characters in embedded file links (T29679)
23873 !! wikitext
23874 [[File:Contains & ampersand.jpg]]
23875 [[File:Does not exist.jpg|Title with & ampersand]]
23876 !! html/php
23877 <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>
23878 <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>
23879 </p>
23880 !! html/parsoid
23881 <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>
23882 <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>
23883 !! end
23884
23885 !! test
23886 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23887 !! wikitext
23888 Text&apos;s been normalized?
23889 !! html
23890 <p>Text&#39;s been normalized?
23891 </p>
23892 !! end
23893
23894 !! test
23895 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23896 !! wikitext
23897 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23898 !! html
23899 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23900 </p>
23901 !! end
23902
23903 !! test
23904 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23905 !! wikitext
23906 [http://www.example.org/ ideograms]
23907 !! html
23908 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23909 </p>
23910 !! end
23911
23912 !! test
23913 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23914 !! wikitext
23915 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23916 !! html
23917 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23918 </p>
23919 !! end
23920
23921 !! article
23922 Mediawiki:loop1
23923 !! text
23924 {{Identical|A}}
23925 !! endarticle
23926
23927 !! article
23928 Mediawiki:loop2
23929 !! text
23930 {{Identical|B}}
23931 !! endarticle
23932
23933 !! article
23934 Template:Identical
23935 !! text
23936 {{int:loop1}}
23937 {{int:loop2}}
23938 !! endarticle
23939
23940 !! test
23941 T33098 Template which includes system messages which includes the template
23942 !! wikitext
23943 {{Identical}}
23944 !! html
23945 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23946 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23947 </p>
23948 !! end
23949
23950 !! test
23951 T33490 Turkish: ucfirst 'blah'
23952 !! options
23953 language=tr
23954 !! wikitext
23955 {{ucfirst:blah}}
23956 !! html
23957 <p>Blah
23958 </p>
23959 !! end
23960
23961 !! test
23962 T33490 Turkish: ucfirst 'ix'
23963 !! options
23964 language=tr
23965 !! wikitext
23966 {{ucfirst:ix}}
23967 !! html
23968 <p>İx
23969 </p>
23970 !! end
23971
23972 !! test
23973 T33490 Turkish: lcfirst 'BLAH'
23974 !! options
23975 language=tr
23976 !! wikitext
23977 {{lcfirst:BLAH}}
23978 !! html
23979 <p>bLAH
23980 </p>
23981 !! end
23982
23983 !! test
23984 T33490 Turkish: ucfırst (with a dotless i)
23985 !! options
23986 language=tr
23987 !! wikitext
23988 {{ucfırst:blah}}
23989 !! html
23990 <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>
23991 </p>
23992 !! end
23993
23994 !! test
23995 T33490 ucfırst (with a dotless i) with English language
23996 !! options
23997 language=en
23998 !! wikitext
23999 {{ucfırst:blah}}
24000 !! html
24001 <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>
24002 </p>
24003 !! end
24004
24005 # Note that Parsoid doesn't emit an explicit TOC.
24006 # Note also that the html2wt direction tends to emit an extra newline
24007 # between the __TOC__ magicword and the first heading unless *both*
24008 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24009 # it's "{}").
24010
24011 !! test
24012 T28375: TOC with italics
24013 !! options
24014 title=[[Main Page]]
24015 !! wikitext
24016 __TOC__
24017 ==''Lost'' episodes==
24018 !! html/php
24019 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24020 <ul>
24021 <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>
24022 </ul>
24023 </div>
24024
24025 <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>
24026
24027 !! html/parsoid
24028 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24029 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24030 !! end
24031
24032 !! test
24033 T28375: TOC with bold
24034 !! options
24035 title=[[Main Page]]
24036 !! wikitext
24037 __TOC__
24038 =='''should be bold''' then normal text==
24039 !! html/php
24040 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24041 <ul>
24042 <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>
24043 </ul>
24044 </div>
24045
24046 <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>
24047
24048 !! html/parsoid
24049 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24050 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24051 !! end
24052
24053 !! test
24054 T35845: Headings become cursive in TOC when they contain an image
24055 !! options
24056 title=[[Main Page]]
24057 !! wikitext
24058 __TOC__
24059 ==Image [[Image:foobar.jpg]]==
24060 !! html/php
24061 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24062 <ul>
24063 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24064 </ul>
24065 </div>
24066
24067 <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>
24068
24069 !! html/parsoid
24070 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24071 <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>
24072 !! end
24073
24074 !! test
24075 T35845 (2): Headings become bold in TOC when they contain a blockquote
24076 !! options
24077 title=[[Main Page]]
24078 !! wikitext
24079 __TOC__
24080 ==<blockquote>Quote</blockquote>==
24081 !! html/php
24082 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24083 <ul>
24084 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24085 </ul>
24086 </div>
24087
24088 <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>
24089
24090 !! html/php+tidy
24091 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24092 <ul>
24093 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24094 </ul>
24095 </div>
24096
24097 <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>
24098 !! html/parsoid
24099 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24100 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24101 !! end
24102
24103 !! test
24104 Unclosed tags in TOC
24105 !! config
24106 wgFragmentMode=[ 'html5', 'legacy' ]
24107 !! options
24108 title=[[Main Page]]
24109 !! wikitext
24110 __TOC__
24111 ==Proof: 2 < 3==
24112 <small>Hanc marginis exiguitas non caperet.</small>
24113 QED
24114 !! html/php
24115 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24116 <ul>
24117 <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>
24118 </ul>
24119 </div>
24120
24121 <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>
24122 <p><small>Hanc marginis exiguitas non caperet.</small>
24123 QED
24124 </p>
24125 !! html/parsoid
24126 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24127 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24128 <p><small>Hanc marginis exiguitas non caperet.</small>
24129 QED</p>
24130 !! end
24131
24132 !! test
24133 Multiple tags in TOC
24134 !! wikitext
24135 __TOC__
24136 ==<i>Foo</i> <b>Bar</b>==
24137
24138 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24139 !! html/php
24140 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24141 <ul>
24142 <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>
24143 <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>
24144 </ul>
24145 </div>
24146
24147 <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>
24148 <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>
24149
24150 !! html/php+tidy
24151 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24152 <ul>
24153 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
24154 <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>
24155 </ul>
24156 </div>
24157
24158 <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>
24159 <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>
24160 !! html/parsoid
24161 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24162 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24163
24164 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24165 !! end
24166
24167 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24168 # html5 tag parsing.
24169 !! test
24170 Tags with parameters in TOC
24171 !! options
24172 parsoid=wt2html
24173 !! wikitext
24174 __TOC__
24175 ==<sup class="in-h2">Hello</sup>==
24176
24177 ==<sup class="a > b">Evilbye</sup>==
24178 !! html/php
24179 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24180 <ul>
24181 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24182 <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>
24183 </ul>
24184 </div>
24185
24186 <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>
24187 <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>
24188
24189 !! html/parsoid
24190 <meta property="mw:PageProp/toc" />
24191 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24192
24193 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24194 !! end
24195
24196 !! test
24197 span tags with directionality in TOC
24198 !! wikitext
24199 __TOC__
24200 ==<span dir="ltr">C++</span>==
24201
24202 ==<span dir="rtl">זבנג!</span>==
24203
24204 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24205
24206 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24207
24208 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24209 !! html/php
24210 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24211 <ul>
24212 <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>
24213 <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>
24214 <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>
24215 <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>
24216 <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>
24217 </ul>
24218 </div>
24219
24220 <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>
24221 <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>
24222 <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>
24223 <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>
24224 <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>
24225
24226 !! html/parsoid
24227 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24228 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24229 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24230 <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>
24231 <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>
24232 <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>
24233 !! end
24234
24235 !! test
24236 T74884: bdi element in ToC
24237 !! wikitext
24238 __TOC__
24239 ==<bdi>test</bdi>==
24240 !! html/php
24241 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24242 <ul>
24243 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24244 </ul>
24245 </div>
24246
24247 <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>
24248
24249 !! html/parsoid
24250 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24251 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24252 !! end
24253
24254 !! test
24255 T35715: s/strike element in ToC
24256 !! wikitext
24257 __TOC__
24258 ==<s>test</s> test <strike>test</strike>==
24259 !! html/php
24260 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24261 <ul>
24262 <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>
24263 </ul>
24264 </div>
24265
24266 <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>
24267
24268 !! html/parsoid
24269 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24270 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24271 !! end
24272
24273 !! test
24274 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24275 !! wikitext
24276 __TOC__
24277 ==x==
24278 !! html/php
24279 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24280 <ul>
24281 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24282 </ul>
24283 </div>
24284
24285 <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>
24286
24287 !! html/parsoid
24288 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24289 <h2 id="x" data-parsoid='{}'>x</h2>
24290 !! end
24291
24292 !! article
24293 MediaWiki:T34057
24294 !! text
24295 == {{int:headline_sample}} ==
24296 !! endarticle
24297
24298 !! test
24299 T34057: Title needed when expanding <h> nodes.
24300 !! options
24301 title=[[Main Page]]
24302 !! wikitext
24303 {{int:T34057}}
24304 !! html
24305 <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>
24306
24307 !! end
24308
24309 !! test
24310 Strip marker in urlencode
24311 !! wikitext
24312 {{urlencode:x<nowiki/>y}}
24313 {{urlencode:x<nowiki/>y|wiki}}
24314 {{urlencode:x<nowiki/>y|path}}
24315 {{urlencode:x<pre id="one">two</pre>y}}
24316 !! html/php
24317 <p>xy
24318 xy
24319 xy
24320 xy
24321 </p>
24322 !! end
24323
24324 !! test
24325 Strip marker in lc
24326 !! wikitext
24327 {{lc:x<nowiki/>y}}
24328 !! html
24329 <p>xy
24330 </p>
24331 !! end
24332
24333 !! test
24334 Strip marker in uc
24335 !! wikitext
24336 {{uc:x<nowiki/>y}}
24337 !! html
24338 <p>XY
24339 </p>
24340 !! end
24341
24342 !! test
24343 Strip marker in formatNum
24344 !! wikitext
24345 {{formatnum:1<nowiki/>2}}
24346 {{formatnum:1<nowiki/>2|R}}
24347 !! html
24348 <p>12
24349 12
24350 </p>
24351 !! end
24352
24353 !! test
24354 Check noCommafy in formatNum
24355 !! options
24356 language=be-tarask
24357 !! wikitext
24358 {{formatnum:123456.78}}
24359 {{formatnum:123456.78|NOSEP}}
24360 !! html
24361 <p>123 456,78
24362 123456.78
24363 </p>
24364 !! end
24365
24366 !! test
24367 Wrong option for formatNum (T58199)
24368 !! wikitext
24369 {{formatnum:1,234.56|Random}}
24370 {{formatnum:1,234.56|EVERYTHING}}
24371 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24372 !! html
24373 <p>1,234.56
24374 1,234.56
24375 1,234.56
24376 </p>
24377 !! end
24378
24379 !! test
24380 Strip marker in grammar
24381 !! options
24382 language=fi
24383 !! wikitext
24384 {{grammar:elative|foo<nowiki/>bar}}
24385 !! html
24386 <p>foobarista
24387 </p>
24388 !! end
24389
24390 !! test
24391 Strip marker in padleft
24392 !! wikitext
24393 {{padleft:|2|x<nowiki/>y}}
24394 !! html
24395 <p>xy
24396 </p>
24397 !! end
24398
24399 !! test
24400 Strip marker in padright
24401 !! wikitext
24402 {{padright:|2|x<nowiki/>y}}
24403 !! html
24404 <p>xy
24405 </p>
24406 !! end
24407
24408 !! test
24409 Strip marker in anchorencode
24410 !! wikitext
24411 {{anchorencode:x<nowiki/>y}}
24412 !! html/php
24413 <p>xy
24414 </p>
24415 !! html/parsoid
24416 <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>
24417 !! end
24418
24419 !! test
24420 nowiki inside link inside heading (T20295)
24421 !! wikitext
24422 ==[[foo|x<nowiki>y</nowiki>z]]==
24423 !! html
24424 <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>
24425
24426 !! end
24427
24428 !! test
24429 new support for bdi element (T33817)
24430 !! wikitext
24431 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24432 !! html
24433 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24434
24435 !!end
24436
24437 !! test
24438 Ignore pipe between table row attributes
24439 !! wikitext
24440 {|
24441 |quux
24442 |- id=foo | style='color: red'
24443 |bar
24444 |}
24445 !! html
24446 <table>
24447 <tr>
24448 <td>quux
24449 </td></tr>
24450 <tr id="foo" style="color: red">
24451 <td>bar
24452 </td></tr></table>
24453
24454 !! end
24455
24456 !!test
24457 Language parser function
24458 !! wikitext
24459 {{#language:ar}}
24460 !! html
24461 <p>العربية
24462 </p>
24463 !! end
24464
24465 !!test
24466 Padleft and padright (default 0-padding)
24467 !! wikitext
24468 {{padleft:xyz|5}}
24469 {{padright:xyz|5}}
24470 !! html/php
24471 <p>00xyz
24472 xyz00
24473 </p>
24474 !! html/parsoid
24475 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24476 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24477 !! end
24478
24479 !!test
24480 Padleft and padright (partial fill)
24481 !! wikitext
24482 {{padleft:xyz|6|ab}}
24483 {{padright:xyz|6|ab}}
24484 !! html/php
24485 <p>abaxyz
24486 xyzaba
24487 </p>
24488 !! html/parsoid
24489 <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>
24490 <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>
24491 !! end
24492
24493 !!test
24494 Padleft and padright as substr
24495 !! wikitext
24496 {{padleft:|3|abcde}}
24497 {{padright:|3|abcde}}
24498 !! html/php
24499 <p>abc
24500 abc
24501 </p>
24502 !! html/parsoid
24503 <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>
24504 <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>
24505 !! end
24506
24507 !!test
24508 Special parser function
24509 !! wikitext
24510 {{#special:RandomPage}}
24511 {{#special:BaDtItLe}}
24512 {{#special:Foobar}}
24513 !! html
24514 <p>Special:Random
24515 Special:Badtitle
24516 Special:Foobar
24517 </p>
24518 !! end
24519
24520 !!test
24521 T36939 - Case insensitive link parsing ([HttP://])
24522 !! wikitext
24523 [HttP://MediaWiki.Org/]
24524 !! html/php
24525 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24526 </p>
24527 !! html/parsoid
24528 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24529 !! end
24530
24531 !!test
24532 T36939 - Case insensitive link parsing ([HttP:// title])
24533 !! wikitext
24534 [HttP://MediaWiki.Org/ MediaWiki]
24535 !! html
24536 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24537 </p>
24538 !! end
24539
24540 !!test
24541 T36939 - Case insensitive link parsing (HttP://)
24542 !! wikitext
24543 HttP://MediaWiki.Org/
24544 !! html/php
24545 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24546 </p>
24547 !! html/parsoid
24548 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24549 !! end
24550
24551 !!test
24552 Disable TOC
24553 !! options
24554 notoc
24555 !! wikitext
24556 Lead
24557 ==Section 1==
24558 ==Section 2==
24559 ==Section 3==
24560 ==Section 4==
24561 ==Section 5==
24562 !! html
24563 <p>Lead
24564 </p>
24565
24566 <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>
24567 <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>
24568 <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>
24569 <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>
24570 <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>
24571
24572 !! end
24573
24574
24575 ###
24576 ### Parsoid-specific tests
24577 ### Parsoid-PHP parser incompatibilities
24578 ###
24579 !!test
24580 1. SOL-sensitive wikitext tokens as template-args
24581 !!options
24582 parsoid=wt2html,wt2wt
24583 !! wikitext
24584 {{echo|*a}}
24585 {{echo|#a}}
24586 {{echo|:a}}
24587 !! html
24588 <span about="#mwt1" typeof="mw:Transclusion">
24589 </span><ul about="#mwt1"><li>a</li>
24590 </ul>
24591 <span about="#mwt2" typeof="mw:Transclusion">
24592 </span><ol about="#mwt2"><li>a</li>
24593 </ol>
24594 <span about="#mwt3" typeof="mw:Transclusion">
24595 </span><dl about="#mwt3"><dd>a</dd>
24596 </dl>
24597 !!end
24598
24599 #### -----------------------------------------------------------------
24600 #### Parsoid-specific functionality tests
24601 #### -----------------------------------------------------------------
24602
24603 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24604 # We know wt2wt will fail, but we expect selser to pass.
24605 # Due to the nature of our testing, wt2wt and selser tests will enter the
24606 # blacklist and we'll catch selser regressions based on changes to the
24607 # blacklist entries for selser tests.
24608 !! test
24609 1. Bad treebuilder fixup of formatting elt is cleaned up
24610 !! options
24611 parsoid=wt2html,wt2wt
24612 !! wikitext
24613 {|
24614 |
24615 <small>
24616 [[Image:Foobar.jpg|right|Test]]
24617 </small>
24618 |}
24619 !! html/parsoid
24620 <table>
24621 <tbody><tr><td>
24622 <small>
24623 <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>
24624 </small>
24625 </td></tr>
24626 </tbody></table>
24627 !! end
24628
24629 !! test
24630 2. Bad treebuilder fixup of formatting elt is cleaned up
24631 !! options
24632 parsoid=wt2html,wt2wt
24633 !! wikitext
24634 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24635
24636 <small>[[Image:Foobar.jpg|right|300px]]</small>
24637 !! html/parsoid
24638
24639 <p><b>foo</b></p>
24640 <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>
24641 <p><b>bar</b></p>
24642 <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>
24643 !! end
24644
24645 !! test
24646 3. Bad treebuilder fixup of formatting elt is cleaned up
24647 !! options
24648 parsoid=wt2html,wt2wt
24649 !! wikitext
24650 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24651 !! html/parsoid
24652 <p><small><b>foo</b></small></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><small><b>caption</b></small></figcaption></figure>
24654 <p><small><b>bar</b></small></p>
24655 !! end
24656
24657 !! test
24658 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24659 !! options
24660 parsoid=wt2html,wt2wt
24661 !! wikitext
24662 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24663 !! html/parsoid
24664 <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>
24665 !! end
24666
24667 #### ----------------------------------------------------------------
24668 #### Parsoid-only testing of Parsoid's impl of LST
24669 #### Not implemented yet, see
24670 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24671 #### ----------------------------------------------------------------
24672
24673 ## We still need to support serializing the older format while content is stored.
24674 !! test
24675 LST Sections: Backwards compatibility
24676 !! options
24677 parsoid={
24678 "suppressErrors": true,
24679 "modes": ["html2wt"]
24680 }
24681 !! wikitext
24682 <section begin="2011-05-16" />
24683 <section end="2014-04-10 (MW 1.23wmf22)" />
24684 !! html/parsoid
24685 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24686 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24687 !! end
24688
24689 !! test
24690 LST Sections: Newfangled approach
24691 !! wikitext
24692 <section begin="2011-05-16" />
24693 <section end="2014-04-10 (MW 1.23wmf22)" />
24694 !! html/parsoid
24695 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24696 </span>
24697 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24698 </span></p>
24699 !! end
24700
24701 #--------- Test stripping of empty nodes in template content ----------
24702
24703 !! test
24704 Empty LI and TR nodes should be stripped from template content
24705 !! wikitext
24706 {{EmptyLITest}}
24707 {{EmptyTRTest}}
24708 !! html/parsoid
24709 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24710 <li>a</li>
24711 <li>b</li>
24712 </ul>
24713 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24714 <tbody>
24715 <tr>
24716 <td>foo</td>
24717 </tr>
24718 <tr>
24719 <td>bar</td>
24720 </tr>
24721 </tbody>
24722 </table>
24723 !! end
24724
24725 !! test
24726 Empty LI and TR nodes should not be stripped from top-level content
24727 !! wikitext
24728 * a
24729 *
24730 * b
24731 {|
24732 |-
24733 |-
24734 |foo
24735 |}
24736 !! html/parsoid
24737 <ul>
24738 <li> a</li>
24739 <li class='mw-empty-elt'></li>
24740 <li> b</li>
24741 </ul>
24742 <table>
24743 <tbody>
24744 <tr class='mw-empty-elt'></tr>
24745 <tr>
24746 <td>foo</td>
24747 </tr>
24748 </tbody>
24749 </table>
24750 !! end
24751
24752 !! test
24753 Empty TR nodes should not be stripped if they have any attributes set
24754 !! wikitext
24755 {{EmptyTRWithHTMLAttrTest}}
24756 !! html/parsoid
24757 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24758 <tr align='center'></tr>
24759 <tr><td>foo</td></tr>
24760 <tr align='center'></tr>
24761 <tr><td>bar</td></tr>
24762 </table>
24763 !! end
24764
24765 #### ----------------------------------------------------------------
24766 #### The following section of tests are primarily to test
24767 #### wikitext escaping capabilities of Parsoid. Given that
24768 #### escaping can be done any number of ways, the wikitext (input)
24769 #### is always adjusted to reflect how Parsoid adds nowiki
24770 #### escape tags.
24771 ####
24772 #### We are marking several tests as parsoid-only since the
24773 #### HTML in the result section is different from what the
24774 #### PHP parser generates for it.
24775 #### ----------------------------------------------------------------
24776
24777
24778 #### --------------- Headings ---------------
24779 #### 0. Unnested
24780 #### 1. Nested inside html <h1>=foo=</h1>
24781 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24782 #### 3. Nested inside html with wikitext split by html tags
24783 #### 4. No escape needed
24784 #### 5. Empty headings <h1></h1>
24785 #### 6. Heading chars in SOL context
24786 #### ----------------------------------------
24787 !! test
24788 Headings: 0. Unnested
24789 !! options
24790 parsoid=html2wt
24791 !! html/parsoid
24792 <p>=foo=</p>
24793
24794 <p> =foo=
24795 <!--cmt-->
24796 =foo=</p>
24797
24798 <p>=foo<i>a</i>=</p>
24799 !! wikitext
24800 <nowiki>=foo=</nowiki>
24801
24802 <nowiki> </nowiki>=foo=
24803 <!--cmt-->
24804 <nowiki>=foo=</nowiki>
24805
24806 =foo''a''<nowiki>=</nowiki>
24807 !!end
24808
24809 # New headings and existing headings are handled differently
24810 !! test
24811 Headings: 1. Nested inside html
24812 !! options
24813 parsoid=html2wt
24814 !! html/parsoid
24815 <h1>=foo=</h1>
24816 <h2>=foo=</h2>
24817 <h3>=foo=</h3>
24818
24819 <h1 data-parsoid=''>=foo=</h1>
24820 <h2 data-parsoid=''>=foo=</h2>
24821 <h3 data-parsoid=''>=foo=</h3>
24822 <h4 data-parsoid=''>=foo=</h4>
24823 <h5 data-parsoid=''>=foo=</h5>
24824 <h6 data-parsoid=''>=foo=</h6>
24825 !! wikitext
24826 = =foo= =
24827
24828 == =foo= ==
24829
24830 === =foo= ===
24831
24832 =<nowiki>=foo=</nowiki>=
24833 ==<nowiki>=foo=</nowiki>==
24834 ===<nowiki>=foo=</nowiki>===
24835 ====<nowiki>=foo=</nowiki>====
24836 =====<nowiki>=foo=</nowiki>=====
24837 ======<nowiki>=foo=</nowiki>======
24838
24839 !!end
24840
24841 !! test
24842 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24843 !! options
24844 parsoid=html2wt
24845 !! html/parsoid
24846 <h1>foo</h1>*bar
24847 <h1>foo</h1>=bar
24848 <h1>foo</h1>=bar=
24849 !! wikitext
24850 = foo =
24851 <nowiki>*</nowiki>bar
24852
24853 = foo =
24854 =bar
24855
24856 = foo =
24857 <nowiki>=bar=</nowiki>
24858 !!end
24859
24860 !! test
24861 Headings: 3. Nested inside html with wikitext split by html tags
24862 !! options
24863 parsoid=html2wt
24864 !! html/parsoid
24865 <h1>=<b>bold</b>foo=</h1>
24866 !! wikitext
24867 = ='''bold'''foo= =
24868 !!end
24869
24870 !! test
24871 Headings: 4a. No escaping needed (testing just h1 and h2)
24872 !! options
24873 parsoid=html2wt
24874 !! html/parsoid
24875 <h1>=foo</h1>
24876 <h1>foo=</h1>
24877 <h1> =foo= </h1>
24878 <h1>=foo= bar</h1>
24879 <h2>=foo</h2>
24880 <h2>foo=</h2>
24881 <h1>=</h1>
24882 <h1><i>=</i>foo=</h1>
24883 !! wikitext
24884 = =foo =
24885
24886 = foo= =
24887
24888 = =foo= =
24889
24890 = =foo= bar =
24891
24892 == =foo ==
24893
24894 == foo= ==
24895
24896 = = =
24897
24898 = ''=''foo= =
24899 !!end
24900
24901 !! test
24902 Headings: 4b. No escaping needed (inside p-tags)
24903 !! options
24904 parsoid=html2wt
24905 !! html/parsoid
24906 <p>=foo= x
24907 =foo= <s></s>
24908 </p>
24909 !! wikitext
24910 =foo= x
24911 =foo= <s></s>
24912 !! html/php
24913 <p>=foo= x
24914 =foo= <s></s>
24915 </p>
24916 !!end
24917
24918 !! test
24919 Headings: 4c. Short headings (1)
24920 !! options
24921 parsoid=html2wt
24922 !! html/parsoid
24923 <p>===
24924 </p>
24925 !! wikitext
24926 <nowiki>===</nowiki>
24927 !! html/php
24928 <p>===
24929 </p>
24930 !! end
24931
24932 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24933 !! test
24934 Headings: 4d. Short headings (2)
24935 !! options
24936 parsoid=wt2html,html2html
24937 !! wikitext
24938 =
24939 ==
24940 ===
24941 ====
24942 =====
24943 !! html/php
24944 <p>=
24945 ==
24946 </p>
24947 <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>
24948 <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>
24949 <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>
24950
24951 !! html/parsoid
24952 <p>=
24953 ==</p>
24954 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24955 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24956 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24957 !! end
24958
24959 !! test
24960 Headings: 5. Empty headings
24961 !! options
24962 parsoid=html2wt
24963 !! html/parsoid
24964 <h1 data-parsoid='{}'></h1>
24965
24966 <h2 data-parsoid='{}'></h2>
24967
24968 <h3 data-parsoid='{}'></h3>
24969
24970 <h4 data-parsoid='{}'></h4>
24971
24972 <h5 data-parsoid='{}'></h5>
24973
24974 <h6 data-parsoid='{}'></h6>
24975 !! wikitext
24976 =<nowiki/>=
24977
24978 ==<nowiki/>==
24979
24980 ===<nowiki/>===
24981
24982 ====<nowiki/>====
24983
24984 =====<nowiki/>=====
24985
24986 ======<nowiki/>======
24987 !!end
24988
24989 !! test
24990 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24991 !! options
24992 parsoid=html2wt
24993 !! html/parsoid
24994 <p>=a=</p>
24995
24996 <p>=a=</p>
24997
24998 <p>=a=</p>
24999 !! wikitext
25000 <nowiki>=a=</nowiki>
25001
25002 <nowiki>=a=</nowiki>
25003
25004 <nowiki>=a=</nowiki>
25005 !!end
25006
25007 !! test
25008 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25009 !! options
25010 parsoid=html2wt
25011 !! html/parsoid
25012 <p>=a=
25013 b</p>
25014
25015 <p>=a=
25016 b</p>
25017
25018 <p>=a=
25019 b</p>
25020 !! wikitext
25021 <nowiki>=a=</nowiki>
25022 b
25023
25024 <nowiki>=a=</nowiki>
25025 b
25026
25027 <nowiki>=a=</nowiki>
25028 b
25029 !!end
25030
25031 !! test
25032 Headings: 6c. Heading chars in SOL context (leading newline break)
25033 !! options
25034 parsoid=html2wt
25035 !! html/parsoid
25036 <p>a
25037 =b=</p>
25038 !! wikitext
25039 a
25040 <nowiki>=b=</nowiki>
25041 !!end
25042
25043 !! test
25044 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25045 !! options
25046 parsoid=html2wt
25047 !! html/parsoid
25048 <!--c0--><p>=a=</p>
25049
25050 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25051 !! wikitext
25052 <!--c0--><nowiki>=a=</nowiki>
25053
25054 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25055 !!end
25056
25057 !! test
25058 Headings: 6d. Heading chars in SOL context (No escaping needed)
25059 !! options
25060 parsoid=html2wt
25061 !! html/parsoid
25062 =a=<div>b</div>
25063 !! wikitext
25064 =a=<div>b</div>
25065 !!end
25066
25067 !! test
25068 Headings: 7. Insert a newline between new content and headings
25069 !! options
25070 parsoid=html2wt
25071 !! html/parsoid
25072 <h2>NEW</h2>
25073 <p>new</p>
25074 <h2 data-parsoid='{}'>A</h2>
25075 <p data-parsoid='{}'>a</p>
25076 !! wikitext
25077 == NEW ==
25078 new
25079
25080 ==A==
25081 a
25082
25083 !! end
25084
25085 !! test
25086 Headings: Used as horizontal rule
25087 !! config
25088 wgFragmentMode=[ 'html5', 'legacy' ]
25089 !! options
25090 parsoid=wt2html
25091 !! wikitext
25092 ===============
25093 !! html/php
25094 <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>
25095
25096 !! html/parsoid
25097 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25098 !! end
25099
25100 #### --------------- Lists ---------------
25101 #### 0. Outside nests (*foo, etc.)
25102 #### 1. Nested inside html <ul><li>*foo</li></ul>
25103 #### 2. Inside definition lists
25104 #### 3. Only bullets at start should be escaped
25105 #### 4. No escapes needed
25106 #### 5. No unnecessary escapes
25107 #### 6. Escape bullets in SOL position
25108 #### 7. Escape bullets in a multi-line context
25109 #### ----------------------------------------
25110
25111 !! test
25112 Lists: 0. Outside nests
25113 !! options
25114 parsoid=html2wt
25115 !! html/parsoid
25116 <p>*foo</p>
25117
25118 <p>#foo</p>
25119
25120 <p>;Foo:bar</p>
25121 !! wikitext
25122 <nowiki>*</nowiki>foo
25123
25124 <nowiki>#</nowiki>foo
25125
25126 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25127 !!end
25128
25129 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25130 ## to test wikitext escaping, and insignificant whitespace diffs
25131 ## cause PHP parser tests to barf
25132 !! test
25133 Lists: 1. Nested inside html (No unnecessary escapes)
25134 !! options
25135 parsoid=html2wt
25136 !! html/parsoid
25137 <ul>
25138 <li>*foo</li>
25139 <li>#foo</li>
25140 <li>:foo</li>
25141 <li>;foo</li>
25142 <li data-parsoid='{}'>*foo</li>
25143 <li data-parsoid='{}'>#foo</li>
25144 <li data-parsoid='{}'>:foo</li>
25145 <li data-parsoid='{}'>;foo</li>
25146 </ul>
25147
25148 <ol>
25149 <li>*foo</li>
25150 <li>#foo</li>
25151 <li>:foo</li>
25152 <li>;foo</li>
25153 <li data-parsoid='{}'>*foo</li>
25154 <li data-parsoid='{}'>#foo</li>
25155 <li data-parsoid='{}'>:foo</li>
25156 <li data-parsoid='{}'>;foo</li>
25157 </ol>
25158 !! wikitext
25159 * *foo
25160 * #foo
25161 * :foo
25162 * ;foo
25163 *<nowiki>*foo</nowiki>
25164 *<nowiki>#foo</nowiki>
25165 *<nowiki>:foo</nowiki>
25166 *<nowiki>;foo</nowiki>
25167
25168 # *foo
25169 # #foo
25170 # :foo
25171 # ;foo
25172 #<nowiki>*foo</nowiki>
25173 #<nowiki>#foo</nowiki>
25174 #<nowiki>:foo</nowiki>
25175 #<nowiki>;foo</nowiki>
25176 !!end
25177
25178 !! test
25179 Lists: 2. Inside definition lists
25180 !! options
25181 parsoid=html2wt
25182 !! html/parsoid
25183 <dl><dt>;foo</dt></dl>
25184 <dl><dt>:foo</dt></dl>
25185 <dl><dt>:foo</dt>
25186 <dd>bar</dd></dl>
25187 <dl><dd>:foo</dd></dl>
25188 !! wikitext
25189 ; ;foo
25190
25191 ; <nowiki>:foo</nowiki>
25192
25193 ; <nowiki>:foo</nowiki>
25194 : bar
25195
25196 : :foo
25197 !!end
25198
25199 !! test
25200 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25201 !! options
25202 parsoid=html2wt
25203 !! html/parsoid
25204 <ul>
25205 <li>*foo*bar</li>
25206 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25207 </ul>
25208 !! wikitext
25209 * *foo*bar
25210 *<nowiki>*foo</nowiki>''it''*bar
25211 !!end
25212
25213 !! test
25214 Lists: 4. No escapes needed
25215 !! options
25216 parsoid=html2wt
25217 !! html/parsoid
25218 <ul>
25219 <li>foo*bar
25220 </li>
25221 </ul>
25222 <ul>
25223 <li><i>foo</i>*bar
25224 </li>
25225 </ul>
25226 <ul>
25227 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25228 </li>
25229 </ul>
25230 <ul>
25231 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25232 </li>
25233 </ul>
25234 !! wikitext
25235 *foo*bar
25236
25237 *''foo''*bar
25238
25239 *[[Foo]]: bar
25240
25241 *[[Foo]]*bar
25242 !!end
25243
25244 !! test
25245 Lists: 5. No unnecessary escapes
25246 !! options
25247 parsoid=html2wt
25248 !! html/parsoid
25249 <ul><li> bar <span>[[foo]]</span></li></ul>
25250 <ul><li> =bar <span>[[foo]]</span></li></ul>
25251 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25252 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25253 <ul><li> =bar <span>foo]]</span>=</li></ul>
25254 <ul><li> <s></s>: a</li></ul>
25255 <ul><li> <i>* foo</i></li></ul>
25256
25257 !! wikitext
25258 * bar <span><nowiki>[[foo]]</nowiki></span>
25259
25260 * =bar <span><nowiki>[[foo]]</nowiki></span>
25261
25262 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25263
25264 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25265
25266 * =bar <span>foo]]</span>=
25267
25268 * <s></s>: a
25269
25270 * ''* foo''
25271 !!end
25272
25273 !! test
25274 Lists: 6. Escape bullets in SOL position
25275 !! options
25276 parsoid=html2wt
25277 !! html/parsoid
25278 <p><!--cmt-->*foo</p>
25279 !! wikitext
25280 <!--cmt--><nowiki>*</nowiki>foo
25281 !!end
25282
25283 !! test
25284 Lists: 7. Escape bullets in a multi-line context
25285 !! options
25286 parsoid=html2wt
25287 !! html/parsoid
25288 <p>a
25289 *b
25290 </p>
25291 !! wikitext
25292 a
25293 <nowiki>*</nowiki>b
25294 !!end
25295
25296 !! test
25297 Lists: 8. Escape colons only if not present in tags
25298 !! options
25299 parsoid=html2wt
25300 !! html/parsoid
25301 <dl><dt>a:b<i>c:d</i></dt></dl>
25302 !! wikitext
25303 ; <nowiki>a:b</nowiki>''c:d''
25304 !! end
25305
25306 #### --------------- HRs ---------------
25307 #### 1. Single line
25308 #### -----------------------------------
25309
25310 !! test
25311 HRs: 1. Single line
25312 !! options
25313 parsoid=html2wt
25314 !! html/parsoid
25315 <hr />----
25316 <hr />=foo=
25317 <hr />*foo
25318 !! wikitext
25319 ----<nowiki>----</nowiki>
25320 ----=foo=
25321 ----*foo
25322 !! end
25323
25324 #### --------------- Tables ---------------
25325 #### 1a. Simple example
25326 #### 1b. No escaping needed (!foo)
25327 #### 1c. No escaping needed (|foo)
25328 #### 1d. No escaping needed (|}foo)
25329 ####
25330 #### 2a. Nested in td (<td>foo|bar</td>)
25331 #### 2b. Nested in td (<td>foo||bar</td>)
25332 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25333 ####
25334 #### 3a. Nested in th (<th>foo!bar</th>)
25335 #### 3b. Nested in th (<th>foo!!bar</th>)
25336 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25337 ####
25338 #### 4a. Escape -
25339 #### 4b. Escape +
25340 #### 4c. No escaping needed
25341 #### --------------------------------------
25342
25343 !! test
25344 Tables: 1a. Simple example
25345 !! options
25346 parsoid=html2wt
25347 !! html/parsoid
25348 <p>{|
25349 |}
25350 </p>
25351 !! wikitext
25352 <nowiki>{|</nowiki>
25353 |}
25354 !! end
25355
25356 !! test
25357 Tables: 1b. No escaping needed
25358 !! options
25359 parsoid=html2wt
25360 !! html/parsoid
25361 <p>!foo
25362 </p>
25363 !! wikitext
25364 !foo
25365 !! end
25366
25367 !! test
25368 Tables: 1c. No escaping needed
25369 !! options
25370 parsoid=html2wt
25371 !! html/parsoid
25372 <p>|foo
25373 </p>
25374 !! wikitext
25375 |foo
25376 !! end
25377
25378 !! test
25379 Tables: 1d. No escaping needed
25380 !! options
25381 parsoid=html2wt
25382 !! html/parsoid
25383 <p>|}foo
25384 </p>
25385 !! wikitext
25386 |}foo
25387 !! end
25388
25389 !! test
25390 Tables: 2a. Nested in td
25391 !! options
25392 parsoid=html2wt
25393 !! html/parsoid
25394 <table><tbody><tr>
25395 <td>foo|bar</td></tr>
25396 <tr><td>x<div>a|b</div></td>
25397 </tbody></table>
25398 !! wikitext
25399 {|
25400 |<nowiki>foo|bar</nowiki>
25401 |-
25402 |x<div><nowiki>a|b</nowiki></div>
25403 |}
25404 !! html/php+tidy
25405 <table>
25406 <tbody><tr>
25407 <td>foo|bar
25408 </td></tr>
25409 <tr>
25410 <td>x<div>a|b</div>
25411 </td></tr></tbody></table>
25412 !! end
25413
25414 !! test
25415 Tables: 2b. Nested in td
25416 !! options
25417 parsoid=html2wt
25418 !! html/parsoid
25419 <table><tbody><tr>
25420 <td>foo||bar</td>
25421 <td>a<i>b||c</i></td>
25422 <td>a<i><div>b||c</div></i></td>
25423 </tr></tbody></table>
25424 !! wikitext
25425 {|
25426 |<nowiki>foo||bar</nowiki>
25427 |a''<nowiki>b||c</nowiki>''
25428 |a''<div><nowiki>b||c</nowiki></div>''
25429 |}
25430 !! html/php
25431 <table>
25432 <tr>
25433 <td>foo||bar
25434 </td>
25435 <td>a<i>b||c</i>
25436 </td>
25437 <td>a<i><div>b||c</div></i>
25438 </td></tr></table>
25439
25440 !! end
25441
25442 !! test
25443 Tables: 2c. Nested in td -- no escaping needed
25444 !! options
25445 parsoid=html2wt
25446 !! html/*
25447 <table>
25448 <tr>
25449 <td>foo!!bar
25450 </td></tr></table>
25451
25452 !! wikitext
25453 {|
25454 |foo!!bar
25455 |}
25456 !! end
25457
25458 !! test
25459 Tables: 3a. Nested in th
25460 !! options
25461 parsoid=html2wt
25462 !! html/*
25463 <table>
25464 <tr>
25465 <th>foo!bar
25466 </th></tr></table>
25467
25468 !! wikitext
25469 {|
25470 !foo!bar
25471 |}
25472 !! end
25473
25474 !! test
25475 Tables: 3b. Nested in th
25476 !! options
25477 parsoid=html2wt
25478 !! html/parsoid
25479 <table><tbody>
25480 <tr><th>foo!!bar</th>
25481 <th><i>foo|bar</i></th>
25482 <th><i>foo!!bar</i></th>
25483 <th><i><span>foo!!bar</span></i></th>
25484 </tr></tbody></table>
25485 !! wikitext
25486 {|
25487 !<nowiki>foo!!bar</nowiki>
25488 !''<nowiki>foo|bar</nowiki>''
25489 !''<nowiki>foo!!bar</nowiki>''
25490 !''<span><nowiki>foo!!bar</nowiki></span>''
25491 |}
25492 !! html/php
25493 <table>
25494 <tr>
25495 <th>foo!!bar
25496 </th>
25497 <th><i>foo|bar</i>
25498 </th>
25499 <th><i>foo!!bar</i>
25500 </th>
25501 <th><i><span>foo!!bar</span></i>
25502 </th></tr></table>
25503
25504 !! end
25505
25506 !! test
25507 Tables: 3c. Nested in th
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <table><tbody>
25512 <tr><th>foo||bar</th>
25513 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25514 </tr></tbody></table>
25515 !! wikitext
25516 {|
25517 !<nowiki>foo||bar</nowiki>
25518 !<nowiki>foo||bar</nowiki>
25519 |}
25520 !! html/php
25521 <table>
25522 <tr>
25523 <th>foo||bar
25524 </th>
25525 <th>foo||bar
25526 </th></tr></table>
25527
25528 !! end
25529
25530 !! test
25531 Tables: 4a. Escape -
25532 !! options
25533 parsoid=html2wt
25534 !! html/*
25535 <table>
25536 <tr>
25537 <th>-bar
25538 </th></tr>
25539 <tr>
25540 <td>-bar
25541 </td></tr></table>
25542
25543 !! wikitext
25544 {|
25545 !-bar
25546 |-
25547 |<nowiki>-bar</nowiki>
25548 |}
25549 !! end
25550
25551 !! test
25552 Tables: 4b. Escape +
25553 !! options
25554 parsoid=html2wt
25555 !! html/*
25556 <table>
25557 <tr>
25558 <th>+bar
25559 </th></tr>
25560 <tr>
25561 <td>+bar
25562 </td></tr></table>
25563
25564 !! wikitext
25565 {|
25566 !+bar
25567 |-
25568 |<nowiki>+bar</nowiki>
25569 |}
25570 !! end
25571
25572 !! test
25573 Tables: 4c. No escaping needed
25574 !! options
25575 parsoid=html2wt
25576 !! html/parsoid
25577 <table><tbody>
25578 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25579 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25580 <tr><td>foo
25581 <p>bar|baz
25582 +bar
25583 -bar</p></td></tr>
25584 <tr><td>x
25585 <div>a|b</div></td>
25586 </tbody></table>
25587 !! wikitext
25588 {|
25589 |foo-bar
25590 |foo+bar
25591 |-
25592 |''foo''-bar
25593 |''foo''+bar
25594 |-
25595 |foo
25596 bar|baz
25597 +bar
25598 -bar
25599 |-
25600 |x
25601 <div>a|b</div>
25602 |}
25603 !! html/php
25604 <table>
25605 <tr>
25606 <td>foo-bar
25607 </td>
25608 <td>foo+bar
25609 </td></tr>
25610 <tr>
25611 <td><i>foo</i>-bar
25612 </td>
25613 <td><i>foo</i>+bar
25614 </td></tr>
25615 <tr>
25616 <td>foo
25617 <p>bar|baz
25618 +bar
25619 -bar
25620 </p>
25621 </td></tr>
25622 <tr>
25623 <td>x
25624 <div>a|b</div>
25625 </td></tr></table>
25626
25627 !! end
25628
25629 !! test
25630 Tables: 4d. No escaping needed
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <table>
25635 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25636 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25637 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25638 </tbody></table>
25639 !! wikitext
25640 {|
25641 |[[Foo]]-bar
25642 ||+1
25643 ||-2
25644 |}
25645 !! html/php
25646 <table>
25647 <tr>
25648 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25649 </td>
25650 <td>+1
25651 </td>
25652 <td>-2
25653 </td></tr></table>
25654
25655 !! end
25656
25657 !! test
25658 T97430: Don't emit empty nowiki pairs around marker meta tags
25659 !! options
25660 parsoid=html2wt
25661 !! html/parsoid
25662 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25663 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25664 !! wikitext
25665 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25666 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25667 !! end
25668
25669 !! test
25670 Unclosed xmlish element in table line shouldn't eat end delimiters
25671 !! options
25672 parsoid=html2wt
25673 !! html/parsoid
25674 <table>
25675 <tbody><tr><td> &lt;foo</td>
25676 <td> bar></td></tr>
25677 </tbody></table>
25678 !! wikitext
25679 {|
25680 | <foo
25681 | bar>
25682 |}
25683 !! html/php
25684 <table>
25685 <tr>
25686 <td>&lt;foo
25687 </td>
25688 <td>bar&gt;
25689 </td></tr></table>
25690
25691 !! end
25692
25693 #### --------------- Links ----------------
25694 #### 1. Quote marks in link text
25695 #### 2. Wikilinks: Escapes needed
25696 #### 3. Wikilinks: No escapes needed
25697 #### 4. Extlinks: Escapes needed
25698 #### 5. Extlinks: No escapes needed
25699 #### --------------------------------------
25700 !! test
25701 Links 1. WikiLinks: No escapes needed
25702 !! options
25703 parsoid=html2wt
25704 !! html/parsoid
25705 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25706 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25707 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25708 !! wikitext
25709 [[Foo|Foo''boo'']]
25710 [[Foo|[Foobar]]]
25711 [[Foo|x [Foobar] x]]
25712 !! html/php
25713 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25714 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25715 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25716 </p>
25717 !! end
25718
25719 !! test
25720 Links 2. WikiLinks: Escapes needed
25721 !! options
25722 parsoid=html2wt
25723 !! html/parsoid
25724 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25725 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25726 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25727 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25728 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25729 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25730 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25731 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25732 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25733 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25734 !! wikitext
25735 [[Foo|<nowiki>Foobar]</nowiki>]]
25736 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25737 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25738 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25739 [[Foo|<nowiki>|Bar</nowiki>]]
25740 [[Foo|<nowiki>]]bar</nowiki>]]
25741 [[Foo|<nowiki>[[bar</nowiki>]]
25742 [[Foo|<nowiki>x [[ y</nowiki>]]
25743 [[Foo|<nowiki>x ]] y</nowiki>]]
25744 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25745 !! html/php
25746 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25747 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25748 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25749 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25750 <a href="/wiki/Foo" title="Foo">|Bar</a>
25751 <a href="/wiki/Foo" title="Foo">]]bar</a>
25752 <a href="/wiki/Foo" title="Foo">[[bar</a>
25753 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25754 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25755 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25756 </p>
25757 !! end
25758
25759 !! test
25760 Links 3. WikiLinks: No escapes needed
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25765 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25766 !! wikitext
25767 [[Foo|[Foobar]]
25768 [[Foo|foo|bar]]
25769 !! html/php
25770 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25771 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25772 </p>
25773 !! end
25774
25775 !! test
25776 Links 4. ExtLinks: Escapes needed
25777 !! options
25778 parsoid=html2wt
25779 !! html/parsoid
25780 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25781 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25782 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25783 <p>[http://google.com]</p>
25784 <p>[http://google.com google]</p>
25785 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25786 <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>
25787 !! wikitext
25788 [http://google.com <nowiki>[google]</nowiki>]
25789 [http://google.com <nowiki>google]</nowiki>]
25790 [http://google.com <nowiki>goog] le</nowiki>]
25791
25792 <nowiki>[http://google.com]</nowiki>
25793
25794 <nowiki>[http://google.com google]</nowiki>
25795
25796 [http://google.com<nowiki>]</nowiki>
25797
25798 [{{echo|http://google.com}}<nowiki>]</nowiki>
25799 !! html/php
25800 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25801 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25802 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25803 </p><p>[http://google.com]
25804 </p><p>[http://google.com google]
25805 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25806 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25807 </p>
25808 !! end
25809
25810 !! test
25811 Links 5. ExtLinks: No escapes needed
25812 !! options
25813 parsoid=html2wt
25814 !! html/parsoid
25815 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25816 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25817 !! wikitext
25818 [http://google.com [google]
25819
25820 [[http://google.com]]
25821 !! html/php
25822 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25823 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25824 </p>
25825 !! end
25826
25827 !! test
25828 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25829 !! options
25830 parsoid=html2wt
25831 !! html/parsoid
25832 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25833 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25834 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25835 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25836 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25837 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25838 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25839 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25840 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25841 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25842 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25843 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25844 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25845 </p>
25846 !! wikitext
25847 x<nowiki/>http://example.com<nowiki/>y
25848 http://example.com<nowiki/>?x
25849 http://example.com<nowiki/>&x
25850 http://example.com<nowiki/>'x
25851 http://example.com<nowiki/>,x
25852 http://example.com<nowiki/>.x
25853 http://example.com<nowiki/>;x
25854 http://example.com<nowiki/>:x
25855 http://example.com<nowiki/>;x
25856 http://example.com<nowiki/>!x
25857 http://example.com<nowiki/>=x
25858 http://example.com<nowiki/>(x)
25859 http://example.com(x<nowiki/>)
25860 !! end
25861
25862 !! test
25863 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <p>x
25868 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25869 y
25870 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25871 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25872 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25873 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25874 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25875 </p>
25876 !! wikitext
25877 x
25878 http://example.com
25879 y
25880 "http://example.com"
25881 (http://example.com)
25882 (http://example.com) foo
25883 http://example.com,
25884 http://example.com, foo
25885 !! html/php
25886 <p>x
25887 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25888 y
25889 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25890 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25891 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25892 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25893 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25894 </p>
25895 !! end
25896
25897 !! test
25898 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25899 !! options
25900 parsoid=html2wt
25901 !! html/parsoid
25902 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25903 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25904 !! wikitext
25905 http://example.com.,;:!?\
25906 -http://example.com:
25907 !! html/php
25908 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25909 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25910 </p>
25911 !! end
25912
25913 !! test
25914 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25915 !! options
25916 parsoid=html2wt
25917 !! html/parsoid
25918 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25919 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25920 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25921 !! wikitext
25922 RFC 123<nowiki/>4
25923 RFC 123<nowiki/>y
25924 X<nowiki/>RFC 123<nowiki/>y
25925 !! end
25926
25927 !! test
25928 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25929 !! options
25930 parsoid=html2wt
25931 !! html/parsoid
25932 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25933 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25934 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25935 </p>
25936 !! wikitext
25937 RFC 123?foo
25938 RFC 123&foo
25939 -RFC 123-
25940 !! html/php
25941 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25942 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25943 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25944 </p>
25945 !! end
25946
25947 !! test
25948 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25949 !! options
25950 parsoid=html2wt
25951 !! html/parsoid
25952 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25953 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25954 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25955 !! wikitext
25956 PMID 123<nowiki/>4
25957 PMID 123<nowiki/>y
25958 X<nowiki/>PMID 123<nowiki/>y
25959 !! end
25960
25961 !! test
25962 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25963 !! options
25964 parsoid=html2wt
25965 !! html/parsoid
25966 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25967 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25968 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25969 </p>
25970 !! wikitext
25971 PMID 123?foo
25972 PMID 123&foo
25973 -PMID 123-
25974 !! html/php
25975 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25976 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25977 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25978 </p>
25979 !! end
25980
25981 !! test
25982 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25983 !! options
25984 parsoid=html2wt
25985 !! html/parsoid
25986 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25987 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25988 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25989 </p>
25990 !! wikitext
25991 ISBN 1234567890<nowiki/>1
25992 ISBN 1234567890<nowiki/>x
25993 a<nowiki/>ISBN 1234567890<nowiki/>b
25994 !! end
25995
25996 !! test
25997 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25998 !! options
25999 parsoid=html2wt
26000 !! html/parsoid
26001 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26002 !! wikitext
26003 -ISBN 1234567890's
26004 !! html/php
26005 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26006 </p>
26007 !! end
26008
26009 !! test
26010 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26011 !! options
26012 parsoid=html2wt
26013 !! html/*
26014 <p>this is not a link: http://example.com
26015 </p>
26016 !! wikitext
26017 this is not a link: <nowiki>http://example.com</nowiki>
26018 !! end
26019
26020 !! test
26021 Links 15. Link trails can't become link prefixes.
26022 !! options
26023 language=is
26024 parsoid=html2wt
26025 !! html/parsoid
26026 <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>
26027 !! wikitext
26028 [[Söfnuður]]-[[00]]
26029 !! html/php
26030 <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>
26031 </p>
26032 !! end
26033
26034 #### --------------- Quotes ---------------
26035 #### 1. Quotes inside <b> and <i>
26036 #### 2. Link fragments separated by <i> and <b> tags
26037 #### 3. Link fragments inside <i> and <b>
26038 #### 4. No escaping needed
26039 #### --------------------------------------
26040 !! test
26041 1a. Quotes inside <b> and <i>
26042 !! options
26043 parsoid=html2wt
26044 !! html/*
26045 <p><i>'foo'</i>
26046 <i>''foo''</i>
26047 <i>'''foo'''</i>
26048 <i>foo</i>'s
26049 <b>'foo'</b>
26050 <b>''foo''</b>
26051 <b>'''foo'''</b>
26052 <b>foo'<i>bar'</i>baz</b>
26053 <b>foo</b>'s
26054 '<i>foo</i>
26055 <i>foo</i>'
26056 <i>foo'</i>'
26057 '<i>foo</i>'
26058 '<b>foo</b>
26059 <b>foo</b>'
26060 '<b>foo</b>'
26061 <i>fools'<span> errand</span></i>
26062 <i><span>fool</span>'s errand</i>
26063 '<i>foo</i> bar '<i>baz</i>
26064 a|!*#-:;+-~[]{}b'<i>x</i>
26065 </p>
26066 !! wikitext
26067 ''<nowiki/>'foo'''
26068 ''<nowiki>''foo''</nowiki>''
26069 ''<nowiki>'''foo'''</nowiki>''
26070 ''foo''<nowiki/>'s
26071 '''<nowiki/>'foo''''
26072 '''<nowiki>''foo''</nowiki>'''
26073 '''<nowiki>'''foo'''</nowiki>'''
26074 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26075 '''foo'''<nowiki/>'s
26076 '''foo''
26077 ''foo''<nowiki/>'
26078 ''foo'''<nowiki/>'
26079 '''foo''<nowiki/>'
26080 ''''foo'''
26081 '''foo'''<nowiki/>'
26082 ''''foo'''<nowiki/>'
26083 ''fools'<span> errand</span>''
26084 ''<span>fool</span>'s errand''
26085 '<nowiki/>''foo'' bar '''baz''
26086 a|!*#-:;+-~[]{}b'''x''
26087 !! end
26088
26089 !! test
26090 1b. Quotes inside <b> and <i> with other tags on same line
26091 !! options
26092 parsoid=html2wt
26093 !! html/parsoid
26094 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26095 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26096 <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>
26097 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26098 '<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>
26099 '<i>foo</i> <div title="name">test</div>
26100 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26101 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26102 <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>
26103 </ol>
26104 !! wikitext
26105 '''a'' foo ''[[bar]]''
26106 ''a''' foo ''[[bar]]''
26107 ''a''' foo '''{{echo|[[bar]]}}'''
26108 [[foo]] x'''[[bar]]''
26109 '''foo'' <ref>test</ref>
26110 '''foo'' <div title="name">test</div>
26111 '''foo'' and <br> bar
26112 <references />
26113 !! end
26114
26115 !! test
26116 2. Link fragments separated by <i> and <b> tags
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 <p>[[<i>foo</i>hello]]</p>
26121 <p>[[<b>foo</b>hello]]</p>
26122 !! wikitext
26123 [[''foo''<nowiki>hello]]</nowiki>
26124
26125 [['''foo'''<nowiki>hello]]</nowiki>
26126 !! end
26127
26128 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26129 # this is one of the shortcomings of this format
26130 !! test
26131 3. Link fragments inside <i> and <b>
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <p><i>[[foo</i>]]</p>
26136 <p><b>[[foo</b>]]</p>
26137 !! wikitext
26138 ''[[foo''<nowiki>]]</nowiki>
26139
26140 '''[[foo'''<nowiki>]]</nowiki>
26141 !! end
26142
26143 !! test
26144 4. No escaping needed
26145 !! options
26146 parsoid=html2wt
26147 !! html/parsoid
26148 <p>'<span><i>bar</i></span>'
26149 '<span><b>bar</b></span>'
26150 'a:b'foo
26151 </p>
26152 !! wikitext
26153 '<span>''bar''</span>'
26154 '<span>'''bar'''</span>'
26155 'a:b'foo
26156 !! end
26157
26158 #### ----------- Paragraphs ---------------
26159 #### 1. No unnecessary escapes
26160 #### --------------------------------------
26161
26162 !! test
26163 1. No unnecessary escapes
26164 !! options
26165 parsoid=html2wt
26166 !! html/parsoid
26167 <p>bar <span>[[foo]]</span>
26168 </p><p>=bar <span>[[foo]]</span>
26169 </p><p>[[bar <span>[[foo]]</span>
26170 </p><p>]]bar <span>[[foo]]</span>
26171 </p><p>=bar <span>foo]]</span>=
26172 </p>
26173 !! wikitext
26174 bar <span><nowiki>[[foo]]</nowiki></span>
26175
26176 =bar <span><nowiki>[[foo]]</nowiki></span>
26177
26178 [[bar <span><nowiki>[[foo]]</nowiki></span>
26179
26180 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26181
26182 =bar <span>foo]]</span><nowiki>=</nowiki>
26183 !!end
26184
26185 #### ----------------------- PRE --------------------------
26186 #### 1. Leading whitespace in SOL context should be escaped
26187 #### ------------------------------------------------------
26188 !! test
26189 1. Leading whitespace in SOL context should be escaped
26190 !! options
26191 parsoid=html2wt
26192 !! html/parsoid
26193 <p> a</p>
26194
26195 <p> a</p>
26196
26197 <p> a(tab)</p>
26198
26199 <p> a
26200 <!--cmt-->
26201 a</p>
26202
26203 <p>a
26204 b</p>
26205
26206 <p>a
26207 b</p>
26208
26209 <p>a
26210 b</p>
26211 !! wikitext
26212 <nowiki> </nowiki>a
26213
26214 <nowiki> </nowiki> a
26215
26216 a(tab)
26217
26218 <nowiki> </nowiki> a
26219 <!--cmt-->
26220 <nowiki> </nowiki>a
26221
26222 a
26223 <nowiki> </nowiki>b
26224
26225 a
26226 b
26227
26228 a
26229 b
26230 !! html/php
26231 <p> a
26232 </p><p> a
26233 </p><p> a(tab)
26234 </p><p> a
26235 a
26236 </p><p>a
26237 b
26238 </p><p>a
26239 b
26240 </p><p>a
26241 b
26242 </p>
26243 !! end
26244
26245 !! test
26246 2. Leading whitespace in non-indent-pre contexts should not be escaped
26247 !! options
26248 parsoid=html2wt
26249 !! html/parsoid
26250 <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>
26251 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26252 <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>
26253 b</span></li>
26254 </ol>
26255 !! wikitext
26256 foo <ref>''a''
26257 b</ref>
26258 <references />
26259 !! end
26260
26261 !! test
26262 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26263 !! options
26264 parsoid=html2wt
26265 !! html/parsoid
26266 <blockquote>
26267 <p>
26268 a
26269 <span>b</span>
26270 c</p>
26271 </blockquote>
26272 !! wikitext
26273 <blockquote>
26274 a
26275 <span>b</span>
26276 c
26277 </blockquote>
26278 !! end
26279
26280 !! test
26281 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26282 !! options
26283 parsoid=html2wt
26284 !! html/parsoid
26285 <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>
26286 !! wikitext
26287 [[File:Foobar.jpg|thumb|caption]]
26288 !! end
26289
26290 !! test
26291 5. Nowiki escaping should account for indent-pres
26292 !! options
26293 parsoid=html2wt
26294 !! html/parsoid
26295 <pre>==foo==</pre>
26296 !! wikitext
26297 ==foo==
26298 !! end
26299
26300 !!test
26301 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26302 !! options
26303 parsoid=html2wt
26304 !! html/parsoid
26305 <pre>
26306 * foo
26307 * bar
26308 </pre>
26309 !! wikitext
26310 * foo
26311 * bar
26312 !! end
26313
26314 #### --------------- Behavior Switches --------------------
26315
26316 !! test
26317 1. Valid behavior switches should be escaped
26318 !! options
26319 parsoid=html2wt
26320 !! html/parsoid
26321 __TOC__
26322 <i>__TOC__</i>
26323 !! wikitext
26324 <nowiki>__TOC__</nowiki>
26325 ''<nowiki>__TOC__</nowiki>''
26326 !! end
26327
26328 !! test
26329 2. Invalid behavior switches should not be escaped
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 __TOO__
26334 __|__
26335 !! wikitext
26336 __TOO__
26337 __|__
26338 !! end
26339
26340 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26341 !! test
26342 Behavior switches should be SOL-transparent
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 <meta property="mw:PageProp/toc" />
26347
26348 <!-- this one's bogus -->
26349 <pre>__TOO__</pre>
26350
26351 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26352
26353 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26354 !! wikitext
26355 __TOC__
26356
26357 <!-- this one's bogus -->
26358 __TOO__
26359
26360 __TOC__ foo
26361
26362 __TOC__
26363 bar
26364 !! end
26365
26366 #### --------------- HTML tags ---------------
26367 #### 1. a tags
26368 #### 2. other tags
26369 #### 3. multi-line html tag
26370 #### 4. extension tags
26371 #### -----------------------------------------
26372 !! test
26373 1. a tags
26374 !! options
26375 parsoid=html2wt
26376 !! html/parsoid
26377 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26378 !! wikitext
26379 <a href="http://google.com">google</a>
26380 !! end
26381
26382 !! test
26383 2. other tags
26384 !! options
26385 parsoid=html2wt
26386 !! html/parsoid
26387 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26388 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26389 <li> &lt;td&gt;</li></ul>
26390
26391 !! wikitext
26392 * <nowiki><div>foo</div></nowiki>
26393 * <nowiki><div style="color:red">foo</div></nowiki>
26394 * <nowiki><td></nowiki>
26395 !! end
26396
26397 !! test
26398 3. multi-line html tag
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <p>&lt;div
26403 &gt;foo&lt;/div
26404 &gt;
26405 </p>
26406 !! wikitext
26407 <nowiki><div
26408 >foo</div
26409 ></nowiki>
26410 !! end
26411
26412 !! test
26413 4. extension tags
26414 !! options
26415 parsoid=html2wt
26416 !! html/parsoid
26417 <p>&lt;ref&gt;foo&lt;/ref&gt;
26418 </p><p>&lt;ref&gt;bar
26419 </p><p>baz&lt;/ref&gt;
26420 </p>
26421 !! wikitext
26422 <nowiki><ref>foo</ref></nowiki>
26423
26424 <nowiki><ref>bar</nowiki>
26425
26426 baz<nowiki></ref></nowiki>
26427 !! end
26428
26429 #### --------------- Others ---------------
26430 !! test
26431 Escaping nowikis
26432 !! options
26433 parsoid=html2wt
26434 !! html/parsoid
26435 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26436 </p>
26437 !! wikitext
26438 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26439 !! end
26440
26441 ## The quote-char in the input is necessary for triggering the bug
26442 !! test
26443 (T54035) Nowiki-escaping should not get tripped by " :" in text
26444 !! options
26445 parsoid=html2wt
26446 !! html/parsoid
26447 <p>foo's bar :</p>
26448 !! wikitext
26449 foo's bar :
26450 !! end
26451
26452 #----------- End of wikitext escaping tests --------------
26453
26454 !! test
26455
26456 Tag-like HTML structures are passed through as text
26457 !! wikitext
26458 <x y>
26459
26460 <x.y>
26461
26462 <x-y>
26463
26464 1>2
26465
26466 x<y
26467
26468 a>b
26469
26470 1<d e>f
26471 !! html
26472 <p>&lt;x y&gt;
26473 </p><p>&lt;x.y&gt;
26474 </p><p>&lt;x-y&gt;
26475 </p><p>1&gt;2
26476 </p><p>x&lt;y
26477 </p><p>a&gt;b
26478 </p><p>1&lt;d e&gt;f
26479 </p>
26480 !! end
26481
26482 !! test
26483 HTML tag with necessary entities in attributes
26484 !! wikitext
26485 <span title="&amp;amp;">foo</span>
26486 !! html
26487 <p><span title="&amp;amp;">foo</span>
26488 </p>
26489 !! end
26490
26491 !! test
26492 HTML tag with 'unnecessary' entity encoding in attributes
26493 !! wikitext
26494 <span title="&amp;">foo</span>
26495 !! html
26496 <p><span title="&amp;">foo</span>
26497 </p>
26498 !! end
26499
26500 !! test
26501 HTML tag with broken attribute value quoting
26502 !! options
26503 parsoid=wt2html,html2html
26504 !! wikitext
26505 <span title="Hello world>Foo</span>
26506 !! html/php
26507 <p><span title="Hello world">Foo</span>
26508 </p>
26509 !! html/parsoid
26510 <p><span title="Hello world">Foo</span></p>
26511 !! end
26512
26513 !! test
26514 Self-closed tag with broken attribute value quoting
26515 !! options
26516 parsoid=wt2html,html2html
26517 !! wikitext
26518 <div title="Hello world />Foo
26519 !! html/php+tidy
26520 <div title="Hello world"></div><p>Foo
26521 </p>
26522 !! html/parsoid
26523 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26524 !! end
26525
26526 !! test
26527 Table with broken attribute value quoting
26528 !! options
26529 parsoid=wt2html,html2html
26530 !! wikitext
26531 {|
26532 | title="Hello world|Foo
26533 |}
26534 !! html/php
26535 <table>
26536 <tr>
26537 <td title="Hello world">Foo
26538 </td></tr></table>
26539
26540 !! html/parsoid
26541 <table>
26542 <tr>
26543 <td title="Hello world">Foo
26544 </td></tr></table>
26545
26546 !! end
26547
26548 !! test
26549 Table with broken attribute value quoting on consecutive lines
26550 !! options
26551 parsoid=wt2html,html2html
26552 !! wikitext
26553 {|
26554 | title="Hello world|Foo
26555 | style="color:red|Bar
26556 |}
26557 !! html/php
26558 <table>
26559 <tr>
26560 <td title="Hello world">Foo
26561 </td>
26562 <td style="color:red">Bar
26563 </td></tr></table>
26564
26565 !! html/parsoid
26566 <table><tbody>
26567 <tr>
26568 <td title="Hello world">Foo
26569 </td><td style="color: red">Bar
26570 </td></tr></tbody></table>
26571
26572 !! end
26573
26574 !!test
26575 Accept empty td cell attribute
26576 !! wikitext
26577 {|
26578 | align="center" |foo|| |
26579 |}
26580 !! html
26581 <table>
26582 <tr>
26583 <td align="center">foo</td>
26584 <td>
26585 </td></tr></table>
26586
26587 !!end
26588
26589 !!test
26590 Non-empty attributes in th-cells
26591 !! wikitext
26592 {|
26593 !Foo!! style="color: red" |Bar
26594 |}
26595 !! html
26596 <table>
26597 <tr>
26598 <th>Foo</th>
26599 <th style="color: red">Bar
26600 </th></tr></table>
26601
26602 !!end
26603
26604 !!test
26605 Accept empty attributes in th-cells
26606 !! wikitext
26607 {|
26608 !|foo!!|bar
26609 |}
26610 !! html
26611 <table>
26612 <tr>
26613 <th>foo</th>
26614 <th>bar
26615 </th></tr></table>
26616
26617 !!end
26618
26619 !!test
26620 Empty table rows go away
26621 !! wikitext
26622 {|
26623 |Hello
26624 |there
26625 |- class="foo"
26626 |-
26627 |}
26628 !! html
26629 <table>
26630 <tr>
26631 <td>Hello
26632 </td>
26633 <td>there
26634 </td></tr>
26635
26636 </table>
26637
26638 !! end
26639
26640 ###
26641 ### Parsoid-centric tests for testing RTing of inter-element separators
26642 ### Edge cases not tested by existing parser tests and specific to
26643 ### Parsoid-specific serialization strategies.
26644 ###
26645
26646 !!test
26647 RT-ed inter-element separators should be valid separators
26648 !! wikitext
26649 {|
26650 |- [[foo]]
26651 |}
26652 !! html/php
26653 <table>
26654
26655 </table>
26656
26657 !! html/parsoid
26658 <table>
26659 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26660 </tbody></table>
26661 !!end
26662
26663 # Parsoid-only test of a DOM pass
26664 !!test
26665 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26666 !! wikitext
26667 {|
26668 |<small>foo
26669 bar
26670 |}
26671
26672 {|
26673 |<small>foo<small>
26674 |}
26675 !! html/parsoid
26676 <table>
26677 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26678 <p>bar</p></small></td></tr>
26679 </tbody></table>
26680
26681 <table>
26682 <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>
26683 </tbody></table>
26684 !!end
26685
26686 # Note that the "style" attribute is really a template parameter here.
26687 # The = would have to be {{=}} if you wanted the literal.
26688 !!test
26689 Empty TD followed by TD with tpl-generated attribute
26690 !! wikitext
26691 {|
26692 |-
26693 |
26694 |{{echo|style='color:red'}}|foo
26695 |}
26696 !! html
26697 <table>
26698
26699 <tr>
26700 <td>
26701 </td>
26702 <td>foo
26703 </td></tr></table>
26704
26705 !!end
26706
26707 !!test
26708 Indented table with an empty td
26709 !! wikitext
26710 {|
26711 |-
26712 |
26713 |foo
26714 |}
26715 !! html
26716 <table>
26717
26718 <tr>
26719 <td>
26720 </td>
26721 <td>foo
26722 </td></tr></table>
26723
26724 !!end
26725
26726 ## We have some newline diffs RT-ing this edge case
26727 ## and it is not important enough -- we seem to be emitting
26728 ## at most 2 newlines after a </tr> and this is unrelated to
26729 ## the issue from T85627 that this is testing.
26730 !!test
26731 Indented table with blank lines in between (T85627)
26732 !! options
26733 parsoid=wt2html
26734 !! wikitext
26735 {|
26736 |foo
26737
26738
26739 |}
26740 !! html
26741 <table>
26742
26743 <tr>
26744 <td>foo
26745 </td></tr></table>
26746
26747 !!end
26748
26749 !!test
26750 Indented block & table
26751 !! wikitext
26752 <div>foo</div>
26753 {|
26754 |foo
26755 |}
26756 !! html/php
26757 <div>foo</div>
26758 <table>
26759 <tr>
26760 <td>foo
26761 </td></tr></table>
26762
26763 !! html/parsoid
26764 <div data-parsoid='{"stx":"html"}'>foo</div>
26765 <table><tbody>
26766 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26767 </tbody></table>
26768 !!end
26769
26770 !! test
26771 Indent and comment before table row
26772 !! wikitext
26773 {|
26774 <!--hi-->|-
26775 |there
26776 |}
26777 !! html/php
26778 <table>
26779
26780 <tr>
26781 <td>there
26782 </td></tr></table>
26783
26784 !! html/parsoid
26785 <table>
26786 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26787 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26788 </tbody></table>
26789 !! end
26790
26791 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26792 !!test
26793 Empty TR followed by a template-generated TR
26794 !!options
26795 parsoid
26796 !! wikitext
26797 {|
26798 |-
26799 {{echo|<tr><td>foo</td></tr>}}
26800 |}
26801 !! html
26802 <table>
26803 <tbody>
26804 <tr class='mw-empty-elt'></tr>
26805 <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}}]}'>
26806 <td>foo</td></tr>
26807 </tbody></table>
26808 !!end
26809
26810 ## PHP and parsoid output differ for this, and since this is primarily
26811 ## for testing Parsoid's serializer, marking this Parsoid only
26812 !!test
26813 Empty TR followed by mixed-ws-comment line should RT correctly
26814 !!options
26815 parsoid
26816 !! wikitext
26817 {|
26818 |-
26819 <!--c-->
26820 |-
26821 <!--c--> <!--d-->
26822 |}
26823 !! html
26824 <table>
26825 <tbody>
26826 <tr class='mw-empty-elt'></tr>
26827 <!--c-->
26828 <tr>
26829 <!--c--> </tr><!--d-->
26830 </tbody></table>
26831
26832 !!end
26833
26834 !!test
26835 Multi-line image caption generated by templates with/without trailing newlines
26836 !! wikitext
26837 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26838 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26839 !! html/parsoid
26840 <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>
26841 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#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>
26842 !!end
26843
26844 !! test
26845 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26846 !! options
26847 parsoid=html2wt
26848 !! html/parsoid
26849 <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>
26850
26851 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26852 !! wikitext
26853 <includeonly>foo</includeonly>
26854 new para
26855
26856 [[Category:Foo]]
26857
26858 = new heading =
26859 !! end
26860
26861 ## PHP emits broken html for this, and since this is primarily
26862 ## a Parsoid serializer test, marking this Parsoid only
26863 !!test
26864 Improperly nested inline or quotes tags with whitespace in between
26865 !! wikitext
26866 <span> <s>x</span> </s>
26867 ''' ''x''' ''
26868 !! html/parsoid
26869 <p><span> <s>x</s></span><s> </s>
26870 <b> <i>x</i></b><i> </i>
26871 </p>
26872 !!end
26873
26874 !!test
26875 Encapsulate protected attributes from wt
26876 !! wikitext
26877 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26878
26879 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26880 | ok
26881 |}
26882 !! html/parsoid
26883 <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>
26884
26885 <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">
26886 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26887 </tbody></table>
26888 !!end
26889
26890 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26891 ## Having nested or stray pre tags results in the attempt to add duplicates,
26892 ## causing an assertion fail. This test tries to prevent that situation.
26893 !!test
26894 Ensure ParagraphWrapper can deal with stray closing pre tags
26895 !!options
26896 parsoid=wt2html
26897 !! wikitext
26898 plain text</pre>
26899 !! html/parsoid
26900 plain text
26901 !!end
26902
26903 !!test
26904 1. Ensure fostered text content is wrapped in element nodes
26905 !!options
26906 parsoid=wt2html
26907 !! wikitext
26908 <table>hi</table><table>ho</table>
26909 !! html/parsoid
26910 <p>hi</p>
26911 <table></table>
26912 <p>ho</p>
26913 <table></table>
26914 !!end
26915
26916 !!test
26917 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26918 !!options
26919 parsoid=wt2html,wt2wt
26920 !! wikitext
26921 <table>
26922 <tr> || ||
26923 <td> a
26924 </table>
26925 !! html/parsoid
26926 <p> || ||
26927 </p><table>
26928 <tbody><tr><td> a</td></tr>
26929 </tbody></table>
26930 !!end
26931
26932 !!test
26933 Encapsulation properly handles null DSR information from foster box
26934 !!options
26935 parsoid=wt2html,wt2wt
26936 !! wikitext
26937 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26938 !! html/parsoid
26939 <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>
26940 !!end
26941
26942 !!test
26943 1. Encapsulate foster-parented transclusion content
26944 !!options
26945 parsoid=wt2wt,wt2html
26946 !! wikitext
26947 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26948 !! html/parsoid
26949 <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>
26950 <tbody>
26951 <tr>
26952 <td>bar</td>
26953 </tr>
26954 </tbody>
26955 </table>
26956 !!end
26957
26958 !!test
26959 2. Encapsulate foster-parented transclusion content
26960 !!options
26961 parsoid=wt2wt,wt2html
26962 !! wikitext
26963 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26964 !! html/parsoid
26965 <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>
26966 <table>
26967 <tbody>
26968 <tr>
26969 <td>bar</td>
26970 </tr>
26971 </tbody>
26972 </table>
26973 !!end
26974
26975 !!test
26976 3. Encapsulate foster-parented transclusion content
26977 !!options
26978 parsoid=wt2wt,wt2html
26979 !! wikitext
26980 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26981 !! html/parsoid
26982 <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;]}">
26983 <p>foo</p>
26984 </div>
26985 <table>
26986 <tbody>
26987 <tr>
26988 <td>bar</td>
26989 </tr>
26990 </tbody>
26991 </table>
26992 !!end
26993
26994 !!test
26995 4. Encapsulate foster-parented transclusion content
26996 !!options
26997 parsoid=wt2wt,wt2html
26998 !! wikitext
26999 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27000 !! html/parsoid
27001 <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;]}">
27002 <p>foo</p>
27003 </div>
27004 <table>
27005 <tbody>
27006 <tr>
27007 <td>bar</td>
27008 </tr>
27009 </tbody>
27010 </table>
27011 !!end
27012
27013 !!test
27014 5. Encapsulate foster-parented transclusion content
27015 !!options
27016 parsoid=wt2wt,wt2html
27017 !! wikitext
27018 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27019 !! html/parsoid
27020 <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>
27021 <table>
27022 <tbody>
27023 <tr>
27024 <td>
27025 <div>
27026 <p>foo</p>
27027 </div>
27028 </td>
27029 </tr>
27030 </tbody>
27031 </table>
27032 !!end
27033
27034 !!test
27035 6. Encapsulate foster-parented transclusion content
27036 !!options
27037 parsoid=wt2wt,wt2html
27038 !! wikitext
27039 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27040 !! html/parsoid
27041 <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>
27042 <table>
27043 <tbody>
27044 <tr>
27045 <td>
27046 <div>
27047 <p>foo</p>
27048 </div>
27049 </td>
27050 </tr>
27051 </tbody>
27052 </table>
27053 <p>ok</p>
27054 !!end
27055
27056 !!test
27057 7. Encapsulate foster-parented transclusion content
27058 !!options
27059 parsoid=wt2wt,wt2html
27060 !! wikitext
27061 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27062 !! html/parsoid
27063 <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>
27064 <table>
27065 <tbody>
27066 <tr>
27067 <td>bar</td>
27068 </tr>
27069 </tbody>
27070 </table>
27071 !!end
27072
27073 # Note that the wt is broken on purpose: the = should be {{=}} if you
27074 # don't want it to be a template parameter key.
27075 !!test
27076 8. Encapsulate foster-parented transclusion content
27077 !!options
27078 parsoid=wt2wt,wt2html
27079 !! wikitext
27080 {{echo|a
27081 }}{|{{echo|style='color:red'}}
27082 |-
27083 |b
27084 |}
27085 !! html/parsoid
27086 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27087 <span> </span>
27088 <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>
27089 <table>
27090 <tbody>
27091 <tr>
27092 <td>b</td>
27093 </tr>
27094 </tbody>
27095 </table>
27096 !!end
27097
27098 !!test
27099 9. Encapsulate foster-parented transclusion content
27100 !!options
27101 parsoid=wt2wt,wt2html
27102 !! wikitext
27103 <table>{{echo|hi</table>hello}}
27104 !! html/parsoid
27105 <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>
27106 !!end
27107
27108 !!test
27109 Table in fosterable position
27110 !!options
27111 parsoid=wt2html
27112 !! wikitext
27113 {{OpenTable}}
27114 <div>
27115 {|
27116 |}
27117 </div>
27118 |}
27119 !! html/parsoid
27120 <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">
27121 </span>
27122 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27123
27124 <table>
27125 </table>
27126 !!end
27127
27128 # Parsoid only for T66747
27129 !! test
27130 Properly encapsulate empty-content transclusions in fosterable positions
27131 !! wikitext
27132 <table>
27133 {{#if:|
27134 <td>foo</td>
27135 }}
27136 </table>
27137 !! html/parsoid
27138 <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"}]]}'>
27139
27140 </table>
27141 !! end
27142
27143 !! test
27144 Always encapsulate foster box when template range is expanded to table
27145 !! options
27146 parsoid=wt2wt
27147 !! wikitext
27148 {|
27149 hello
27150 {{OpenTable}}
27151 |}
27152 !! html/parsoid
27153
27154 !! end
27155
27156 !! test
27157 T115289: Unclosed table
27158 !! wikitext
27159 {{echo|<table>}}<!--c-->[[Category:Two]]
27160 !! html/parsoid
27161 <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>
27162 !! end
27163
27164 !! test
27165 T115289: Don't migrate newlines out of tables with fostered content
27166 !! wikitext
27167 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27168 !! html/parsoid
27169 <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>
27170 !! end
27171
27172 !! test
27173 T73074: More fostering fun
27174 !! wikitext
27175 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27176 !! html/parsoid
27177 <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>
27178 !! end
27179
27180 !!test
27181 Support <object> element with .data attribute
27182 !!options
27183 parsoid=html2wt
27184 !! html/parsoid
27185 <object data="test.swf"></object>
27186 !! wikitext
27187 <object data="test.swf"></object>
27188 !!end
27189
27190 !! test
27191 Don't block XML namespace declaration
27192 !! wikitext
27193 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27194 !! html/php
27195 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27196 </p>
27197 !! html/parsoid
27198 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27199 !! end
27200
27201 # -----------------------------------------------------------------
27202 # The following section of tests are primarily to spec requirements
27203 # around Parsoid's serialization (old, new, edited content)
27204 #
27205 # All these tests are marked Parsoid html2wt and html2html only
27206 # ----------------------------------------------------------------
27207
27208 !! test
27209 Ignore rel attribute in a-tags during serialization to url-links
27210 !! options
27211 parsoid=html2wt
27212 !! html/parsoid
27213 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27214 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27215 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27216 !! wikitext
27217 http://en.wikipedia.org/wiki/Foobar
27218 http://en.wikipedia.org/wiki/Foobar
27219 http://en.wikipedia.org/wiki/Foobar
27220 !! end
27221
27222 # 'mi' is a localinterwiki prefix as well as a language
27223 !! test
27224 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27225 !! options
27226 parsoid=html2wt
27227 !! html/parsoid
27228 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27229 !! wikitext
27230 [[Foo]]
27231 !! end
27232
27233 !! test
27234 Parsoid should accept interwiki shortcuts
27235 !! options
27236 parsoid=html2wt
27237 !! html/parsoid
27238 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27239 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27240 <a href='./fr:Foo'>Foo</a></p>
27241 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27242 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27243 <a href='fr%3AFoo'>Foo</a></p>
27244 <p><a href='FR%3AFoo'>Foo</a>
27245 <a href='./FR:Foo'>Foo</a></p>
27246 !! wikitext
27247 [[:fr:Foo|Foo]]
27248 [[:fr:Foo|Foo]]
27249 [[:fr:Foo|Foo]]
27250
27251 [[:fr:Foo|Foo]]
27252 [[:fr:Foo|Foo]]
27253 [[:fr:Foo|Foo]]
27254
27255 [[:fr:Foo|Foo]]
27256 [[:fr:Foo|Foo]]
27257 !! end
27258
27259 !! test
27260 Parsoid should not accept invalid interwiki shortcuts
27261 !! options
27262 parsoid=html2wt
27263 !! html/parsoid
27264 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27265 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27266 <a href='news:Foo'>Foo</a></p>
27267 !! wikitext
27268 [news:Foo Foo]
27269 [news:Foo Foo]
27270 [news:Foo Foo]
27271 !! end
27272
27273 # See T93839
27274 !! test
27275 New wikilinks should be serialized properly
27276 !! options
27277 parsoid=html2wt
27278 !! html/parsoid
27279 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27280 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27281 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27282 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27283 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27284 !! wikitext
27285 [[Foo]]
27286 [[Foo]]
27287 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27288 http://en.wikipedia.org/wiki/Foo
27289 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27290 !! end
27291
27292 !! test
27293 New wiki links (href variations)
27294 !! options
27295 parsoid=html2wt
27296 !! html/parsoid
27297 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27298 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27299 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27300 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27301 !! wikitext
27302 [[Foo_bar]]
27303 [[Foo_bar]]
27304 [[Foo_bar]]
27305 [[Toxine bactérienne]]
27306 !! end
27307
27308 !! test
27309 New wiki links (content string variations)
27310 !! options
27311 parsoid=html2wt
27312 !! html/parsoid
27313 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27314 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27315 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27316 !! wikitext
27317 [[Foo_bar]]
27318 [[Foo bar]]
27319 [[Foo_bar|./Foo_bar]]
27320 !! end
27321
27322 !! test
27323 New category links (href variations)
27324 !! options
27325 parsoid=html2wt
27326 !! html/parsoid
27327 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27328 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27329 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27330 !! wikitext
27331 [[Category:Toxine bactérienne]]
27332 [[Category:Toxine bactérienne]]
27333 [[Category:Toxine bactérienne]]
27334 !! end
27335
27336 !! test
27337 New sol transparent links don't need indent-pre nowiki protection
27338 !! options
27339 parsoid=html2wt
27340 language=de
27341 !! html/parsoid
27342 <link rel="mw:PageProp/redirect" href="./Main_Page">
27343 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27344 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27345 !! wikitext
27346 #WEITERLEITUNG [[Main Page]]
27347 <!-- this is good --> [[Category:Good]]
27348 <!-- this is great --> [[Kategorie:Great]]
27349 !! end
27350
27351 !! test
27352 New interlanguage links (href variations)
27353 !! options
27354 parsoid=html2wt
27355 !! html/parsoid
27356 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27357 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27358 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27359 !! wikitext
27360 [[es:Toxine bactérienne]]
27361 [[es:Toxine_bactérienne]]
27362 [[es:Toxine_bactérienne]]
27363 !! end
27364
27365 !! test
27366 Image: Modifying size of an image (1)
27367 !! options
27368 parsoid={
27369 "modes": ["wt2wt"],
27370 "changes": [
27371 ["img[height]", "attr", "height", "22"],
27372 ["img[width]", "attr", "width", "200"]
27373 ]
27374 }
27375 !! wikitext
27376 [[Image:Foobar.jpg|230x230px]]
27377 !! wikitext/edited
27378 [[Image:Foobar.jpg|200x200px]]
27379 !!end
27380
27381 !! test
27382 Image: Modifying size of an image (2)
27383 !! options
27384 parsoid={
27385 "modes": ["wt2wt"],
27386 "changes": [
27387 ["img[height]", "attr", "height", "100"],
27388 ["img[width]", "attr", "width", "500"]
27389 ]
27390 }
27391 !! wikitext
27392 [[Image:Foobar.jpg|230x230px]]
27393 !! wikitext/edited
27394 [[Image:Foobar.jpg|500x500px]]
27395 !!end
27396
27397 # Change in size is ignored so long as class='mw-default-size'
27398 !! test
27399 Image: Modifying size of an image (3)
27400 !! options
27401 parsoid={
27402 "modes": ["wt2wt"],
27403 "changes": [
27404 ["figure[class]", "removeClass", "mw-default-size"],
27405 ["figure img", "attr", "height", "19"],
27406 ["figure img", "attr", "width", "170"]
27407 ]
27408 }
27409 !! wikitext
27410 [[Image:Foobar.jpg|thumb]]
27411 !! wikitext/edited
27412 [[Image:Foobar.jpg|thumb|170x170px]]
27413 !!end
27414
27415 !! test
27416 Image: Modifying alignment of an image (T50665)
27417 !! options
27418 parsoid={
27419 "modes": ["wt2wt"],
27420 "changes": [
27421 ["figure[class]", "removeClass", "mw-halign-right"],
27422 ["figure[class]", "addClass", "mw-halign-left"]
27423 ]
27424 }
27425 !! wikitext
27426 [[Image:Foobar.jpg|thumb|caption|right]]
27427 !! wikitext/edited
27428 [[Image:Foobar.jpg|thumb|caption|left]]
27429 !! end
27430
27431 !! test
27432 Image: Modifying mw-default-size of an frameless image (T64805)
27433 !! options
27434 parsoid={
27435 "modes": ["wt2wt"],
27436 "changes": [
27437 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27438 ]
27439 }
27440 !! wikitext
27441 [[Image:Foobar.jpg|frameless|right]]
27442 !! wikitext/edited
27443 [[Image:Foobar.jpg|frameless|right|220x220px]]
27444 !! end
27445
27446 !! test
27447 Image: Modifying valign of an image (T51221)
27448 !! options
27449 parsoid={
27450 "modes": ["wt2wt"],
27451 "changes": [
27452 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27453 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27454 ]
27455 }
27456 !! wikitext
27457 [[File:Foobar.jpg|20px|middle]]
27458 !! wikitext/edited
27459 [[File:Foobar.jpg|20px|text-top]]
27460 !! end
27461
27462 !! test
27463 Image: Modifying alt attribute of an image (T58400)
27464 !! options
27465 parsoid={
27466 "modes": ["wt2wt"],
27467 "changes": [
27468 ["img[alt]", "attr", "alt", "some alternate edited text"]
27469 ]
27470 }
27471 !! wikitext
27472 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27473 !! wikitext/edited
27474 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27475 !!end
27476
27477 !! test
27478 Image: Modifying caption of an image
27479 !! options
27480 parsoid={
27481 "modes": ["wt2wt"],
27482 "changes": [
27483 ["figcaption", "text", "new caption"]
27484 ]
27485 }
27486 !! wikitext
27487 [[Image:Foobar.jpg|thumb|original caption]]
27488 !! wikitext/edited
27489 [[Image:Foobar.jpg|thumb|new caption]]
27490 !!end
27491
27492 !! test
27493 Image: empty alt attribute (T50924)
27494 !! options
27495 parsoid
27496 !! wikitext
27497 [[File:Foobar.jpg|thumb|alt=|bar]]
27498 !! html
27499 <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>
27500 !! end
27501
27502 !! test
27503 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27504 !! options
27505 parsoid=html2wt
27506 language=ar
27507 disabled
27508 !! html/parsoid
27509 <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>
27510 !! wikitext
27511 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27512 !! end
27513
27514 !! test
27515 Image: Block level image should have \n before and after
27516 !! wikitext
27517 123
27518 [[File:Foobar.jpg|right|thumb|150x150px]]
27519 456
27520 !! html/parsoid
27521 <p>123</p>
27522 <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>
27523 <p>456</p>
27524 !! end
27525
27526 !! test
27527 Image: New block level image should have \n before and after (existing content)
27528 !! wikitext
27529 123
27530 [[File:Foobar.jpg|right|thumb|150x150px]]
27531 456
27532 !! html/parsoid
27533 <p>123</p>
27534 <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>
27535 <p>456</p>
27536 !! end
27537
27538 !! test
27539 Image: upright option (parsoid)
27540 !! wikitext
27541 [[File:Foobar.jpg|thumb|upright|caption]]
27542 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27543 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27544 !! html/parsoid
27545 <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>
27546 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
27547 <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>
27548 !! end
27549
27550 !! test
27551 Image: upright option is ignored on inline and frame images (parsoid)
27552 !! wikitext
27553 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27554 !! html/parsoid
27555 <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>
27556 !! end
27557
27558 !! test
27559 Image: in template parameter with empty parameter
27560 !! wikitext
27561 {{echo|[[File:Foobar.jpg|link=]]}}
27562 !! html/parsoid
27563 <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>
27564 !! end
27565
27566 !! test
27567 Image: from basic HTML (1)
27568 !! options
27569 parsoid=html2wt
27570 !! html/parsoid
27571 <span typeof="mw:Image">
27572 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27573 </span>
27574 !! wikitext
27575 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27576 !! end
27577
27578 !! test
27579 Image: from basic HTML (2)
27580 !! options
27581 parsoid=html2wt
27582 !! html/parsoid
27583 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27584 !! wikitext
27585 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27586 !! end
27587
27588 !! test
27589 Image: from basic HTML (3)
27590 !! options
27591 parsoid=html2wt
27592 !! html/parsoid
27593 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27594 !! wikitext
27595 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27596 !! end
27597
27598 !! test
27599 Image: from basic HTML (4)
27600 !! options
27601 parsoid=html2wt
27602 !! html/parsoid
27603 <img src="./File:Foobar.jpg">
27604 !! wikitext
27605 [[File:Foobar.jpg|link=]]
27606 !! end
27607
27608 !! test
27609 Image: Invalid title as link
27610 !! wikitext
27611 [[File:Foobar.jpg|link=<]]
27612 !! html/php
27613 <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>
27614 </p>
27615 !! html/parsoid
27616 <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>
27617 !! end
27618
27619 !! test
27620 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27621 !! options
27622 parsoid=html2wt
27623 !! html/parsoid
27624 <ul>
27625 <li><p>foo</p></li>
27626 </ul>
27627 !! wikitext
27628 * foo
27629 !! end
27630
27631 !! test
27632 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27633 !! options
27634 parsoid=html2wt
27635 !! html/parsoid
27636 <ul> <li>foo</li></ul>
27637 !! wikitext
27638 * foo
27639 !! end
27640
27641 !! test
27642 Don't strip leading whitespace when handling indent-pre suppressing tags
27643 !! options
27644 parsoid=html2wt
27645 !! html/parsoid
27646 <table>
27647 <tr><td> indented row</td></tr>
27648 </table>
27649 <blockquote><p>
27650 <b>This is very bold of you!</b>
27651 </p>
27652 <table><tr><td>
27653 indented cell (no pre-wrapping!)
27654 </td></tr></table>
27655 </blockquote>
27656 <p>foo</p>
27657 <div>bar</div>
27658 !! wikitext
27659 {|
27660 | indented row
27661 |}
27662 <blockquote>
27663 '''This is very bold of you!'''
27664
27665 {|
27666 |
27667 indented cell (no pre-wrapping!)
27668 |}
27669 </blockquote>
27670 foo
27671 <div>bar</div>
27672 !! end
27673
27674 !! test
27675 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27676 !! options
27677 parsoid=html2wt
27678 !! html/parsoid
27679 <p>foo</p>
27680 <span>bar</span>
27681
27682 <span>foo2
27683 </span>bar2
27684
27685 <div>foo</div>
27686 <span>bar</span>
27687
27688 <div>
27689 <span>foo</span>
27690 </div>
27691 !! wikitext
27692 foo
27693
27694 <span>bar</span>
27695
27696 <span>foo2
27697 <nowiki> </nowiki></span>bar2
27698
27699 <div>foo</div>
27700 <nowiki> </nowiki><span>bar</span>
27701
27702 <div>
27703 <nowiki> </nowiki><span>foo</span>
27704 </div>
27705 !! end
27706
27707 !! test
27708 Lists: Dont insert newlines in a serialized list item.
27709 !! options
27710 parsoid=html2wt
27711 !! html/parsoid
27712 <ul><li>a<br>b</li><li>c</li></ul>
27713 !! wikitext
27714 * a<br />b
27715 * c
27716 !! end
27717
27718 !! test
27719 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27720 !! options
27721 parsoid={
27722 "modes": ["html2wt"],
27723 "scrubWikitext": false
27724 }
27725 !! html/parsoid
27726 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27727 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27728
27729 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27730 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27731
27732 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27733
27734 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27735 !! wikitext
27736 == hello there [[Category:A1]] ==
27737
27738 == [[Category:A2]] hi pal ==
27739
27740 == <!--foo--> [[Category:A3]] how goes it ==
27741
27742 == it goes well [[Category:A4]] <!--bar--> ==
27743
27744 ==howdy [[Category:A5]]==
27745
27746 == __TOC__ ok ==
27747 !! end
27748
27749 !! test
27750 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27751 !! options
27752 parsoid={
27753 "modes": ["html2wt"],
27754 "scrubWikitext": true
27755 }
27756 !! html/parsoid
27757 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27758 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27759
27760 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27761 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27762
27763 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27764 !! wikitext
27765 == hello there ==
27766 [[Category:A1]]
27767 [[Category:A2]]
27768
27769 == hi pal ==
27770
27771 <!--foo--> [[Category:A3]]
27772
27773 == how goes it ==
27774
27775 == it goes well ==
27776 [[Category:A4]] <!--bar-->
27777
27778 __TOC__
27779
27780 == ok ==
27781 !! end
27782
27783 !! test
27784 Headings: Don't hoist metas that come from templates
27785 !! options
27786 parsoid={
27787 "modes": ["html2wt"],
27788 "scrubWikitext": true
27789 }
27790 !! html/parsoid
27791 <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>
27792 !! wikitext
27793 == {{echo|foo [[Category:Foo]]}} ==
27794 !! end
27795
27796 !! test
27797 Headings: Category in ref isn't hoisted
27798 !! options
27799 parsoid={
27800 "modes": ["html2wt"],
27801 "scrubWikitext": true
27802 }
27803 !! html/parsoid
27804 <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>
27805
27806 <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>
27807 !! wikitext
27808 == foo <ref>bar
27809 [[Category:Baz]] </ref> ==
27810
27811 <references />
27812 !! end
27813
27814 !! test
27815 Parsoid: Serialize positional parameters with = in them as named parameter
27816 !! options
27817 parsoid=html2wt
27818 !! html/parsoid
27819 <p about="#mwt1" typeof="mw:Transclusion"
27820 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27821
27822 <p about="#mwt1" typeof="mw:Transclusion"
27823 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27824
27825 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27826 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27827 <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>
27828 !! wikitext
27829 {{echo|1=f=oo}}
27830
27831 {{echo|1=f=oo|2=bar}}
27832
27833 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27834 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27835 {{echo|<nowiki>f=oo</nowiki>|bar}}
27836 !! end
27837
27838 !! test
27839 Parsoid: Serialize positional parameters with = in extlink as named parameter
27840 !! options
27841 parsoid=html2wt
27842 !! html/parsoid
27843 <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>
27844 !! wikitext
27845 {{echo|1=http://stuff?is=ok}}
27846 !! end
27847
27848 !! test
27849 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27850 !! options
27851 parsoid=html2wt
27852 !! html/parsoid
27853 <div>a<p>b</p></div>
27854 <div>a
27855 <p>b</p></div>
27856 <div>
27857 a
27858 <p>b</p></div>
27859 !! wikitext
27860 <div>a
27861 b
27862 </div>
27863 <div>a
27864 b
27865 </div>
27866 <div>
27867 a
27868
27869 b
27870 </div>
27871 !! end
27872
27873 !! test
27874 Substrings resembling wikitext in hrefs should not get nowiki escapes
27875 !! options
27876 parsoid=html2wt
27877 !! html/parsoid
27878 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27879 !! wikitext
27880 [[Foo''bar''baz]]
27881 !! end
27882
27883 !! test
27884 Enforce single-line context in the serializer
27885 !! options
27886 parsoid=html2wt
27887 !! html/parsoid
27888 <h2>testing
27889 123</h2>
27890
27891 <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">
27892 </span><span about="#mwt1">you</span> </h2>
27893
27894 <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>
27895
27896 <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
27897 there</span></li></ol>
27898
27899 <ul><li>asd
27900 sdf</li></ul>
27901
27902 <ul><li>foo
27903 bar
27904 baz</li>
27905 <li>foo <b>bar</b>
27906 baz</li></ul>
27907
27908 <dl><dt>hi
27909 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27910 ho</dd></dl>
27911
27912 <dl><dd> <table>
27913 <tbody><tr><td> ha
27914 ha
27915 ha</td></tr>
27916 </tbody></table></dd></dl>
27917 !! wikitext
27918 == testing 123 ==
27919
27920 == hi {{bogus|there
27921 you}} ==
27922
27923 == foo <ref>hello
27924 there</ref> ==
27925
27926 <references />
27927
27928 * asd sdf
27929
27930 * foo bar baz
27931 * foo '''bar''' baz
27932
27933 ; hi ho : hi ho
27934
27935 : {|
27936 | ha
27937 ha
27938 ha
27939 |}
27940 !! end
27941
27942 !! test
27943 Serialize new placeholder space without spans
27944 !! options
27945 parsoid=html2wt
27946 !! html/parsoid
27947 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27948
27949 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27950
27951 <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>
27952 !! wikitext
27953 foo : bar
27954
27955 foo : bar
27956
27957 <ref>foo : bar</ref>ok
27958 !! end
27959
27960
27961 #-----------------------
27962 # Tag minimization tests
27963 #-----------------------
27964
27965 !! test
27966 1. I/B quote minimization: wikitext-only tags should be combined
27967 !! options
27968 parsoid=html2wt
27969 !! html/parsoid
27970 <p><i>A</i><i>B</i></p>
27971 <p><b>A</b><b>B</b></p>
27972 <p><i>A</i><b><i>B</i></b></p>
27973 <p><b>A</b><i><b>B</b></i></p>
27974 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27975 <p><i><b>A</b></i><i><b>B</b></i></p>
27976 <p><i><b>A</b></i><b><i>B</i></b></p>
27977 <p><b><i>A</i></b><i><b>B</b></i></p>
27978 !! wikitext
27979 ''AB''
27980
27981 '''AB'''
27982
27983 ''A'''B'''''
27984
27985 '''A''B'''''
27986
27987 '''A''BC''D'''
27988
27989 '''''AB'''''
27990
27991 '''''AB'''''
27992
27993 '''''AB'''''
27994 !! end
27995
27996 !! test
27997 2. I/B quote minimization: wikitext and html tags should not be combined
27998 !! options
27999 parsoid=html2wt
28000 !! html/parsoid
28001 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28002 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28003 !! wikitext
28004 ''A''<i>B</i>
28005
28006 ''A''<nowiki/>'''<i>B</i>'''
28007 !! end
28008
28009 !! test
28010 3. I/B quote minimization: templated content stops minimization
28011 !! options
28012 parsoid=html2wt
28013 !! html/parsoid
28014 <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>
28015 <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>
28016 !! wikitext
28017 ''A''{{echo|''B''}}
28018
28019 ''A''{{echo|'''''B'''''}}
28020 !! end
28021
28022 !! test
28023 4. I/B quote minimization: new content should be mimimized with adjacent old content
28024 !! options
28025 parsoid=html2wt
28026 !! html/parsoid
28027 <p><i>A</i><i>B</i></p>
28028 <p><b>A</b><b>B</b></p>
28029 <p><i>A</i><b><i>B</i></b></p>
28030 !! wikitext
28031 ''AB''
28032
28033 '''AB'''
28034
28035 ''A'''B'''''
28036 !! end
28037
28038 !! test
28039 5a. Merge adjacent quote nodes if they've been edited
28040 !! options
28041 parsoid={
28042 "modes": ["wt2wt", "selser"],
28043 "changes": [
28044 ["p", "contents", "remove", ":contains('b')"]
28045 ]
28046 }
28047 !! wikitext
28048 ''a''b''c''
28049 !! wikitext/edited
28050 ''ac''
28051 !! end
28052
28053 !! test
28054 5b. Merge adjacent quote nodes if they've been edited
28055 !! options
28056 parsoid={
28057 "modes": ["wt2wt", "selser"],
28058 "changes": [
28059 ["#x", "remove"]
28060 ]
28061 }
28062 !! wikitext
28063 ''a''<span id="x">b</span>''c''
28064 !! wikitext/edited
28065 ''ac''
28066 !! end
28067
28068 !! test
28069 1. Merge adjacent link nodes as long as at least one element is new
28070 !! options
28071 parsoid={
28072 "modes": ["html2wt"],
28073 "scrubWikitext": true
28074 }
28075 !! html/parsoid
28076 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28077 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28078 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28079 !! wikitext
28080 [[Football]]
28081 [[Football]]
28082 [[Football|Foot]][[Football|ball]]
28083 !! end
28084
28085 !! test
28086 2. Merge adjacent link nodes and enable additional normalizations
28087 !! options
28088 parsoid={
28089 "modes": ["html2wt"],
28090 "scrubWikitext": true
28091 }
28092 !! html/parsoid
28093 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28094 !! wikitext
28095 [[Football|''Football'']]
28096 !! end
28097
28098 !! test
28099 3. Don't merge adjacent link nodes if scrubWikitext is false
28100 !! options
28101 parsoid={
28102 "modes": ["html2wt"],
28103 "scrubWikitext": false
28104 }
28105 !! html/parsoid
28106 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28107 !! wikitext
28108 [[Football|Foot]][[Football|ball]]
28109 !! end
28110
28111 #------------------------------
28112 # End of tag minimization tests
28113 #------------------------------
28114
28115 !!test
28116 T56262: New entities
28117 !! options
28118 parsoid=html2wt
28119 !! html/parsoid
28120 <span typeof="mw:Entity">&nbsp;</span>
28121 !! wikitext
28122 &nbsp;
28123 !! end
28124
28125 ## Note that there is no wikitext output for 'unknownproperty' ##
28126 ## Unknown magic words are silently dropped ##
28127
28128 !! test
28129 Magic words
28130 !! options
28131 parsoid=html2wt
28132 !! html/parsoid
28133 <meta property='mw:PageProp/toc' />
28134 <meta property='mw:PageProp/notoc' />
28135 <meta property='mw:PageProp/forcetoc' />
28136 <meta property='mw:PageProp/index' />
28137 <meta property='mw:PageProp/noindex' />
28138 <meta property='mw:PageProp/nogallery' />
28139 <meta property='mw:PageProp/noeditsection' />
28140 <meta property='mw:PageProp/notitleconvert' />
28141 <meta property='mw:PageProp/nocontentconvert' />
28142 <meta property='mw:PageProp/unknownproperty' />
28143 !! wikitext
28144 __TOC__
28145 __NOTOC__
28146 __FORCETOC__
28147 __INDEX__
28148 __NOINDEX__
28149 __NOGALLERY__
28150 __NOEDITSECTION__
28151 __NOTITLECONVERT__
28152 __NOCONTENTCONVERT__
28153 !! end
28154
28155 !! test
28156 Consecutive <pre>s should not get merged
28157 !! options
28158 parsoid=html2wt,html2html
28159 !! html/parsoid
28160 <pre>a</pre><pre>b</pre>
28161
28162 <pre>c
28163 </pre><pre>
28164 d</pre>
28165
28166 <pre>e
28167
28168 </pre><pre>
28169
28170 f</pre>
28171 !! wikitext
28172 a
28173
28174 b
28175
28176 c
28177
28178 d
28179
28180 e
28181
28182
28183
28184 f
28185 !! end
28186
28187 !! test
28188 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28189 !! options
28190 parsoid=html2wt
28191 !! html/parsoid
28192 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28193 !! wikitext
28194 [[Special:BookSources/1234567890|ISBN 1234567895]]
28195 !! end
28196
28197 !! test
28198 Edited RFC links not serializable as RFC links should serialize as extlinks
28199 !! options
28200 parsoid=html2wt
28201 !! html/parsoid
28202 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28203 !! wikitext
28204 [https://tools.ietf.org/html/rfc123 New RFC]
28205 !! end
28206
28207 !! test
28208 Edited PMID links not serializable as PMID links should serialize as extlinks
28209 !! options
28210 parsoid=html2wt
28211 !! html/parsoid
28212 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28213 !! wikitext
28214 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28215 !! end
28216
28217 !! test
28218 WTS of autolinks with trailing/surrounding context
28219 !! options
28220 parsoid=html2wt
28221 !! html/parsoid
28222 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28223 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28224 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28225 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28226 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28227 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28228 !! wikitext
28229 http://cscott.net'''foo'''
28230
28231 http://cscott.net<b>foo</b>
28232
28233 '''http://cscott.net'''
28234
28235 '''http://cscott.net '''
28236
28237 '''http://cscott.net<nowiki/>x'''
28238
28239 http://cscott.net<nowiki/>x
28240 !! end
28241
28242 !! test
28243 WTS of autolinks with nowikis (round-trip)
28244 !! wikitext
28245 x<nowiki/>http://cscott.net<nowiki/>x
28246 !! html/parsoid
28247 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28248 !! end
28249
28250 # this is the "easy" test because it leaves in place all the
28251 # data-parsoid information indicating this is an autolink
28252 !! test
28253 WTS of autolinks with escapes (editing)
28254 !! options
28255 parsoid={
28256 "modes": ["wt2wt"],
28257 "changes": [
28258 [ "span", "remove" ]
28259 ]
28260 }
28261 !! wikitext
28262 x<nowiki/>http://cscott.net<nowiki/>x
28263 !! wikitext/edited
28264 x<nowiki/>http://cscott.net<nowiki/>x
28265 !! end
28266
28267 !! test
28268 WTS of edited autolink-like text (T103364)
28269 !! options
28270 parsoid={
28271 "modes": ["wt2wt"],
28272 "changes": [
28273 [ "span[typeof]", "removeAttr", "typeof" ]
28274 ]
28275 }
28276 !! wikitext
28277 Not a link: <nowiki>http://example.com</nowiki>.
28278 !! wikitext/edited
28279 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28280 !! end
28281
28282 !! test
28283 WTS of newly-authored autolink-like text (T103364)
28284 !! options
28285 parsoid=html2wt
28286 !! html/parsoid
28287 <p>http://example.com is not a link.</p>
28288 !! wikitext
28289 <nowiki>http://example.com</nowiki> is not a link.
28290 !! end
28291
28292 !! test
28293 WTS of autolink-like text after an autolink (T108563)
28294 !! options
28295 parsoid=html2wt
28296 !! html/parsoid
28297 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28298 !! wikitext
28299 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28300 !! end
28301
28302 !! test
28303 Magic links inside links (not autolinked)
28304 !! wikitext
28305 [[Foo|http://example.com]]
28306 [[Foo|RFC 1234]]
28307 [[Foo|PMID 1234]]
28308 [[Foo|ISBN 123456789x]]
28309
28310 [http://foo.com http://example.com]
28311 [http://foo.com RFC 1234]
28312 [http://foo.com PMID 1234]
28313 [http://foo.com ISBN 123456789x]
28314 !! html+tidy
28315 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28316 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28317 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28318 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28319 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28320 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28321 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28322 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28323 </p>
28324 !! html/parsoid
28325 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28326 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28327 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28328 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28329
28330 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28331 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28332 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28333 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28334 !! end
28335
28336 !! test
28337 Magic links inside image captions (autolinked)
28338 !! wikitext
28339 [[File:Foobar.jpg|thumb|http://example.com]]
28340 [[File:Foobar.jpg|thumb|RFC 1234]]
28341 [[File:Foobar.jpg|thumb|PMID 1234]]
28342 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28343 !! html+tidy
28344 <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>
28345 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div></div></div>
28346 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div></div></div>
28347 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div></div></div>
28348 !! html/parsoid
28349 <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>
28350 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external text">RFC 1234</a></figcaption></figure>
28351 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></figcaption></figure>
28352 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
28353 !! end
28354
28355 !! test
28356 WTS of magic word text (T109371)
28357 !! options
28358 parsoid=html2wt
28359 !! html/parsoid
28360 <p>RFC 1234</p>
28361 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28362 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28363 !! wikitext
28364 <nowiki>RFC 1234</nowiki>
28365
28366 [http://foo.com RFC 1234]
28367
28368 [[Foo|RFC 1234]]
28369 !! end
28370
28371 !! test
28372 Edited Redirect link should emit a non-piped wikitext link
28373 !! options
28374 parsoid=html2wt
28375 !! html/parsoid
28376 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28377 !! wikitext
28378 #REDIRECT [[Bar]]
28379 !! end
28380
28381 !! test
28382 T75121: Infer extension name from typeOf if data-mw is not present
28383 !! options
28384 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28385 !! html/parsoid
28386 <div typeOf="mw:Extension/foo"></div>
28387 !! wikitext
28388 <foo />
28389 !! end
28390
28391 # Note that the <p> wrapping isn't present in PHP parser output
28392 # The important thing for this test is that P-wrapping doesn't
28393 # interfere with the <nowiki> protection for leading - in <td>
28394 # (which isn't necessary for <th>).
28395 !! test
28396 T88318: p-wrapped dash in table.
28397 !! options
28398 parsoid=html2wt,wt2wt
28399 !! html/parsoid
28400 <table><tbody>
28401 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28402 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28403 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28404 </tbody></table>
28405 !! wikitext
28406 {|
28407 !-
28408 !-
28409 |-
28410 |<nowiki>-</nowiki>
28411 |<nowiki>- </nowiki>
28412 |-
28413 |<small>-</small>
28414 |<br />
28415 -
28416 |<br />
28417 -
28418 |}
28419 !! html/php+tidy
28420 <table>
28421 <tbody><tr>
28422 <th>-
28423 </th>
28424 <th>-
28425 </th></tr>
28426 <tr>
28427 <td>-
28428 </td>
28429 <td>-
28430 </td></tr>
28431 <tr>
28432 <td><small>-</small>
28433 </td>
28434 <td><br />
28435 <p>-
28436 </p>
28437 </td>
28438 <td><br />
28439 <p>-
28440 </p>
28441 </td></tr></tbody></table>
28442 !! end
28443
28444 !! test
28445 T149209: WTS: Handle newlines in table cells properly
28446 !! options
28447 parsoid=html2wt
28448 !! html/parsoid
28449 <table>
28450 <tbody>
28451 <tr><td>a
28452 b
28453 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28454 <tr><td><p>x</p>
28455 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28456 </tbody></table>
28457 <table>
28458 <tbody>
28459 <tr><th>a
28460 b
28461 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28462 <tr><th><p>x</h>
28463 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28464 </tbody></table>
28465 !! wikitext
28466 {|
28467 |a
28468 b
28469 |c
28470 |-
28471 |x
28472 {{!}}y
28473 |}
28474 {|
28475 !a
28476 b
28477 !c
28478 |-
28479 !x
28480 !y
28481 |}
28482 !! end
28483
28484 !! test
28485 T149209: Selser: Handle newlines in table cells properly
28486 !! options
28487 parsoid={
28488 "modes": ["selser"],
28489 "changes": [
28490 [ "#h1", "html", "a\nb\n" ],
28491 [ "#h2", "html", "a\nb\n" ],
28492 [ "#c1", "html", "a\nb\n" ],
28493 [ "#c2", "html", "<p>a</p>" ],
28494 [ "#c3", "html", "<p>a</p>" ],
28495 [ "#c4", "html", "edit-me<p>a</p>" ]
28496 ]
28497 }
28498 !! wikitext
28499 {|
28500 ! id="h1" |edit-me!!1
28501 |-
28502 ! id="h2" |edit-me||2
28503 |-
28504 | id="c1" |edit-me||3
28505 |-
28506 | id="c2" |edit-me||4
28507 |-
28508 | id="c3" |edit-me||p||q||r
28509 |-
28510 | id="c4" |edit-me||p||q||r
28511 |}
28512 !! wikitext/edited
28513 {|
28514 ! id="h1" |a
28515 b
28516 !1
28517 |-
28518 ! id="h2" |a
28519 b
28520 !2
28521 |-
28522 | id="c1" |a
28523 b
28524 |3
28525 |-
28526 | id="c2" |a
28527 |4
28528 |-
28529 | id="c3" |a
28530 |p||q||r
28531 |-
28532 | id="c4" |edit-me
28533 a
28534 |p||q||r
28535 |}
28536 !! end
28537
28538 !! test
28539 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28540 !! options
28541 parsoid=html2wt
28542 !! html/parsoid
28543 <table id='mwAb'>
28544 <td id='mwAc'>foo</td>
28545 <td id='serialize-this'>bar</td>
28546 </table>
28547 !! wikitext
28548 {|
28549 |foo
28550 | id="serialize-this" |bar
28551 |}
28552 !! end
28553
28554 !! test
28555 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28556 !! options
28557 parsoid=html2wt
28558 !! html/parsoid
28559 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28560 !! wikitext
28561 <div id="hello">ok</div>
28562 !! end
28563
28564 !! test
28565 WTS change modes
28566 !! options
28567 parsoid={
28568 "modes": ["wt2wt"],
28569 "changes": [
28570 [ "#xyz", "before", "<b>before</b> stuff " ],
28571 [ "#xyz", "after", " stuff <i>after</i>" ],
28572 [ "#xyz", "html", "x <b>y</b> z" ]
28573 ]
28574 }
28575 !! wikitext
28576 <span id="xyz">hello</span>
28577 !! wikitext/edited
28578 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28579 !! end
28580
28581 !! test
28582 Never serialize a-tag as html, regardless of what data-parsoid has to say
28583 !! options
28584 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28585 !! html/parsoid
28586 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28587 !! wikitext
28588 [[Foo]]
28589 !! end
28590
28591 ## SSS FIXME: This is broken output nevertheless.
28592 ## What might be a reasonable non-broken output for this?
28593 ## This is an edge case unlikely to be seen in production
28594 ## that I am not wasting more time on this right now.
28595 !! test
28596 Never serialize a-tag as html, no matter what attributes it has
28597 !! options
28598 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28599 !! html/parsoid
28600 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28601 !! wikitext
28602 [http://boo.org http://boohoo.org]
28603 !! end
28604
28605 # Misnested is an indication that selser can reuse the source but these have
28606 # shown to sneak through on occasion. See T101768.
28607 # The original wikitext here is: [http://test.com [[one]] two three]
28608 !! test
28609 Strip span tags added to mark misnested links
28610 !! options
28611 parsoid=html2wt
28612 !! html/parsoid
28613 <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>
28614 !! wikitext
28615 [http://test.com][[one]] two three
28616 !! end
28617
28618 !! test
28619 Catch regression when unpacking misnested links
28620 !! options
28621 parsoid=wt2html
28622 !! wikitext
28623 {{echo|hi}}[http://example.com [[ho]]]
28624 !! html/parsoid
28625 <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>
28626 !! end
28627
28628 !! test
28629 Catch regression when unpacking with trailing content
28630 !! wikitext
28631 {{echo|Foo <references/> bar}}
28632 !! html/parsoid
28633 <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>
28634 !! end
28635
28636 !! test
28637 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28638 !! options
28639 parsoid=html2wt
28640 !! html/parsoid
28641 <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|}"]}'>
28642 <tbody><tr><td>d
28643 </td></tr>
28644 </tbody></table>
28645 !! wikitext
28646 {{echo|a}}
28647 {|{{echo|c
28648 {{!}}d
28649 }}
28650 |}
28651 !! end
28652
28653 ## This test verifies the presence and computation of this attribute indirectly
28654 ## by making an edit and ensuring that the serialization is correct (which it would be
28655 ## only if firstWikitextNode is properly set).
28656 !! test
28657 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28658 !! options
28659 parsoid= {
28660 "modes": ["wt2wt"],
28661 "changes": [
28662 [ "div#x", "remove" ],
28663 [ "div", "before", "<div>new</div>" ]
28664 ]
28665 }
28666 !! wikitext
28667 <div id="x">foo</div>
28668 {|
28669 {{echo|<div>boo</div>
28670 {{!}}b}}
28671 |c
28672 |}
28673 !! wikitext/edited
28674
28675 <div>new</div>
28676 {|
28677 {{echo|<div>boo</div>
28678 {{!}}b}}
28679 |c
28680 |}
28681 !! end
28682
28683 # --------------------------------------------
28684 # Tests spec'ing wikitext serialization norms |
28685 # --------------------------------------------
28686
28687 !! test
28688 Serialize multi-line indent-pre starting with wikitext syntax
28689 !! options
28690 parsoid=html2wt
28691 !! html/parsoid
28692 <pre>* 1
28693 ** 2
28694 * 3</pre>
28695 !! wikitext
28696 * 1
28697 ** 2
28698 * 3
28699 !! end
28700
28701 !! test
28702 1. Categories should always be serialized on their own line
28703 !! options
28704 parsoid=html2wt
28705 !! html/parsoid
28706 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28707 !! wikitext
28708 foo
28709 [[Category:Foo]]
28710 bar
28711 !! end
28712
28713 !! test
28714 2. Categories that are part of templates should not introduce a line break
28715 !! wikitext
28716 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28717 !! html/parsoid
28718 <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>
28719 !! end
28720
28721 # Careful while editing these next 2 tests. There are \u200f characters
28722 # before and after the <link> tags in the HTML and following some
28723 # of the categories in wikitext
28724 # Do not remove these characters in edits.
28725 #
28726 # As part of the serialization, these bidi characters will get stripped.
28727 !! test
28728 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28729 !! options
28730 parsoid={
28731 "modes": ["html2wt"],
28732 "scrubWikitext": true
28733 }
28734 !! html/parsoid
28735 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28736 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28737 !! wikitext
28738 [[קטגוריה:טקסים]]
28739 [[קטגוריה: שיטות משפט]]
28740 !! end
28741
28742 !! test
28743 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28744 !! options
28745 parsoid={
28746 "modes": ["html2wt"],
28747 "scrubWikitext": true
28748 }
28749 !! html/parsoid
28750 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28751 !! wikitext
28752 [[קטגוריה:טקסים]]
28753 ‏y
28754 !! end
28755
28756 !! test
28757 Lists: Add space after bullets
28758 !! options
28759 parsoid=html2wt
28760 !! html/parsoid
28761 <ul>
28762 <li>foo</li>
28763 <li> bar</li>
28764 <li><span> baz</span></li>
28765 </ul>
28766 !! wikitext
28767 * foo
28768 * bar
28769 * <span> baz</span>
28770 !! end
28771
28772 !! test
28773 1. Headings: Add space before/after == (T53744)
28774 !! options
28775 parsoid=html2wt
28776 !! html/parsoid
28777 <h2>foo</h2>
28778 <h2> bar</h2>
28779 <h2>baz </h2>
28780 <h2><span> baz</span></h2>
28781 !! wikitext
28782 == foo ==
28783
28784 == bar ==
28785
28786 == baz ==
28787
28788 == <span> baz</span> ==
28789 !! end
28790
28791 !! test
28792 2. Headings: Add space before/after == even after hoisted content
28793 !! options
28794 parsoid={
28795 "modes": ["html2wt"],
28796 "scrubWikitext": true
28797 }
28798 !! html/parsoid
28799 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28800 !! wikitext
28801 [[Category:A2]]
28802
28803 == ok ==
28804 !! end
28805
28806 !! test
28807 1. Headings: suppress newly created empty headings
28808 !! options
28809 parsoid={
28810 "modes": ["html2wt"],
28811 "scrubWikitext": true
28812 }
28813 !! html/parsoid
28814 <h2></h2>
28815 !! wikitext
28816 !! end
28817
28818 !! test
28819 2. Headings: don't suppress empty headings if scrubWikitext is false
28820 !! options
28821 parsoid=html2wt
28822 !! html/parsoid
28823 <h2></h2>
28824 !! wikitext
28825 ==<nowiki/>==
28826 !! end
28827
28828 !! test
28829 3. Headings: suppress empty headings on edits
28830 !! options
28831 parsoid={
28832 "modes": ["selser"],
28833 "scrubWikitext": true,
28834 "changes": [
28835 [ "#x", "remove"]
28836 ]
28837 }
28838 !! wikitext
28839 ==<span id="x">foo</span>==
28840 !! wikitext/edited
28841 !! end
28842
28843 !! test
28844 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28845 !! options
28846 parsoid={
28847 "modes": ["html2wt"],
28848 "scrubWikitext": true
28849 }
28850 !! html/parsoid
28851 <h2>foo<br/>bar</h2>
28852 <h2>foo <span><br/>bar</span> baz</h2>
28853 !! wikitext
28854 == foo bar ==
28855
28856 == foo <span> bar</span> baz ==
28857 !! end
28858
28859 !! test
28860 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28861 !! options
28862 parsoid={
28863 "modes": ["html2wt"],
28864 "scrubWikitext": false
28865 }
28866 !! html/parsoid
28867 <h2>foo<br/>bar</h2>
28868 !! wikitext
28869 == foo<br /> bar ==
28870 !! end
28871
28872 !! test
28873 1. WT Quote Tags: suppress newly created empty style tags
28874 !! options
28875 parsoid={
28876 "modes": ["html2wt"],
28877 "scrubWikitext": true
28878 }
28879 !! html/parsoid
28880 <i></i><b></b>
28881 !! wikitext
28882 !! end
28883
28884 !! test
28885 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28886 !! options
28887 parsoid=html2wt
28888 !! html/parsoid
28889 <i></i><b></b>
28890 !! wikitext
28891 ''<nowiki/>'''''<nowiki/>'''
28892 !! end
28893
28894 !! test
28895 3. WT Quote Tags: suppress empty style tags on edits
28896 !! options
28897 parsoid={
28898 "modes": ["selser"],
28899 "scrubWikitext": true,
28900 "changes": [
28901 [ "#x", "remove"]
28902 ]
28903 }
28904 !! wikitext
28905 '''<span id="x">foo</span>'''
28906 !! wikitext/edited
28907 !! end
28908
28909 !! test
28910 1. Anchors: suppress newly created empty anchors
28911 !! options
28912 parsoid={
28913 "modes": ["html2wt"],
28914 "scrubWikitext": true
28915 }
28916 !! html/parsoid
28917 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28918 !! wikitext
28919 !! end
28920
28921 !! test
28922 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28923 !! options
28924 parsoid={
28925 "modes": ["html2wt"],
28926 "scrubWikitext": false
28927 }
28928 !! html/parsoid
28929 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28930 !! wikitext
28931 [[Test|<nowiki/>]]
28932 !! end
28933
28934 !! test
28935 3. Anchors: suppress empty anchors on edits
28936 !! options
28937 parsoid={
28938 "modes": ["selser"],
28939 "scrubWikitext": true,
28940 "changes": [
28941 [ "#x", "remove"]
28942 ]
28943 }
28944 !! wikitext
28945 [[Test|<span id="x">foo</span>]]
28946 !! wikitext/edited
28947 !! end
28948
28949 !! test
28950 3a. Anchors: do not suppress numbered extlinks
28951 !! options
28952 parsoid={
28953 "modes": ["wt2wt"],
28954 "scrubWikitext": true
28955 }
28956 !! wikitext
28957 [http://foo.com]
28958 !! html/parsoid
28959 <a rel="mw:ExtLink" href="http://foo.com"></a>
28960 !! end
28961
28962 !! test
28963 3b. Anchors: do not suppress numbered extlinks
28964 !! options
28965 parsoid={
28966 "modes": ["wt2wt"],
28967 "scrubWikitext": true,
28968 "changes": [
28969 [ "#x", "remove"]
28970 ]
28971 }
28972 !! wikitext
28973 [http://foo.com <span id="x">foo</span>]
28974 !! wikitext/edited
28975 [http://foo.com]
28976 !! end
28977
28978 !!test
28979 Normalizations should be restricted to edited content
28980 !!options
28981 parsoid={
28982 "modes": ["selser"],
28983 "scrubWikitext": true,
28984 "changes": [
28985 [ "h1", "before", "<i></i>"]
28986 ]
28987 }
28988 !!wikitext
28989 a
28990 = =
28991 b
28992 !!wikitext/edited
28993 a
28994 = =
28995 b
28996 !!end
28997
28998 !! test
28999 1. Multiple normalizations (html2wt)
29000 !! options
29001 parsoid={
29002 "modes": ["html2wt"],
29003 "scrubWikitext": true
29004 }
29005 !! html
29006 <h2><i></i></h2>
29007 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29008 </a><b><i></i></b>x</p>
29009 !! wikitext
29010
29011 [[foo]]
29012 x
29013
29014 !! end
29015
29016 !! test
29017 2. Multiple normalizations (selser)
29018 !! options
29019 parsoid={
29020 "modes": ["selser"],
29021 "scrubWikitext": true,
29022 "changes": [
29023 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29024 ]
29025 }
29026 !! wikitext
29027 <span id="x">foo</span>
29028 !! wikitext/edited
29029 <span id="x">foo</span>
29030
29031 x
29032 !! end
29033
29034 !! test
29035 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29036 !! options
29037 parsoid={
29038 "modes": ["html2wt"],
29039 "scrubWikitext": true
29040 }
29041 !! html/parsoid
29042 <p> hi</p>
29043 <p> hello</p>
29044 !! wikitext
29045 hi
29046
29047 hello
29048 !! end
29049
29050 !! test
29051 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29052 !! options
29053 parsoid=html2wt
29054 !! html/parsoid
29055 <p> hi</p>
29056 <p> hello</p>
29057 !! wikitext
29058 <nowiki> </nowiki>hi
29059
29060 <nowiki> </nowiki> hello
29061 !! end
29062
29063 !! test
29064 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29065 !! options
29066 parsoid={
29067 "modes": ["html2wt"],
29068 "scrubWikitext": true
29069 }
29070 !! html/parsoid
29071 <p>Foo
29072 bar
29073 baz</p>
29074
29075 <table><tr><td>Foo
29076 bar
29077 baz bang</td></tr></table>
29078
29079 <p><!--boo--> foo
29080 bar</p>
29081
29082 <p> foo
29083 bar<span>boo</span></p>
29084 !! wikitext
29085 Foo
29086 bar
29087 baz
29088
29089 {|
29090 |Foo
29091 bar
29092 baz bang
29093 |}
29094
29095 <!--boo-->foo
29096 bar
29097
29098 foo
29099 bar<span>boo</span>
29100 !! end
29101
29102 !! test
29103 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29104 !! options
29105 parsoid={
29106 "modes": ["selser"],
29107 "scrubWikitext": true,
29108 "changes": [
29109 [ "p", "html", " a\n b" ]
29110 ]
29111 }
29112 !! wikitext
29113 xyz
29114 !! wikitext/edited
29115 a
29116 b
29117 !! end
29118
29119 !! test
29120 1. New links that end in spaces
29121 !! options
29122 parsoid={
29123 "modes": ["html2wt"],
29124 "scrubWikitext": false
29125 }
29126 !! html/parsoid
29127 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29128 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29129 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29130 !! wikitext
29131 [[Berlin ]]<nowiki/>is the capital of Germany.
29132
29133 [[Foo ]]'''bar'''
29134
29135 [[Boston ]] is a city.
29136 !! end
29137
29138 !! test
29139 2. New links that end in spaces
29140 !! options
29141 parsoid={
29142 "modes": ["html2wt"],
29143 "scrubWikitext": true
29144 }
29145 !! html/parsoid
29146 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29147 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29148 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29149 !! wikitext
29150 [[Berlin]] is the capital of Germany.
29151
29152 [[Foo]] '''bar'''
29153
29154 [[Boston]] is a city.
29155 !! end
29156
29157 !! test
29158 1. Table cells with escapable prefixes
29159 !! options
29160 parsoid={
29161 "modes": ["html2wt"],
29162 "scrubWikitext": false
29163 }
29164 !! html
29165 <table>
29166 <tr><td>a</td></tr>
29167 <tr><td>-</td></tr>
29168 <tr><td>+</td></tr>
29169 </table>
29170 !! wikitext
29171 {|
29172 |a
29173 |-
29174 |<nowiki>-</nowiki>
29175 |-
29176 |<nowiki>+</nowiki>
29177 |}
29178 !! end
29179
29180 !! test
29181 2. Table cells with escapable prefixes
29182 !! options
29183 parsoid={
29184 "modes": ["html2wt"],
29185 "scrubWikitext": true
29186 }
29187 !! html
29188 <table>
29189 <tr><td>a</td></tr>
29190 <tr><td>-</td></tr>
29191 <tr><td>+</td></tr>
29192 </table>
29193 !! wikitext
29194 {|
29195 |a
29196 |-
29197 | -
29198 |-
29199 | +
29200 |}
29201 !! end
29202
29203 !! test
29204 3a. Table cells with escapable prefixes after edits
29205 !! options
29206 parsoid={
29207 "modes": ["selser"],
29208 "scrubWikitext": true,
29209 "changes": [
29210 [ "table tbody tr:first-child td:first-child", "remove"]
29211 ]
29212 }
29213 !! wikitext
29214 {|
29215 |a||-
29216 |}
29217 !! wikitext/edited
29218 {|
29219 | -
29220 |}
29221 !! end
29222
29223 !! test
29224 3b. Table cells with escapable prefixes after edits
29225 !! options
29226 parsoid={
29227 "modes": ["selser"],
29228 "scrubWikitext": true,
29229 "changes": [
29230 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29231 [ "#x", "remove" ]
29232 ]
29233 }
29234 !! wikitext
29235 {|
29236 |pqr
29237 |<span id="x">foo</span>+
29238 |}
29239 !! wikitext/edited
29240 {|
29241 | -
29242 | +
29243 |}
29244 !! end
29245
29246 # FIXME: This test will fail because
29247 # normalization doesn't realize that the id attribute
29248 # will eliminate the escapable scenario
29249 !! test
29250 4a. Table cells without escapable prefixes after edits
29251 !! options
29252 parsoid={
29253 "modes": ["selser"],
29254 "scrubWikitext": true,
29255 "changes": [
29256 [ "#x", "html", "-" ]
29257 ]
29258 }
29259 !! wikitext
29260 {|
29261 | id="x" |abcd
29262 |}
29263 !! wikitext/edited
29264 {|
29265 | id="x" |-
29266 |}
29267 !! end
29268
29269 ## This tests normalizer's ability to discriminate between
29270 ## cells having identical content.
29271 !! test
29272 4b. Table cells without escapable prefixes after edits
29273 !! options
29274 parsoid={
29275 "modes": ["selser"],
29276 "scrubWikitext": true,
29277 "changes": [
29278 [ "td", "html", "-" ]
29279 ]
29280 }
29281 !! wikitext
29282 {|
29283 |a||b
29284 |}
29285 !! wikitext/edited
29286 {|
29287 | -||-
29288 |}
29289 !! end
29290
29291 ## This tests normalizer's ability to not be tripped by
29292 ## comments (and whitespace)
29293 !! test
29294 4c. Table cells without escapable prefixes after edits
29295 !! options
29296 parsoid={
29297 "modes": ["selser"],
29298 "scrubWikitext": true,
29299 "changes": [
29300 [ "table tbody tr td:first-child", "remove" ]
29301 ]
29302 }
29303 !! wikitext
29304 {|
29305 |-
29306 <!--foo--> |a||-
29307 |}
29308 !! wikitext/edited
29309 {|
29310 |-
29311 <!--foo--> | -
29312 |}
29313 !! end
29314
29315 ## This tests normalizer's ability to handle HTML cells
29316 !! test
29317 4d. Table cells without escapable prefixes after edits
29318 !! options
29319 parsoid={
29320 "modes": ["selser"],
29321 "scrubWikitext": true,
29322 "changes": [
29323 [ "td", "html", "-" ]
29324 ]
29325 }
29326 !! wikitext
29327 <table>
29328 <tr><td>a</td></tr>
29329 </table>
29330 !! wikitext/edited
29331 <table>
29332 <tr><td>-</td></tr>
29333 </table>
29334 !! end
29335
29336 ## T111151 Remove font elements without attributes
29337 !! test
29338 5a. font tags without attributes should be dropped in scrubWikitext mode
29339 !! options
29340 parsoid={
29341 "modes": ["html2wt"],
29342 "scrubWikitext": true
29343 }
29344 !! html
29345 <font>foo</font>
29346 <font><font>bar</font></font>
29347 <font class="x">boo</font>
29348 !! wikitext
29349 foo
29350 bar
29351 <font class="x">boo</font>
29352 !! end
29353
29354 !! test
29355 5b. font tags should not be dropped without scrubWikitext being enabled
29356 !! options
29357 parsoid={
29358 "modes": ["html2wt"],
29359 "scrubWikitext": false
29360 }
29361 !! html
29362 <font>foo</font>
29363 !! wikitext
29364 <font>foo</font>
29365 !! end
29366
29367 !! test
29368 Escape nowiki DOM elements
29369 !! options
29370 parsoid=html2wt
29371 !! html/parsoid
29372 <nowiki><i>foo</i></nowiki>
29373 !! wikitext
29374 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29375 !! end
29376
29377 # This is meant to be an interim fix while we go about figuring out
29378 # how to not introduce these trailing <nowiki/>s in the first place.
29379 !! test
29380 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29381 !! options
29382 parsoid=html2wt
29383 !! html/parsoid
29384 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29385 y</p>
29386 <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>
29387 <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>
29388 !! wikitext
29389 x
29390 y
29391
29392 {{echo|
29393 1 = <nowiki/>}}
29394
29395 {{echo|
29396 1 = <nowiki/>
29397 }}
29398 !! end
29399
29400 # ---------------------------------------------------
29401 # End of tests spec'ing wikitext serialization norms |
29402 # ---------------------------------------------------
29403
29404 # T104032
29405 !! test
29406 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29407 !! options
29408 parsoid=html2wt
29409 !! html/parsoid
29410 a<p>b</p>
29411 <b>c</b><p>d</p>
29412 <table><tr>
29413 <td>a<p>b</p></td>
29414 <td><b>c</b><p>d</p></td>
29415 </tr></table>
29416 !! wikitext
29417 a
29418
29419 b
29420
29421 '''c'''
29422
29423 d
29424 {|
29425 |a
29426 b
29427 |'''c'''
29428 d
29429 |}
29430 !! end
29431
29432 !! test
29433 Anchor without href scenarios
29434 !! options
29435 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29436 !! html/parsoid
29437 <a class="bc"></a>
29438 <a class="no">dice</a>
29439 <a name="foo"></a>
29440 !! wikitext
29441
29442 dice
29443 <span name="foo"></span>
29444 !! end
29445
29446 !! test
29447 New transclusion added after a list should be serialized after the list
29448 !! options
29449 parsoid=html2wt
29450 !! html/parsoid
29451 <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>
29452 !! wikitext
29453 * a
29454 {{echo|foo}}
29455 !! end
29456
29457 # -----------------------------------------------------------------
29458 # End of section for Parsoid-only html2wt tests for serialization
29459 # of new content
29460 # -----------------------------------------------------------------
29461
29462 # -----------------------------------------------------------------
29463 # The following section of tests are primarily to spec behavior of
29464 # the selective serializer. All these tests have manual selser
29465 # changes. The automated selser changes for all tests handle the
29466 # wide variation of changes, but these tests here capture specs
29467 # deterministically.
29468 # ----------------------------------------------------------------
29469
29470 ## T90517
29471 !! test
29472 Selser: New comments should not be lost
29473 !! options
29474 parsoid={
29475 "modes": ["selser"],
29476 "changes": [
29477 [ "#a", "after", "<!--c1-->" ],
29478 [ "#b", "before", "<!--c2-->" ]
29479 ]
29480 }
29481 !! wikitext
29482 <span id="a">a</span>
29483
29484 <span id="b">b</span>
29485 !! wikitext/edited
29486 <span id="a">a</span><!--c1-->
29487
29488 <!--c2--><span id="b">b</span>
29489 !! end
29490
29491 ## T89383
29492 !! test
29493 Selser: Check for validity of DSR before using it
29494 !! options
29495 parsoid={
29496 "modes": ["selser"],
29497 "changes": [
29498 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29499 ]
29500 }
29501 !! wikitext
29502 <span id="a">a</span>
29503 !! wikitext/edited
29504 {{DISPLAYTITLE:foo}}
29505 <span id="a">a</span>
29506 !! end
29507
29508 !! test
29509 1. DOMDiff: Changes to <ref> content should be looked up using id
29510 !! options
29511 parsoid={
29512 "modes": ["selser"],
29513 "changes": [
29514 ["#X", "after", "bar"],
29515 ["#Y", "after", "baz"]
29516 ]
29517 }
29518 !! wikitext
29519 X <ref><span id="X">foo</span></ref>
29520 Y <ref name="a" />
29521 <references>
29522 <ref name="a"><span id="Y">foo</span></ref>
29523 </references>
29524 !! wikitext/edited
29525 X <ref><span id="X">foo</span>bar</ref>
29526 Y <ref name="a" />
29527 <references>
29528 <ref name="a"><span id="Y">foo</span>baz</ref>
29529 </references>
29530 !! end
29531
29532 !! test
29533 2. DOMDiff: Changes to <ref> content should be looked up using id
29534 !! options
29535 parsoid={
29536 "modes": ["selser"],
29537 "changes": [
29538 ["#Z", "after", "bar"]
29539 ]
29540 }
29541 !! wikitext
29542 A <ref>foo bar for a</ref>
29543 B <ref group="X" name="b" />
29544
29545 <references />
29546
29547 <references group="X">
29548 <ref name="b"><span id="Z">foo</span></ref>
29549 </references>
29550 !! wikitext/edited
29551 A <ref>foo bar for a</ref>
29552 B <ref group="X" name="b" />
29553
29554 <references />
29555
29556 <references group="X">
29557 <ref name="b"><span id="Z">foo</span>bar</ref>
29558 </references>
29559 !! end
29560
29561 !! test
29562 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29563 !! options
29564 parsoid={
29565 "modes": ["selser"],
29566 "changes": [
29567 [ "div:first-child", "text", "bar" ]
29568 ]
29569 }
29570 !! wikitext
29571 <div style="{{1x|color:red;}}%">foo</div>
29572 !! wikitext/edited
29573 <div style="{{1x|color:red;}}%">bar</div>
29574 !! end
29575
29576 !! test
29577 Empty LI (T49673)
29578 !! wikitext
29579 *a
29580 *
29581 *
29582 *b
29583 !! html+tidy
29584 <ul><li>a</li>
29585 <li class="mw-empty-elt"></li>
29586 <li class="mw-empty-elt"></li>
29587 <li>b</li></ul>
29588 !! end
29589
29590 !! test
29591 Thumbnail output
29592 !! wikitext
29593 [[File:Thumb.png|thumb]]
29594 !! html/php+tidy
29595 <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>
29596 !! html/parsoid
29597 <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>
29598 !! end
29599
29600 !! test
29601 unclosed internal link XSS (T137264)
29602 !! wikitext
29603 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29604 !! html/php
29605 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29606 </p>
29607 !! html/parsoid
29608 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29609 !! end
29610
29611 !! test
29612 Validating that <style> isn't eaten by tidy (T167349)
29613 !! options
29614 styletag=1
29615 !! wikitext
29616 <div class="foo">
29617 <style>.foo::before { content: "<foo>"; }</style>
29618 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29619 </div>
29620 !! html/php+tidy
29621 <div class="foo">
29622 <style>.foo::before { content: "<foo>"; }</style>
29623 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29624 </div>
29625 !! end
29626
29627 !! test
29628 Validating that <style> isn't wrapped in a paragraph (T186965)
29629 !! options
29630 styletag=1
29631 !! wikitext
29632 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29633
29634 <style>.foo::before { content: "<foo>"; }</style>
29635
29636 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29637
29638 But if it's on a line with other content, let it be wrapped.
29639
29640 <style>.foo::before { content: "<foo>"; }</style> bar
29641
29642 foo <style>.foo::before { content: "<foo>"; }</style>
29643
29644 foo <style>.foo::before { content: "<foo>"; }</style> bar
29645
29646 And the same if we have non-paragraph-breaking whitespace
29647
29648 foo
29649 <style>.foo::before { content: "<foo>"; }</style>
29650 bar
29651 !! html/php
29652 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29653 </p>
29654 <style>.foo::before { content: "<foo>"; }</style>
29655 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29656 <p>But if it's on a line with other content, let it be wrapped.
29657 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29658 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29659 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29660 </p><p>And the same if we have non-paragraph-breaking whitespace
29661 </p><p>foo
29662 <style>.foo::before { content: "<foo>"; }</style>
29663 bar
29664 </p>
29665 !! end
29666
29667 !! test
29668 Validating that <link> isn't wrapped in a paragraph (T186965)
29669 !! options
29670 styletag=1
29671 !! wikitext
29672 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29673
29674 <link rel="foo" href="bar"/>
29675
29676 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29677
29678 But if it's on a line with other content, let it be wrapped.
29679
29680 <link rel="foo" href="bar"/> bar
29681
29682 foo <link rel="foo" href="bar"/>
29683
29684 foo <link rel="foo" href="bar"/> bar
29685
29686 And the same if we have non-paragraph-breaking whitespace
29687
29688 foo
29689 <link rel="foo" href="bar"/>
29690 bar
29691 !! html/php
29692 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29693 </p>
29694 <link rel="foo" href="bar"/>
29695 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29696 <p>But if it's on a line with other content, let it be wrapped.
29697 </p><p><link rel="foo" href="bar"/> bar
29698 </p><p>foo <link rel="foo" href="bar"/>
29699 </p><p>foo <link rel="foo" href="bar"/> bar
29700 </p><p>And the same if we have non-paragraph-breaking whitespace
29701 </p><p>foo
29702 <link rel="foo" href="bar"/>
29703 bar
29704 </p>
29705 !! end
29706
29707 !! test
29708 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29709 !! config
29710 wgFragmentMode=[ 'html5', 'legacy' ]
29711 !! wikitext
29712 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29713 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29714 !! html/php
29715 <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>
29716 <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>
29717 </p>
29718 !! html/parsoid
29719 <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>
29720 <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>
29721 !! end
29722
29723 !! test
29724 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29725 !! config
29726 wgFragmentMode=[ 'legacy' ]
29727 !! wikitext
29728 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29729 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29730 !! html/php
29731 <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>
29732 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29733 </p>
29734 !! end
29735
29736 !! test
29737 Decoding of HTML entities in embedded HTML tags
29738 !! wikitext
29739 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29740 !! html/php
29741 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29742
29743 !! html/parsoid
29744 <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>
29745 !! end
29746
29747 !! test
29748 Decoding of HTML entities in indicator names for IDs (T104196)
29749 !! options
29750 parsoid=wt2html,html2html
29751 showindicators
29752 !! wikitext
29753 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29754 !! html/php
29755 1&2&3&amp;4&amp;amp;5=Indicator
29756
29757 !! html/parsoid
29758 <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>
29759 !! end
29760
29761 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29762 !! test
29763 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29764 !! options
29765 showindicators
29766 !! wikitext
29767 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29768 !! html/php
29769 1&2&3&amp;4&amp;amp;5=Indicator
29770
29771 !! html/parsoid
29772 <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>
29773 !! end
29774
29775 # This fragment mode is what Parsoid supports.
29776 !! test
29777 HTML5 ids: fallback to legacy
29778 !! config
29779 wgFragmentMode=[ 'html5', 'legacy' ]
29780 !! wikitext
29781 ==Foo bar==
29782
29783 ==foo Bar==
29784
29785 ==Тест==
29786
29787 ==Тест==
29788
29789 ==тест==
29790
29791 ==Hey < # " > % : '==
29792 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29793
29794 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29795
29796 <!-- These two links should produce identical HTML -->
29797 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29798
29799 !! html/php
29800 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29801 <ul>
29802 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29803 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29804 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29805 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29806 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29807 <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>
29808 </ul>
29809 </div>
29810
29811 <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>
29812 <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>
29813 <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>
29814 <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>
29815 <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>
29816 <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>
29817 <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>
29818 </p><p>💩 <span id="💩"></span>
29819 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29820 </p>
29821 !! html/parsoid
29822 <h2 id="Foo_bar">Foo bar</h2>
29823
29824 <h2 id="foo_Bar_2">foo Bar</h2>
29825
29826 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29827
29828 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29829
29830 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29831
29832 <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>
29833 <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>
29834
29835 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[178,197,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
29836
29837 <!-- These two links should produce identical HTML -->
29838 <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>
29839 !! end
29840
29841 # Parsoid doesn't support this mode
29842 !! test
29843 HTML5 ids: legacy with a fallback to modern
29844 !! config
29845 wgFragmentMode=[ 'legacy', 'html5' ]
29846 !! wikitext
29847 ==Foo bar==
29848
29849 ==foo Bar==
29850
29851 ==Тест==
29852
29853 ==Тест==
29854
29855 ==тест==
29856
29857 ==Hey < # " > % : '==
29858 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29859
29860 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29861
29862 <!-- These two links should produce identical HTML -->
29863 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29864
29865 !! html/php
29866 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29867 <ul>
29868 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29869 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29870 <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>
29871 <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>
29872 <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>
29873 <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>
29874 </ul>
29875 </div>
29876
29877 <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>
29878 <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>
29879 <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>
29880 <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>
29881 <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>
29882 <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>
29883 <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>
29884 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29885 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29886 </p>
29887 !! end
29888
29889 # Parsoid doesn't support this mode.
29890 !! test
29891 HTML5 ids: no legacy
29892 !! config
29893 wgFragmentMode=[ 'html5' ]
29894 !! wikitext
29895 ==Foo bar==
29896
29897 ==foo Bar==
29898
29899 ==Тест==
29900
29901 ==Тест==
29902
29903 ==тест==
29904
29905 ==Hey < # " > % : '==
29906 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29907
29908 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29909
29910 <!-- These two links should produce identical HTML -->
29911 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29912
29913 !! html/php
29914 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29915 <ul>
29916 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29917 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29918 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29919 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29920 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29921 <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>
29922 </ul>
29923 </div>
29924
29925 <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>
29926 <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>
29927 <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>
29928 <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>
29929 <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>
29930 <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>
29931 <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>
29932 </p><p>💩 <span id="💩"></span>
29933 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29934 </p>
29935 !! end
29936
29937 !! test
29938 T90902: Normalize weird characters in section IDs
29939 !! config
29940 wgFragmentMode=[ 'html5', 'legacy' ]
29941 !! wikitext
29942 ==Foo&nbsp;bar==
29943 [[#Foo&nbsp;bar]]
29944
29945 !! html/php
29946 <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>
29947 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29948 </p>
29949 !! html/parsoid
29950 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
29951 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
29952 !! end
29953
29954 !! test
29955 T51672: Test for brackets in attributes of elements in external link texts
29956 !! wikitext
29957 [http://example.com/ link <span title="title with [brackets]">span</span>]
29958 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29959
29960 !! html/php
29961 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29962 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29963 </p>
29964 !! html/parsoid
29965 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29966 <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>
29967 !! end
29968
29969 !! test
29970 T72875: Test for brackets in attributes of elements in internal link texts
29971 !! wikitext
29972 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29973 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29974
29975 !! html/php
29976 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29977 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29978 </p>
29979 !! html/parsoid
29980 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
29981 <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>
29982 !! end
29983
29984 !! test
29985 T179544: {{anchorencode:}} output should be always usable in links
29986 !! config
29987 wgFragmentMode=[ 'html5' ]
29988 !! wikitext
29989 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
29990 !! html/php
29991 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
29992 </p>
29993 !! html/parsoid
29994 <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>
29995 !! end
29996
29997 ## ------------------------------
29998 ## Parsoid section-wrapping tests
29999 ## ------------------------------
30000 !! test
30001 Section wrapping for well-nested sections (no leading content)
30002 !! options
30003 parsoid={
30004 "wrapSections": true
30005 }
30006 !! wikitext
30007 =1=
30008 a
30009
30010 =2=
30011 b
30012
30013 ==2.1==
30014 c
30015
30016 ==2.2==
30017 d
30018
30019 ===2.2.1===
30020 e
30021
30022 =3=
30023 f
30024 !! html/parsoid
30025 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30026 <p>a</p>
30027
30028 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30029 <p>b</p>
30030
30031 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30032 <p>c</p>
30033
30034 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30035 <p>d</p>
30036
30037 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30038 <p>e</p>
30039
30040 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30041 <p>f</p>
30042
30043 </section>
30044 !! end
30045
30046 !! test
30047 Section wrapping for well-nested sections (with leading content)
30048 !! options
30049 parsoid={
30050 "wrapSections": true
30051 }
30052 !! wikitext
30053 Para 1.
30054
30055 Para 2 with a <div>nested in it</div>
30056
30057 Para 3.
30058
30059 =1=
30060 a
30061
30062 =2=
30063 b
30064
30065 ==2.1==
30066 c
30067 !! html/parsoid
30068 <section data-mw-section-id="0"><p>Para 1.</p>
30069
30070 <p>Para 2 with a </p><div>nested in it</div>
30071
30072 <p>Para 3.</p>
30073
30074 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30075 <p>a</p>
30076
30077 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30078 <p>b</p>
30079
30080 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30081 <p>c</p>
30082
30083 </section></section>
30084 !! end
30085
30086 !! test
30087 Section wrapping with template-generated sections (good nesting 1)
30088 !! options
30089 parsoid={
30090 "wrapSections": true
30091 }
30092 !! wikitext
30093 =1=
30094 a
30095
30096 {{echo|1=
30097 ==1.1==
30098 b
30099 }}
30100
30101 ==1.2==
30102 c
30103
30104 =2=
30105 d
30106 !! html/parsoid
30107 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30108 <p>a</p>
30109
30110 <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">
30111 </span><p about="#mwt1">b</p>
30112 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30113 <p>c</p>
30114
30115 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30116 <p>d</p></section>
30117 !! end
30118
30119 # In this example, the template scope is mildly expanded to incorporate the
30120 # trailing newline after the transclusion since that is part of section 1.1.1
30121 !! test
30122 Section wrapping with template-generated sections (good nesting 2)
30123 !! options
30124 parsoid={
30125 "wrapSections": true,
30126 "modes": ["wt2html", "wt2wt"]
30127 }
30128 !! wikitext
30129 =1=
30130 a
30131
30132 {{echo|1=
30133 ==1.1==
30134 b
30135 ===1.1.1===
30136 d
30137 }}
30138 =2=
30139 e
30140 !! html/parsoid
30141 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30142 <p>a</p>
30143
30144 <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">
30145 </span><p about="#mwt1">b</p><span about="#mwt1">
30146 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30147 </span><p about="#mwt1">d</p><span about="#mwt1">
30148 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30149 <p>e</p></section>
30150 !! end
30151
30152 # In this example, the template scope is mildly expanded to incorporate the
30153 # trailing newline after the transclusion since that is part of section 1.2.1
30154 !! test
30155 Section wrapping with template-generated sections (good nesting 3)
30156 !! options
30157 parsoid={
30158 "wrapSections": true,
30159 "modes": ["wt2html", "wt2wt"]
30160 }
30161 !! wikitext
30162 =1=
30163 a
30164
30165 {{echo|1=
30166 x
30167 ==1.1==
30168 b
30169 ==1.2==
30170 c
30171 ===1.2.1===
30172 d
30173 }}
30174 =2=
30175 e
30176 !! html/parsoid
30177 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30178 <p>a</p>
30179
30180 <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">
30181 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30182 </span><p about="#mwt1">b</p><span about="#mwt1">
30183 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30184 </span><p about="#mwt1">c</p><span about="#mwt1">
30185 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30186 </span><p about="#mwt1">d</p><span about="#mwt1">
30187 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30188 <p>e</p></section>
30189 !! end
30190
30191 # Because of section-wrapping and template-wrapping interactions,
30192 # the scope of the template is expanded so that the template markup
30193 # is valid in the presence of <section> tags.
30194 # This exercises the s1 is null scenario in the wrapSections code
30195 !! test
30196 Section wrapping with template-generated sections (bad nesting 1)
30197 !! options
30198 parsoid={
30199 "wrapSections": true
30200 }
30201 !! wikitext
30202 <div>
30203 a
30204
30205 {{echo|
30206 =1=
30207 b
30208 }}
30209
30210 c
30211 </div>
30212 !! html/parsoid
30213 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30214 <p>a</p>
30215
30216 <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"]}'>
30217 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30218 </span><p about="#mwt1">b
30219 </p><span about="#mwt1">
30220
30221 </span><p about="#mwt1">c</p><span about="#mwt1">
30222 </span></section></div></section>
30223 !! end
30224
30225 # Because of section-wrapping and template-wrapping interactions,
30226 # the scope of the template is expanded so that the template markup
30227 # is valid in the presence of <section> tags.
30228 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30229 !! test
30230 Section wrapping with template-generated sections (bad nesting 2)
30231 !! options
30232 parsoid={
30233 "wrapSections": true
30234 }
30235 !! wikitext
30236 =1=
30237 a
30238
30239 {{echo|1=
30240 =2=
30241 b
30242 ==2.1==
30243 c
30244 }}
30245
30246 d
30247
30248 =3=
30249 e
30250 !! html/parsoid
30251 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30252 <p>a</p>
30253
30254 </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">
30255 </span><p about="#mwt1">b</p><span about="#mwt1">
30256 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30257 </span><p about="#mwt1">c</p><span about="#mwt1">
30258
30259 </span><p about="#mwt1">d</p><span about="#mwt1">
30260
30261 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30262 <p>e</p></section>
30263 !! end
30264
30265 # Because of section-wrapping and template-wrapping interactions,
30266 # additional template wrappers are added to <section> tags
30267 # so that template wrapping semantics are valid whether section
30268 # tags are retained or stripped. But, the template scope can expand
30269 # greatly when accounting for section tags.
30270 # This exercises the s1 and s2 are in different subtrees scenario
30271 !! test
30272 Section wrapping with template-generated sections (bad nesting 3)
30273 !! options
30274 parsoid={
30275 "wrapSections": true,
30276 "modes": ["wt2html", "wt2wt"]
30277 }
30278 !! wikitext
30279 =1=
30280 a
30281
30282 {{echo|1=
30283 ==1.2==
30284 b
30285 =2=
30286 c
30287 }}
30288
30289 d
30290
30291 =3=
30292 e
30293 !! html/parsoid
30294 <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>
30295 <p>a</p>
30296
30297 <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">
30298 </span><p about="#mwt1">b</p><span about="#mwt1">
30299 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30300 </span><p about="#mwt1">c</p>
30301
30302 <p>d</p>
30303 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30304 <p>e</p></section>
30305 !! end
30306
30307 !! test
30308 Section wrapping with uneditable lead section + div wrapping multiple sections
30309 !! options
30310 parsoid={
30311 "wrapSections": true
30312 }
30313 !! wikitext
30314 foo
30315
30316 <div style="border:1px solid red;">
30317 =1=
30318 a
30319
30320 ==1.1==
30321 b
30322
30323 =2=
30324 c
30325 </div>
30326
30327 =3=
30328 d
30329
30330 ==3.1==
30331 e
30332 !! html/parsoid
30333 <section data-mw-section-id="-1"><p>foo</p>
30334
30335 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30336 <section data-mw-section-id="1"><h1 id="1">1</h1>
30337 <p>a</p>
30338
30339 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30340 <p>b</p>
30341
30342 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30343 <p>c</p>
30344 </section></div>
30345
30346 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30347 <p>d</p>
30348
30349 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30350 <p>e</p>
30351 </section></section>
30352 !! end
30353
30354 !! test
30355 Section wrapping with editable lead section + div overlapping multiple sections
30356 !! options
30357 parsoid={
30358 "wrapSections": true
30359 }
30360 !! wikitext
30361 foo
30362
30363 =1=
30364 a
30365 <div style="border:1px solid red;">
30366 b
30367
30368 ==1.1==
30369 c
30370
30371 =2=
30372 d
30373 </div>
30374 e
30375
30376 =3=
30377 f
30378
30379 ==3.1==
30380 g
30381 !! html/parsoid
30382 <section data-mw-section-id="0"><p>foo</p>
30383
30384 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30385 <p>a</p>
30386 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30387 <p>b</p>
30388
30389 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30390 <p>c</p>
30391
30392 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30393 <p>d</p>
30394 </section></div>
30395 <p>e</p>
30396
30397 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30398 <p>f</p>
30399
30400 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30401 <p>g</p>
30402 </section></section>
30403 !! end
30404
30405 !! test
30406 HTML header tags should not be wrapped in section tags
30407 !! options
30408 parsoid={
30409 "wrapSections": true
30410 }
30411 !! wikitext
30412 foo
30413
30414 <h1>a</h1>
30415
30416 =b=
30417
30418 <h1>c</h1>
30419
30420 =d=
30421 !! html/parsoid
30422 <section data-mw-section-id="0"><p>foo</p>
30423
30424 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30425
30426 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30427
30428 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30429
30430 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30431 !! end
30432
30433 !! test
30434 Lead section containing only whitespace and comments.
30435 !! options
30436 parsoid={
30437 "wrapSections": true
30438 }
30439 !! wikitext
30440
30441 <!-- this is a comment, presumably significant to editors -->
30442 =1=
30443 a
30444
30445 =2=
30446 b
30447 !! html/parsoid
30448 <section data-mw-section-id="0" data-parsoid="{}">
30449 <!-- this is a comment, presumably significant to editors -->
30450 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30451 <p>a</p>
30452
30453 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30454 <p>b</p></section>
30455 !! end
30456
30457 !! test
30458 Pseudo-sections emitted by templates should have id -2
30459 !! options
30460 parsoid={
30461 "wrapSections": true
30462 }
30463 !! wikitext
30464 foo
30465 {{echo|<div>
30466 ==a==
30467 ==b==
30468 </div>
30469 }}
30470 !! html/parsoid
30471 <section data-mw-section-id="-1"><p>foo</p>
30472 </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}}]}'>
30473 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30474 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30475 </section></div><span about="#mwt1">
30476 </span></section>
30477 !! end
30478
30479 ##########################################################################
30480 Tests demonstrating white-space insensitivity in input wikitext
30481 for wikitext headings, wikitext list items, and wikitext table captions,
30482 headings, and cells. HTML versions of the same should preserve whitespace.
30483 ##########################################################################
30484 !! test
30485 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30486 !! wikitext
30487 __NOTOC__
30488 == <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> ==
30489 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30490 ; <!--term to define--> term : <!--term's definition--> definition
30491 {|
30492 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30493 |-
30494 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30495 |-
30496 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30497 |-
30498 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30499 |-
30500 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30501 |}
30502 : {|
30503 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30504 |} foo <!--c1-->
30505 !! html/php+tidy
30506 <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>
30507 <ul><li>List item</li></ul>
30508 <dl><dt>term&#160;</dt>
30509 <dd>definition</dd></dl>
30510 <table>
30511 <caption>Table Caption
30512 </caption>
30513 <tbody><tr>
30514 <th>Table Heading 1</th>
30515 <th>Table Heading 2
30516 </th></tr>
30517 <tr>
30518 <td>Table Cell 1</td>
30519 <td>Table Cell 2
30520 </td></tr>
30521 <tr>
30522 <td>class="foo"</td>
30523 <td>Table Cell 3
30524 </td></tr>
30525 <tr>
30526 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | some content
30527 </td></tr></tbody></table>
30528 <dl><dd><table>
30529 <tbody><tr>
30530 <td>Table Cell 1</td>
30531 <td>Table Cell 2
30532 </td></tr></tbody></table> foo</dd></dl>
30533 !! end
30534
30535 # Looks like <caption> is not accepted in HTML
30536 !! test
30537 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30538 !! wikitext
30539 __NOTOC__
30540 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> <h2>
30541 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30542 <table>
30543 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30544 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30545 </table>
30546 !! html/php+tidy
30547 <h2> Heading </h2><h2>
30548 <ul><li> List item </li></ul>
30549 <table>
30550 <tbody><tr><th> Table Heading </th><th></th></tr>
30551 <tr><td> Table Cell </td><th></th></tr>
30552 </tbody></table>
30553 </h2>
30554 !! end
30555
30556 !! test
30557 Do not trim whitespace in links and quotes
30558 !! wikitext
30559 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30560 [[Foo| some text ]]
30561 !! html/php+tidy
30562 <p>foo <i> italic </i> and <b> bold </b>
30563 <a href="/wiki/Foo" title="Foo"> some text </a>
30564 </p>
30565 !! end