Merge "Add support for 'hu-formal'"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:With: Colon
284 !! text
285 Template with colon
286 !! endarticle
287
288 ###
289 ### Basic tests
290 ###
291
292 !! test
293 Blank input
294 !! wikitext
295 !! html
296 !! end
297
298 !! test
299 Simple paragraph
300 !! wikitext
301 This is a simple paragraph.
302 !! html
303 <p>This is a simple paragraph.
304 </p>
305 !! end
306
307 !! test
308 Paragraphs with extra newline spacing
309 !! wikitext
310 foo
311
312 bar
313
314
315 baz
316
317
318
319 booz
320 !! html
321 <p>foo
322 </p><p>bar
323 </p><p><br />
324 baz
325 </p><p><br />
326 </p><p>booz
327 </p>
328 !! end
329
330 !! test
331 Paragraphs with newline spacing with comment lines in between
332 !! wikitext
333 ----
334 a
335 <!--foo-->
336 b
337 ----
338 a
339 <!--foo--><!--More than 1 comment, still stripped-->
340 b
341 ----
342 a
343 <!--foo--> <!----> <!-- bar -->
344 b
345 ----
346 a
347 <!--foo-->
348
349 b
350 ----
351 a
352
353 <!--foo-->
354 b
355 ----
356 a
357 <!--foo-->
358
359
360 b
361 ----
362 a
363
364
365 <!--foo-->
366 b
367 ----
368 !! html
369 <hr />
370 <p>a
371 b
372 </p>
373 <hr />
374 <p>a
375 b
376 </p>
377 <hr />
378 <p>a
379 b
380 </p>
381 <hr />
382 <p>a
383 </p><p>b
384 </p>
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395 <p>a
396 </p><p><br />
397 b
398 </p>
399 <hr />
400
401 !! end
402
403 !! test
404 Paragraphs with newline spacing with non-empty white-space lines in between
405 !! wikitext
406 ----
407 a
408
409 b
410 ----
411 a
412
413
414 b
415 ----
416 !! html
417 <hr />
418 <p>a
419 </p><p>b
420 </p>
421 <hr />
422 <p>a
423 </p><p><br />
424 b
425 </p>
426 <hr />
427
428 !! end
429
430 !! test
431 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
432 !! wikitext
433 ----
434 a
435 <!--foo-->
436 b
437 ----
438 a
439 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
440 b
441 ----
442 a
443
444 <!--foo-->
445 <!--bar-->
446 b
447 ----
448 a
449
450 <!--foo-->
451 <!--bar-->
452
453 b
454 ----
455 !! html
456 <hr />
457 <p>a
458 b
459 </p>
460 <hr />
461 <p>a
462 b
463 </p>
464 <hr />
465 <p>a
466 </p><p>b
467 </p>
468 <hr />
469 <p>a
470 </p><p><br />
471 b
472 </p>
473 <hr />
474
475 !! end
476
477 !! test
478 Extra newlines: More paragraphs with indented comment
479 !! wikitext
480 a
481
482 <!--boo-->
483
484 b
485 !! html
486 <p>a
487 </p><p><br />
488 b
489 </p>
490 !!end
491
492 !! test
493 Extra newlines followed by heading
494 !! wikitext
495 a
496
497
498
499 =b=
500 [[a]]
501
502
503 =b=
504 !! html
505 <p>a
506 </p><p><br />
507 </p>
508 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
509 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
510 </p><p><br />
511 </p>
512 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
513
514 !! end
515
516 !! test
517 Extra newlines between heading and content are swallowed
518 !! wikitext
519 =b=
520
521
522
523 [[a]]
524 !! html
525 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
526 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
527 </p>
528 !! end
529
530 !! test
531 Heading with line break in nowiki
532 !! options
533 parsoid=wt2html
534 !! config
535 wgFragmentMode=[ 'html5', 'legacy' ]
536 !! wikitext
537 == A <nowiki>B
538 C</nowiki> ==
539 !! html/php
540 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
541 C">A B
542 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
543
544 !! html/parsoid
545 <h2 id="A_B
546 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span> A <span typeof="mw:Nowiki">B
547 C</span> </h2>
548 !! end
549
550 !! test
551 Parsing an URL
552 !! wikitext
553 http://fr.wikipedia.org/wiki/🍺
554 <!-- EasterEgg we love beer, better be able be able to link to it -->
555 !! html
556 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
557 </p>
558 !! end
559
560 !! test
561 Simple list
562 !! wikitext
563 * Item 1
564 * Item 2
565 !! html
566 <ul><li> Item 1</li>
567 <li> Item 2</li></ul>
568
569 !! end
570
571 !! test
572 Italics and bold
573 !! wikitext
574 * plain
575 * plain''italic''plain
576 * plain''italic''plain''italic''plain
577 * plain'''bold'''plain
578 * plain'''bold'''plain'''bold'''plain
579 * plain''italic''plain'''bold'''plain
580 * plain'''bold'''plain''italic''plain
581 * plain''italic'''bold-italic'''italic''plain
582 * plain'''bold''bold-italic''bold'''plain
583 * plain'''''bold-italic'''italic''plain
584 * plain'''''bold-italic''bold'''plain
585 * plain''italic'''bold-italic'''''plain
586 * plain'''bold''bold-italic'''''plain
587 * plain l'''italic''plain
588 * plain l''''bold''' plain
589 !! html
590 <ul><li> plain</li>
591 <li> plain<i>italic</i>plain</li>
592 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
593 <li> plain<b>bold</b>plain</li>
594 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
595 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
596 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
597 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
598 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
599 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
600 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
601 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
603 <li> plain l'<i>italic</i>plain</li>
604 <li> plain l'<b>bold</b> plain</li></ul>
605
606 !! end
607
608 # this example taken from the [[simple:Moon]] article (T49326)
609 !! test
610 Italics and possessives (1)
611 !! wikitext
612 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
613 !! html
614 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
615 </p>
616 !! end
617
618 # this example taken from [[en:Flaming Pie]] (T51926)
619 !! test
620 Italics and possessives (2)
621 !! wikitext
622 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
623 !! html
624 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
625 </p>
626 !! end
627
628 # this example taken from [[en:Dictionary]] (T51926)
629 !! test
630 Italics and possessives (3)
631 !! wikitext
632 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
633 !! html
634 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
635 </p>
636 !! end
637
638
639 ###
640 ### 2-quote opening sequence tests
641 ###
642 !! test
643 Italics and bold: 2-quote opening sequence: (2,2)
644 !! wikitext
645 ''foo''
646 !! html
647 <p><i>foo</i>
648 </p>
649 !!end
650
651 !! test
652 Italics and bold: 2-quote opening sequence: (2,3)
653 !! wikitext
654 ''foo'''
655 !! html/*
656 <p><i>foo'</i>
657 </p>
658 !!end
659
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,4)
662 !! options
663 parsoid=wt2html
664 !! wikitext
665 ''foo''''
666 !! html/*
667 <p><i>foo''</i>
668 </p>
669 !!end
670
671 # same html as previous, but wikitext adjusted to match parsoid html2wt
672 !! test
673 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
674 !! wikitext
675 ''foo<nowiki>''</nowiki>''
676 !! html
677 <p><i>foo''</i>
678 </p>
679 !! end
680
681 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
682 !! test
683 Italics and bold: 2-quote opening sequence: (2,5)
684 !! options
685 parsoid=wt2html
686 !! wikitext
687 ''foo'''''
688 !! html/php
689 <p><i>foo</i>
690 </p>
691 !! html/parsoid
692 <p><i>foo</i><b></b>
693 </p>
694 !!end
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
699 !! wikitext
700 ''foo'''''<nowiki/>'''
701 !! html/php
702 <p><i>foo</i>
703 </p>
704 !! html/parsoid
705 <p><i>foo</i><b></b>
706 </p>
707 !! end
708
709
710 ###
711 ### 3-quote opening sequence tests
712 ###
713
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,2)
716 !! wikitext
717 '''foo''
718 !! html/*
719 <p>'<i>foo</i>
720 </p>
721 !!end
722
723 !! test
724 Italics and bold: 3-quote opening sequence: (3,3)
725 !! wikitext
726 '''foo'''
727 !! html
728 <p><b>foo</b>
729 </p>
730 !!end
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,4)
734 !! wikitext
735 '''foo''''
736 !! html/*
737 <p><b>foo'</b>
738 </p>
739 !!end
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: 3-quote opening sequence: (3,5)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 '''foo'''''
748 !! html/php
749 <p><b>foo</b>
750 </p>
751 !! html/parsoid
752 <p><b>foo</b><i></i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
759 !! wikitext
760 '''foo'''''<nowiki/>''
761 !! html/php
762 <p><b>foo</b>
763 </p>
764 !! html/parsoid
765 <p><b>foo</b><i></i>
766 </p>
767 !! end
768
769
770 ###
771 ### 4-quote opening sequence tests
772 ###
773
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,2)
776 !! options
777 parsoid=wt2html
778 !! wikitext
779 ''''foo''
780 !! html/*
781 <p>''<i>foo</i>
782 </p>
783 !!end
784
785 # same html as previous, but wikitext adjusted to match parsoid html2wt
786 !! test
787 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
788 !! wikitext
789 <nowiki>''</nowiki>''foo''
790 !! html
791 <p>''<i>foo</i>
792 </p>
793 !! end
794
795 !! test
796 Italics and bold: 4-quote opening sequence: (4,3)
797 !! wikitext
798 ''''foo'''
799 !! html/*
800 <p>'<b>foo</b>
801 </p>
802 !!end
803
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,4)
806 !! options
807 parsoid=wt2html
808 !! wikitext
809 ''''foo''''
810 !! html/*
811 <p>'<b>foo'</b>
812 </p>
813 !!end
814
815 # same html as previous, but wikitext adjusted to match parsoid html2wt
816 !! test
817 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
818 !! wikitext
819 '<nowiki/>'''foo''''
820 !! html
821 <p>'<b>foo'</b>
822 </p>
823 !! end
824
825 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
826 !! test
827 Italics and bold: 4-quote opening sequence: (4,5)
828 !! options
829 parsoid=wt2html
830 !! wikitext
831 ''''foo'''''
832 !! html/php
833 <p>'<b>foo</b>
834 </p>
835 !! html/parsoid
836 <p>'<b>foo</b><i></i>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
843 !! wikitext
844 '<nowiki/>'''foo'''''<nowiki/>''
845 !! html/php
846 <p>'<b>foo</b>
847 </p>
848 !! html/parsoid
849 <p>'<b>foo</b><i></i>
850 </p>
851 !! end
852
853
854 ###
855 ### 5-quote opening sequence tests
856 ###
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,2)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''
864 !! html/*
865 <p><b><i>foo</i></b>
866 </p>
867 !!end
868
869 # same html as previous, but wikitext adjusted to match parsoid html2wt
870 !! test
871 Italics and bold: 5-quote opening sequence: (5,2+3)
872 !! wikitext
873 '''''foo'''''
874 !! html/*
875 <p><i><b>foo</b></i>
876 </p>
877 !! end
878
879 !! test
880 Italics and bold: 5-quote opening sequence: (5,3)
881 !! options
882 parsoid=wt2html
883 !! wikitext
884 '''''foo'''
885 !! html/*
886 <p><i><b>foo</b></i>
887 </p>
888 !!end
889
890 # same html as previous, but wikitext adjusted to match parsoid html2wt
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,3+2)
893 !! wikitext
894 '''''foo'''''
895 !! html
896 <p><i><b>foo</b></i>
897 </p>
898 !! end
899
900 !! test
901 Italics and bold: 5-quote opening sequence: (5,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 '''''foo''''
906 !! html/*
907 <p><i><b>foo'</b></i>
908 </p>
909 !!end
910
911 !! test
912 Italics and bold: 5-quote opening sequence: (5,5)
913 !! wikitext
914 '''''foo'''''
915 !! html
916 <p><i><b>foo</b></i>
917 </p>
918 !!end
919
920 !! test
921 Italics and bold: 5-quote opening sequence: (5,6)
922 !! wikitext
923 '''''foo''''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !! end
928
929 ###
930 ### multiple quote sequences in a line
931 ###
932
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,2)
935 !! options
936 parsoid=wt2html
937 !! wikitext
938 ''foo''''bar''
939 !! html/*
940 <p><i>foo'<b>bar</b></i>
941 </p>
942 !! end
943
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
947 !! wikitext
948 ''foo'<nowiki/>'''bar'''''
949 !! html
950 <p><i>foo'<b>bar</b></i>
951 </p>
952 !! end
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !! end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
968 !! wikitext
969 ''foo'<nowiki/>'''bar'''''
970 !! html
971 <p><i>foo'<b>bar</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: multiple quote sequences: (2,4,4)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 ''foo''''bar''''
981 !! html/*
982 <p><i>foo'<b>bar'</b></i>
983 </p>
984 !! end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
989 !! wikitext
990 ''foo'<nowiki/>'''bar'<nowiki/>'''''
991 !! html
992 <p><i>foo'<b>bar'</b></i>
993 </p>
994 !! end
995
996 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
997 !! test
998 Italics and bold: multiple quote sequences: (3,4,2)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''foo''''bar''
1003 !! html/php
1004 <p><b>foo'</b>bar
1005 </p>
1006 !! html/parsoid
1007 <p><b>foo'</b>bar<i></i>
1008 </p>
1009 !! end
1010
1011 # same html as previous, but wikitext adjusted to match parsoid html2wt
1012 !! test
1013 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1014 !! wikitext
1015 '''foo''''bar''<nowiki/>''
1016 !! html/php
1017 <p><b>foo'</b>bar
1018 </p>
1019 !! html/parsoid
1020 <p><b>foo'</b>bar<i></i>
1021 </p>
1022 !! end
1023
1024 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1025 !! test
1026 Italics and bold: multiple quote sequences: (3,4,3)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''foo''''bar'''
1031 !! html/php
1032 <p><b>foo'</b>bar
1033 </p>
1034 !! html/parsoid
1035 <p><b>foo'</b>bar<b></b>
1036 </p>
1037 !! end
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1042 !! wikitext
1043 '''foo''''bar'''<nowiki/>'''
1044 !! html/php
1045 <p><b>foo'</b>bar
1046 </p>
1047 !! html/parsoid
1048 <p><b>foo'</b>bar<b></b>
1049 </p>
1050 !! end
1051
1052 ###
1053 ### other quote tests
1054 ###
1055 !! test
1056 Italics and bold: other quote tests: (2,3,5)
1057 !! wikitext
1058 ''this is about '''foo's family'''''
1059 !! html
1060 <p><i>this is about <b>foo's family</b></i>
1061 </p>
1062 !!end
1063
1064
1065 !! test
1066 Italics and bold: other quote tests: (2,(3,3),2)
1067 !! wikitext
1068 ''this is about '''foo's''' family''
1069 !! html
1070 <p><i>this is about <b>foo's</b> family</i>
1071 </p>
1072 !!end
1073
1074
1075 !! test
1076 Italics and bold: other quote tests: (3,2,3,2)
1077 !! options
1078 parsoid=wt2html
1079 !! wikitext
1080 '''this is about ''foo'''s family''
1081 !! html/*
1082 <p><b>this is about <i>foo</i></b><i>s family</i>
1083 </p>
1084 !!end
1085
1086
1087 # same html as previous, but wikitext adjusted to match parsoid html2wt
1088 !! test
1089 Italics and bold: other quote tests: (3,2,3+2+2,2)
1090 !! wikitext
1091 '''this is about ''foo'''''<nowiki/>''s family''
1092 !! html
1093 <p><b>this is about <i>foo</i></b><i>s family</i>
1094 </p>
1095 !! end
1096
1097
1098 !! test
1099 Italics and bold: other quote tests: (3,2,3,3)
1100 !! wikitext
1101 '''this is about ''foo'''s family'''
1102 !! html/*
1103 <p>'<i>this is about </i>foo<b>s family</b>
1104 </p>
1105 !!end
1106
1107
1108 !! test
1109 Italics and bold: other quote tests: (3,(2,2),3)
1110 !! wikitext
1111 '''this is about ''foo's'' family'''
1112 !! html
1113 <p><b>this is about <i>foo's</i> family</b>
1114 </p>
1115 !!end
1116
1117
1118 !! test
1119 Italicized possessive
1120 !! wikitext
1121 The ''[[Main Page]]'''s talk page.
1122 !! html/php
1123 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1124 </p>
1125 !! html/parsoid
1126 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1127 !! end
1128
1129 !! test
1130 Quote balancing context should be restricted to td/th cells on the same wikitext line
1131 !! options
1132 parsoid=wt2html,wt2wt
1133 !! wikitext
1134 {|
1135 !''a!!''b
1136 |''a||''b
1137 |}
1138 !! html+tidy
1139 <table>
1140 <tbody><tr>
1141 <th><i>a</i></th>
1142 <th><i>b</i>
1143 </th>
1144 <td><i>a</i></td>
1145 <td><i>b</i>
1146 </td></tr></tbody></table>
1147 !! end
1148
1149 ###
1150 ### Non-html5 tags
1151 ###
1152
1153 !! test
1154 Non-html5 tags should be accepted
1155 !! wikitext
1156 <center>''foo''</center>
1157 <big>''foo''</big>
1158 <font>''foo''</font>
1159 <strike>''foo''</strike>
1160 <tt>''foo''</tt>
1161 !! html
1162 <center><i>foo</i></center>
1163 <p><big><i>foo</i></big>
1164 <font><i>foo</i></font>
1165 <strike><i>foo</i></strike>
1166 <tt><i>foo</i></tt>
1167 </p>
1168 !! end
1169
1170 !! test
1171 <wbr> is valid wikitext (T54468)
1172 !! wikitext
1173 <wbr>
1174 !! html
1175 <p><wbr />
1176 </p>
1177 !! end
1178
1179 # <strike> is HTML4, <s> is HTML4/5.
1180 !! test
1181 <s> or <strike> for strikethrough
1182 !! wikitext
1183 <strike>strike</strike>
1184
1185 <s>s</s>
1186 !! html
1187 <p><strike>strike</strike>
1188 </p><p><s>s</s>
1189 </p>
1190 !! end
1191
1192 ## a not permitted
1193 ## i,b,br omitted
1194 !! test
1195 Text-level semantic html elements in wikitext
1196 !! wikitext
1197 <em>text</em>
1198 <strong>text</strong>
1199 <small>text</small>
1200 <s>text</s>
1201 <cite>text</cite>
1202 <q>text</q>
1203 <dfn>text</dfn>
1204 <abbr>text</abbr>
1205 <data>text</data>
1206 <time>text</time>
1207 <code>text</code>
1208 <var>text</var>
1209 <samp>text</samp>
1210 <kbd>text</kbd>
1211 <sub>text</sub>
1212 <u>text</u>
1213 <mark>text</mark>
1214 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1215 <bdi>text</bdi>
1216 <bdo>text</bdo>
1217 <span>text</span>
1218 <wbr />
1219 !! html
1220 <p><em>text</em>
1221 <strong>text</strong>
1222 <small>text</small>
1223 <s>text</s>
1224 <cite>text</cite>
1225 <q>text</q>
1226 <dfn>text</dfn>
1227 <abbr>text</abbr>
1228 <data>text</data>
1229 <time>text</time>
1230 <code>text</code>
1231 <var>text</var>
1232 <samp>text</samp>
1233 <kbd>text</kbd>
1234 <sub>text</sub>
1235 <u>text</u>
1236 <mark>text</mark>
1237 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1238 <bdi>text</bdi>
1239 <bdo>text</bdo>
1240 <span>text</span>
1241 <wbr />
1242 </p>
1243 !! end
1244
1245 # test cases taken from
1246 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1247 !! test
1248 Ruby markup (W3C-style)
1249 !! wikitext
1250 ; Mono-ruby for individual base characters
1251 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1252 ; Group ruby
1253 : <ruby>今日<rt>きょう</rt></ruby>
1254 ; Jukugo ruby
1255 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1256 ; Inline ruby
1257 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1258 ; Double-sided ruby
1259 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1260 <ruby>
1261 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1262 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1263 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1264 </ruby>
1265 !! html
1266 <dl><dt> Mono-ruby for individual base characters</dt>
1267 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1268 <dt> Group ruby</dt>
1269 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1270 <dt> Jukugo ruby</dt>
1271 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1272 <dt> Inline ruby</dt>
1273 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1274 <dt> Double-sided ruby</dt>
1275 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1276 <p><ruby>
1277 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1278 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1279 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1280 </ruby>
1281 </p>
1282 !! end
1283
1284 # The next two test different paths in the sanitizer.
1285 !! test
1286 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1287 !! wikitext
1288 <blockquote|>a</blockquote>
1289
1290 <b→> doesn't terminate </b→>
1291
1292 <bä> doesn't terminate </bä>
1293
1294 <boo> doesn't terminate </boo>
1295
1296 <s.foo> doesn't terminate </s.foo>
1297
1298 <sub-ID#1>
1299 !! html
1300 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1301 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1302 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1303 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1304 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1305 </p><p>&lt;sub-ID#1&gt;
1306 </p>
1307 !! end
1308
1309 !! test
1310 Non-word characters don't terminate tag names
1311 !! wikitext
1312 <blockquote|>a</blockquote>
1313
1314 <b→> doesn't terminate </b→>
1315
1316 <bä> doesn't terminate </bä>
1317
1318 <boo> doesn't terminate </boo>
1319
1320 <s.foo> doesn't terminate </s.foo>
1321
1322 <sub-ID#1>
1323 !! html+tidy
1324 <p>&lt;blockquote|&gt;a
1325 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1326 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1327 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1328 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1329 </p><p>&lt;sub-ID#1&gt;
1330 </p>
1331 !! end
1332
1333 ###
1334 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1335 ### This checks that HTML5 tags (with non-word characters in the tag
1336 ### name) make it safely through the parser -- the Sanitizer will
1337 ### munge them later, as it should.
1338 ###
1339 !! test
1340 Non-word characters are valid in extension tags (T19663)
1341 !! wikitext
1342 <tåg>tåg</tåg>
1343 !! html/php
1344 <pre>
1345 'tåg'
1346 array (
1347 )
1348 </pre>
1349
1350 !! html/parsoid
1351 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1352 !! end
1353
1354 !! test
1355 Isolated close tags should be treated as literal text (T54760)
1356 !! options
1357 parsoid=wt2html
1358 !! wikitext
1359 </b>
1360
1361 <s.foo>s</s>
1362 !! html/php+tidy
1363 <p class="mw-empty-elt">
1364 </p><p>&lt;s.foo&gt;s
1365 </p>
1366 !! html/parsoid
1367 <p>&lt;s.foo&gt;s</p>
1368 !! end
1369
1370 ###
1371 ### Special characters
1372 ###
1373
1374 !! test
1375 Bare pipe character (T54363)
1376 !! wikitext
1377 |
1378 !! html
1379 <p>|
1380 </p>
1381 !! end
1382
1383 !! test
1384 Bare pipe character from a template (T54363)
1385 !! wikitext
1386 {{pipe}}
1387 !! html
1388 <p>|
1389 </p>
1390 !! end
1391
1392 ###
1393 ### <nowiki> test cases
1394 ###
1395
1396 !! test
1397 <nowiki> unordered list
1398 !! wikitext
1399 <nowiki>* This is not an unordered list item.</nowiki>
1400 !! html/php
1401 <p>* This is not an unordered list item.
1402 </p>
1403 !! html/parsoid
1404 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1405 !! end
1406
1407 !! test
1408 <nowiki> spacing
1409 !! wikitext
1410 <nowiki>Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </nowiki>
1417 !! html/php
1418 <p>Lorem ipsum dolor
1419
1420 sed abit.
1421 sed nullum.
1422
1423 :and a colon
1424
1425 </p>
1426 !! html/parsoid
1427 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1428
1429 sed abit.
1430 sed nullum.
1431
1432 :and a colon
1433 </span></p>
1434 !! end
1435
1436 !! test
1437 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1438 !! wikitext
1439 <nowiki><span class="error"></nowiki>
1440 !! html/php
1441 <p>&lt;span class="error"&gt;
1442 </p>
1443 !! html/parsoid
1444 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1445 !! end
1446
1447 !! test
1448 nowiki 3
1449 !! wikitext
1450 :There is not nowiki.
1451 :There is <nowiki>nowiki</nowiki>.
1452
1453 #There is not nowiki.
1454 #There is <nowiki>nowiki</nowiki>.
1455
1456 *There is not nowiki.
1457 *There is <nowiki>nowiki</nowiki>.
1458 !! html/php
1459 <dl><dd>There is not nowiki.</dd>
1460 <dd>There is nowiki.</dd></dl>
1461 <ol><li>There is not nowiki.</li>
1462 <li>There is nowiki.</li></ol>
1463 <ul><li>There is not nowiki.</li>
1464 <li>There is nowiki.</li></ul>
1465
1466 !! html/parsoid
1467 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1468 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1469
1470 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1471 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1472
1473 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1474 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1475 !! end
1476
1477 !! test
1478 Entities inside <nowiki>
1479 !! wikitext
1480 <nowiki>&lt;</nowiki>
1481 !! html/php
1482 <p>&lt;
1483 </p>
1484 !! html/parsoid
1485 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1486 !! end
1487
1488 !! test
1489 Entities inside template parameters
1490 !! wikitext
1491 {{echo|&ndash;}}
1492 !! html/php+tidy
1493 <p>&#8211;
1494 </p>
1495 !! html/parsoid
1496 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1497 !! end
1498
1499 !! test
1500 Properly escape nowiki when combined with other wiki markup
1501 !! options
1502 parsoid=html2wt
1503 !! html/parsoid
1504 <p>* &lt;/nowiki&gt; tag</p>
1505 !! wikitext
1506 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1507 !! end
1508
1509 !! test
1510 T93824: Put escaped HTML tags inside nowiki
1511 !! options
1512 parsoid=html2wt
1513 !! html/parsoid
1514 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1515 !! wikitext
1516 <nowiki><h2>foo</h2></nowiki>
1517 !! end
1518
1519 !! test
1520 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1525 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1526 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1527 !! wikitext
1528 This text: L'[[Foo]]
1529 This text: L<nowiki>''</nowiki>[[Foo]]
1530 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1531 !! end
1532
1533 # This test fails because wikitext whitespace is not normalized before comparing.
1534 !! test
1535 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 </p>
1541 !! wikitext
1542 This text : L<nowiki>''</nowiki>[[Foo]]
1543 !! end
1544
1545 # This test and the next one are html2wt only as they test that incorrect wikitext
1546 # passed in template arguments gets escaped or wrapped in nowikis where required.
1547 !! test
1548 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1549 !! options
1550 parsoid=html2wt
1551 !! html/parsoid
1552 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1553 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1554 !! wikitext
1555 {{echo|foo{{!}}bar}}
1556 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1557 !! end
1558
1559 !! test
1560 T53961: Output correct nowikis in template arguments
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1565 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1566 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1567 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1568 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1569 !! wikitext
1570 {{echo|a [ b}}
1571 {{echo|<nowiki>a }} b</nowiki>}}
1572 {{echo|<nowiki>a [[ b</nowiki>}}
1573 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1574 {{echo|a <nowiki>}</nowiki>}}
1575 !! end
1576
1577 !! test
1578 Cases where "!!" needs nowiki protection
1579 !! options
1580 parsoid=html2wt
1581 !! html/parsoid
1582 <table>
1583 <tr><th>this needs protection !! here</th></tr>
1584 </table>
1585
1586 <table>
1587 <tr><th>this does not need
1588 protection !! here</th></tr>
1589 </table>
1590 !! wikitext
1591 {|
1592 !<nowiki>this needs protection !! here</nowiki>
1593 |}
1594
1595 {|
1596 !this does not need
1597 protection !! here
1598 |}
1599 !! end
1600
1601 ###
1602 ### Comments
1603 ###
1604 !! test
1605 Comments and Indent-Pre
1606 !! wikitext
1607 <!-- comment 1 --> asdf
1608
1609 <!-- comment 1 --> asdf
1610 <!-- comment 2 -->
1611
1612 <!-- comment 1 --> asdf
1613 <!-- comment 2 -->xyz
1614
1615 <!-- comment 1 --> asdf
1616 <!-- comment 2 --> xyz
1617 !! html
1618 <pre>asdf
1619 </pre>
1620 <pre>asdf
1621 </pre>
1622 <pre>asdf
1623 </pre>
1624 <p>xyz
1625 </p>
1626 <pre>asdf
1627 xyz
1628 </pre>
1629 !! end
1630
1631 !! test
1632 Comment test 2a
1633 !! wikitext
1634 asdf
1635 <!-- comment 1 -->
1636 jkl
1637 !! html
1638 <p>asdf
1639 jkl
1640 </p>
1641 !! end
1642
1643 !! test
1644 Comment test 2b
1645 !! wikitext
1646 asdf
1647 <!-- comment 1 -->
1648
1649 jkl
1650 !! html
1651 <p>asdf
1652 </p><p>jkl
1653 </p>
1654 !! end
1655
1656 !! test
1657 Comment test 3
1658 !! wikitext
1659 asdf
1660 <!-- comment 1 -->
1661 <!-- comment 2 -->
1662 jkl
1663 !! html
1664 <p>asdf
1665 jkl
1666 </p>
1667 !! end
1668
1669 !! test
1670 Comment test 4
1671 !! wikitext
1672 asdf<!-- comment 1 -->jkl
1673 !! html
1674 <p>asdfjkl
1675 </p>
1676 !! end
1677
1678 !! test
1679 Comment spacing
1680 !! wikitext
1681 a
1682 <!-- foo --> b <!-- bar -->
1683 c
1684 !! html
1685 <p>a
1686 </p>
1687 <pre> b
1688 </pre>
1689 <p>c
1690 </p>
1691 !! end
1692
1693 !! test
1694 Comment whitespace
1695 !! wikitext
1696 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1697 !! html
1698
1699 !! end
1700
1701 !! test
1702 Comment semantics and delimiters
1703 !! wikitext
1704 <!-- --><!----><!-----><!------>
1705 !! html/php
1706
1707 !! html/parsoid
1708 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1709 !! end
1710
1711 !! test
1712 Comment semantics and delimiters, redux
1713 !! wikitext
1714 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1715 -- foo -- funky huh? ... -->
1716 !! html/php
1717
1718 !! html/parsoid
1719 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1720 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1721 !! end
1722
1723 !! test
1724 Comment semantics and delimiters: directors cut
1725 !! wikitext
1726 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1727 everything starting with < followed by !-- until the first -- and > we see,
1728 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1729 -->-->
1730 !! html/php
1731 <p>--&gt;
1732 </p>
1733 !! html/parsoid
1734 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1735 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1736 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1737 --><p>--></p>
1738 !! end
1739
1740 !! test
1741 Comment semantics: nesting
1742 !! wikitext
1743 <!--<!-- no, we're not going to do anything fancy here -->-->
1744 !! html/php
1745 <p>--&gt;
1746 </p>
1747 !! html/parsoid
1748 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1749 !! end
1750
1751 # Parsoid closes the unclosed comment, even if it means a slight
1752 # round-trip diff.
1753 !! test
1754 Comment semantics: unclosed comment at end
1755 !! options
1756 parsoid=wt2html,html2html
1757 !! wikitext
1758 <!--This comment will run out to the end of the document
1759 !! html/php
1760
1761 !! html/parsoid
1762 <!--This comment will run out to the end of the document-->
1763 !! end
1764
1765 !! test
1766 Comment semantics: normalize comments to play nice with XML and browsers
1767 !! wikitext
1768 <!-- Browsers --!> think this is closed -->
1769 <!--> This would normally be text -->
1770 <!---> As would this -->
1771 <!-- XML doesn't like trailing dashes -------->
1772 <!-- Nor doubled hyphens -- anywhere in the data -->
1773 But this is not a comment.
1774 !! html/php
1775 <p>But this is not a comment.
1776 </p>
1777 !! html/parsoid
1778 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1779 <!--&#x3E; This would normally be text -->
1780 <!--&#x2D;&#x3E; As would this -->
1781 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1782 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1783 <p>But this is not a comment.</p>
1784 !! end
1785
1786 !! test
1787 Comment semantics: round-trip even text which contains encoded -->
1788 !! wikitext
1789 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1790 !! html/parsoid
1791 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1792 !! end
1793
1794 !! test
1795 Comment in template title
1796 !! wikitext
1797 {{f<!---->oo}}
1798 !! html
1799 <p>FOO
1800 </p>
1801 !! end
1802
1803 !! test
1804 Comment on its own line post-expand
1805 !! wikitext
1806 a
1807 {{blank}}<!---->
1808 b
1809 !! html
1810 <p>a
1811 </p><p>b
1812 </p>
1813 !! end
1814
1815 !! test
1816 Comment on its own line post-expand with non-significant whitespace
1817 !! wikitext
1818 a
1819 {{blank}} <!---->
1820 b
1821 !! html
1822 <p>a
1823 </p><p>b
1824 </p>
1825 !! end
1826
1827 !! test
1828 Multiple comments should still parse as SOL-transparent
1829 !! options
1830 parsoid=wt2html,wt2wt
1831 !! wikitext
1832 <!--c1-->*a
1833 <!--c2--><!--c3--><!--c4-->*b
1834 !! html/php
1835 <ul><li>a</li>
1836 <li>b</li></ul>
1837
1838 !! html/parsoid
1839 <!--c1--><ul>
1840 <li>a
1841 </li>
1842 <!--c2--><!--c3--><!--c4-->
1843 <li>b
1844 </li>
1845 </ul>
1846 !! end
1847
1848 ## Make sure ">" gets escaped in comments to avoid XSS
1849 !! test
1850 IE conditional comments
1851 !! wikitext
1852 <!--[if lt IE 9]>
1853 <script>alert('hi');</script>
1854 <![endif]-->
1855 !! html/parsoid
1856 <!--[if lt IE 9]&#x3E;
1857 <script&#x3E;alert('hi');</script&#x3E;
1858 <![endif]-->
1859 !! end
1860
1861 ###
1862 ### paragraph wrapping tests
1863 ###
1864
1865 !! test
1866 No block tags
1867 !! wikitext
1868 a
1869
1870 b
1871 !! html
1872 <p>a
1873 </p><p>b
1874 </p>
1875 !! end
1876
1877 !! test
1878 Block tag on one line (<div>)
1879 !! wikitext
1880 a <div>foo</div>
1881
1882 b
1883 !! html
1884 a <div>foo</div>
1885 <p>b
1886 </p>
1887 !! html+tidy
1888 <p>a </p><div>foo</div>
1889 <p>b
1890 </p>
1891 !! end
1892
1893 # Remex wraps empty tag runs with p-tags.
1894 # Parsoid strips them out during p-wrapping.
1895 !! test
1896 No p-wrappable content
1897 !! wikitext
1898 <span><div>x</div></span>
1899 <span><s><div>x</div></s></span>
1900 <small><em></em></small><span><s><div>x</div></s></span>
1901 !! html/php+tidy
1902 <span><div>x</div></span>
1903 <span><s><div>x</div></s></span>
1904 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1905 !! html/parsoid
1906 <span><div>x</div></span>
1907 <span><s><div>x</div></s></span>
1908 <small><em></em></small><span><s><div>x</div></s></span>
1909 !! end
1910
1911 # T177612: Parsoid-only test
1912 !! test
1913 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1914 !! wikitext
1915 {{echo|<span><div>x</div></span>}}
1916 x
1917 !! html/parsoid
1918 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
1919 <p>x</p>
1920 !! end
1921
1922 !! test
1923 Block tag on one line (<blockquote>)
1924 !! wikitext
1925 a <blockquote>foo</blockquote>
1926
1927 b
1928 !! html
1929 a <blockquote>foo</blockquote>
1930 <p>b
1931 </p>
1932 !! html+tidy
1933 <p>a </p><blockquote><p>foo</p></blockquote>
1934 <p>b
1935 </p>
1936 !! end
1937
1938 !! test
1939 Block tag on both lines (<div>)
1940 !! wikitext
1941 a <div>foo</div>
1942
1943 b <div>foo</div>
1944 !! html
1945 a <div>foo</div>
1946 b <div>foo</div>
1947
1948 !! html+tidy
1949 <p>a </p><div>foo</div><p>
1950 b </p><div>foo</div>
1951 !! end
1952
1953 !! test
1954 Block tag on both lines (<blockquote>)
1955 !! wikitext
1956 a <blockquote>foo</blockquote>
1957
1958 b <blockquote>foo</blockquote>
1959 !! html
1960 a <blockquote>foo</blockquote>
1961 b <blockquote>foo</blockquote>
1962
1963 !! html+tidy
1964 <p>a </p><blockquote><p>foo</p></blockquote><p>
1965 b </p><blockquote><p>foo</p></blockquote>
1966 !! end
1967
1968 !! test
1969 Multiple lines without block tags
1970 !! wikitext
1971 <div>foo</div> a
1972 b
1973 c
1974 d<!--foo--> e
1975 x <div>foo</div> z
1976 !! html
1977 <div>foo</div> a
1978 <p>b
1979 c
1980 d e
1981 </p>
1982 x <div>foo</div> z
1983
1984 !! html+tidy
1985 <div>foo</div><p> a
1986 </p><p>b
1987 c
1988 d e
1989 </p><p>
1990 x </p><div>foo</div><p> z
1991 </p>
1992 !! end
1993
1994 # The difference between Parsoid & Remex here
1995 # is because of Parsoid's Tidy-emulation code
1996 # for p-wrapping. We'll start work to remove this
1997 # emulation code in Parsoid sooner than later.
1998 # Remex wraps empty tag runs with p-tags.
1999 # Parsoid strips them out in a separate pass.
2000 !! test
2001 Empty lines between lines with block tags
2002 !! wikitext
2003 <div></div>
2004
2005
2006 <div></div>a
2007
2008 b
2009 <div>a</div>b
2010
2011 <div>b</div>d
2012
2013
2014 <div>e</div>
2015 !! html
2016 <div></div>
2017 <p><br />
2018 </p>
2019 <div></div>a
2020 <p>b
2021 </p>
2022 <div>a</div>b
2023 <div>b</div>d
2024 <p><br />
2025 </p>
2026 <div>e</div>
2027
2028 !! html+tidy
2029 <div></div>
2030 <p><br />
2031 </p>
2032 <div></div><p>a
2033 </p><p>b
2034 </p>
2035 <div>a</div><p>b
2036 </p><div>b</div><p>d
2037 </p><p><br />
2038 </p>
2039 <div>e</div>
2040 !! html/parsoid
2041 <div data-parsoid='{"stx":"html"}'></div>
2042
2043 <p><br /></p>
2044 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2045
2046 <p>b</p>
2047 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2048
2049 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2050
2051 <p><br /></p>
2052 <div data-parsoid='{"stx":"html"}'>e</div>
2053 !! end
2054
2055 !! test
2056 Unclosed HTML p-tags should be handled properly
2057 !! wikitext
2058 <div><p>foo</div>
2059 a
2060
2061 b
2062 !! html/php+tidy
2063 <div><p>foo</p></div>
2064 <p>a
2065 </p><p>b
2066 </p>
2067 !! html/parsoid
2068 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2069 <p>a</p>
2070 <p>b</p>
2071 !! end
2072
2073 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2074 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2075 ## them for now.
2076 !! test
2077 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2078 !! options
2079 parsoid=wt2html
2080 !! wikitext
2081 a [[Category:A1]] [[Category:A2]]
2082 [[Category:A3]]
2083 [[Category:A4]]
2084 !! html/parsoid
2085 <p>a</p>
2086 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2087 !! end
2088
2089 !! test
2090 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2091 !! options
2092 parsoid=wt2html
2093 !! wikitext
2094 [[Category:A1]]a
2095 !! html/parsoid
2096 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2097 !! end
2098
2099 !! test
2100 No paragraph necessary for SOL transparent template
2101 !! wikitext
2102 <span><div>foo</div></span>
2103 [[Category:Foo]]
2104
2105 <span><div>foo</div></span>
2106 {{echo|[[Category:Foo]]}}
2107 !! html/php
2108 <span><div>foo</div></span>
2109 <span><div>foo</div></span>
2110
2111 !! html/parsoid
2112 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2113 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2114
2115 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2116 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2117 !! end
2118
2119 !! test
2120 Avoid expanding multiline sol transparent template ranges unnecessarily
2121 !! wikitext
2122 hi
2123
2124
2125 {{echo|<br/>
2126 }}
2127
2128 [[Category:Ho]]
2129 !! html/php
2130 <p>hi
2131 </p><p><br />
2132 <br />
2133 </p>
2134 !! html/parsoid
2135 <p>hi</p>
2136
2137 <p><br />
2138 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2139 </span></p>
2140
2141 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2142 !! end
2143
2144 ###
2145 ### Preformatted text
2146 ###
2147
2148 !! test
2149 Preformatted text
2150 !! wikitext
2151 This is some
2152 Preformatted text
2153 With ''italic''
2154 And '''bold'''
2155 And a [[Main Page|link]]
2156 !! html
2157 <pre>This is some
2158 Preformatted text
2159 With <i>italic</i>
2160 And <b>bold</b>
2161 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2162 </pre>
2163 !! end
2164
2165 !! test
2166 Tabs don't trigger preformatted text
2167 !! wikitext
2168 This is not
2169 preformatted text.
2170 This is preformatted text.
2171 So is this.
2172 !! html/php
2173 <p> This is not
2174 preformatted text.
2175 </p>
2176 <pre>This is preformatted text.
2177 So is this.
2178 </pre>
2179 !! html/parsoid
2180 <p> This is not
2181 preformatted text.</p>
2182 <pre>This is preformatted text.
2183 So is this.</pre>
2184 !! end
2185
2186 !! test
2187 Space before tab needs nowiki pre protection
2188 !! options
2189 parsoid=html2wt
2190 !! html/parsoid
2191 <p> a</p>
2192 !! wikitext
2193 <nowiki> </nowiki> a
2194 !! end
2195
2196 !! test
2197 Ident preformatting with inline content
2198 !! wikitext
2199 a
2200 ''b''
2201 !! html
2202 <pre>a
2203 <i>b</i>
2204 </pre>
2205 !! end
2206
2207 !! test
2208 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2209 !! wikitext
2210 <pre><nowiki>
2211 <b>
2212 <cite>
2213 <em>
2214 </nowiki></pre>
2215 !! html
2216 <pre>
2217 &lt;b&gt;
2218 &lt;cite&gt;
2219 &lt;em&gt;
2220 </pre>
2221
2222 !! end
2223
2224 !! test
2225 Regression with preformatted in <center>
2226 !! wikitext
2227 <center>
2228 Blah
2229 </center>
2230 !! html
2231 <center>
2232 <pre>Blah
2233 </pre>
2234 </center>
2235
2236 !! end
2237
2238 !! test
2239 T54763: Preformatted in <blockquote>
2240 !! wikitext
2241 <blockquote>
2242 Blah
2243 {|
2244 |
2245 indented cell (no pre-wrapping!)
2246 |}
2247 </blockquote>
2248 !! html
2249 <blockquote>
2250 <p> Blah
2251 </p>
2252 <table>
2253 <tr>
2254 <td>
2255 <p> indented cell (no pre-wrapping!)
2256 </p>
2257 </td></tr></table>
2258 </blockquote>
2259
2260 !! end
2261
2262 !! test
2263 T53086: Double newlines in blockquotes should be turned into paragraphs
2264 !! wikitext
2265 <blockquote>
2266 Foo
2267
2268 Bar
2269 </blockquote>
2270 !! html
2271 <blockquote>
2272 <p>Foo
2273 </p><p>Bar
2274 </p>
2275 </blockquote>
2276
2277 !! end
2278
2279 !! test
2280 T17491: <ins>/<del> in blockquote
2281 !! wikitext
2282 <blockquote>
2283 Foo <del>bar</del> <ins>baz</ins> quux
2284 </blockquote>
2285 !! html
2286 <blockquote>
2287 <p>Foo <del>bar</del> <ins>baz</ins> quux
2288 </p>
2289 </blockquote>
2290
2291 !! end
2292
2293 !! test
2294 T17491: <ins>/<del> in blockquote (2)
2295 !! wikitext
2296 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2297 </blockquote>
2298 !! html
2299 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2300 </blockquote>
2301
2302 !! html+tidy
2303 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2304 </p></blockquote>
2305 !! end
2306
2307 !! test
2308 <pre> with attributes (T5202)
2309 !! wikitext
2310 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2311 !! html
2312 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2313
2314 !! end
2315
2316 !! test
2317 <pre> with width attribute (T5202)
2318 !! wikitext
2319 <pre width="8">Narrow screen goodies</pre>
2320 !! html
2321 <pre width="8">Narrow screen goodies</pre>
2322
2323 !! end
2324
2325 !! test
2326 <pre> with forbidden attribute (T5202)
2327 !! wikitext
2328 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2329 !! html
2330 <pre width="8">Narrow screen goodies</pre>
2331
2332 !! end
2333
2334 !! test
2335 Entities inside <pre>
2336 !! wikitext
2337 <pre>&lt;</pre>
2338 !! html
2339 <pre>&lt;</pre>
2340
2341 !! end
2342
2343 !! test
2344 <pre> with forbidden attribute values (T5202)
2345 !! wikitext
2346 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2347 !! html
2348 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2349
2350 !! end
2351
2352 !! test
2353 <nowiki> inside <pre> (T15238)
2354 !! wikitext
2355 <pre>
2356 <nowiki>
2357 </pre>
2358 <pre>
2359 <nowiki></nowiki>
2360 </pre>
2361 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2362 !! html
2363 <pre>
2364 &lt;nowiki&gt;
2365 </pre>
2366 <pre>
2367
2368 </pre>
2369 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2370
2371 !! end
2372
2373 !! test
2374 <nowiki> inside of #tag:pre
2375 !! wikitext
2376 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2377 !! html/php
2378 <pre>Foo &#8594;bar</pre>
2379
2380 !! html/parsoid
2381 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2382 !! end
2383
2384 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2385 ## aren't enclosed in nowikis.
2386 !! test
2387 <nowiki> and <pre> preference (first one wins)
2388 !! options
2389 parsoid=wt2html
2390 !! wikitext
2391 <pre>
2392 <nowiki>
2393 </pre>
2394 </nowiki>
2395 </pre>
2396
2397 <nowiki>
2398 <pre>
2399 <nowiki>
2400 </pre>
2401 </nowiki>
2402 </pre>
2403
2404 !! html/php
2405 <pre>
2406 &lt;nowiki&gt;
2407 </pre>
2408 <p>&lt;/nowiki&gt;
2409 &lt;/pre&gt;
2410 </p><p>
2411 &lt;pre&gt;
2412 &lt;nowiki&gt;
2413 &lt;/pre&gt;
2414
2415 &lt;/pre&gt;
2416 </p>
2417 !! html/parsoid
2418 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2419 </pre>
2420 <p>&lt;/nowiki></p>
2421
2422
2423 <p><span typeof="mw:Nowiki">
2424 &lt;pre>
2425 &lt;nowiki>
2426 &lt;/pre>
2427 </span></p>
2428 !! end
2429
2430 !! test
2431 </pre> inside nowiki
2432 !! wikitext
2433 <nowiki></pre></nowiki>
2434 !! html
2435 <p>&lt;/pre&gt;
2436 </p>
2437 !! end
2438
2439 !! test
2440 Empty pre; pre inside other HTML tags (T56946)
2441 !! wikitext
2442 a
2443
2444 <div><pre>
2445 foo
2446 </pre></div>
2447 <pre></pre>
2448 !! html/php+tidy
2449 <p>a
2450 </p>
2451 <div><pre>foo
2452 </pre></div>
2453 <pre></pre>
2454 !! html/parsoid
2455 <p>a</p>
2456
2457 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2458 </pre></div>
2459 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2460 !! end
2461
2462 !! test
2463 HTML pre followed by indent-pre
2464 !! wikitext
2465 <pre>foo</pre>
2466 bar
2467 !! html
2468 <pre>foo</pre>
2469 <pre>bar
2470 </pre>
2471 !! end
2472
2473 !! test
2474 Block tag pre
2475 !! wikitext
2476 <p><pre>foo</pre></p>
2477 !! html/php+tidy
2478 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2479 !! html/parsoid
2480 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2481 !! end
2482
2483 !!test
2484 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2485 !! wikitext
2486 {{echo|}}
2487 !! html
2488
2489 !!end
2490
2491 !!test
2492 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2493 !! wikitext
2494 {{echo|
2495 foo}}
2496 !! html
2497 <p>foo
2498 </p>
2499 !!end
2500
2501 !! test
2502 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2503 !! wikitext
2504 {{echo|a
2505 b}}
2506 !! html
2507 <pre>a
2508 </pre>
2509 <p>b
2510 </p>
2511 !!end
2512
2513 !! test
2514 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2515 !! wikitext
2516 {{echo|a
2517 b
2518 c
2519 d
2520 e
2521 }}
2522 !! html
2523 <pre>a
2524 </pre>
2525 <p>b
2526 c
2527 </p>
2528 <pre>d
2529 </pre>
2530 <p>e
2531 </p>
2532 !!end
2533
2534 !!test
2535 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2536 !! wikitext
2537 {{echo| foo}}
2538
2539 {{echo| foo}}{{echo| bar}}
2540
2541 {{echo| foo}}
2542 {{echo| bar}}
2543
2544 {{echo|<!--cmt--> foo}}
2545
2546 <!--cmt-->{{echo| foo}}
2547
2548 {{echo|{{echo| }}bar}}
2549 !! html
2550 <pre>foo
2551 </pre>
2552 <pre>foo bar
2553 </pre>
2554 <pre>foo
2555 bar
2556 </pre>
2557 <pre>foo
2558 </pre>
2559 <pre>foo
2560 </pre>
2561 <pre>bar
2562 </pre>
2563 !!end
2564
2565 !! test
2566 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2567 !! wikitext
2568 {{echo| }}a
2569
2570 {{echo|
2571 }}a
2572
2573 {{echo|
2574 b}}
2575
2576 {{echo|a
2577 }}b
2578
2579 {{echo|a
2580 }} b
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p><br />
2585 </p>
2586 <pre>a
2587 </pre>
2588 <p><br />
2589 </p>
2590 <pre>b
2591 </pre>
2592 <p>a
2593 </p>
2594 <pre>b
2595 </pre>
2596 <p>a
2597 </p>
2598 <pre>b
2599 </pre>
2600 !!end
2601
2602 ## Hmm, should Parsoid rt this?
2603 !! test
2604 Pres with newline attributes
2605 !! options
2606 parsoid=wt2html,html2html
2607 !! wikitext
2608 <pre class="one
2609 two">hi</pre>
2610 !! html/php
2611 <pre class="one two">hi</pre>
2612
2613 !! html/parsoid
2614 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2615 !! end
2616
2617 !! test
2618 Things that look like <pre> tags aren't treated as such
2619 !! wikitext
2620 Barack Obama <President> of the United States
2621 <President></President>
2622 !! html
2623 <p>Barack Obama &lt;President&gt; of the United States
2624 &lt;President&gt;&lt;/President&gt;
2625 </p>
2626 !! end
2627
2628 !! test
2629 Handle broken pre-like tags (T66025)
2630 !! options
2631 parsoid=wt2html
2632 !! wikitext
2633 {{echo|<pre <pre>x</pre>}}
2634
2635 <table><pre </table>
2636 !! html/php
2637 <pre>x</pre>
2638 <table>&lt;pre </table>
2639
2640 !! html/php+tidy
2641 <pre>x</pre>
2642 &lt;pre <table></table>
2643 !! html/parsoid
2644 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2645
2646
2647 <p>&lt;pre </p>
2648
2649 <table></table>
2650 !! end
2651
2652 !! test
2653 Parsoid: handle pre with space after attribute
2654 !! options
2655 parsoid=wt2html
2656 !! wikitext
2657 <pre style="width:50%;" >{{echo|foo}}</pre>
2658 !! html/php
2659 <pre style="width:50%;">{{echo|foo}}</pre>
2660
2661 !! html/parsoid
2662 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2663 !! end
2664
2665 # TODO / maybe: fix wt2wt for this
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td></td>
2673 <td></td>
2674
2675
2676
2677 |}
2678 !! html
2679 <table>
2680
2681 <tbody>
2682 <tr>
2683 <td></td>
2684
2685 <td></td></tr>
2686
2687
2688
2689 </tbody></table>
2690 !! end
2691
2692 !! test
2693 Self-closed pre
2694 !! wikitext
2695 <pre />
2696 !! html/php
2697 <pre></pre>
2698
2699 !! html/parsoid
2700 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2701 !! end
2702
2703 !! test
2704 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2705 !! options
2706 parsoid=wt2html
2707 !! wikitext
2708 {|
2709 <td>
2710 <td>
2711 </td>
2712
2713
2714
2715 |}
2716 !! html
2717 <table>
2718
2719 <tbody>
2720 <tr>
2721 <td></td>
2722
2723 <td>
2724 </td></tr>
2725
2726
2727
2728 </tbody></table>
2729 !! end
2730
2731
2732 #--------------------------------------------------------------------
2733 # Transclusion parameter whitespace stripping tests
2734 # Behavior is different for positional and named parameters
2735 #--------------------------------------------------------------------
2736 !! test
2737 Templates: Strip leading and trailing whitespace from named-param values
2738 !! wikitext
2739 {{echo|1= a }}
2740
2741 {{echo|1= {{echo|b}} }}
2742
2743 {{echo| 1 =
2744 c }}
2745
2746 {{echo| 1 =
2747 * d
2748 }}
2749 !! html
2750 <p>a
2751 </p><p>b
2752 </p><p>c
2753 </p>
2754 <ul><li> d</li></ul>
2755
2756 !! end
2757
2758 !! test
2759 Templates: Don't strip whitespace from positional-param values
2760 !! wikitext
2761 {{echo|a }}
2762
2763 {{echo|{{echo|b}} }}
2764
2765 {{echo| c
2766 }}
2767
2768 {{echo| {{echo|d}}
2769 }}
2770
2771 {{echo|
2772 e}}
2773
2774 {{echo|
2775 * f}}
2776
2777 {{echo|
2778 }}g
2779 !! html
2780 <p>a
2781 </p><p>b
2782 </p>
2783 <pre>c
2784 </pre>
2785 <p><br />
2786 </p>
2787 <pre>d
2788 </pre>
2789 <p><br />
2790 </p>
2791 <pre>e
2792 </pre>
2793 <p><br />
2794 </p>
2795 <ul><li> f</li></ul>
2796 <p><br />
2797 </p>
2798 <pre>g
2799 </pre>
2800 !! end
2801
2802 !! test
2803 Templates: Don't recognize targets split by newlines
2804 !! options
2805 parsoid=wt2html
2806 !! wikitext
2807 {{ech
2808 o|foo}}
2809 !! html/php
2810 <p>{{ech
2811 o|foo}}
2812 </p>
2813 !! html/parsoid
2814 <p>{{ech
2815 o|foo}}</p>
2816 !! end
2817
2818 !! test
2819 Templates: Recognize targets when newlines and comments don't split the target
2820 !! options
2821 parsoid=wt2html
2822 !! wikitext
2823 {{
2824 <!--X--> ech<!--X-->o<!--X-->
2825 <!--X--> <!--X-->
2826
2827 |foo}}
2828 !! html/php
2829 <p>foo
2830 </p>
2831 !! html/parsoid
2832 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2833 !! end
2834
2835 !! test
2836 Templates: Handle empty comment-and-ws-only lines correctly
2837 !! wikitext
2838 {{echo|foo
2839 <!--should be ignored-->
2840 <!--should be ignored as well-->
2841 bar}}
2842 !! html/php
2843 <p>foo
2844 bar
2845 </p>
2846 !! html/parsoid
2847 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2848 !! end
2849
2850 !! test
2851 Templates: Handle comments in the target
2852 !! wikitext
2853 {{echo
2854 <!-- should be ignored -->
2855 |foo}}
2856
2857 {{echo
2858 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2859 |foo}}
2860
2861 {{echo<!-- should be ignored -->
2862 |foo}}
2863
2864 {{echo<!-- should be ignored -->|foo}}
2865
2866 {{<!-- should be ignored -->echo|foo}}
2867 !! html/php
2868 <p>foo
2869 </p><p>foo
2870 </p><p>foo
2871 </p><p>foo
2872 </p><p>foo
2873 </p>
2874 !! html/parsoid
2875 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2876
2877 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2878
2879 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2880
2881 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2882
2883 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2884 !! end
2885
2886 !! test
2887 Templates: Handle comments in parameter names (T69657)
2888 !! wikitext
2889 {{echo|1
2890 <!-- should be ignored -->
2891 =foo}}
2892
2893 {{echo|
2894 <!-- should be ignored -->
2895 1 = foo}}
2896
2897 {{echo|1<!-- should be ignored -->=foo}}
2898
2899 {{echo|<!-- should be ignored -->1=foo}}
2900 !! html/php
2901 <p>foo
2902 </p><p>foo
2903 </p><p>foo
2904 </p><p>foo
2905 </p>
2906 !! html/parsoid
2907 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2908
2909 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2910
2911 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2912
2913 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2914 !! end
2915
2916 !! test
2917 Templates: Other wikitext in parameter names (T69657)
2918 !! wikitext
2919 {{echo|''1''=foo}}
2920 !! html/php
2921 <p>{{{1}}}
2922 </p>
2923 !! html/parsoid
2924 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2925 !! end
2926
2927 !! test
2928 Templates: With colons
2929 !! wikitext
2930 {{With: Colon}}
2931 !! html/php
2932 <p>Template with colon
2933 </p>
2934 !! html/parsoid
2935 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
2936 !! end
2937
2938 #--------------------------------------------------------------------
2939 # Transclusion parameter escaping tests
2940 #--------------------------------------------------------------------
2941
2942 !! test
2943 Templates: Parsoid parameter escaping test 1
2944 !! wikitext
2945 {{echo|[foo]|{{echo|[bar]}}}}
2946 !! html/php+tidy
2947 <p>[foo]
2948 </p>
2949 !! html/parsoid
2950 <p about="#mwt1" typeof="mw:Transclusion"
2951 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2952 !! end
2953
2954 !! test
2955 Parsoid: Pipes in external links in template parameter
2956 !! wikitext
2957 {{echo|[{{echo|http://example.com}} link]}}
2958 !! html/php+tidy
2959 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2960 </p>
2961 !! html/parsoid
2962 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2963 !! end
2964
2965 !! test
2966 Parsoid: pipe in transclusion parameter
2967 !! wikitext
2968 {{echo|http://foo.com/a&#124;b}}
2969 !! html/php+tidy
2970 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2971 </p>
2972 !! html/parsoid
2973 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
2974 !! end
2975
2976 !! test
2977 Parsoid: Pipe in external link target and content in template parameter
2978 !! options
2979 parsoid=html2wt,wt2wt
2980 !! wikitext
2981 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2982 !! html/php+tidy
2983 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2984 </p>
2985 !! html/parsoid
2986 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2987 typeof="mw:Transclusion"
2988 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2989 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2990 !! end
2991
2992 !! test
2993 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2994 !! options
2995 parsoid
2996 !! wikitext
2997 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2998 !! html
2999 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3000 !! end
3001
3002 !! test
3003 Templates: Don't escape already nowiki-escaped text in template parameters
3004 !! options
3005 parsoid=html2wt,wt2wt
3006 !! wikitext
3007 {{echo|foo<nowiki>|</nowiki>bar}}
3008 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3009 {{echo|<nowiki></nowiki>}}
3010 !! html/php+tidy
3011 <p>foo|bar
3012 &lt;div&gt;
3013
3014 </p>
3015 !! html/parsoid
3016 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3017 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3018 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3019 </p>
3020 !! end
3021
3022 ## T54824
3023 !! test
3024 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3025 !! options
3026 parsoid=html2wt,wt2wt
3027 !! wikitext
3028 {{echo|{{echo|1=bar}}}}
3029 !! html/php+tidy
3030 <p>bar
3031 </p>
3032 !! html/parsoid
3033 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3034 !! end
3035
3036 ## T58733
3037 !! test
3038 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3039 !! wikitext
3040 {{echo|a : b}}
3041 !! html/php+tidy
3042 <p>a&#160;: b
3043 </p>
3044 !! html/parsoid
3045 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3046 !! end
3047
3048 ## T73412
3049 !! test
3050 Templates: Preserve blank parameter names
3051 !! wikitext
3052 {{echo|=foo}}
3053 !! html/php+tidy
3054 <p>{{{1}}}
3055 </p>
3056 !! html/parsoid
3057 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3058 !! end
3059
3060 !! test
3061 Templates: Preserve blank parameter names in other positions
3062 !! wikitext
3063 {{blank_param|bar|=foo}}
3064 !! html/php+tidy
3065 <p>bar
3066 foo
3067 </p>
3068 !! html/parsoid
3069 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3070 foo</p>
3071 !! end
3072
3073 ###
3074 ### Parsoid-centric tests for testing RT edge cases for pre
3075 ###
3076
3077 !!test
3078 1a. Indent-Pre and Comments
3079 !! wikitext
3080 a
3081 <!--a-->
3082 c
3083 !! html
3084 <pre>a
3085 </pre>
3086 <p>c
3087 </p>
3088 !!end
3089
3090 !!test
3091 1b. Indent-Pre and Comments
3092 !! wikitext
3093 a
3094 <!--a-->
3095 c
3096 !! html
3097 <pre>a
3098 </pre>
3099 <p>c
3100 </p>
3101 !!end
3102
3103 !!test
3104 1c. Indent-Pre and Comments
3105 !! wikitext
3106 <!--a--> a
3107
3108 <!--a--> a
3109 !! html
3110 <pre> a
3111 </pre>
3112 <pre> a
3113 </pre>
3114 !!end
3115
3116 !!test
3117 1d. Indent-Pre and Comments
3118 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3119 !! wikitext
3120 <!--a--> a
3121
3122 <!--b-->b
3123 !! html
3124 <pre>a
3125 </pre>
3126 <pre>b
3127 </pre>
3128 !!end
3129
3130 !!test
3131 2a. Indent-Pre and tables
3132 !! wikitext
3133 {|
3134 |-
3135 !h1!!h2
3136 |foo||bar
3137 |}
3138 !! html
3139 <table>
3140
3141 <tr>
3142 <th>h1</th>
3143 <th>h2
3144 </th>
3145 <td>foo</td>
3146 <td>bar
3147 </td></tr></table>
3148
3149 !!end
3150
3151 !!test
3152 2b. Indent-Pre and tables
3153 !! wikitext
3154 {|
3155 |-
3156 |foo
3157 |}
3158 !! html
3159 <table>
3160
3161 <tr>
3162 <td>foo
3163 </td></tr></table>
3164
3165 !!end
3166
3167 !!test
3168 2c. Indent-Pre and tables (T44252)
3169 !! wikitext
3170 {|
3171 |+ foo
3172 ! | bar
3173 |}
3174 !! html
3175 <table>
3176 <caption> foo
3177 </caption>
3178 <tr>
3179 <th> bar
3180 </th></tr></table>
3181
3182 !!end
3183
3184 !!test
3185 2d. Indent-Pre and tables
3186 !! wikitext
3187 a
3188 {|
3189 | b
3190 |}
3191 !! html/php
3192 <pre>a
3193 </pre>
3194 <table>
3195 <tr>
3196 <td> b
3197 </td></tr></table>
3198
3199 !! html/parsoid
3200 <pre>a</pre>
3201 <table>
3202 <tbody><tr><td> b</td></tr>
3203 </tbody></table>
3204 !!end
3205
3206 !!test
3207 2e. Indent-Pre and table-line syntax
3208 !! wikitext
3209 a
3210 | b
3211 | c
3212 !! html/php
3213 <pre>a
3214 | b
3215 | c
3216 </pre>
3217 !!end
3218
3219 !!test
3220 2f. Indent-pre started by table-line syntax
3221 !! wikitext
3222 a
3223 | b
3224 | c
3225 !! html/php
3226 <p>a
3227 </p>
3228 <pre>| b
3229 | c
3230 </pre>
3231 !! html/parsoid
3232 <p>a</p>
3233 <pre>
3234 | b
3235 | c</pre>
3236 !!end
3237
3238 !! test
3239 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3240 !! wikitext
3241 <table>
3242 <tr>
3243 <td>
3244 Text that should be rendered preformatted
3245 </td>
3246 </tr>
3247 </table>
3248 !! html
3249 <table>
3250 <tr>
3251 <td>
3252 <pre>Text that should be rendered preformatted
3253 </pre>
3254 </td>
3255 </tr>
3256 </table>
3257
3258 !! end
3259
3260 !!test
3261 3a. Indent-Pre and block tags (single-line html)
3262 !! wikitext
3263 a <p> foo </p>
3264 b <div> foo </div>
3265 c <blockquote> foo </blockquote>
3266 <span> foo </span>
3267 !! html
3268 a <p> foo </p>
3269 b <div> foo </div>
3270 c <blockquote> foo </blockquote>
3271 <pre><span> foo </span>
3272 </pre>
3273 !! html/parsoid
3274 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3275 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3276 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3277 <pre><span> foo </span>
3278 </pre>
3279 !! html/php+tidy
3280 <p> a </p><p> foo </p><p>
3281 b </p><div> foo </div><p>
3282 c </p><blockquote><p> foo </p></blockquote>
3283 <pre><span> foo </span>
3284 </pre>
3285 !! end
3286
3287 !!test
3288 3b. Indent-Pre and block tags (multi-line html)
3289 !! wikitext
3290 a <span>foo</span>
3291 b <div> foo </div>
3292 !! html
3293 <pre>a <span>foo</span>
3294 </pre>
3295 b <div> foo </div>
3296
3297 !! html/parsoid
3298 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3299 b <div data-parsoid='{"stx":"html"}'> foo </div>
3300 !! html/php+tidy
3301 <pre>a <span>foo</span>
3302 </pre><p>
3303 b </p><div> foo </div>
3304 !!end
3305
3306 !!test
3307 3c. Indent-Pre and block tags (pre-content on separate line)
3308 !! wikitext
3309 <p>
3310 foo
3311 </p>
3312
3313 <div>
3314 foo
3315 </div>
3316
3317 <center>
3318 foo
3319 </center>
3320
3321 <blockquote>
3322 foo
3323 </blockquote>
3324
3325 <blockquote>
3326 <pre>
3327 foo
3328 </pre>
3329 </blockquote>
3330
3331 <table><tr><td>
3332 foo
3333 </td></tr></table>
3334
3335 <ul><li>
3336 foo
3337 </li></ul>
3338
3339 !! html
3340 <p>
3341 foo
3342 </p>
3343 <div>
3344 <pre>foo
3345 </pre>
3346 </div>
3347 <center>
3348 <pre>foo
3349 </pre>
3350 </center>
3351 <blockquote>
3352 <p> foo
3353 </p>
3354 </blockquote>
3355 <blockquote>
3356 <pre>
3357 foo
3358 </pre>
3359 </blockquote>
3360 <table><tr><td>
3361 <pre>foo
3362 </pre>
3363 </td></tr></table>
3364 <ul><li>
3365 foo
3366 </li></ul>
3367
3368 !!end
3369
3370 !! test
3371 4. Indent-Pre and extension tags
3372 !! wikitext
3373 a <tag />
3374 !! html/php
3375 a <pre>
3376 NULL
3377 array (
3378 )
3379 </pre>
3380
3381 !! html/parsoid
3382 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3383 !! end
3384
3385 !! test
3386 5. Indent-Pre and html pre
3387 !! wikitext
3388 <pre class="123">hi</pre>
3389 !! html/php
3390 <pre class="123">hi</pre>
3391
3392 !! html/parsoid
3393 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3394 !! end
3395
3396 !!test
3397 Render paragraphs when indent-pre is suppressed in blocklevels
3398 !! wikitext
3399 <blockquote>
3400 foo
3401
3402 bar
3403 </blockquote>
3404 !! html
3405 <blockquote>
3406 <p> foo
3407 </p><p> bar
3408 </p>
3409 </blockquote>
3410
3411 !!end
3412
3413 !!test
3414 4. Multiple spaces at start-of-line
3415 !! wikitext
3416 <p> foo </p>
3417 foo
3418 {|
3419 |foo
3420 |}
3421 !! html
3422 <p> foo </p>
3423 <pre> foo
3424 </pre>
3425 <table>
3426 <tr>
3427 <td>foo
3428 </td></tr></table>
3429
3430 !!end
3431
3432 ## NOTE: the leading white-space chars on empty line are significant
3433 !! test
3434 5a. White-space in indent-pre
3435 !! wikitext
3436 a<br />
3437
3438 b
3439 !! html
3440 <pre>a<br />
3441
3442 b
3443 </pre>
3444 !! end
3445
3446 ## NOTE: the leading white-space chars on empty line are significant
3447 !! test
3448 5b. White-space in indent-pre
3449 !! wikitext
3450 a
3451
3452 b
3453
3454
3455 c
3456 !! html
3457 <pre>a
3458
3459 b
3460
3461
3462 c
3463 </pre>
3464 !! end
3465
3466 !! test
3467 5c. White-space in indent-pre
3468 !! wikitext
3469 ''a''
3470 ''b''
3471 ''c''
3472 !! html
3473 <pre><i>a</i>
3474 <i>b</i>
3475 <i>c</i>
3476 </pre>
3477 !! end
3478
3479 !! test
3480 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3481 !! wikitext
3482 a
3483
3484 <!-- continue -->
3485 b
3486
3487 c
3488
3489 d
3490 !! html
3491 <pre>a
3492
3493 b
3494 </pre>
3495 <pre>c
3496
3497 </pre>
3498 <p>d
3499 </p>
3500 !! end
3501
3502 !! test
3503 7a. Indent-pre and category links
3504 !! options
3505 parsoid=wt2html,wt2wt
3506 !! wikitext
3507 [[Category:foo]] <!-- No pre-wrapping -->
3508 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3509 !! html/php+tidy
3510 !! html/parsoid
3511 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3512 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3513 !! end
3514
3515 ## We used to, but no longer wt2wt this test since the default serializer
3516 ## will normalize all categories to serialize on their own line.
3517 ## This wikitext usage is going to be fairly uncommon in production and
3518 ## selser will take care of preserving formatting in those scenarios.
3519 !! test
3520 7b. Indent-pre and category links
3521 !! options
3522 parsoid=wt2html
3523 !! wikitext
3524 [[Category:foo]] a
3525 [[Category:foo]] {{echo|b}}
3526 !! html/parsoid
3527 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3528 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3529 !! end
3530
3531 !! test
3532 Indent-Pre: Newlines in comments shouldn't affect sol state
3533 !! wikitext
3534 a <!--
3535 foo
3536 --> b
3537 !! html/php+tidy
3538 <p>a b
3539 </p>
3540 !! html/parsoid
3541 <p>a <!--
3542 foo
3543 --> b</p>
3544 !! end
3545
3546 ###
3547 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3548 ###
3549
3550 !!test
3551 HTML-pre: 1. embedded newlines
3552 !! wikitext
3553 <pre>foo</pre>
3554
3555 <pre>
3556 foo
3557 </pre>
3558
3559 <pre>
3560
3561 foo
3562 </pre>
3563
3564 <pre>
3565
3566
3567 foo
3568 </pre>
3569 !! html/php+tidy
3570 <pre>foo</pre>
3571 <pre>foo
3572 </pre>
3573 <pre>
3574
3575 foo
3576 </pre>
3577 <pre>
3578
3579
3580 foo
3581 </pre>
3582 !! html/parsoid
3583 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3584
3585 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3586 </pre>
3587
3588 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3589
3590 foo
3591 </pre>
3592
3593 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3594
3595
3596 foo
3597 </pre>
3598 !!end
3599
3600 !! test
3601 HTML-pre: big spaces
3602 !! wikitext
3603 <pre>
3604
3605
3606
3607
3608 haha
3609
3610
3611
3612
3613 haha
3614
3615
3616
3617
3618 </pre>
3619 !! html/php+tidy
3620 <pre>
3621
3622
3623
3624
3625 haha
3626
3627
3628
3629
3630 haha
3631
3632
3633
3634
3635 </pre>
3636 !! html/parsoid
3637 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3638
3639
3640
3641
3642 haha
3643
3644
3645
3646
3647 haha
3648
3649
3650
3651
3652 </pre>
3653 !! end
3654
3655 !!test
3656 HTML-pre: 2: indented text
3657 !! wikitext
3658 <pre>
3659 foo
3660 </pre>
3661 !! html
3662 <pre>
3663 foo
3664 </pre>
3665
3666 !!end
3667
3668 !!test
3669 HTML-pre: 3: other wikitext
3670 !! wikitext
3671 <pre>
3672 * foo
3673 # bar
3674 = no-h =
3675 '' no-italic ''
3676 [[ NoLink ]]
3677 </pre>
3678 !! html/php
3679 <pre>
3680 * foo
3681 # bar
3682 = no-h =
3683 '' no-italic ''
3684 [[ NoLink ]]
3685 </pre>
3686
3687 !! html/parsoid
3688 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3689 # bar
3690 = no-h =
3691 '' no-italic ''
3692 [[ NoLink ]]
3693 </pre>
3694 !!end
3695
3696 ###
3697 ### Definition lists
3698 ###
3699 !! test
3700 Simple definition
3701 !! wikitext
3702 ; name : Definition
3703 !! html
3704 <dl><dt> name&#160;</dt>
3705 <dd> Definition</dd></dl>
3706
3707 !! end
3708
3709 !! test
3710 Definition list for indentation only
3711 !! wikitext
3712 : Indented text
3713 !! html
3714 <dl><dd> Indented text</dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition list with no space
3720 !! wikitext
3721 ;name:Definition
3722 !! html
3723 <dl><dt>name</dt>
3724 <dd>Definition</dd></dl>
3725
3726 !!end
3727
3728 !! test
3729 Definition list with URL link
3730 !! wikitext
3731 ; http://example.com/ : definition
3732 !! html
3733 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3734 <dd> definition</dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition list with bracketed URL link
3740 !! wikitext
3741 ;[http://www.example.com/ Example]:Something about it
3742 !! html
3743 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3744 <dd>Something about it</dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition list with wikilink containing colon
3750 !! wikitext
3751 ; [[Help:FAQ]]: The least-read page on Wikipedia
3752 !! html
3753 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3754 <dd> The least-read page on Wikipedia</dd></dl>
3755
3756 !! end
3757
3758 # At Brion's and JeLuF's insistence... :)
3759 !! test
3760 Definition list with news link containing colon
3761 !! wikitext
3762 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3763 !! html/php
3764 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3765 <dd> This isn't even a real newsgroup!</dd></dl>
3766
3767 !! html/parsoid
3768 <dl><dt> <a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3769 !! end
3770
3771 !! test
3772 Malformed definition list with colon
3773 !! wikitext
3774 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3775 !! html
3776 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3777
3778 !! end
3779
3780 !! test
3781 Definition lists: colon in external link text
3782 !! wikitext
3783 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3784 !! html
3785 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3786 <dd> OK, I made that up</dd></dl>
3787
3788 !! end
3789
3790 !! test
3791 Definition lists: colon in HTML attribute
3792 !! wikitext
3793 ;<b style="display: inline">bold</b>
3794 !! html
3795 <dl><dt><b style="display: inline">bold</b></dt></dl>
3796
3797 !! end
3798
3799 !! test
3800 Definition lists: self-closed tag
3801 !! wikitext
3802 ;one<br/>two : two-line fun
3803 !! html
3804 <dl><dt>one<br />two&#160;</dt>
3805 <dd> two-line fun</dd></dl>
3806
3807 !! end
3808
3809 !! test
3810 Definition lists: ignore colons inside tags
3811 !! wikitext
3812 ;one <b>two : tag <i>fun:</i>:</b>: def
3813 !! html
3814 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3815 <dd> def</dd></dl>
3816
3817 !! end
3818
3819 !! test
3820 Definition lists: excess closed tags
3821 !! wikitext
3822 ;one</b>two : bad tag fun
3823 !! html/php+tidy
3824 <dl><dt>onetwo&#160;</dt>
3825 <dd> bad tag fun</dd></dl>
3826 !! html/parsoid
3827 <dl>
3828 <dt>onetwo</dt>
3829 <dd>bad tag fun</dd>
3830 </dl>
3831 !! end
3832
3833 !! test
3834 T13748: Literal closing tags
3835 !! wikitext
3836 <dl>
3837 <dt>test 1</dt>
3838 <dd>test test test test test</dd>
3839 <dt>test 2</dt>
3840 <dd>test test test test test</dd>
3841 </dl>
3842 !! html
3843 <dl>
3844 <dt>test 1</dt>
3845 <dd>test test test test test</dd>
3846 <dt>test 2</dt>
3847 <dd>test test test test test</dd>
3848 </dl>
3849
3850 !! end
3851
3852 !! test
3853 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3854 !! wikitext
3855 <ul><li>
3856 ; term : description
3857 * unordered
3858 </li></ul>
3859 !! html
3860 <ul><li>
3861 <dl><dt> term&#160;</dt>
3862 <dd> description</dd></dl>
3863 <ul><li> unordered</li></ul>
3864 </li></ul>
3865
3866 !! end
3867
3868 !! test
3869 Definition list with empty definition and following paragraph
3870 !! wikitext
3871 ; term:
3872 Paragraph text
3873 !! html
3874 <dl><dt> term</dt>
3875 <dd></dd></dl>
3876 <p>Paragraph text
3877 </p>
3878 !! end
3879
3880 !! test
3881 Nested definition lists using html syntax
3882 !! wikitext
3883 <dl><dt>x</dt>
3884 <dd>a</dd>
3885 <dd>b</dd></dl>
3886 !! html
3887 <dl><dt>x</dt>
3888 <dd>a</dd>
3889 <dd>b</dd></dl>
3890
3891 !! end
3892
3893 !! test
3894 Definition Lists: No nesting: Multiple dd's
3895 !! wikitext
3896 ;x
3897 :a
3898 :b
3899 !! html
3900 <dl><dt>x</dt>
3901 <dd>a</dd>
3902 <dd>b</dd></dl>
3903
3904 !! end
3905
3906 !! test
3907 Definition Lists: Indentation: Regular
3908 !! wikitext
3909 :i1
3910 ::i2
3911 :::i3
3912 !! html
3913 <dl><dd>i1
3914 <dl><dd>i2
3915 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3916
3917 !! end
3918
3919 !! test
3920 Definition Lists: Indentation: Missing 1st level
3921 !! wikitext
3922 ::i2
3923 :::i3
3924 !! html
3925 <dl><dd><dl><dd>i2
3926 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3927
3928 !! end
3929
3930 !! test
3931 Definition Lists: Indentation: Multi-level indent
3932 !! wikitext
3933 :::i3
3934 !! html
3935 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3936
3937 !! end
3938
3939 !! test
3940 Definition Lists: Hacky use to indent tables
3941 !! wikitext
3942 ::{|
3943 |foo
3944 |bar
3945 |}
3946 this text
3947 should be left alone
3948 !! html
3949 <dl><dd><dl><dd><table>
3950 <tr>
3951 <td>foo
3952 </td>
3953 <td>bar
3954 </td></tr></table></dd></dl></dd></dl>
3955 <p>this text
3956 should be left alone
3957 </p>
3958 !! end
3959
3960 !! test
3961 Definition Lists: Hacky use to indent tables, with comments (T65979)
3962 !! wikitext
3963 <!-- foo -->
3964 ::{|
3965 |foo
3966 |bar
3967 |}<!-- bar -->
3968 this text
3969 should be left alone
3970 !! html/parsoid
3971 <!-- foo -->
3972 <dl><dd><dl><dd><table><tr>
3973 <td>foo</td>
3974 <td>bar</td>
3975 </tr></table><!-- bar --></dd></dl></dd></dl>
3976 <p>this text
3977 should be left alone</p>
3978 !! end
3979
3980 !! test
3981 Definition Lists: Hacky use to indent tables, with comment before table
3982 !! wikitext
3983 ::<!-- foo -->{|
3984 |foo
3985 |}
3986 !! html/parsoid
3987 <dl><dd><dl><dd><!-- foo --><table><tr>
3988 <td>foo</td>
3989 </tr></table></dd></dl></dd></dl>
3990 !! end
3991
3992 # The trailing whitespace in this test is to catch a regression in
3993 # Parsoid after T54473.
3994 !! test
3995 Definition Lists: Hacky use to indent tables (WS-insensitive)
3996 !! wikitext
3997 : {|
3998 |a
3999 |}
4000 !! html/php
4001 <dl><dd><table>
4002 <tr>
4003 <td>a
4004 </td></tr></table></dd></dl>
4005
4006 !! html/parsoid
4007 <dl><dd> <table>
4008 <tbody><tr><td>a</td></tr>
4009 </tbody></table> </dd></dl>
4010 !! end
4011
4012 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4013 ## as an empty dt item. It also ignores all but the last ";" when followed
4014 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4015 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4016 ## ";"s.
4017 ##
4018 ## Ex: ";;t2 ::d2" is transformed into:
4019 ##
4020 ## <dl>
4021 ## <dt>t2 </dt>
4022 ## <dd>
4023 ## <dl>
4024 ## <dt></dt>
4025 ## <dd>d2</dd>
4026 ## </dl>
4027 ## </dd>
4028 ## </dl>
4029 ##
4030 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4031 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4032 ##
4033 ## <dl>
4034 ## <dt>
4035 ## <dl>
4036 ## <dt>t2 </dt>
4037 ## <dd>:d2</dd>
4038 ## </dl>
4039 ## </dt>
4040 ## </dl>
4041 ##
4042 ## All Parsoid only definition list tests have this difference.
4043 ##
4044 ## See also: https://phabricator.wikimedia.org/T8569
4045 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4046
4047 !! test
4048 Table / list interaction: indented table with lists in table contents
4049 !! wikitext
4050 :{|
4051 |-
4052 | a
4053 * b
4054 |-
4055 | c
4056 * d
4057 |}
4058 !! html
4059 <dl><dd><table>
4060
4061 <tr>
4062 <td> a
4063 <ul><li> b</li></ul>
4064 </td></tr>
4065 <tr>
4066 <td> c
4067 <ul><li> d</li></ul>
4068 </td></tr></table></dd></dl>
4069
4070 !! end
4071
4072 !!test
4073 Table / list interaction: lists nested in tables nested in indented lists
4074 !! wikitext
4075 :{|
4076 |
4077 :a
4078 :b
4079 |
4080 *c
4081 *d
4082 |}
4083
4084 *e
4085 *f
4086 !! html
4087 <dl><dd><table>
4088 <tr>
4089 <td>
4090 <dl><dd>a</dd>
4091 <dd>b</dd></dl>
4092 </td>
4093 <td>
4094 <ul><li>c</li>
4095 <li>d</li></ul>
4096 </td></tr></table></dd></dl>
4097 <ul><li>e</li>
4098 <li>f</li></ul>
4099
4100 !!end
4101
4102 !! test
4103 Definition Lists: Nesting: Multi-level (Parsoid only)
4104 !! wikitext
4105 ;t1 :d1
4106 ;;t2 ::d2
4107 ;;;t3 :::d3
4108 !! html/parsoid
4109 <dl>
4110 <dt>t1 </dt>
4111 <dd>d1</dd>
4112 <dt>
4113 <dl>
4114 <dt>t2 </dt>
4115 <dd>:d2</dd>
4116 <dt>
4117 <dl>
4118 <dt>t3 </dt>
4119 <dd>::d3</dd>
4120 </dl>
4121 </dt>
4122 </dl>
4123 </dt>
4124 </dl>
4125
4126
4127 !! end
4128
4129
4130 !! test
4131 Definition Lists: Nesting: Test 2
4132 !! wikitext
4133 ;t1
4134 ::d2
4135 !! html+tidy
4136 <dl><dt>t1</dt>
4137 <dd>
4138 <dl><dd>d2</dd></dl></dd></dl>
4139 !! end
4140
4141
4142 !! test
4143 Definition Lists: Nesting: Test 3
4144 !! wikitext
4145 :;t1
4146 ::::d2
4147 !! html+tidy
4148 <dl><dd><dl><dt>t1</dt>
4149 <dd>
4150 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Nesting: Test 4
4156 !! wikitext
4157 ::;t3
4158 :::d3
4159 !! html
4160 <dl><dd><dl><dd><dl><dt>t3</dt>
4161 <dd>d3</dd></dl></dd></dl></dd></dl>
4162
4163 !! end
4164
4165
4166 ## The Parsoid team believes the following three test exposes a
4167 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4168 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4169 ## It also exposes a "misfeature" in tidy, which doesn't like
4170 ## <dl> tags with a single <dt> child; it converts the <dt> into
4171 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4172 !! test
4173 Definition Lists: Mixed Lists: Test 1
4174 !! wikitext
4175 :;* foo
4176 ::* bar
4177 :; baz
4178 !! html/php
4179 <dl><dd><dl><dt><ul><li> foo</li>
4180 <li> bar</li></ul></dt></dl>
4181 <dl><dt> baz</dt></dl></dd></dl>
4182
4183 !! html/php+tidy
4184 <dl><dd><dl><dt><ul><li> foo</li>
4185 <li> bar</li></ul></dt></dl>
4186 <dl><dt> baz</dt></dl></dd></dl>
4187 !! html/parsoid
4188 <dl>
4189 <dd><dl>
4190 <dt><ul>
4191 <li> foo
4192 </li>
4193 </ul></dt>
4194 <dd><ul>
4195 <li> bar
4196 </li>
4197 </ul></dd>
4198 <dt> baz</dt>
4199 </dl></dd>
4200 </dl>
4201 !! end
4202
4203 !! test
4204 Definition Lists: Mixed Lists: Test 2
4205 !! wikitext
4206 *: d1
4207 *: d2
4208 !! html
4209 <ul><li><dl><dd> d1</dd>
4210 <dd> d2</dd></dl></li></ul>
4211
4212 !! end
4213
4214
4215 !! test
4216 Definition Lists: Mixed Lists: Test 3
4217 !! wikitext
4218 *::: d1
4219 *::: d2
4220 !! html
4221 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4222 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4223
4224 !! end
4225
4226
4227 !! test
4228 Definition Lists: Mixed Lists: Test 4
4229 !! wikitext
4230 *;d1 :d2
4231 *;d3 :d4
4232 !! html
4233 <ul><li><dl><dt>d1&#160;</dt>
4234 <dd>d2</dd>
4235 <dt>d3&#160;</dt>
4236 <dd>d4</dd></dl></li></ul>
4237
4238 !! end
4239
4240
4241 !! test
4242 Definition Lists: Mixed Lists: Test 5
4243 !! wikitext
4244 *:d1
4245 *:: d2
4246 !! html
4247 <ul><li><dl><dd>d1
4248 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4249
4250 !! end
4251
4252
4253 !! test
4254 Definition Lists: Mixed Lists: Test 6
4255 !! wikitext
4256 #*:d1
4257 #*::: d3
4258 !! html
4259 <ol><li><ul><li><dl><dd>d1
4260 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4261
4262 !! end
4263
4264
4265 !! test
4266 Definition Lists: Mixed Lists: Test 7
4267 !! wikitext
4268 :* d1
4269 :* d2
4270 !! html
4271 <dl><dd><ul><li> d1</li>
4272 <li> d2</li></ul></dd></dl>
4273
4274 !! end
4275
4276
4277 !! test
4278 Definition Lists: Mixed Lists: Test 8
4279 !! wikitext
4280 :* d1
4281 ::* d2
4282 !! html
4283 <dl><dd><ul><li> d1</li></ul>
4284 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4285
4286 !! end
4287
4288
4289 !! test
4290 Definition Lists: Mixed Lists: Test 9
4291 !! wikitext
4292 *;foo :bar
4293 !! html
4294 <ul><li><dl><dt>foo&#160;</dt>
4295 <dd>bar</dd></dl></li></ul>
4296
4297 !! end
4298
4299
4300 !! test
4301 Definition Lists: Mixed Lists: Test 10
4302 !! wikitext
4303 *#;foo :bar
4304 !! html
4305 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4306 <dd>bar</dd></dl></li></ol></li></ul>
4307
4308 !! end
4309
4310 # The Parsoid team disagrees with the PHP parser's seemingly-random
4311 # rules regarding dd/dt on the next few tests. Parsoid is more
4312 # consistent, and recognizes the shared nesting and keeps the
4313 # still-open tags around until the nesting is complete.
4314
4315 # This is a regression test for T175099
4316 !! test
4317 Definition Lists: Mixed Lists: Test 11
4318 !! wikitext
4319 ;a
4320 :*b
4321 !! html/php
4322 <dl><dt>a</dt>
4323 <dd>
4324 <ul><li>b</li></ul></dd></dl>
4325
4326 !! html/parsoid
4327 <dl><dt>a
4328 <dd><ul><li>b</li></ul></dd></dl>
4329 !! end
4330
4331 # FIXME: Maybe get rid of this test?
4332 !! test
4333 Definition Lists: Mixed Lists: Test 12
4334 !! wikitext
4335 *#*#;*;;foo :bar
4336 *#*#;boo :baz
4337 !! html/php
4338 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4339 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4340 <dl><dt>boo&#160;</dt>
4341 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4342
4343 !! html/php+tidy
4344 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4345 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4346 <dl><dt>boo&#160;</dt>
4347 <dd>baz</dd></dl></li></ol></li></ul>
4348 !! html/parsoid
4349 <ul>
4350 <li>
4351 <ol>
4352 <li>
4353 <ul>
4354 <li>
4355 <ol>
4356 <li>
4357 <dl>
4358 <dt>
4359 <ul>
4360 <li>
4361 <dl>
4362 <dt>
4363 <dl>
4364 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4365 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4366 </dl></dt>
4367 </dl></li>
4368 </ul></dt>
4369 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4370 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4371 </dl></li>
4372 </ol></li>
4373 </ul></li>
4374 </ol></li>
4375 </ul>
4376 !! end
4377
4378 # FIXME: Maybe get rid of this test?
4379 # From whitelist:
4380 # * The test is wrong, there are two colons where there should be :;
4381 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4382 !! test
4383 Definition Lists: Weird Ones: Test 1
4384 !! wikitext
4385 *#;*::;; foo : bar (who uses this?)
4386 !! html/php+tidy
4387 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4388 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4389 !! html/parsoid
4390 <ul>
4391 <li>
4392 <ol>
4393 <li>
4394 <dl>
4395 <dt>
4396 <ul>
4397 <li>
4398 <dl>
4399 <dd>
4400 <dl>
4401 <dd>
4402 <dl>
4403 <dt>
4404 <dl>
4405 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4406 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4407 </dl></dt>
4408 </dl></dd>
4409 </dl></dd>
4410 </dl></li>
4411 </ul></dt>
4412 </dl></li>
4413 </ol></li>
4414 </ul>
4415 !! end
4416
4417 !! test
4418 Definition Lists: colons occurring in tags
4419 !! wikitext
4420 ;a:b
4421 ;'''a:b'''
4422 ;<i>a:b</i>
4423 ;<span>a:b</span>
4424 ;<div>a:b</div>
4425 ;<div>a
4426 :b</div>
4427 ;{{echo|a:b}}
4428 ;{{echo|''a:b''}}
4429 ;;;''a:b''
4430 !! html+tidy
4431 <dl><dt>a</dt>
4432 <dd>b</dd>
4433 <dt><b>a:b</b></dt>
4434 <dt><i>a:b</i></dt>
4435 <dt><span>a:b</span></dt>
4436 <dt><div>a:b</div></dt>
4437 <dt><div>a</div></dt>
4438 <dd>b</dd>
4439 <dt>a</dt>
4440 <dd>b</dd>
4441 <dt><i>a:b</i></dt></dl>
4442 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4443 !! html/parsoid
4444 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4445 <dt><b>a:b</b></dt>
4446 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4447 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4448 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4449 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4450 <dd>b</dd>
4451 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4452 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4453 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4454 !! end
4455
4456 # Parsoid's output differs here again because it shares
4457 # nesting between the two lists unlike the PHP parser.
4458 # Unsure which is more desirable.
4459 !! test
4460 Definition Lists: colons and tables 1
4461 !! wikitext
4462 :{|
4463 | x
4464 |}
4465 :{|
4466 | y
4467 |}
4468 !! html/php
4469 <dl><dd><table>
4470 <tr>
4471 <td> x
4472 </td></tr></table></dd></dl>
4473 <dl><dd><table>
4474 <tr>
4475 <td> y
4476 </td></tr></table></dd></dl>
4477
4478 !! html/parsoid
4479 <dl><dd><table>
4480 <tr>
4481 <td> x
4482 </td></tr></table></dd>
4483 <dd><table>
4484 <tr>
4485 <td> y
4486 </td></tr></table></dd></dl>
4487 !! end
4488
4489 # FIXME: Does this need a html/php section?
4490 !! test
4491 Definition Lists: template interaction
4492 !! wikitext
4493 ::{{definition_list}}
4494
4495 :one
4496 ::{{definition_list}}
4497 :::two
4498 :::three
4499 ::four
4500 !! html/parsoid
4501 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4502 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4503
4504 <dl><dd data-parsoid='{}'>one
4505 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4506 </span><dd about="#mwt2">two
4507 <dl><dd>two</dd>
4508 <dd>three</dd></dl></dd>
4509 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4510 !! end
4511
4512
4513 ###
4514 ### External links
4515 ###
4516 !! test
4517 External links: non-bracketed
4518 !! wikitext
4519 Non-bracketed: http://example.com
4520 !! html
4521 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4522 </p>
4523 !! end
4524
4525 # parsoid doesn't explicitly mark autonumbered links, see T55505
4526 !! test
4527 External links: numbered
4528 !! wikitext
4529 Numbered: [http://example.com]
4530 Numbered: [http://example.net]
4531 Numbered: [http://example.com]
4532 !! html/php
4533 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4534 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4535 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4536 </p>
4537 !! html/parsoid
4538 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4539 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4540 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4541 !!end
4542
4543 !! test
4544 External links: specified text
4545 !! wikitext
4546 Specified text: [http://example.com link]
4547 !! html
4548 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4549 </p>
4550 !!end
4551
4552 !! test
4553 External links: trail
4554 !! wikitext
4555 Linktrails should not work for external links: [http://example.com link]s
4556 !! html
4557 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: dollar sign in URL
4563 !! wikitext
4564 http://example.com/1$2345
4565 !! html
4566 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4567 </p>
4568 !! end
4569
4570 # parsoid doesn't explicitly mark autonumbered links, see T55505
4571 !! test
4572 External links: dollar sign in URL (autonumber)
4573 !! wikitext
4574 [http://example.com/1$2345]
4575 !! html/php
4576 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4577 </p>
4578 !! html/parsoid
4579 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4580 !!end
4581
4582 !! test
4583 External links: open square bracket forbidden in URL (T6377)
4584 !! options
4585 parsoid=wt2html,wt2wt,html2html
4586 !! wikitext
4587 http://example.com/1[2345
4588 !! html/php
4589 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4590 </p>
4591 !! html/parsoid
4592 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4593 !! end
4594
4595 !! test
4596 External links: open square bracket forbidden in URL (named) (T6377)
4597 !! options
4598 parsoid=wt2html,html2html
4599 !! wikitext
4600 [http://example.com/1[2345]
4601 !! html/php
4602 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4603 </p>
4604 !! html/parsoid
4605 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4606 !!end
4607
4608 # parsoid adds a space before the link name
4609 !! test
4610 External links: open square bracket forbidden in URL (named) (T6377)
4611 Parsoid variant.
4612 !! wikitext
4613 [http://example.com/1 [2345]
4614 !! html
4615 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: nowiki in URL link text (T8230)
4621 !! wikitext
4622 [http://example.com/ <nowiki>''example site''</nowiki>]
4623 !! html
4624 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: newline forbidden in text (T8230 regression check)
4630 !! wikitext
4631 [http://example.com/ first
4632 second]
4633 !! html
4634 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4635 second]
4636 </p>
4637 !!end
4638
4639 !! test
4640 External links: Pipe char between url and text
4641 !! wikitext
4642 [http://example.com | link]
4643 !! html
4644 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4645 </p>
4646 !!end
4647
4648 !! test
4649 External links: protocol-relative URL in brackets
4650 !! wikitext
4651 [//example.com/ Test]
4652 !! html
4653 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4654 </p>
4655 !! end
4656
4657 # parsoid doesn't explicitly mark autonumbered links, see T55505
4658 !! test
4659 External links: protocol-relative URL in brackets without text
4660 !! wikitext
4661 [//example.com]
4662 !! html/php
4663 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4664 </p>
4665 !! html/parsoid
4666 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4667 !! end
4668
4669 !! test
4670 External links: protocol-relative URL in free text is left alone
4671 !! wikitext
4672 //example.com/Foo
4673 !! html
4674 <p>//example.com/Foo
4675 </p>
4676 !!end
4677
4678 !! test
4679 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4680 !! wikitext
4681 foo//example.com/Foo
4682 !! html
4683 <p>foo//example.com/Foo
4684 </p>
4685 !! end
4686
4687 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4688 !! test
4689 External links: with no contents
4690 !! options
4691 parsoid=wt2html,wt2wt
4692 !! wikitext
4693 [http://en.wikipedia.org/wiki/Foo]
4694
4695 [[wikipedia:Foo|Bar]]
4696
4697 [[wikipedia:Foo|<span>Bar</span>]]
4698 !! html/php
4699 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4701 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4702 </p>
4703 !! html/parsoid
4704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4705 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4706 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4707 !! end
4708
4709 !! test
4710 External links: Free with trailing punctuation
4711 !! wikitext
4712 http://example.com,
4713 http://example.com;
4714 http://example.com\
4715 http://example.com.
4716 http://example.com:
4717 http://example.com!
4718 http://example.com?
4719 http://example.com)
4720 http://example.com/url_with_(brackets)
4721 (http://example.com/url_without_brackets)
4722 http://example.com/url_with_entity&amp;
4723 http://example.com/url_with_entity&#x26;
4724 http://example.com/url_with_entity&#038;
4725 http://example.com/url_with_entity&nbsp;
4726 http://example.com/url_with_entity&#xA0;
4727 http://example.com/url_with_entity&#160;
4728 http://example.com/url_with_entity&lt;
4729 http://example.com/url_with_entity&#x3C;
4730 http://example.com/url_with_entity&#60;
4731 !! html/php
4732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4739 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4740 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4741 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4750 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4751 </p>
4752 !! html/parsoid
4753 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4754 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4755 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4756 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4757 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4758 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4759 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4760 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4761 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4762 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4763 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4766 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4767 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4768 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4769 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4770 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4771 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4772 !! end
4773
4774 !! test
4775 External links: tricky Parsoid html2html case
4776 !! options
4777 parsoid=wt2html,wt2wt,html2html
4778 !! wikitext
4779 http://example.com/url_with_entity&amp;amp;
4780 !! html/php
4781 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4782 </p>
4783 !! html/parsoid
4784 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4785 !! end
4786
4787 !! test
4788 External links: Free with trailing quotes (T113666)
4789 !! wikitext
4790 '''News:''' Stuff here
4791
4792 news:'a'b''c''d e
4793 !! html/php
4794 <p><b>News:</b> Stuff here
4795 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4796 </p>
4797 !! html/parsoid
4798 <p><b>News:</b> Stuff here</p>
4799 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4800 !! end
4801
4802 !! test
4803 External links: with entity
4804 !! wikitext
4805 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4806 !! html/php
4807 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4808 </p>
4809 !! html/parsoid
4810 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
4811 !! end
4812
4813 !! test
4814 External links: Lone protocols are never linked (T105697)
4815 !! wikitext
4816 http://
4817 http://;
4818 (http://)
4819 bitcoin:
4820 bitcoin:;
4821 (bitcoin:)
4822 !! html
4823 <p>http://
4824 http://;
4825 (http://)
4826 bitcoin:
4827 bitcoin:;
4828 (bitcoin:)
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: No preceding word characters allowed (T67278)
4834 !! wikitext
4835 NOPEhttp://example.com
4836 N0http://example.com
4837 ok:http://example.com
4838 ok-http://example.com
4839 !! html
4840 <p>NOPEhttp://example.com
4841 N0http://example.com
4842 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4843 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: nofollow domain exception
4849 !! wikitext
4850 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4851 !! html
4852 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4853 </p>
4854 !!end
4855
4856 !! test
4857 External image
4858 !! wikitext
4859 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4860 !! html
4861 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External image from https
4867 !! wikitext
4868 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4869 !! html
4870 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External image (when not allowed)
4876 !! options
4877 wgAllowExternalImages=0
4878 !! wikitext
4879 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4880 !! html
4881 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4882 </p>
4883 !! end
4884
4885 !! test
4886 Link to non-http image, no img tag
4887 !! wikitext
4888 Link to non-http image, no img tag: ftp://example.com/test.jpg
4889 !! html
4890 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4891 </p>
4892 !! end
4893
4894 !! test
4895 External links: terminating separator
4896 !! wikitext
4897 Terminating separator: http://example.com/thing,
4898 !! html
4899 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: intervening separator
4905 !! wikitext
4906 Intervening separator: http://example.com/1,2,3
4907 !! html
4908 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4909 </p>
4910 !! end
4911
4912 !! test
4913 External links: old bug with URL in query
4914 !! wikitext
4915 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4916 !! html
4917 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: old URL-in-URL bug, mixed protocols
4923 !! wikitext
4924 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4925 !! html
4926 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4927 </p>
4928 !!end
4929
4930 # Since Parsoid is starting to emit canonical wikitext for links,
4931 # [http://example.com http://example.com] will not RT back to that
4932 # form anymore.
4933 !! test
4934 External links: URL in text
4935 !! options
4936 parsoid=wt2html
4937 !! wikitext
4938 URL in text: [http://example.com http://example.com]
4939 !! html/php
4940 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4941 </p>
4942 !! html/parsoid
4943 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4944 !! end
4945
4946 !! test
4947 External links: Clickable images
4948 !! wikitext
4949 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4950 !! html/php
4951 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4952 </p>
4953 !! html/parsoid
4954 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4955 !! end
4956
4957 !! test
4958 External links: raw ampersand
4959 !! wikitext
4960 Old &amp; use: http://x&y
4961 !! html
4962 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: encoded ampersand
4968 !! wikitext
4969 Old &amp; use: http://x&amp;y
4970 !! html/php
4971 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4972 </p>
4973 !! html/parsoid
4974 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
4975 !! end
4976
4977 !! test
4978 External links: encoded equals (T8102)
4979 !! wikitext
4980 http://example.com/?foo&#61;bar
4981 !! html/php
4982 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4983 </p>
4984 !! html/parsoid
4985 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4986 !! end
4987
4988 ##
4989 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4990 ## does it number them. As discussed in T55505, we can identify
4991 ## autonumbered links via CSS.
4992 ##
4993
4994 !! test
4995 External links: [raw ampersand]
4996 !! wikitext
4997 Old &amp; use: [http://x&y]
4998 !! html/php
4999 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5000 </p>
5001 !! html/parsoid
5002 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5003 !! end
5004
5005 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5006 # mode will return the [raw ampersand] wikitext
5007 !! test
5008 External links: [encoded ampersand]
5009 !! options
5010 parsoid=wt2html,wt2wt,html2html
5011 !! wikitext
5012 Old &amp; use: [http://x&amp;y]
5013 !! html/php
5014 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5015 </p>
5016 !! html/parsoid
5017 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5018 !! end
5019
5020 !! test
5021 External links: [raw equals]
5022 !! wikitext
5023 [http://example.com/?foo=bar]
5024 !! html/php
5025 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5026 </p>
5027 !! html/parsoid
5028 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5029 !! end
5030
5031 # note that parsoid html is identical to [raw equals] case; so html2wt
5032 # mode will return the [raw equals] wikitext
5033 !! test
5034 External links: [encoded equals] (T8102)
5035 !! options
5036 parsoid=wt2html,wt2wt,html2html
5037 !! wikitext
5038 [http://example.com/?foo&#61;bar]
5039 !! html/php
5040 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5041 </p>
5042 !! html/parsoid
5043 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5044 !! end
5045
5046 # xxx parsoid strips the IDN character, so the round-trip tests will
5047 # obviously fail and are disabled. --cscott
5048 !! test
5049 External links: [IDN ignored character reference in hostname; strip it right off]
5050 !! options
5051 parsoid=wt2html,wt2wt,html2html
5052 !! wikitext
5053 [http://e&zwnj;xample.com/]
5054 !! html/php
5055 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5056 </p>
5057 !! html/parsoid
5058 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5059 !! end
5060
5061 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5062 # Where an external link could easily circumvent the sanitization of the text of
5063 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5064 # test demands a higher standard. That's a bit strange.
5065 #
5066 # Example:
5067 #
5068 # http://e‌xample.com -> [http://example.com|http://example.com]
5069 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5070 #
5071 # The first example is sanitized, but the second is not. Any security benefits
5072 # from this production are trivial to circumvent. Either remove this test and
5073 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5074 # the test accordingly.
5075 #
5076 # All our love,
5077 # The Parsoid team.
5078 # xxx parsoid strips the IDN character, so the round-trip tests will
5079 # obviously fail and are disabled. --cscott
5080 !! test
5081 External links: IDN ignored character reference in hostname; strip it right off
5082 !! options
5083 parsoid=wt2html,html2html
5084 !! wikitext
5085 http://e&zwnj;xample.com/
5086 !! html/php
5087 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5088 </p>
5089 !! html/parsoid
5090 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5091 !! end
5092
5093 !! test
5094 External links: www.jpeg.org (T2554)
5095 !! wikitext
5096 http://www.jpeg.org
5097 !! html
5098 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5099 </p>
5100 !! end
5101
5102 # parsoid doesn't explicitly mark autonumbered links, see T55505
5103 !! test
5104 External links: URL within URL (T2002)
5105 !! wikitext
5106 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5107 !! html/php
5108 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5109 </p>
5110 !! html/parsoid
5111 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5112 !! end
5113
5114 !! test
5115 T2361: URL inside bracketed URL
5116 !! wikitext
5117 [http://www.example.com/foo http://www.example.com/bar]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 T2361: URL within URL, not bracketed
5125 !! wikitext
5126 http://www.example.com/foo?=http://www.example.com/bar
5127 !! html
5128 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5129 </p>
5130 !! end
5131
5132 !! test
5133 T2289: ">"-token in URL-tail
5134 !! wikitext
5135 http://www.example.com/<hello>
5136 !! html
5137 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5138 </p>
5139 !!end
5140
5141 !! test
5142 T2289: literal ">"-token in URL-tail
5143 !! wikitext
5144 http://www.example.com/<b>html</b>
5145 !! html/php
5146 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5150 !! end
5151
5152 !! test
5153 T2289: ">"-token in bracketed URL
5154 !! wikitext
5155 [http://www.example.com/<hello> stuff]
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5158 </p>
5159 !!end
5160
5161 !! test
5162 T2289: literal ">"-token in bracketed URL
5163 !! wikitext
5164 [http://www.example.com/<b>html</b> stuff]
5165 !! html
5166 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5167 </p>
5168 !!end
5169
5170 !! test
5171 T2289: literal double quote at end of URL
5172 !! wikitext
5173 http://www.example.com/"hello"
5174 !! html
5175 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5176 </p>
5177 !!end
5178
5179 !! test
5180 T2289: literal double quote in bracketed URL
5181 !! wikitext
5182 [http://www.example.com/"hello" stuff]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5185 </p>
5186 !!end
5187
5188 !! test
5189 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5190 !! wikitext
5191 [http://www.example.com test]
5192 !! html
5193 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 External links: link text with spaces
5199 !! wikitext
5200 [http://www.example.com a b c]
5201 [http://www.example.com ''a'' ''b'']
5202 !! html
5203 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5204 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5205 </p>
5206 !! end
5207
5208 # Note edge case difference between PHP and Parsoid here.
5209 !! test
5210 External links: wiki links within external link (T5695)
5211 !! options
5212 parsoid=wt2html,html2html
5213 !! wikitext
5214 [http://example.com [[wikilink]] embedded in ext link]
5215
5216 [http://example.com test [[wikilink]] embedded in ext link]
5217 !! html/php
5218 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5219 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5220 </p>
5221 !! html/parsoid
5222 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5223 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5224 !! end
5225
5226 !! test
5227 T2787: Links with one slash after the url protocol are invalid
5228 !! wikitext
5229 http:/example.com
5230
5231 [http:/example.com title]
5232 !! html
5233 <p>http:/example.com
5234 </p><p>[http:/example.com title]
5235 </p>
5236 !! end
5237
5238 !! test
5239 Bracketed external links with template-generated invalid target
5240 !! wikitext
5241 [{{echo|http:/example.com}} title]
5242 !! html
5243 <p>[http:/example.com title]
5244 </p>
5245 !! end
5246
5247 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5248 !! test
5249 Broken wikilinks (but not external links) prevent templates from closing
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 [http://example.com x
5254
5255 {{echo|[http://example.com x}}
5256
5257 [[Foo
5258
5259 {{echo|[[Foo}}
5260 !! html/php
5261 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5262 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5263 </p><p>[[Foo
5264 </p><p>{{echo|[[Foo}}
5265 </p>
5266 !! html/parsoid
5267 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5268 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5269 <p>[[Foo</p>
5270 <p>{{echo|[[Foo}}</p>
5271 !! end
5272
5273 !! test
5274 Wikilinks with embedded newlines are not broken
5275 !! wikitext
5276 {{echo|[[ Foo
5277 B
5278 C]]}}
5279 !! html/php
5280 <p>[[ Foo
5281 B
5282 C]]
5283 </p>
5284 !! html/parsoid
5285 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5286 !! end
5287
5288 !! test
5289 Broken templates
5290 !! options
5291 parsoid=wt2html
5292 !! wikitext
5293 {{echo|[[Foo|}}]]
5294
5295 [[Foo|{{echo|]]}}
5296 !! html/php
5297 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5298 </p><p>[[Foo|]]
5299 </p>
5300 !! html/parsoid
5301 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5302 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5303 !! end
5304
5305 !! test
5306 T4702: Mismatched <i>, <b> and <a> tags are invalid
5307 !! wikitext
5308 ''[http://example.com text'']
5309 [http://example.com '''text]'''
5310 ''Something [http://example.com in italic'']
5311 ''Something [http://example.com mixed''''', even bold]'''
5312 '''''Now [http://example.com both''''']
5313 !! html
5314 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5315 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5316 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5317 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5318 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5319 </p>
5320 !! end
5321
5322
5323 !! test
5324 T6781: %26 in URL
5325 !! wikitext
5326 http://www.example.com/?title=AT%26T
5327 !! html/php
5328 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5329 </p>
5330 !! html/parsoid
5331 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5332 !! end
5333
5334 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5335 # % is actually legal in HTML5. Any change in output would need testing though.
5336 !! test
5337 T6781, T7267: %25 in URL
5338 !! wikitext
5339 http://www.example.com/?title=100%25_Bran
5340 !! html/php
5341 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5342 </p>
5343 !! html/parsoid
5344 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5345 !! end
5346
5347 !! test
5348 T6781, T7267: %28, %29 in URL
5349 !! wikitext
5350 http://www.example.com/?title=Ben-Hur_%281959_film%29
5351 !! html/php
5352 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5353 </p>
5354 !! html/parsoid
5355 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5356 !! end
5357
5358
5359 !! test
5360 T6781: %26 in autonumber URL
5361 !! wikitext
5362 [http://www.example.com/?title=AT%26T]
5363 !! html/php
5364 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5368 !! end
5369
5370 !! test
5371 T6781, T7267: %26 in autonumber URL
5372 !! wikitext
5373 [http://www.example.com/?title=100%25_Bran]
5374 !! html/php
5375 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5379 !! end
5380
5381 !! test
5382 T6781, T7267: %28, %29 in autonumber URL
5383 !! wikitext
5384 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5390 !! end
5391
5392
5393 !! test
5394 T6781: %26 in bracketed URL
5395 !! wikitext
5396 [http://www.example.com/?title=AT%26T link]
5397 !! html/php
5398 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5399 </p>
5400 !! html/parsoid
5401 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5402 !! end
5403
5404 !! test
5405 T6781, T7267: %25 in bracketed URL
5406 !! wikitext
5407 [http://www.example.com/?title=100%25_Bran link]
5408 !! html
5409 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5410 </p>
5411 !! end
5412
5413 !! test
5414 T6781, T7267: %28, %29 in bracketed URL
5415 !! wikitext
5416 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5417 !! html/php
5418 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5422 !! end
5423
5424 !! test
5425 External link containing a period in the anchor. (T65947)
5426 !! wikitext
5427 [//foo.org/bar#baz. bang]
5428
5429 [//foo.org/bar. bang]
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5432 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5433 </p>
5434 !! html/parsoid
5435 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5436 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5437 !! end
5438
5439 !! test
5440 External link containing a single quote. (T65947)
5441 !! wikitext
5442 [//foo.org/bar'baz]
5443
5444 [//foo.org/bar'baz bang]
5445 !! html/php
5446 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5447 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5448 </p>
5449 !! html/parsoid
5450 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5451 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5452 !! end
5453
5454 !! test
5455 External link containing double-single-quotes in text '' (T6598 sanity check)
5456 !! wikitext
5457 Some [http://example.com/ pretty ''italics'' and stuff]!
5458 !! html
5459 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5460 </p>
5461 !! end
5462
5463 !! test
5464 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5465 !! wikitext
5466 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5467 !! html
5468 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5469 </p>
5470 !! end
5471
5472 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5473 !! test
5474 External link containing double-single-quotes with no space separating the url from text in italics
5475 !! wikitext
5476 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5477 !! html/php+tidy
5478 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5482 !! end
5483
5484 !! test
5485 External link with comments in link text
5486 !! wikitext
5487 [http://www.google.com Google <!-- comment -->]
5488 !! html/php
5489 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5493 !! end
5494
5495 !! test
5496 External link to bare IPv4 address
5497 !! wikitext
5498 [http://192.168.0.1 Link]
5499 !! html/php
5500 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5504 !! end
5505
5506 !! test
5507 URL-encoding in URL functions (single parameter)
5508 !! wikitext
5509 {{localurl:Some page|amp=&}}
5510 !! html
5511 <p>/index.php?title=Some_page&amp;amp=&amp;
5512 </p>
5513 !! end
5514
5515 !! test
5516 URL-encoding in URL functions (multiple parameters)
5517 !! wikitext
5518 {{localurl:Some page|q=?&amp=&}}
5519 !! html
5520 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5521 </p>
5522 !! end
5523
5524 !! test
5525 Brackets in urls
5526 !! wikitext
5527 http://example.com/index.php?foozoid%5B%5D=bar
5528
5529 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5530 !! html/php
5531 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5532 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5536
5537 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5538 !! end
5539
5540 !! test
5541 IPv6 urls, autolink format (T23261)
5542 !! wikitext
5543 http://[2404:130:0:1000::187:2]/index.php
5544
5545 Examples from RFC 2373, section 2.2:
5546 * http://[1080::8:800:200C:417A]/unicast
5547 * http://[FF01::101]/multicast
5548 * http://[::1]/loopback
5549 * http://[::]/unspecified
5550 * http://[::13.1.68.3]/ipv4compat
5551 * http://[::FFFF:129.144.52.38]/ipv4compat
5552
5553 Examples from RFC 2732, section 2:
5554 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5555 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5556 * http://[3ffe:2a00:100:7031::1]
5557 * http://[1080::8:800:200C:417A]/foo
5558 * http://[::192.9.5.5]/ipng
5559 * http://[::FFFF:129.144.52.38]:80/index.html
5560 * http://[2010:836B:4179::836B:4179]
5561
5562 !! html/php
5563 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5564 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5565 </p>
5566 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5567 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5568 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5569 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5570 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5571 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5572 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5573 </p>
5574 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5575 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5576 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5577 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5578 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5579 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5580 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5581
5582 !! html/parsoid
5583 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5584
5585 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5586 <ul><li> <a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5587 <li> <a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5588 <li> <a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5589 <li> <a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5590 <li> <a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5591 <li> <a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5592
5593 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5594 <ul><li> <a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5595 <li> <a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5596 <li> <a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5597 <li> <a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5598 <li> <a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5599 <li> <a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5600 <li> <a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5601 !! end
5602
5603 !! test
5604 IPv6 urls, bracketed format (T23261)
5605 !! wikitext
5606 [http://[2404:130:0:1000::187:2]/index.php test]
5607
5608 Examples from RFC 2373, section 2.2:
5609 * [http://[1080::8:800:200C:417A] unicast]
5610 * [http://[FF01::101] multicast]
5611 * [http://[::1]/ loopback]
5612 * [http://[::] unspecified]
5613 * [http://[::13.1.68.3] ipv4compat]
5614 * [http://[::FFFF:129.144.52.38] ipv4compat]
5615
5616 Examples from RFC 2732, section 2:
5617 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5618 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5619 * [http://[3ffe:2a00:100:7031::1] 3]
5620 * [http://[1080::8:800:200C:417A]/foo 4]
5621 * [http://[::192.9.5.5]/ipng 5]
5622 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5623 * [http://[2010:836B:4179::836B:4179] 7]
5624
5625 !! html/php
5626 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5627 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5628 </p>
5629 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5630 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5631 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5632 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5633 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5634 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5635 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5636 </p>
5637 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5638 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5639 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5640 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5641 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5642 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5643 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5644
5645 !! html/parsoid
5646 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5647
5648 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5649 <ul><li> <a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5650 <li> <a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5651 <li> <a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5652 <li> <a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5653 <li> <a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5654 <li> <a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5655
5656 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5657 <ul><li> <a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5658 <li> <a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5659 <li> <a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5660 <li> <a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5661 <li> <a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5662 <li> <a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5663 <li> <a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5664 !! end
5665
5666 !! test
5667 Non-extlinks in brackets
5668 !! wikitext
5669 [foo]
5670 [foo bar]
5671 [foo ''bar'']
5672 [fool's] errand
5673 [fool's errand]
5674 [{{echo|foo}}]
5675 [{{echo|foo}} bar]
5676 [{{echo|foo}} ''bar'']
5677 [{{echo|foo}}l's] errand
5678 [{{echo|foo}}l's errand]
5679 [url={{echo|foo}}]
5680 [url=http://example.com]
5681 [http:// bare protocols don't count]
5682 !! html/php
5683 <p>[foo]
5684 [foo bar]
5685 [foo <i>bar</i>]
5686 [fool's] errand
5687 [fool's errand]
5688 [foo]
5689 [foo bar]
5690 [foo <i>bar</i>]
5691 [fool's] errand
5692 [fool's errand]
5693 [url=foo]
5694 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5695 [http:// bare protocols don't count]
5696 </p>
5697 !! html/parsoid
5698 <p>[foo]
5699 [foo bar]
5700 [foo <i>bar</i>]
5701 [fool's] errand
5702 [fool's errand]
5703 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5704 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
5705 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
5706 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
5707 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
5708 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5709 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5710 [http:// bare protocols don't count]</p>
5711 !! end
5712
5713 !! test
5714 Percent encoding in external links
5715 !! wikitext
5716 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5717 !! html/php
5718 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5719 </p>
5720 !! html/parsoid
5721 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5722 !! end
5723
5724 !! test
5725 Use url link syntax for links where the content is equal the link target
5726 !! wikitext
5727 http://example.com
5728 !! html/php
5729 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5733 !! end
5734
5735 !! test
5736 Parenthesis in external links, especially URL links
5737 !! wikitext
5738 http://example.com)
5739
5740 http://example.com/test)
5741
5742 http://example.com/(test)
5743
5744 http://example.com/((test)
5745
5746 (http://example.com/(test))
5747
5748 (http://example.com/(test)))))
5749
5750 http://example.com/a)b
5751
5752 [http://example.com) foo]
5753 !! html/php
5754 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5755 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5756 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5757 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5758 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5759 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5760 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5761 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5762 </p>
5763 !! html/parsoid
5764 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5765 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5766 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5767 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5768 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5769 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5770 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5771 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5772 !! end
5773
5774 !! test
5775 Parenthesis in external links, w/ transclusion or comment
5776 !! wikitext
5777 (http://example.com/{{echo|hi}})
5778
5779 (http://example.com<!-- hi -->)
5780 !! html/php
5781 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5782 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5783 </p>
5784 !! html/parsoid
5785 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5786
5787 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5788 !! end
5789
5790 !! test
5791 Serialize <a> tags with invalid link targets as plain text
5792 !! options
5793 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5794 !! html/parsoid
5795 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5796 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5797 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5798 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5799 !! wikitext
5800 text
5801 <nowiki>*</nowiki>text
5802 <nowiki>[[foo]]</nowiki>
5803 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5804 !! end
5805
5806 !! test
5807 mw:ExtLink -vs- mw:WikiLink (T94723)
5808 !! options
5809 parsoid=html2wt
5810 !! html/parsoid
5811 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5812 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5813 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5814 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5815 <p>
5816 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5817 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5818 </p>
5819 !! wikitext
5820 [[Foo|Bar]]
5821 [[Foo|Bar]]
5822 [[:en:Foo|Bar]]
5823 [[:en:Foo|Bar]]
5824
5825 [[:en:European_Robin|European Robin]]
5826 [[:en:European_Robin|European Robin]]
5827 !! end
5828
5829 !! test
5830 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5831 !! options
5832 parsoid=wt2wt
5833 !! wikitext
5834 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5835 !! html/parsoid
5836 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5837 !! end
5838
5839
5840 ###
5841 ### Quotes
5842 ###
5843
5844 !! test
5845 Quotes
5846 !! wikitext
5847 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5848
5849 Normal text. '''''Bold italic text.''''' Normal text.
5850 !! html
5851 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5852 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5853 </p>
5854 !! end
5855
5856
5857 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5858 # parser strips. The wikitext contains just the first half of the bold
5859 # quote pair.
5860 !! test
5861 Unclosed and unmatched quotes
5862 !! wikitext
5863 '''''Bold italic text '''with bold deactivated''' in between.'''''
5864
5865 '''''Bold italic text ''with italic deactivated'' in between.'''''
5866
5867 '''Bold text..
5868
5869 ..spanning two paragraphs (should not work).'''
5870
5871 '''Bold tag left open
5872
5873 ''Italic tag left open
5874
5875 Normal text.
5876
5877 <!-- Unmatching number of opening, closing tags: -->
5878 '''This year''''s election ''should'' beat '''last year''''s.
5879
5880 ''Tom'''s car is bigger than ''Susan'''s.
5881
5882 Plain ''italic'''s plain
5883 !! html/php
5884 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5885 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5886 </p><p><b>Bold text..</b>
5887 </p><p>..spanning two paragraphs (should not work).
5888 </p><p><b>Bold tag left open</b>
5889 </p><p><i>Italic tag left open</i>
5890 </p><p>Normal text.
5891 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5892 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5893 </p><p>Plain <i>italic'</i>s plain
5894 </p>
5895 !! html/parsoid
5896 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5897 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5898 </p><p><b>Bold text..</b>
5899 </p><p>..spanning two paragraphs (should not work).<b></b>
5900 </p><p><b>Bold tag left open</b>
5901 </p><p><i>Italic tag left open</i>
5902 </p><p>Normal text.
5903 </p>
5904 <!-- Unmatching number of opening, closing tags: -->
5905 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5906 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5907 </p><p>Plain <i>italic'</i>s plain
5908 </p>
5909 !! end
5910
5911 ###
5912 ### Tables
5913 ###
5914 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5915 ###
5916
5917 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5918 # is the bare minimum required by the spec, see:
5919 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5920 # Parsoid team replies: empty table tags are legal in HTML5
5921 !! test
5922 A table with no data.
5923 !! options
5924 parsoid=wt2html
5925 !! wikitext
5926 {||}
5927 !! html/php
5928
5929 !! html/parsoid
5930 <table></table>
5931
5932 !! end
5933
5934 !! test
5935 A table with stray table end tags on start tag line (wt2html)
5936 !! options
5937 parsoid=wt2html
5938 !! wikitext
5939 {|style="color: red;"|}
5940
5941 {|style="color: red;" |}
5942 |foo
5943 |}
5944
5945 {|style="color: red;"|} id="foo"
5946 |foo
5947 |}
5948
5949 {|style="color: red;" |} id="foo"
5950 |foo
5951 |}
5952 !! html
5953 <table style="color: red;"></table>
5954
5955 <table style="color: red;">
5956 <tbody><tr>
5957 <td>foo</td>
5958 </tr></tbody>
5959 </table>
5960
5961 <table style="color: red;" id="foo">
5962 <tbody><tr>
5963 <td>foo</td>
5964 </tr></tbody>
5965 </table>
5966
5967 <table style="color: red;" id="foo">
5968 <tbody><tr>
5969 <td>foo</td>
5970 </tr></tbody>
5971 </table>
5972
5973 !! end
5974
5975 !! test
5976 A table with no data (take 2)
5977 !! wikitext
5978 {|
5979 |}
5980 !! html/parsoid
5981 <table></table>
5982 !! end
5983
5984 # A table with nothing but a caption is invalid XHTML, we might want to render
5985 # this as <p>caption</p>
5986 # Parsoid team replies: table with only a caption is legal in HTML5
5987 !! test
5988 A table with nothing but a caption
5989 !! wikitext
5990 {|
5991 |+ caption
5992 |}
5993 !! html/php
5994 <table>
5995 <caption> caption
5996 </caption><tr><td></td></tr></table>
5997
5998 !! html/parsoid
5999 <table><caption> caption</caption></table>
6000 !! end
6001
6002 !! test
6003 A table with caption with default-spaced attributes and a table row
6004 !! wikitext
6005 {|
6006 |+ style="color: red;" | caption1
6007 |-
6008 | foo
6009 |}
6010 !! html
6011 <table>
6012 <caption style="color: red;"> caption1
6013 </caption>
6014 <tr>
6015 <td> foo
6016 </td></tr></table>
6017
6018 !! end
6019
6020 !! test
6021 A table with captions with non-default spaced attributes and a table row
6022 !! wikitext
6023 {|
6024 |+style="color: red;"|caption2
6025 |+ style="color: red;"| caption3
6026 |-
6027 | foo
6028 |}
6029 !! html
6030 <table>
6031 <caption style="color: red;">caption2
6032 </caption>
6033 <caption style="color: red;"> caption3
6034 </caption>
6035 <tr>
6036 <td> foo
6037 </td></tr></table>
6038
6039 !! end
6040
6041 !! test
6042 Table td-cell syntax variations
6043 !! wikitext
6044 {|
6045 | foo bar foo | baz
6046 | foo bar foo || baz
6047 | style='color:red;' | baz
6048 | style='color:red;' || baz
6049 |}
6050 !! html
6051 <table>
6052 <tr>
6053 <td> baz
6054 </td>
6055 <td> foo bar foo </td>
6056 <td> baz
6057 </td>
6058 <td style="color:red;"> baz
6059 </td>
6060 <td> style='color:red;' </td>
6061 <td> baz
6062 </td></tr></table>
6063
6064 !! end
6065
6066 !! test
6067 Simple table
6068 !! wikitext
6069 {|
6070 | 1 || 2
6071 |-
6072 | 3 || 4
6073 |}
6074 !! html
6075 <table>
6076 <tr>
6077 <td> 1 </td>
6078 <td> 2
6079 </td></tr>
6080 <tr>
6081 <td> 3 </td>
6082 <td> 4
6083 </td></tr></table>
6084
6085 !! end
6086
6087 !! test
6088 Simple table but with multiple dashes for row wikitext
6089 !! wikitext
6090 {|
6091 | foo
6092 |-----
6093 | bar
6094 |}
6095 !! html
6096 <table>
6097 <tr>
6098 <td> foo
6099 </td></tr>
6100 <tr>
6101 <td> bar
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !! test
6107 Multiplication table
6108 !! wikitext
6109 {| border="1" cellpadding="2"
6110 |+Multiplication table
6111 |-
6112 ! &times; !! 1 !! 2 !! 3
6113 |-
6114 ! 1
6115 | 1 || 2 || 3
6116 |-
6117 ! 2
6118 | 2 || 4 || 6
6119 |-
6120 ! 3
6121 | 3 || 6 || 9
6122 |-
6123 ! 4
6124 | 4 || 8 || 12
6125 |-
6126 ! 5
6127 | 5 || 10 || 15
6128 |}
6129 !! html
6130 <table border="1" cellpadding="2">
6131 <caption>Multiplication table
6132 </caption>
6133 <tr>
6134 <th> &#215; </th>
6135 <th> 1 </th>
6136 <th> 2 </th>
6137 <th> 3
6138 </th></tr>
6139 <tr>
6140 <th> 1
6141 </th>
6142 <td> 1 </td>
6143 <td> 2 </td>
6144 <td> 3
6145 </td></tr>
6146 <tr>
6147 <th> 2
6148 </th>
6149 <td> 2 </td>
6150 <td> 4 </td>
6151 <td> 6
6152 </td></tr>
6153 <tr>
6154 <th> 3
6155 </th>
6156 <td> 3 </td>
6157 <td> 6 </td>
6158 <td> 9
6159 </td></tr>
6160 <tr>
6161 <th> 4
6162 </th>
6163 <td> 4 </td>
6164 <td> 8 </td>
6165 <td> 12
6166 </td></tr>
6167 <tr>
6168 <th> 5
6169 </th>
6170 <td> 5 </td>
6171 <td> 10 </td>
6172 <td> 15
6173 </td></tr></table>
6174
6175 !! end
6176
6177 !! test
6178 Accept "||" in table headings
6179 !! wikitext
6180 {|
6181 !h1 || h2
6182 |}
6183 !! html
6184 <table>
6185 <tr>
6186 <th>h1 </th>
6187 <th> h2
6188 </th></tr></table>
6189
6190 !! end
6191
6192 !! test
6193 Accept "!!" in table data
6194 !! wikitext
6195 {|
6196 | Foo!! ||
6197 |}
6198 !! html
6199 <table>
6200 <tr>
6201 <td> Foo!! </td>
6202 <td>
6203 </td></tr></table>
6204
6205 !! html/parsoid
6206 <table>
6207 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6208 </tbody></table>
6209 !! end
6210
6211 !! test
6212 Accept "||" in indented table headings
6213 !! wikitext
6214 :{|
6215 !h1 || h2
6216 |}
6217 !! html
6218 <dl><dd><table>
6219 <tr>
6220 <th>h1 </th>
6221 <th> h2
6222 </th></tr></table></dd></dl>
6223
6224 !! end
6225
6226 !! test
6227 Accept "!!" in templates
6228 !! wikitext
6229 {|
6230 !a {{echo|b!!c}}
6231 |}
6232 !! html/php
6233 <table>
6234 <tr>
6235 <th>a b</th>
6236 <th>c
6237 </th></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6242 !! end
6243
6244 !! test
6245 Accept "!!" in table headings after newline
6246 !! wikitext
6247 {|
6248 !a
6249 b!!c
6250 |}
6251 !! html/php
6252 <table>
6253 <tr>
6254 <th>a
6255 <p>b!!c
6256 </p>
6257 </th></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><th>a
6262 <p>b!!c</p></th></tr>
6263 </tbody></table>
6264 !! end
6265
6266 !! test
6267 Accept "!!" in table data of mixed wikitext / html syntax
6268 !! wikitext
6269 {|
6270 !a
6271 <tr><td>b!!c</td></tr>
6272 |}
6273 !! html/php+tidy
6274 <table>
6275 <tbody><tr>
6276 <th>a
6277 </th></tr><tr><td>b!!c</td></tr>
6278 </tbody></table>
6279 !! html/parsoid
6280 <table>
6281 <tbody><tr><th>a</th></tr>
6282 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6283 </tbody></table>
6284 !! end
6285
6286 !! test
6287 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6288 !! wikitext
6289 {|
6290 !| h1
6291 || a
6292 |}
6293 !! html
6294 <table>
6295 <tr>
6296 <th> h1
6297 </th>
6298 <td> a
6299 </td></tr></table>
6300
6301 !! end
6302
6303 !!test
6304 Accept "| !" at start of line in tables (ignore !-attribute)
6305 !! wikitext
6306 {|
6307 |-
6308 | !style="color:red" | bar
6309 |}
6310 !! html
6311 <table>
6312
6313 <tr>
6314 <td> bar
6315 </td></tr></table>
6316
6317 !!end
6318
6319 !!test
6320 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6321 !! wikitext
6322 {|
6323 |-
6324 |style='color:red;'|+1
6325 |style='color:blue;'|-1
6326 |-
6327 | 1 || 2 || 3
6328 | 1 ||+2 ||-3
6329 |-
6330 | +1
6331 | -1
6332 |}
6333 !! html
6334 <table>
6335
6336 <tr>
6337 <td style="color:red;">+1
6338 </td>
6339 <td style="color:blue;">-1
6340 </td></tr>
6341 <tr>
6342 <td> 1 </td>
6343 <td> 2 </td>
6344 <td> 3
6345 </td>
6346 <td> 1 </td>
6347 <td>+2 </td>
6348 <td>-3
6349 </td></tr>
6350 <tr>
6351 <td> +1
6352 </td>
6353 <td> -1
6354 </td></tr></table>
6355
6356 !!end
6357
6358 !! test
6359 Table rowspan
6360 !! wikitext
6361 {| border=1
6362 | Cell 1, row 1
6363 |rowspan=2| Cell 2, row 1 (and 2)
6364 | Cell 3, row 1
6365 |-
6366 | Cell 1, row 2
6367 | Cell 3, row 2
6368 |}
6369 !! html
6370 <table border="1">
6371 <tr>
6372 <td> Cell 1, row 1
6373 </td>
6374 <td rowspan="2"> Cell 2, row 1 (and 2)
6375 </td>
6376 <td> Cell 3, row 1
6377 </td></tr>
6378 <tr>
6379 <td> Cell 1, row 2
6380 </td>
6381 <td> Cell 3, row 2
6382 </td></tr></table>
6383
6384 !! end
6385
6386 !! test
6387 Nested table
6388 !! wikitext
6389 {| border=1
6390 | &alpha;
6391 |
6392 {| bgcolor=#ABCDEF border=2
6393 |nested
6394 |-
6395 |table
6396 |}
6397 |the original table again
6398 |}
6399 !! html
6400 <table border="1">
6401 <tr>
6402 <td> &#945;
6403 </td>
6404 <td>
6405 <table bgcolor="#ABCDEF" border="2">
6406 <tr>
6407 <td>nested
6408 </td></tr>
6409 <tr>
6410 <td>table
6411 </td></tr></table>
6412 </td>
6413 <td>the original table again
6414 </td></tr></table>
6415
6416 !! end
6417
6418 !! test
6419 Invalid attributes in table cell (T3830)
6420 !! wikitext
6421 {|
6422 |Cell:|broken
6423 |}
6424 !! html
6425 <table>
6426 <tr>
6427 <td>broken
6428 </td></tr></table>
6429
6430 !! end
6431
6432 !! test
6433 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6434 !! wikitext
6435 {|
6436 | title="foo" |bar
6437 | title="foo<nowiki>|</nowiki>" |bar
6438 | title="foo<nowiki>|</nowiki>" bar
6439 |}
6440 !! html/php
6441 <table>
6442 <tr>
6443 <td title="foo">bar
6444 </td>
6445 <td title="foo&#124;">bar
6446 </td>
6447 <td> title="foo|" bar
6448 </td></tr></table>
6449
6450 !! html/parsoid
6451 <table>
6452 <tbody><tr><td title="foo">bar</td>
6453 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6454 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6455 </tbody></table>
6456 !! end
6457
6458 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6459 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6460 # *2wt modes will fail.
6461 !! test
6462 Table security: embedded pipes
6463 !! options
6464 parsoid=wt2html,html2html
6465 !! wikitext
6466 {|
6467 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6468 !! html/php
6469 <table>
6470 <tr>
6471 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6472 <td>]" onmouseover="alert(document.cookie)"&gt;test
6473 </td>
6474 </tr>
6475 </table>
6476
6477 !! html/parsoid
6478 <table><tbody>
6479 <tr>
6480 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6481 !! end
6482
6483 !! test
6484 Element attributes with double ! should not be broken up by <th>
6485 !! wikitext
6486 {|
6487 ! hi <div class="!!">ha</div> ho
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th> hi <div class="!!">ha</div> ho
6493 </th></tr></table>
6494
6495 !! html/parsoid
6496 <table>
6497 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 ! and || in element attributes should not be parsed as <th>/<td>
6503 !! wikitext
6504 {|
6505 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6506 |}
6507 !! html/php
6508 <table>
6509 <tr>
6510 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6511 </td></tr></table>
6512
6513 !! html/parsoid
6514 <table>
6515 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6516 </tbody></table>
6517 !! end
6518
6519 # FIXME: The output seems broken. Filed as T110268.
6520 !! test
6521 ! and || in td attributes should not be parsed as <th>/<td>
6522 !! options
6523 parsoid=wt2html
6524 !! wikitext
6525 {|
6526 | style="color: red !important;" data-contrived="put this here ||" | foo
6527 |}
6528 !! html/php
6529 <table>
6530 <tr>
6531 <td> style="color: red !important;" data-contrived="put this here </td>
6532 <td> foo
6533 </td></tr></table>
6534
6535 !! html/parsoid
6536 <table>
6537 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6538 </tbody></table>
6539 !! end
6540
6541 !! test
6542 Break on | in element attribute in template
6543 !! options
6544 parsoid=wt2html,html2html
6545 !! wikitext
6546 {{echo|1=<div class="hi|ho">ha</div>}}
6547 !! html/php
6548 <p>ho"&gt;ha&lt;/div&gt;
6549 </p>
6550 !! html/parsoid
6551 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6552 !! end
6553
6554 !! test
6555 Break on | in element attribute name in template
6556 !! wikitext
6557 {{echo|<div cla|ss="hiho">ha</div>}}
6558 !! html/parsoid
6559 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6560 !! end
6561
6562 !! test
6563 Don't break on | in extension attribute in template
6564 !! wikitext
6565 {{echo|<ref name="hi|ho">ha</ref>}}
6566
6567 <references />
6568 !! html/parsoid
6569 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6570
6571 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6572 !! end
6573
6574 ## We don't support roundtripping of these attributes in Parsoid.
6575 ## Selective serialization takes care of preventing dirty diffs.
6576 ## But, on edits, we dirty-diff the invalid attribute text.
6577 !! test
6578 Invalid text in table attributes should be discarded
6579 !! options
6580 parsoid=wt2html
6581 !! wikitext
6582 {| <span>boo</span> style='border:1px solid black'
6583 | <span>boo</span> style='color:blue' | 1
6584 |<span>boo</span> style='color:blue'| 2
6585 |}
6586 !! html/php
6587 <table style="border:1px solid black">
6588 <tr>
6589 <td style="color:blue"> 1
6590 </td>
6591 <td style="color:blue"> 2
6592 </td></tr></table>
6593
6594 !! html/parsoid
6595 <table style="border:1px solid black">
6596 <tr>
6597 <td style="color:blue"> 1</td>
6598 <td style="color:blue"> 2</td>
6599 </tr>
6600 </table>
6601 !! end
6602
6603 !! test
6604 Invalid text in table attributes should be preserved by selective serializer
6605 !! options
6606 parsoid={
6607 "modes": ["selser"],
6608 "changes": [
6609 ["td:first-child", "text", "abc"],
6610 ["td + td", "text", "xyz"]
6611 ]
6612 }
6613 !! wikitext
6614 {| <span>boo</span> style='border:1px solid black'
6615 | <span>boo</span> style='color:blue' | 1
6616 |<span>boo</span> style='color:blue'| 2
6617 |}
6618 !! wikitext/edited
6619 {| <span>boo</span> style='border:1px solid black'
6620 | <span>boo</span> style='color:blue' |abc
6621 |<span>boo</span> style='color:blue'|xyz
6622 |}
6623 !! end
6624
6625 !! test
6626 1. Template-generated table cell attributes and cell content
6627 !! wikitext
6628 {|
6629 |{{table_attribs}}
6630 | {{table_attribs}}
6631 || {{table_attribs_5}}
6632 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6633 |align=center {{table_attribs}}
6634 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6635 |}
6636 !! html
6637 <table>
6638 <tr>
6639 <td style="color:red;">Foo
6640 </td>
6641 <td style="color:red;">Foo
6642 </td>
6643 <td> style="color:red;"</td>
6644 <td>Bar
6645 </td>
6646 <td style="color:red;">Foo
6647 </td>
6648 <td align="center" style="color:red;">Foo
6649 </td>
6650 <td align="center" style="color:red;">Foo
6651 </td></tr></table>
6652
6653 !! end
6654
6655 !! test
6656 2. Template-generated table cell attributes and cell content
6657 !! wikitext
6658 {|
6659 |{{table_attribs_2}}
6660 |}
6661 !! html/php
6662 <table>
6663 <tr>
6664 <td style="color:red;">Foo
6665 </td>
6666 <td>Bar</td>
6667 <td>Baz
6668 </td></tr></table>
6669
6670 !! html/parsoid
6671 <table>
6672 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6673 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6674 </tbody></table>
6675 !! end
6676
6677 !! test
6678 3. Template-generated table cell attributes and cell content
6679 !! wikitext
6680 {|
6681 !align=center {{table_header_cells}}
6682 |-
6683 |align=center {{table_cells}}
6684 |}
6685 !! html/php
6686 <table>
6687 <tr>
6688 <th align="center" style="color:red;">Foo</th>
6689 <th style="color:red;"><i>Bar</i></th>
6690 <th style="color:brown;"><i>Foo</i> and Baz
6691 </th></tr>
6692 <tr>
6693 <td align="center" style="color:red;">Foo</td>
6694 <td style="color:red;"><i>Bar</i></td>
6695 <td style="color:brown;"><i>Foo</i> and Baz
6696 </td></tr></table>
6697
6698 !! html/parsoid
6699 <table>
6700 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6701 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6702 </tbody></table>
6703 !! end
6704
6705 !! test
6706 4. Template-generated table cell attributes and cell content inside a templated table
6707 !! wikitext
6708 {{tbl-start}}
6709 !align=center {{table_header_cells}}
6710 |-
6711 |align=center {{table_cells}}
6712 {{tbl-end}}
6713 !! html/php
6714 <table>
6715 <tr>
6716 <th align="center" style="color:red;">Foo</th>
6717 <th style="color:red;"><i>Bar</i></th>
6718 <th style="color:brown;"><i>Foo</i> and Baz
6719 </th></tr>
6720 <tr>
6721 <td align="center" style="color:red;">Foo</td>
6722 <td style="color:red;"><i>Bar</i></td>
6723 <td style="color:brown;"><i>Foo</i> and Baz
6724 </td></tr></table>
6725
6726 !! html/parsoid
6727 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6728 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6729 <tr>
6730 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6731 </tbody></table>
6732 !! end
6733
6734 ## Edge case fix to prevent future regressions
6735 !! test
6736 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6737 !! wikitext
6738 {|
6739 |{{table_attribs_7}}
6740 |}
6741 <references />
6742 !! html/parsoid
6743 <table>
6744 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
6745 </tbody></table>
6746 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6747 !! end
6748
6749 !! test
6750 Table with row followed by newlines and table heading
6751 !! options
6752 parsoid=wt2html,html2html
6753 !! wikitext
6754 {|
6755 |-
6756
6757 ! foo
6758 |}
6759 !! html/*
6760 <table>
6761
6762
6763 <tr>
6764 <th> foo
6765 </th></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Table with empty line following the start tag
6771 !! options
6772 parsoid=wt2html,html2html
6773 !! wikitext
6774 {|
6775
6776 |-
6777 | foo
6778 |}
6779 !! html/*
6780 <table>
6781
6782
6783 <tr>
6784 <td> foo
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table attributes with empty value
6791 !! options
6792 parsoid=wt2html,html2html
6793 !! wikitext
6794 {|
6795 | style=| hello
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td style=""> hello
6801 </td></tr></table>
6802
6803 !! html/parsoid
6804 <table>
6805 <tbody><tr><td style=""> hello</td></tr>
6806 </tbody></table>
6807 !! end
6808
6809 !! test
6810 Wikitext table with a lot of comments
6811 !! wikitext
6812 {|
6813 <!-- c0 -->
6814 | foo
6815 <!-- c1 -->
6816 |-<!-- c2 -->
6817 <!-- c3 -->
6818 |<!-- c4 -->
6819 <!-- c5 -->
6820 |}
6821 !! html
6822 <table>
6823 <tr>
6824 <td> foo
6825 </td></tr>
6826 <tr>
6827 <td>
6828 </td></tr></table>
6829
6830 !! end
6831
6832 !! test
6833 Wikitext table comments represented in parsoid dom
6834 !! wikitext
6835 {|<!--c1--><!--c2-->
6836 |-<!--c3-->
6837 | x
6838 |}
6839 !! html/php+tidy
6840 <table>
6841
6842 <tbody><tr>
6843 <td> x
6844 </td></tr></tbody></table>
6845 !! html/parsoid
6846 <table><!--c1--><!--c2-->
6847 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6848 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6849 </tbody></table>
6850 !! end
6851
6852 !! test
6853 Wikitext table with double-line table cell
6854 !! wikitext
6855 {|
6856 |a
6857 b
6858 |}
6859 !! html
6860 <table>
6861 <tr>
6862 <td>a
6863 <p>b
6864 </p>
6865 </td></tr></table>
6866
6867 !! end
6868
6869 !! test
6870 Table cell with a single comment
6871 !! wikitext
6872 {|
6873 | <!-- c1 -->
6874 | a
6875 |}
6876 !! html
6877 <table>
6878 <tr>
6879 <td>
6880 </td>
6881 <td> a
6882 </td></tr></table>
6883
6884 !! end
6885
6886 !! test
6887 Table-cell after a comment-only-empty-line
6888 !! wikitext
6889 {|
6890 |a
6891 <!--c1-->
6892 <!--c2-->| b
6893 |}
6894 !! html
6895 <table>
6896 <tr>
6897 <td>a
6898 </td>
6899 <td> b
6900 </td></tr></table>
6901
6902 !! html/parsoid
6903 <table>
6904 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6905 <!--c1-->
6906 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6907 </tbody></table>
6908
6909 !! end
6910
6911 !! test
6912 Build table with {{!}}
6913 !! wikitext
6914 {{{!}} class="wikitable"
6915 ! header
6916 ! second header
6917 {{!}}- style="color:red;"
6918 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6919 {{!}}}
6920 !! html
6921 <table class="wikitable">
6922 <tr>
6923 <th> header
6924 </th>
6925 <th> second header
6926 </th></tr>
6927 <tr style="color:red;">
6928 <td> data </td>
6929 <td style="color:red;"> second data
6930 </td></tr></table>
6931
6932 !! end
6933
6934 !! test
6935 Build table with pipe as data
6936 !! wikitext
6937 {| class="wikitable"
6938 ! header
6939 ! second header
6940 |- style="color:red;"
6941 | data || style="color:red;" | second data
6942 |-
6943 | style="color:red;" | data with | || style="color:red;" | second data with |
6944 |-
6945 || data with | ||| second data with |
6946 |}
6947 !! html
6948 <table class="wikitable">
6949 <tr>
6950 <th> header
6951 </th>
6952 <th> second header
6953 </th></tr>
6954 <tr style="color:red;">
6955 <td> data </td>
6956 <td style="color:red;"> second data
6957 </td></tr>
6958 <tr>
6959 <td style="color:red;"> data with | </td>
6960 <td style="color:red;"> second data with |
6961 </td></tr>
6962 <tr>
6963 <td> data with | </td>
6964 <td> second data with |
6965 </td></tr></table>
6966
6967 !! end
6968
6969 !! test
6970 Build table with wikilink
6971 !! wikitext
6972 {| class="wikitable"
6973 ! header || second header
6974 |- style="color:red;"
6975 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6976 |-
6977 | data || second data [[Main Page|link|text with pipe]]
6978 |}
6979 !! html
6980 <table class="wikitable">
6981 <tr>
6982 <th> header </th>
6983 <th> second header
6984 </th></tr>
6985 <tr style="color:red;">
6986 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6987 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6988 </td></tr>
6989 <tr>
6990 <td> data </td>
6991 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6992 </td></tr></table>
6993
6994 !! end
6995
6996 # The expected HTML structure in this test is debatable. The PHP parser does
6997 # not parse this kind of table at all. The main focus for Parsoid is on
6998 # round-tripping, so this output is ok for now. TODO: revisit!
6999 !! test
7000 Wikitext table with html-syntax row
7001 !! wikitext
7002 {|
7003 |-
7004 <td>foo</td>
7005 |}
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr>
7010 <td>foo</td></tr></tbody></table>
7011 !! end
7012
7013 !! test
7014 Fostered content in tables: Plain text
7015 !! options
7016 parsoid=wt2html,html2html
7017 !! wikitext
7018 {|
7019 |-
7020 a
7021 |}
7022 !! html/php
7023 <table>
7024
7025 a
7026 </table>
7027
7028 !! html/php+tidy
7029
7030
7031 a
7032 <table></table>
7033 !! html/parsoid
7034 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7035 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7036
7037 </tr></tbody></table>
7038 !! end
7039
7040 !! test
7041 Fostered content in tables: Lists
7042 !! options
7043 parsoid=wt2html,html2html
7044 !! wikitext
7045 {|
7046 |-
7047 *a
7048 |}
7049 !! html/php
7050 <table>
7051
7052 <ul><li>a</li></ul>
7053 </table>
7054
7055 !! html/php+tidy
7056 <ul><li>a</li></ul><table>
7057
7058
7059 </table>
7060 !! html/parsoid
7061 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7062 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7063
7064 </tr></tbody></table>
7065 !! end
7066
7067 !! test
7068 Template generated table cell with attributes
7069 !! wikitext
7070 {|
7071 |-
7072 {{table_attribs_4}} || a || b
7073 |}
7074 !! html/php+tidy
7075 <table>
7076
7077 <tbody><tr>
7078 <td style="background-color:#DC241f;" width="10px"> </td>
7079 <td> a </td>
7080 <td> b
7081 </td></tr></tbody></table>
7082 !! html/parsoid
7083 <table>
7084 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7085 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," || a || b"]}'> </td><td about="#mwt1"> a </td><td about="#mwt1"> b</td></tr>
7086 !! end
7087
7088 !! test
7089 Parsoid: Round-trip tables directly followed by content (T53219)
7090 !! options
7091 parsoid=wt2html,wt2wt
7092 !! wikitext
7093 {|
7094 |foo
7095 |} bar
7096
7097 {|
7098 |baz
7099 |}<b>quux</b>
7100 !! html+tidy
7101 <table>
7102 <tbody><tr>
7103 <td>foo
7104 </td></tr></tbody></table><p> bar
7105 </p><table>
7106 <tbody><tr>
7107 <td>baz
7108 </td></tr></tbody></table><p><b>quux</b>
7109 </p>
7110 !! end
7111
7112 !! test
7113 Parsoid: Default to a newline after tables in new content (T53219)
7114 !! options
7115 parsoid=html2wt
7116 !! html/parsoid
7117 <table><tbody>
7118 <tr><td>foo</td></tr></tbody></table> bar
7119 <table><tbody>
7120 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7121 !! wikitext
7122 {|
7123 |foo
7124 |}
7125 <nowiki> </nowiki>bar
7126 {|
7127 |baz
7128 |}
7129 '''quux'''
7130 !! end
7131
7132 !! test
7133 Parsoid: newline inducing block nodes don't suppress <nowiki>
7134 !! options
7135 parsoid=html2wt
7136 !! html/parsoid
7137 a<h1>foo</h1>
7138 !! wikitext
7139 <nowiki> </nowiki>a
7140
7141 = foo =
7142 !! end
7143
7144 !! test
7145 Parsoid: Row-syntax table headings followed by comment & table cells
7146 !! options
7147 parsoid=wt2html,wt2wt
7148 !! wikitext
7149 {|
7150 ! foo || bar
7151 <!-- foo --> || baz || quux
7152 |}
7153 !! html/php
7154 <table>
7155 <tr>
7156 <th> foo </th>
7157 <th> bar
7158 </th>
7159 <td> baz </td>
7160 <td> quux
7161 </td></tr></table>
7162
7163 !! html/parsoid
7164 <table>
7165 <tbody><tr><th> foo </th><th> bar
7166 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7167 </tbody></table>
7168 !! end
7169
7170 !!test
7171 Parsoid: Recover better from broken table attributes
7172 !!options
7173 parsoid=wt2html
7174 !!wikitext
7175 {| class="foo
7176 | class="bar" |
7177 foo
7178 |}
7179 !!html/php+tidy
7180 <table class="foo">
7181 <tbody><tr>
7182 <td class="bar">
7183 <p>foo
7184 </p>
7185 </td></tr></tbody></table>
7186 !!html/parsoid
7187 <table class="foo">
7188 <tr>
7189 <td class="bar">
7190 <p>foo</p></td></tr>
7191 </tbody></table>
7192 !!end
7193
7194 !! test
7195 Tables: Digest broken attributes on table and tr tag
7196 !! options
7197 parsoid=wt2html
7198 !! wikitext
7199 {| || |} ++
7200 |- || || ++ --
7201 |- > [
7202 |}
7203 !! html
7204 <table>
7205 <tbody>
7206 <tr class='mw-empty-elt'></tr>
7207 <tr class='mw-empty-elt'></tr>
7208 </tbody></table>
7209 !! end
7210
7211 # T137406: Whitespace in the HTML
7212 !! test
7213 1. Generate correct wikitext for tables with thead/tbody/tfoot
7214 !! options
7215 parsoid=html2wt
7216 !! html/parsoid
7217 <table>
7218 <caption>Test</caption>
7219 <thead>
7220 <tr>
7221 <th>Month</th>
7222 <th>Savings</th>
7223 </tr>
7224 </thead>
7225 <tbody>
7226 <tr>
7227 <td>January</td>
7228 <td>$100</td>
7229 </tr>
7230 <tr>
7231 <td>February</td>
7232 <td>$80</td>
7233 </tr>
7234 </tbody>
7235 <tfoot>
7236 <tr>
7237 <td>Sum</td>
7238 <td>$180</td>
7239 </tr>
7240 </tfoot>
7241 </table>
7242 !! wikitext
7243 {|
7244 |+Test
7245 !Month
7246 !Savings
7247 |-
7248 |January
7249 |$100
7250 |-
7251 |February
7252 |$80
7253 |-
7254 |Sum
7255 |$180
7256 |}
7257 !! html/php+tidy
7258 <table>
7259 <caption>Test
7260 </caption>
7261 <tbody><tr>
7262 <th>Month
7263 </th>
7264 <th>Savings
7265 </th></tr>
7266 <tr>
7267 <td>January
7268 </td>
7269 <td>$100
7270 </td></tr>
7271 <tr>
7272 <td>February
7273 </td>
7274 <td>$80
7275 </td></tr>
7276 <tr>
7277 <td>Sum
7278 </td>
7279 <td>$180
7280 </td></tr></tbody></table>
7281 !! end
7282
7283 # T137406: No whitespace in the HTML
7284 !! test
7285 2. Generate correct wikitext for tables with thead/tbody/tfoot
7286 !! options
7287 parsoid=html2wt
7288 !! html/parsoid
7289 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7290 !! wikitext
7291 {|
7292 !heading
7293 |-
7294 |foo
7295 |}
7296 !! end
7297
7298 !! test
7299 Testing serialization after deletion in references
7300 !! options
7301 parsoid={
7302 "modes": ["wt2wt"],
7303 "changes": [
7304 ["#x", "remove"]
7305 ]
7306 }
7307 !! wikitext
7308 hi <ref><div id="x">ho</div></ref>
7309
7310 <references />
7311 !! wikitext/edited
7312 hi <ref></ref>
7313
7314 <references />
7315 !! end
7316
7317 !!test
7318 Testing serialization after deletion of table cells
7319 !!options
7320 parsoid={
7321 "modes": ["wt2wt", "selser"],
7322 "changes": [
7323 ["#x", "remove"]
7324 ]
7325 }
7326 !!wikitext
7327 {|
7328 !h1 !!h2 !!h3
7329 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7330 |}
7331 !! wikitext/edited
7332 {|
7333 !h1 !!h2 !!h3
7334 |c2 |||c3
7335 |}
7336 !!end
7337
7338 !! test
7339 Testing selser after addition of new row before first row (T125419)
7340 !! options
7341 parsoid={
7342 "modes": ["wt2wt", "selser"],
7343 "changes": [
7344 [ "tr", "before", "<tr><td>X</td></tr>" ]
7345 ]
7346 }
7347 !! wikitext
7348 {|
7349 |a
7350 |}
7351 !! wikitext/edited
7352 {|
7353 |X
7354 |-
7355 |a
7356 |}
7357 !! end
7358
7359 !! test
7360 Serialize new table rows in a HTML table using HTML tags
7361 !! options
7362 parsoid={
7363 "modes": ["wt2wt", "selser"],
7364 "changes": [
7365 [ "tr", "before", "<tr><td>X</td></tr>" ]
7366 ]
7367 }
7368 !! wikitext
7369 <table><tr><td>a</td></tr></table>
7370 !! wikitext/edited
7371 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7372 !! end
7373
7374 !! test
7375 Serialize new table cells in a HTML row using HTML tags
7376 !! options
7377 parsoid={
7378 "modes": ["wt2wt", "selser"],
7379 "changes": [
7380 [ "td", "before", "<td>X</td>" ]
7381 ]
7382 }
7383 !! wikitext
7384 <table><tr><td>a</td></tr></table>
7385 !! wikitext/edited
7386 <table><tr><td>X</td><td>a</td></tr></table>
7387 !! end
7388
7389 !! test
7390 Wikitext tables can be nested inside HTML tables
7391 !! options
7392 parsoid=html2wt
7393 !! html
7394 <table data-parsoid='{"stx":"html"}'>
7395 <tr><td>
7396 <table>
7397 <tr><td>foo</td></tr>
7398 </table>
7399 </td></tr>
7400 </table>
7401 !! wikitext
7402 <table>
7403 <tr><td>
7404 {|
7405 |foo
7406 |}
7407 </td></tr>
7408 </table>
7409 !! end
7410
7411 !! test
7412 Serialize wikitext list items as HTML list items when embedded in a HTML list
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{}'>a</li>
7418 <li>b</li>
7419 </ul>
7420 !! wikitext
7421 <ul>
7422 <li>a</li>
7423 <li>b</li>
7424 </ul>
7425 !! end
7426
7427 # SSS FIXME: Is this actually a good thing given the
7428 # odd nested list output that is generated by MW?
7429 # <ul><li>foo<ul>..</ul></li></ul> instead of
7430 # <ul><li>foo</li><ul>..</ul></ul>
7431 !! test
7432 Wikitext lists can be nested inside HTML lists
7433 !! options
7434 parsoid=html2wt
7435 !! html
7436 <ul data-parsoid='{"stx": "html"}'>
7437 <li data-parsoid='{"stx": "html"}'>a
7438 <ul><li>b</li></ul>
7439 </li>
7440 </ul>
7441
7442 <ul data-parsoid='{"stx": "html"}'>
7443 <li>x
7444 <ul><li>y</li></ul>
7445 </li>
7446 </ul>
7447 !! wikitext
7448 <ul>
7449 <li>a
7450 * b
7451 </li>
7452 </ul>
7453
7454 <ul>
7455 <li>x
7456 * y
7457 </li>
7458 </ul>
7459 !! end
7460
7461 ###
7462 ### Internal links
7463 ###
7464 !! test
7465 Plain link, capitalized
7466 !! wikitext
7467 [[Main Page]]
7468 !! html
7469 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7470 </p>
7471 !! end
7472
7473 !! test
7474 Plain link, uncapitalized
7475 !! wikitext
7476 [[main Page]]
7477 !! html
7478 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7479 </p>
7480 !! end
7481
7482 !! test
7483 Piped link
7484 !! wikitext
7485 [[Main Page|The Main Page]]
7486 !! html
7487 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Piped link with comment in link text
7493 !! wikitext
7494 [[Main Page|The Main<!--front--> Page]]
7495 !! html
7496 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Piped link with multiple pipe characters in link text
7502 !! wikitext
7503 [[Main Page||The|Main|Page|]]
7504 !! html/php
7505 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7506 </p>
7507 !! html/parsoid
7508 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7509 !! end
7510
7511 !! test
7512 Piped link with no link text
7513 !! wikitext
7514 [[Thomas Bek (bishop of St David's)|]]
7515 !! html/php
7516 <p>[[Thomas Bek (bishop of St David's)|]]
7517 </p>
7518 !! html/parsoid
7519 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7520 !! end
7521
7522 !! test
7523 Piped link with empty link text
7524 !! wikitext
7525 [[Main Page|<nowiki/>]] - empty nowiki
7526 [[Main Page| ]] - empty space
7527 [[Main Page|&nbsp;]] - empty non breaking space
7528 !! html/php
7529 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7530 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7531 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7532 </p>
7533 !! html/parsoid
7534 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7535 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7536 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7537 !! end
7538
7539 !! test
7540 Broken link
7541 !! wikitext
7542 [[Zigzagzogzagzig]]
7543 !! html
7544 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7545 </p>
7546 !! end
7547
7548 !! test
7549 Broken link with fragment
7550 !! wikitext
7551 [[Zigzagzogzagzig#zug]]
7552 !! html
7553 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Special page link with fragment
7559 !! wikitext
7560 [[Special:Version#anchor]]
7561 !! html
7562 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7563 </p>
7564 !! end
7565
7566 !! test
7567 Nonexistent special page link with fragment
7568 !! wikitext
7569 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7570 !! html
7571 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7572 </p>
7573 !! end
7574
7575 !! test
7576 Link with prefix
7577 !! wikitext
7578 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7579 !! html
7580 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7581 </p>
7582 !! end
7583
7584 !! test
7585 Link with suffix
7586 !! wikitext
7587 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7588 !! html
7589 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7590 </p>
7591 !! end
7592
7593 !! article
7594 prefixed article
7595 !! text
7596 Some text
7597 !! endarticle
7598
7599 !! test
7600 T45661: Piped links with identical prefixes
7601 !! wikitext
7602 [[prefixed article|prefixed articles with spaces]]
7603
7604 [[prefixed article|prefixed articlesaoeu]]
7605
7606 [[Main Page|Main Page test]]
7607 !! html
7608 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7609 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7610 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7611 </p>
7612 !! end
7613
7614
7615 !! test
7616 Link with HTML entity in suffix / tail
7617 !! wikitext
7618 [[Main Page]]&quot;, [[Main Page]]&#97;
7619 !! html/php
7620 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7621 </p>
7622 !! html/parsoid
7623 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7624 !! end
7625
7626 !! test
7627 Link with 3 brackets
7628 !! wikitext
7629 [[[Main Page]]]
7630 Foo [[[Main Page]]]
7631 !! html
7632 <p>[[[Main Page]]]
7633 Foo [[[Main Page]]]
7634 </p>
7635 !! end
7636
7637 !! test
7638 Link with 4 brackets
7639 !! wikitext
7640 [[[[Main Page]]]]
7641 !! html
7642 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7643 </p>
7644 !! end
7645
7646 !! test
7647 Piped link with 3 brackets
7648 !! wikitext
7649 [[[main page|the main page]]]
7650 !! html
7651 <p>[[[main page|the main page]]]
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link with extlink-like text
7657 !! wikitext
7658 [[Main Page|[bar]]]
7659 [[Main Page|This is a [bar]]]
7660 [[Main Page|[bar]]
7661 !! html/php
7662 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7663 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7664 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7665 </p>
7666 !! html/parsoid
7667 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7668 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7669 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7670 !! end
7671
7672 !! test
7673 Link with multiple pipes
7674 !! wikitext
7675 [[Main Page|The|Main|Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Anchor containing a #. (T65430)
7683 !! config
7684 wgFragmentMode=[ 'html5', 'legacy' ]
7685 !! wikitext
7686 [[Main Page#And#Link]]
7687 !! html/php
7688 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7689 </p>
7690 !! html/parsoid
7691 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7692 !! end
7693
7694 !! test
7695 Link to namespaces
7696 !! wikitext
7697 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7698 !! html
7699 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Link with space in namespace
7705 !! wikitext
7706 [[User talk:Foo bar]]
7707 !! html
7708 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7709 </p>
7710 !! end
7711
7712 !! article
7713 MemoryAlpha:AlphaTest
7714 !! text
7715 This is an article in the MemoryAlpha namespace
7716 (which shadows the memoryalpha interwiki link).
7717 !! endarticle
7718
7719 !! test
7720 Namespace takes precedence over interwiki link (T53680)
7721 !! wikitext
7722 [[MemoryAlpha:AlphaTest]]
7723 !! html
7724 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7725 </p>
7726 !! end
7727
7728 # The previous test doesn't work correctly in html2*, due to not recognizing the
7729 # link as an internal one. This one checks for the correct behavior.
7730 !! test
7731 Link to namespace preferred over interwiki with correct rel attribute
7732 !! options
7733 parsoid=html2wt,html2html
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7736 !! wikitext
7737 [[MemoryAlpha:AlphaTest]]
7738 !! end
7739
7740 !! test
7741 Piped link to namespace
7742 !! wikitext
7743 [[Meta:Disclaimers|The disclaimers]]
7744 !! html
7745 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7746 </p>
7747 !! end
7748
7749 !! test
7750 Link containing }
7751 !! wikitext
7752 [[Usually caused by a typo (oops}]]
7753 !! html
7754 <p>[[Usually caused by a typo (oops}]]
7755 </p>
7756 !! end
7757
7758 !! article
7759 7% Solution
7760 !! text
7761 Just a test of an article title containing a percent.
7762 !! endarticle
7763
7764 !! test
7765 Link containing % (not as a hex sequence)
7766 !! wikitext
7767 [[7% Solution]]
7768 [[7% Solution|7%25 Solution]]
7769 !! html/php
7770 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7771 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7772 </p>
7773 !! html/parsoid
7774 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7775 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7776 !! end
7777
7778 # note that the parsoid HTML is identical to the previous test output,
7779 # so the previous test ensures that the html2wt mode will generate the
7780 # "not as a hex sequence" wikitext.
7781 !! test
7782 Link containing % as a single hex sequence interpreted to char
7783 !! options
7784 parsoid=wt2wt,wt2html,html2html
7785 !! wikitext
7786 [[7%25 Solution]]
7787 [[7%25 Solution|7%25 Solution]]
7788 !! html/php
7789 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7790 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7791 </p>
7792 !! html/parsoid
7793 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7794 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7795 !!end
7796
7797 !! test
7798 Link containing % as a double hex sequence interpreted to hex sequence
7799 !! wikitext
7800 [[7%2525 Solution]]
7801 !! html
7802 <p>[[7%2525 Solution]]
7803 </p>
7804 !!end
7805
7806 ## Example for such a section: == < ==
7807 !! test
7808 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7809 !! config
7810 wgFragmentMode=[ 'html5', 'legacy' ]
7811 !! wikitext
7812 [[%23%3c]][[%23%3e]]
7813 !! html/php
7814 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7818 !! end
7819
7820 ## Example for such a section: == < ==
7821 !! test
7822 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7823 !! config
7824 wgFragmentMode=[ 'legacy' ]
7825 !! wikitext
7826 [[%23%3c]][[%23%3e]]
7827 !! html/php
7828 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Link containing "<#" and ">#" as a hex sequences
7834 !! wikitext
7835 [[%3c%23]][[%3e%23]]
7836 !! html
7837 <p>[[%3c%23]][[%3e%23]]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Link containing an equals sign
7843 !! wikitext
7844 [[Special:BookSources/isbn=4-00-026157-6]]
7845 !! html/php
7846 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7847 </p>
7848 !! html/parsoid
7849 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7850 !! end
7851
7852 !! article
7853 Foo~bar
7854 !! text
7855 Just a test of an article title containing a tilde.
7856 !! endarticle
7857
7858 # note that links containing signatures, like [[Foo~~~~]], are
7859 # massaged by the pre-save transform (PST) and so the tildes are never
7860 # seen by the parser.
7861 !! test
7862 Link containing a tilde
7863 !! wikitext
7864 [[Foo~bar]]
7865 !! html/php
7866 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7867 </p>
7868 !! html/parsoid
7869 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7870 !! end
7871
7872 !! test
7873 Link containing double-single-quotes '' (T6598)
7874 !! wikitext
7875 [[Lista d''e paise d''o munno]]
7876 !! html/php
7877 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
7878 </p>
7879 !! html/parsoid
7880 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7881 !! end
7882
7883 !! test
7884 Link containing double quotes and spaces
7885 !! wikitext
7886 [[Cool "Gator"]]
7887 !! html/php
7888 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7892 !! end
7893
7894 !! test
7895 File containing double quotes and spaces
7896 !! wikitext
7897 [[File:Cool "Gator".png]]
7898 !! html/parsoid
7899 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
7900 !! end
7901
7902 !! test
7903 Redirect containing double quotes and spaces
7904 !! wikitext
7905 #REDIRECT [[Cool "Gator"]]
7906 !! html/parsoid
7907 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7908 !! end
7909
7910 !! test
7911 Link containing double-single-quotes '' in text (T6598 sanity check)
7912 !! wikitext
7913 Some [[Link|pretty ''italics'' and stuff]]!
7914 !! html/php
7915 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7916 </p>
7917 !! html/parsoid
7918 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7919 !! end
7920
7921 !! test
7922 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7923 !! wikitext
7924 ''Some [[Link|pretty ''italics'' and stuff]]!''
7925 !! html
7926 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link with double quotes in title part (literal) and alternate part (interpreted)
7932 !! wikitext
7933 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7934
7935 [[''Pentecoste'']]
7936
7937 [[''Pentecoste''|Pentecoste]]
7938
7939 [[''Pentecoste''|''Pentecoste'']]
7940 !! html/php
7941 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7942 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
7943 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
7944 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
7945 </p>
7946 !! html/parsoid
7947 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
7948 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7949 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7950 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7951 !! end
7952
7953 !! test
7954 Broken image links with HTML captions (T41700)
7955 !! wikitext
7956 [[File:Nonexistent|<script></script>]]
7957 [[File:Nonexistent|100x100px|<script></script>]]
7958 [[File:Nonexistent|&lt;]]
7959 [[File:Nonexistent|a<i>b</i>c]]
7960 !! html/php
7961 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7962 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7963 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7964 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7965 </p>
7966 !! html/parsoid
7967 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7968 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7969 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
7970 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
7971 !! end
7972
7973 !! test
7974 Plain link to URL
7975 !! wikitext
7976 [[http://www.example.com]]
7977 !! html/php
7978 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7979 </p>
7980 !! html/parsoid
7981 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
7982 !! end
7983
7984 !! test
7985 Plain link to URL with link text
7986 !! wikitext
7987 [[http://www.example.com Link text]]
7988 !! html
7989 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Plain link to protocol-relative URL
7995 !! wikitext
7996 [[//www.example.com]]
7997 !! html/php
7998 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7999 </p>
8000 !! html/parsoid
8001 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8002 !! end
8003
8004 !! test
8005 Plain link to protocol-relative URL with link text
8006 !! wikitext
8007 [[//www.example.com Link text]]
8008 !! html
8009 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8010 </p>
8011 !! end
8012
8013 !! test
8014 Plain link to page with question mark in title
8015 !! wikitext
8016 [[A?b]]
8017
8018 [[A?b|Baz]]
8019 !! html
8020 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8021 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8022 </p>
8023 !! end
8024
8025 # I'm fairly sure the expected result here is wrong.
8026 # We want these to be URL links, not pseudo-pages with URLs for titles....
8027 # However the current output is also pretty screwy.
8028 #
8029 # ----
8030 # I'm changing it to match the current output--it arguably makes more
8031 # sense in the light of the test above. Old expected result was:
8032 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8033 #</p>
8034 # But I think this test is bordering on "garbage in, garbage out" anyway.
8035 # -- wtm
8036 !! test
8037 Piped link to URL
8038 !! wikitext
8039 Piped link to URL: [[http://www.example.com|an example URL]]
8040 !! html/php
8041 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8042 </p>
8043 !! html/parsoid
8044 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8045 !! end
8046
8047 !! test
8048 Plain link in template argument
8049 !! options
8050 parsoid=wt2html
8051 !! wikitext
8052 {{echo|[http://www.example.com |123]}}
8053
8054 {{echo|[[http://www.example.com |123]]}}
8055
8056 {{echo|[[http://www.example.com |123]}}
8057
8058 {{echo|[http://www.example.com |123]]}}
8059 !! html/php
8060 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8061 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8062 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8063 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8064 </p>
8065 !! html/parsoid
8066 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8067
8068 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8069
8070 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8071
8072 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8073 !! end
8074
8075 !! test
8076 T2002: [[page|http://url/]] should link to page, not http://url/
8077 !! wikitext
8078 [[Main Page|http://url/]]
8079 !! html/php
8080 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8084 !! end
8085
8086 # Parsoid does not mark self-links, by design.
8087 !! test
8088 T2337: Escaped self-links should be bold
8089 !! options
8090 title=[[Bug462]]
8091 !! wikitext
8092 [[Bu&#103;462]] [[Bug462]]
8093 !! html/php+tidy
8094 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8095 </p>
8096 !! html/parsoid
8097 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8098 !! end
8099
8100 !! test
8101 Self-link to section should not be bold
8102 !! options
8103 title=[[Main Page]]
8104 !! wikitext
8105 [[Main Page#section]]
8106 !! html
8107 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8108 </p>
8109 !! end
8110
8111 !! article
8112 00
8113 !! text
8114 This is 00.
8115 !! endarticle
8116
8117 !!test
8118 Self-link to numeric title
8119 !!options
8120 title=[[0]]
8121 !! wikitext
8122 [[0]]
8123 !! html
8124 <p><a class="mw-selflink selflink">0</a>
8125 </p>
8126 !!end
8127
8128 !!test
8129 Link to numeric-equivalent title
8130 !!options
8131 title=[[0]]
8132 !! wikitext
8133 [[00]]
8134 !! html
8135 <p><a href="/wiki/00" title="00">00</a>
8136 </p>
8137 !!end
8138
8139 !! test
8140 <nowiki> inside a link
8141 !! wikitext
8142 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8143 !! html
8144 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8145 </p>
8146 !! end
8147
8148 !! test
8149 Non-breaking spaces in title
8150 !! wikitext
8151 [[&nbsp; Main &nbsp; Page &nbsp;]]
8152 !! html
8153 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8154 </p>
8155 !!end
8156
8157 # Add new article for the test below so that it doesn't red-link
8158 !! article
8159 Foo bar baz
8160 !! text
8161 boo
8162 !! endarticle
8163
8164 !! test
8165 Multiple spaces in titles should normalize to a single underscore
8166 !! options
8167 parsoid=wt2html,wt2wt
8168 !! wikitext
8169 [[Foo bar baz|x]]
8170 [[Foo bar baz|x]]
8171 [[Foo bar baz|x]]
8172 !! html/php
8173 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8174 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8175 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8176 </p>
8177 !! html/parsoid
8178 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8179 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8180 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8181 </p>
8182 !! end
8183
8184 !! test
8185 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8186 !! options
8187 language=ca
8188 !! wikitext
8189 '''[[Main Page]]'''
8190 !! html
8191 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8192 </p>
8193 !! end
8194
8195 !! test
8196 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8197 !! options
8198 language=ca
8199 !! wikitext
8200 ''[[Main Page]]''
8201 !! html
8202 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8203 </p>
8204 !! end
8205
8206 !! test
8207 Internal link with en linktrail: no apostrophes (T29473)
8208 !! options
8209 language=en
8210 !! wikitext
8211 [[Something]]'nice
8212 !! html
8213 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8214 </p>
8215 !! end
8216
8217 !! test
8218 Internal link with ca linktrail with apostrophes (T29473)
8219 !! options
8220 language=ca
8221 !! wikitext
8222 [[Something]]'nice
8223 !! html
8224 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8225 </p>
8226 !! end
8227
8228 !! test
8229 Internal link with kaa linktrail with apostrophes (T29473)
8230 !! options
8231 language=kaa
8232 !! wikitext
8233 [[Something]]'nice
8234 !! html
8235 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Link with multiple ":" in a subpage-supporting namespace (T65636)
8241 !! wikitext
8242 [[User:Foo/Test/63636:Bar|Test]]
8243 !! html/php
8244 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8245 </p>
8246 !! html/parsoid
8247 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8248 !! end
8249
8250 ## Mainly a sanity check for Parsoid
8251 !! test
8252 Handle title parsing for subpages
8253 !! options
8254 title=[[/123123]]
8255 subpage
8256 !! wikitext
8257 123
8258 !! html/php
8259 <p>123
8260 </p>
8261 !! html/parsoid
8262 <p>123</p>
8263 !! end
8264
8265 !! article
8266 User:Test/123
8267 !! text
8268 test 123
8269 !! endarticle
8270
8271 !! test
8272 Link to a subpage from a namespace other than main
8273 !! options
8274 title=[[User:Test]]
8275 subpage
8276 !! wikitext
8277 [[/123]]
8278 !! html/php
8279 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8280 </p>
8281 !! html/parsoid
8282 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8283 !! end
8284
8285 !! test
8286 Ensure that transclusion titles are not url-decoded
8287 !! options
8288 subpage title=[[Test]]
8289 parsoid=wt2html
8290 !! wikitext
8291 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8292 !! html/php
8293 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8294 </p>
8295 !! html/parsoid
8296 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8297 !! end
8298
8299 !! test
8300 Purely hash wikilink
8301 !! options
8302 title=[[User:Test/123]]
8303 subpage
8304 !! wikitext
8305 [[#a|b]]
8306 !! html/php
8307 <p><a href="#a">b</a>
8308 </p>
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8311 !! end
8312
8313 !! test
8314 Serialization of purely hash wikilink
8315 !! options
8316 title=[[User:Test/123]]
8317 subpage
8318 parsoid=html2wt
8319 !! html/parsoid
8320 <p><a href="#a">[[</a></p>
8321 !! wikitext
8322 [[#a|<nowiki>[[</nowiki>]]
8323 !! html/php
8324 <p><a href="#a">[[</a>
8325 </p>
8326 !! end
8327
8328 !! test
8329 1. Interaction of linktrail and template encapsulation
8330 !! wikitext
8331 {{echo|[[Foo]]}}l
8332 !! html/parsoid
8333 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8334 !! end
8335
8336 !! test
8337 2. Interaction of linktrail and template encapsulation
8338 !! options
8339 parsoid
8340 !! wikitext
8341 {{echo|Some [[Fool]]}}s
8342 !! html
8343 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8344 !! end
8345
8346 !! test
8347 3. Interaction of linktrail and template encapsulation
8348 !! options
8349 parsoid
8350 !! wikitext
8351 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8352 !! html
8353 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8354 !! end
8355
8356 !! article
8357 Söfnuður
8358 !! text
8359 Test.
8360 !! endarticle
8361
8362 !! test
8363 Internal link with is link prefix
8364 !! options
8365 language=is
8366 !! wikitext
8367 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8368 !! html
8369 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8370 </p>
8371 !! end
8372
8373 !! article
8374 Mótmælendatrú
8375 !! text
8376 Test.
8377 !! endarticle
8378
8379 !! test
8380 Internal link with is link trail and link prefix
8381 !! options
8382 language=is
8383 !! wikitext
8384 [[mótmælendatrú|xxx]]ar
8385 [[mótmælendatrú]]ar
8386 mótmælenda[[söfnuður]]
8387 mótmælenda[[söfnuður|söfnuðir]]
8388 mótmælenda[[söfnuður|söfnuðir]]xxx
8389 !! html
8390 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8391 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8392 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8393 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8394 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Parsoid link trail escaping
8400 !! options
8401 parsoid=html2wt,html2html
8402 !! html/parsoid
8403 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8404 !! wikitext
8405 [[apple]]<nowiki/>s
8406 !! end
8407
8408 !! test
8409 Parsoid link prefix escaping
8410 !! options
8411 language=is
8412 parsoid=html2wt,html2html
8413 !! html/parsoid
8414 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8415 !! wikitext
8416 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8417 !! end
8418
8419 !! test
8420 Parsoid link bracket escaping
8421 !! options
8422 parsoid=html2wt,html2html
8423 !! html/parsoid
8424 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8425 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8426 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8427 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8428 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8429 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8430 !! wikitext
8431 [[Test]]
8432
8433 [<nowiki/>[[Test]]]
8434
8435 [[[[Test]]]]
8436
8437 [[[<nowiki/>[[Test]]]]]
8438
8439 [[[[[[Test]]]]]]
8440
8441 [[[[[<nowiki/>[[Test]]]]]]]
8442 !! end
8443
8444 !! test
8445 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8446 !! wikitext
8447 [[Foo| bar]]
8448
8449 [[Foo| ''bar'']]
8450
8451 [http://wp.org foo]
8452
8453 [http://wp.org ''foo'']
8454 !! html
8455 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8456 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8457 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8458 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8459 </p>
8460 !! end
8461
8462 !! test
8463 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8464 !! wikitext
8465 [[Foo|{{echo|a}} b {{echo|c}}]]
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8468 !! end
8469
8470 !! test
8471 Link with angle bracket after anchor
8472 !! config
8473 wgFragmentMode=[ 'html5', 'legacy' ]
8474 !! wikitext
8475 [[Foo#<bar>]]
8476 !! html/php
8477 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8478 </p>
8479 !! html/parsoid
8480 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8481 !! end
8482
8483 !! test
8484 Link with angle bracket after anchor (legacy)
8485 !! config
8486 wgFragmentMode=[ 'legacy' ]
8487 !! wikitext
8488 [[Foo#<bar>]]
8489 !! html/php
8490 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8491 </p>
8492 !! end
8493
8494 ###
8495 ### Interwiki links (see maintenance/interwiki.sql)
8496 ###
8497
8498 !! test
8499 Inline interwiki link
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[MeatBall:SoftSecurity]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8509 !! end
8510
8511 !! test
8512 Inline interwiki link with empty title (T4372)
8513 !! options
8514 parsoid=wt2html,wt2wt,html2html
8515 !! wikitext
8516 [[MeatBall:]]
8517 !! html/php
8518 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8522 !! end
8523
8524 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8525 !! test
8526 Interwiki link encoding conversion (T3636)
8527 !! options
8528 parsoid=wt2html,wt2wt
8529 !! wikitext
8530 *[[Wikipedia:ro:Olteni&#0355;a]]
8531 *[[Wikipedia:ro:Olteni&#355;a]]
8532 !! html
8533 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8534 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8535
8536 !! html/php+tidy
8537 <ul>
8538 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8539 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8540 </ul>
8541 !! html/parsoid
8542 <ul>
8543 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8544 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8545 </ul>
8546 !! end
8547
8548 !! test
8549 Interwiki link with fragment (T4130)
8550 !! wikitext
8551 [[MeatBall:SoftSecurity#foo]]
8552 !! html
8553 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8554 </p>
8555 !! end
8556
8557 !! test
8558 Link scenarios with escaped fragments
8559 !! config
8560 wgFragmentMode=[ 'html5', 'legacy' ]
8561 !! wikitext
8562 [[#Is this great?]]
8563 [[Foo#Is this great?]]
8564 [[meatball:Foo#Is this great?]]
8565 !! html/php
8566 <p><a href="#Is_this_great?">#Is this great?</a>
8567 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8568 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8572 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8573 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8574 !! end
8575
8576 !! test
8577 Link scenarios with escaped fragments (legacy)
8578 !! config
8579 wgFragmentMode=[ 'legacy' ]
8580 !! wikitext
8581 [[#Is this great?]]
8582 [[Foo#Is this great?]]
8583 [[meatball:Foo#Is this great?]]
8584 !! html/php
8585 <p><a href="#Is_this_great.3F">#Is this great?</a>
8586 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8587 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8588 </p>
8589 !! end
8590
8591 # Ideally the wikipedia: prefix here should be proto-relative too
8592 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8593 # define the 'en' prefix, and originally the test used 'wikipedia',
8594 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8595 # article.
8596 !! test
8597 Different interwiki prefixes mapping to the same URL
8598 !! wikitext
8599 [[:en:Foo]]
8600
8601 [[:en:Foo|Foo]]
8602
8603 [[wikipedia:Foo]]
8604
8605 [[:wikipedia:Foo|Foo]]
8606
8607 [[wikipedia:en:Foo]]
8608
8609 [[:wikipedia:en:Foo]]
8610
8611 [[ wikiPEdia :Foo]]
8612 !! html/parsoid
8613 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8614
8615 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8616
8617 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8618
8619 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8620
8621 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8622
8623 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8624
8625 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8626 !! end
8627
8628 !! test
8629 Interwiki links that cannot be represented in wiki syntax
8630 !! wikitext
8631 [[meatball:ok]]
8632 [[meatball:ok#foo|ok with fragment]]
8633 [[meatball:ok_as_well?|ok ending with ? mark]]
8634 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8635 [http://de.wikipedia.org/wiki/#foo is just fragment]
8636
8637 !! html/php
8638 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8639 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8640 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8641 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8642 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8643 </p>
8644 !! html/parsoid
8645 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8646 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8647 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8648 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8649 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8650 !! end
8651
8652 !! test
8653 Interwiki links: trail
8654 !! wikitext
8655 [[wikipedia:Foo|Ba]]r
8656 !! html/php
8657 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8658 </p>
8659 !! html/parsoid
8660 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8661 !! end
8662
8663 !! test
8664 Local interwiki link
8665 !! options
8666 parsoid=wt2html,wt2wt,html2html
8667 !! wikitext
8668 [[local:Template:Foo]]
8669 !! html/php
8670 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8671 </p>
8672 !! html/parsoid
8673 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8674 !! end
8675
8676 # Parsoid does not mark self-links, by design.
8677 !! test
8678 Local interwiki link: self-link to current page
8679 !! options
8680 title=[[Main Page]]
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 [[local:Main Page]]
8684 !! html/php
8685 <p><a class="mw-selflink selflink">local:Main Page</a>
8686 </p>
8687 !! html/parsoid
8688 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8689 !! end
8690
8691 !! test
8692 Local interwiki link: prefix only (T66167)
8693 !! options
8694 parsoid=wt2html,wt2wt,html2html
8695 !! wikitext
8696 [[local:]]
8697 !! html/php
8698 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8699 </p>
8700 !! html/parsoid
8701 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8702 !! end
8703
8704 !! test
8705 Local interwiki link: with additional interwiki prefix (T63357)
8706 !! options
8707 parsoid=wt2html,wt2wt,html2html
8708 !! wikitext
8709 [[local:meatball:Hello]]
8710 !! html/php
8711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8712 </p>
8713 !! html/parsoid
8714 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8715 !! end
8716
8717 !! test
8718 Multiple local interwiki link prefixes
8719 !! wikitext
8720 [[local:local:local:local:mi:local:Foo]]
8721 !! options
8722 parsoid=wt2html,wt2wt,html2html
8723 !! html/php
8724 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8725 </p>
8726 !! html/parsoid
8727 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8728 !! end
8729
8730 ###
8731 ### Interlanguage links
8732 ### Language links (so that searching for '### language' matches..)
8733 ###
8734
8735 !! test
8736 Interlanguage link
8737 !! wikitext
8738 Blah blah blah
8739 [[zh:Chinese]]
8740 !! html/php
8741 <p>Blah blah blah
8742 </p>
8743 !! html/parsoid
8744 <p>Blah blah blah</p>
8745 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8746 !! end
8747
8748 ## parsoid html2wt will lose the space variations
8749 !! test
8750 Interlanguage link with spacing
8751 !! options
8752 parsoid=wt2html,wt2wt,html2html
8753 !! wikitext
8754 Blah blah blah
8755 [[ zh : Chinese ]]
8756 !! html/php
8757 <p>Blah blah blah
8758 </p>
8759 !! html/parsoid
8760 <p>Blah blah blah</p>
8761 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8762 !! end
8763
8764 !! test
8765 Double interlanguage link
8766 !! wikitext
8767 Blah blah blah
8768 [[es:Spanish]]
8769 [[zh:Chinese]]
8770 !! html/php
8771 <p>Blah blah blah
8772 </p>
8773 !! html/parsoid
8774 <p>Blah blah blah</p>
8775 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8776 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8777 !! end
8778
8779 ## parsoid html2wt will lose the space variations
8780 !! test
8781 Interlanguage link variations
8782 !! options
8783 parsoid=wt2html,wt2wt,html2html
8784 !! wikitext
8785 Blah blah blah
8786 [[ es :Spanish]]
8787 [[ ZH :Chinese]]
8788 [[es:Foo_bar]]
8789 !! html/php
8790 <p>Blah blah blah
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah</p>
8794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8795 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8797 !! end
8798
8799 !! test
8800 Escaping of interlanguage links (T129218, T156308)
8801 !! wikitext
8802 Blah blah blah
8803 [[:es:Spanish]]
8804 [[ : zh : Chinese ]]
8805 !! html/php
8806 <p>Blah blah blah
8807 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8808 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8809 </p>
8810 !! html/parsoid
8811 <p>Blah blah blah
8812 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8813 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8814 !! end
8815
8816 !! test
8817 Multiple colons escaping interlanguage links
8818 !! options
8819 parsoid=wt2html
8820 !! wikitext
8821 [[:es:Spanish]]
8822 [[::es:Spanish]]
8823 [[:::es:Spanish]]
8824 !! html/php
8825 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8826 [[::es:Spanish]]
8827 [[:::es:Spanish]]
8828 </p>
8829 !! html/parsoid
8830 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8831 [[::es:Spanish]]
8832 [[:::es:Spanish]]</p>
8833 !! end
8834
8835 ## parsoid html2wt will normalize the space to _
8836 !! test
8837 Space and question mark encoding in interlanguage links (T95473)
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 Blah blah blah
8842 [[es:Foo bar?]]
8843 !! html/php
8844 <p>Blah blah blah
8845 </p>
8846 !! html/parsoid
8847 <p>Blah blah blah</p>
8848 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8849 !! end
8850
8851 !! test
8852 Interlanguage link, with prefix links
8853 !! options
8854 language=ln
8855 !! wikitext
8856 Blah blah blah
8857 [[zh:Chinese]]
8858 !! html/php
8859 <p>Blah blah blah
8860 </p>
8861 !! html/parsoid
8862 <p>Blah blah blah</p>
8863 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8864 !! end
8865
8866 !! test
8867 Double interlanguage link, with prefix links (T10897)
8868 !! options
8869 language=ln
8870 !! wikitext
8871 Blah blah blah
8872 [[es:Spanish]]
8873 [[zh:Chinese]]
8874 !! html/php
8875 <p>Blah blah blah
8876 </p>
8877 !! html/parsoid
8878 <p>Blah blah blah</p>
8879 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8880 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8881 !! end
8882
8883 !! test
8884 "Extra" interlanguage links (T34189 / gerrit 111390)
8885 !! wikitext
8886 Blah blah blah
8887 [[mul:Article]]
8888 !! html/php
8889 <p>Blah blah blah
8890 </p>
8891 !! html/parsoid
8892 <p>Blah blah blah</p>
8893 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8894 !! end
8895
8896 ## PHP parser tests script needs an update
8897 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8898 !! test
8899 Language links render as inline links if $wgInterwikiMagic=false
8900 !! options
8901 wgInterwikiMagic=false
8902 parsoid=wt2html,wt2wt,html2html
8903 !! wikitext
8904 Blah blah blah
8905 [[zh:Chinese]]
8906 !! html/parsoid
8907 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8908 !! end
8909
8910 ## PHP parser tests script needs an update
8911 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8912 !! test
8913 Language links render as inline links in the Talk namespace
8914 !! options
8915 title=Talk:Foo
8916 parsoid=wt2html,wt2wt,html2html
8917 !! wikitext
8918 Blah blah blah
8919 [[zh:Chinese]]
8920 !! html/parsoid
8921 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8922 !! end
8923
8924 !! test
8925 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8926 !! options
8927 language=ln
8928 !! wikitext
8929 [[WW&nbsp;II]]
8930 !! html
8931 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8932 </p>
8933 !! end
8934
8935 !! test
8936 Parsoid T55221: Wikilinks should be properly entity-escaped
8937 !! options
8938 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8939 !! html/parsoid
8940 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8941 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8942 !! wikitext
8943 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8944
8945 He&amp;nbsp;llo He&amp;nbsp;llo
8946 !! html/php
8947 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8948 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8949 </p>
8950 !! end
8951
8952 # html2wt will fail because of title normalization without data-parsoid
8953 !! test
8954 Parsoid: handle constructor well
8955 !! options
8956 parsoid=wt2html,wt2wt
8957 !! wikitext
8958 [[constructor]]
8959
8960 [[constructor:foo]]
8961 !! html/php
8962 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8963 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8964 </p>
8965 !! html/parsoid
8966 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8967
8968 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8969 !! end
8970
8971 !! article
8972 ko:
8973 !! text
8974 Test.
8975 !! endarticle
8976
8977 # Note that `ko` isn't a known interlanguage prefix
8978 !! test
8979 Parsoid: recognize interlanguage links without a target page
8980 !! options
8981 ill
8982 !! wikitext
8983 [[es:]]
8984
8985 [[ko:]]
8986 !! html/php
8987 es:
8988 !! html/parsoid
8989 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8990
8991 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8992 !! end
8993
8994 # Note that `ko` isn't a known interwiki prefix
8995 !! test
8996 Parsoid: recognize interwiki links without a target page
8997 !! options
8998 parsoid=wt2html,wt2wt,html2html
8999 !! wikitext
9000 [[:es:]]
9001
9002 [[:ko:]]
9003 !! html/php
9004 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9005 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9006 </p>
9007 !! html/parsoid
9008 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9009 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9010 !! end
9011
9012 !! test
9013 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9014 !! wikitext
9015 [[mi:Foo]]
9016 !! html/php
9017 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9018 </p>
9019 !! html/parsoid
9020 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9021 !! end
9022
9023 !! test
9024 Interlanguage link with preceding local interwiki link (T70085)
9025 !! options
9026 parsoid=wt2html,wt2wt,html2html
9027 !! wikitext
9028 Blah blah blah
9029 [[local:es:Spanish]]
9030 !! html/php
9031 <p>Blah blah blah
9032 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9033 </p>
9034 !! html/parsoid
9035 <p>Blah blah blah
9036 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9037 !! end
9038
9039 !! test
9040 Looks like an interlanguage link, but is actually a local interwiki
9041 !! options
9042 parsoid=wt2html,wt2wt,html2html
9043 !! wikitext
9044 Blah blah blah
9045 [[mi:Template:Foo]]
9046 !! html/php
9047 <p>Blah blah blah
9048 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9049 </p>
9050 !! html/parsoid
9051 <p>Blah blah blah
9052 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9053 !! end
9054
9055 ###
9056 ### Redirects, Parsoid-only
9057 ###
9058
9059 !! test
9060 1. Simple redirect to page
9061 !! wikitext
9062 #REDIRECT [[Main Page]]
9063 !! html/parsoid
9064 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9065 !! end
9066
9067 !! test
9068 2. Other redirect variants
9069 !! wikitext
9070 #REDIRECT [[Main_Page]]
9071 !! html/parsoid
9072 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9073 !! end
9074
9075 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9076 # This tests the Parsoid bail-out code.
9077 !! test
9078 3. Other redirect variants
9079 !! options
9080 parsoid=wt2html
9081 !! wikitext
9082 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9083 !! html/parsoid
9084 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9085 !! end
9086
9087 !! test
9088 4. Redirect to a templated destination
9089 !! wikitext
9090 #REDIRECT [[{{echo|Foo}}bar]]
9091 !! html/parsoid
9092 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9093 !! end
9094
9095 !! test
9096 Empty redirect
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 #REDIRECT [[]]
9101 !! html/parsoid
9102 <ol>
9103 <li>REDIRECT [[]]</li></ol>
9104 !! end
9105
9106 !! test
9107 Optional colon in #REDIRECT
9108 !! options
9109 # the colon is archaic syntax. we support it for wt2html, but we
9110 # don't care that it roundtrips back to the modern syntax.
9111 parsoid=wt2html,html2html
9112 !! wikitext
9113 #REDIRECT:[[Main Page]]
9114 !! html/parsoid
9115 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9116 !! end
9117
9118 !! test
9119 Whitespace in #REDIRECT with optional colon
9120 !! options
9121 # the colon and gratuitous whitespace is archaic syntax. we support
9122 # it for wt2html, but we don't care that it roundtrips back to the
9123 # modern syntax (without extra whitespace)
9124 parsoid=wt2html,html2html
9125 !! wikitext
9126
9127 #REDIRECT
9128 :
9129 [[Main Page]]
9130 !! html/parsoid
9131 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9132 !! end
9133
9134 !! test
9135 Piped link in #REDIRECT
9136 !! options
9137 # content after piped link is ignored. we support this syntax,
9138 # but don't care that the piped link is lost when we roundtrip this.
9139 parsoid=wt2html
9140 !! wikitext
9141 #REDIRECT [[Main Page|bar]]
9142 !! html/parsoid
9143 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9144 !! end
9145
9146 !! test
9147 Redirect to category (T104502)
9148 !! options
9149 parsoid=wt2html,wt2wt
9150 !! wikitext
9151 #REDIRECT [[Category:Foo]]
9152 !! html/parsoid
9153 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9154 !! end
9155
9156 !! test
9157 Redirect to category with URL encoding (T104502)
9158 !! options
9159 parsoid=wt2html
9160 !! wikitext
9161 #REDIRECT [[Category%3AFoo]]
9162 !! html/parsoid
9163 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9164 !! end
9165
9166 !! test
9167 Redirect to category page
9168 !! wikitext
9169 #REDIRECT [[:Category:Foo]]
9170 !! html/parsoid
9171 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9172 !! end
9173
9174 !! test
9175 Redirect to image page (1)
9176 !! wikitext
9177 #REDIRECT [[File:Wiki.png]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9180 !! end
9181
9182 !! test
9183 Redirect to image page (2)
9184 !! wikitext
9185 #REDIRECT [[Image:Wiki.png]]
9186 !! html/parsoid
9187 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9188 !! end
9189
9190 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9191 # Next test confirms this.
9192 !! test
9193 Redirect to language (1) (T104918)
9194 !! options
9195 parsoid=wt2html,wt2wt,html2html
9196 !! wikitext
9197 #REDIRECT [[en:File:Wiki.png]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9200 !! end
9201
9202 !! test
9203 Redirect to language (2) (T104918)
9204 !! wikitext
9205 #REDIRECT [[:en:File:Wiki.png]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9208 !! end
9209
9210 !! test
9211 Redirect to interwiki (T104918)
9212 !! wikitext
9213 #REDIRECT [[meatball:File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Non-English #REDIRECT
9220 !! options
9221 language=is
9222 !! wikitext
9223 #TILVÍSUN [[Main Page]]
9224 !! html/parsoid
9225 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9226 !! end
9227
9228 !! test
9229 Redirect syntax under text isn't considered a redirect
9230 !! wikitext
9231 some text
9232 #redirect [[Main Page]]
9233 !! html/parsoid
9234 <p>some text</p>
9235 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9236 !! end
9237
9238 !! test
9239 New redirect
9240 !! options
9241 parsoid=html2wt
9242 !! html/parsoid
9243 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9244 !! wikitext
9245 #REDIRECT [[Foo]]
9246 Foo
9247 !! end
9248
9249 !! test
9250 Redirect followed by block on the same line
9251 !! options
9252 parsoid=wt2html
9253 !! wikitext
9254 #REDIRECT [[Main Page]]<!-- haha -->== hi ==
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi"> hi </h2>
9257 !! end
9258
9259 !! test
9260 Redirect followed by a newline
9261 !! wikitext
9262 #REDIRECT [[Main Page]]
9263 A newline
9264 !! html/parsoid
9265 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9266 <p>A newline</p>
9267 !! end
9268
9269 !! test
9270 Redirect followed by multiple newlines
9271 !! wikitext
9272 #REDIRECT [[Main Page]]
9273
9274
9275 A newline
9276 !! html/parsoid
9277 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9278
9279 <p><br/>
9280 A newline</p>
9281 !! end
9282
9283 !! test
9284 Drop duplicate redirects
9285 !! options
9286 parsoid=html2wt
9287 !! html/parsoid
9288 <link rel="mw:PageProp/redirect" href="./Foo"/>
9289 <link rel="mw:PageProp/redirect" href="./Bar"/>
9290 <link rel="mw:PageProp/redirect" href="./Baz"/>
9291 !! wikitext
9292 #REDIRECT [[Foo]]
9293 !! end
9294
9295 ##
9296 ## XHTML tidiness
9297 ###
9298
9299 !! test
9300 <br> to <br />
9301 !! wikitext
9302 1<br>2<br />3
9303 !! html
9304 <p>1<br />2<br />3
9305 </p>
9306 !! end
9307
9308 !! test
9309 Broken br tag sanitization
9310 !! wikitext
9311 </br>
9312 !! html/php
9313 <p>&lt;/br&gt;
9314 </p>
9315 !! end
9316
9317 # TODO: Fix html2html mode (T53055)!
9318 !! test
9319 Parsoid: Broken br tag recognition
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 </br>
9324
9325 <br/ >
9326 !! html+tidy
9327 <p><br />
9328 </p><p><br />
9329 </p>
9330 !! end
9331
9332 !! test
9333 Incorrecly removing closing slashes from correctly formed XHTML
9334 !! wikitext
9335 <br style="clear:both;" />
9336 !! html
9337 <p><br style="clear:both;" />
9338 </p>
9339 !! end
9340
9341 !! test
9342 Failing to transform badly formed HTML into correct XHTML
9343 !! wikitext
9344 <br style="clear: left;">
9345 <br style="clear: right;">
9346 <br style="clear: both;">
9347 !! html
9348 <p><br style="clear: left;" />
9349 <br style="clear: right;" />
9350 <br style="clear: both;" />
9351 </p>
9352 !!end
9353
9354 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9355 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9356 !! test
9357 Handling html with a div self-closing tag
9358 !! wikitext
9359 <div title />
9360 <div title/>
9361 <div title/ >
9362 <div title=bar />
9363 <div title=bar/>
9364 <div title=bar/ >
9365 !! html/php
9366 <p>&lt;div title /&gt;
9367 &lt;div title/&gt;
9368 </p>
9369 <div>
9370 <p>&lt;div title=bar /&gt;
9371 &lt;div title=bar/&gt;
9372 </p>
9373 <div title="bar/"></div>
9374 </div>
9375
9376 !! html/parsoid
9377 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9378 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9379 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9380 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9381 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9382 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9383 !! end
9384
9385 !! test
9386 Handling html with a br self-closing tag
9387 !! wikitext
9388 <br title />
9389 <br title/>
9390 <br title/ >
9391 <br title=bar />
9392 <br title=bar/>
9393 <br title=bar/ >
9394 !! html/php
9395 <p><br title="" />
9396 <br title="" />
9397 <br />
9398 <br title="bar" />
9399 <br title="bar" />
9400 <br title="bar/" />
9401 </p>
9402 !! html/parsoid
9403 <p><br title="" />
9404 <br title="" />
9405 <br title="" />
9406 <br title="bar" />
9407 <br title="bar" />
9408 <br title="bar/" />
9409 </p>
9410 !! end
9411
9412 !! test
9413 Horizontal ruler (should it add that extra space?)
9414 !! wikitext
9415 <hr>
9416 <hr >
9417 foo <hr
9418 > bar
9419 !! html+tidy
9420 <hr />
9421 <hr /><p>
9422 foo </p><hr /><p> bar
9423 </p>
9424 !! end
9425
9426 !! test
9427 Horizontal ruler -- 4+ dashes render hr
9428 !! wikitext
9429 ----
9430 !! html
9431 <hr />
9432
9433 !! end
9434
9435 !! test
9436 Horizontal ruler -- eats additional dashes on the same line
9437 !! wikitext
9438 ---------
9439 !! html
9440 <hr />
9441
9442 !! end
9443
9444 !! test
9445 Horizontal ruler -- does not collapse dashes on consecutive lines
9446 !! wikitext
9447 ----
9448 ----
9449 !! html
9450 <hr />
9451 <hr />
9452
9453 !! end
9454
9455 !! test
9456 Horizontal ruler -- <4 dashes render as plain text
9457 !! wikitext
9458 ---
9459 !! html
9460 <p>---
9461 </p>
9462 !! end
9463
9464 !! test
9465 Horizontal ruler -- Supports content following dashes on same line
9466 !! wikitext
9467 ---- Foo
9468 !! html
9469 <hr /> Foo
9470
9471 !! html+tidy
9472 <hr /><p> Foo
9473 </p>
9474 !! end
9475
9476 ###
9477 ### Block-level elements
9478 ###
9479 !! test
9480 Common list
9481 !! wikitext
9482 *Common list
9483 * item 2
9484 *item 3
9485 !! html
9486 <ul><li>Common list</li>
9487 <li> item 2</li>
9488 <li>item 3</li></ul>
9489
9490 !! end
9491
9492 !! test
9493 Numbered list
9494 !! wikitext
9495 #Numbered list
9496 #item 2
9497 # item 3
9498 !! html
9499 <ol><li>Numbered list</li>
9500 <li>item 2</li>
9501 <li> item 3</li></ol>
9502
9503 !! end
9504
9505 !! test
9506 Mixed list
9507 !! wikitext
9508 *Mixed list
9509 *# with numbers
9510 ** and bullets
9511 *# and numbers
9512 *bullets again
9513 **bullet level 2
9514 ***bullet level 3
9515 ***#Number on level 4
9516 **bullet level 2
9517 **#Number on level 3
9518 **#Number on level 3
9519 *#number level 2
9520 *Level 1
9521 *** Level 3
9522 #** Level 3, but ordered
9523 !! html
9524 <ul><li>Mixed list
9525 <ol><li> with numbers</li></ol>
9526 <ul><li> and bullets</li></ul>
9527 <ol><li> and numbers</li></ol></li>
9528 <li>bullets again
9529 <ul><li>bullet level 2
9530 <ul><li>bullet level 3
9531 <ol><li>Number on level 4</li></ol></li></ul></li>
9532 <li>bullet level 2
9533 <ol><li>Number on level 3</li>
9534 <li>Number on level 3</li></ol></li></ul>
9535 <ol><li>number level 2</li></ol></li>
9536 <li>Level 1
9537 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9538 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9539
9540 !! end
9541
9542 !! test
9543 1. Nested mixed wikitext and html list
9544 !! wikitext
9545 * hi
9546 * <ul><li>ho</li></ul>
9547 * hi
9548 ** ho
9549 !! html/php
9550 <ul><li> hi</li>
9551 <li> <ul><li>ho</li></ul></li>
9552 <li> hi
9553 <ul><li> ho</li></ul></li></ul>
9554
9555 !! html/parsoid
9556 <ul><li> hi</li>
9557 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9558 <li> hi
9559 <ul><li> ho</li></ul></li></ul>
9560 !! end
9561
9562 !! test
9563 2. Nested mixed wikitext and html list (incompatible)
9564 !! wikitext
9565 ; hi
9566 : {{echo|<li>ho</li>}}
9567 !! html/php
9568 <dl><dt> hi</dt>
9569 <dd> <li>ho</li></dd></dl>
9570
9571 !! html/parsoid
9572 <dl><dt> hi</dt>
9573 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9574 !! end
9575
9576 !! test
9577 Nested lists 1
9578 !! wikitext
9579 *foo
9580 **bar
9581 !! html
9582 <ul><li>foo
9583 <ul><li>bar</li></ul></li></ul>
9584
9585 !! end
9586
9587 !! test
9588 Nested lists 2
9589 !! wikitext
9590 **foo
9591 *bar
9592 !! html
9593 <ul><li><ul><li>foo</li></ul></li>
9594 <li>bar</li></ul>
9595
9596 !! end
9597
9598 !! test
9599 Nested lists 3 (first element empty)
9600 !! wikitext
9601 *
9602 **bar
9603 !! html
9604 <ul><li>
9605 <ul><li>bar</li></ul></li></ul>
9606
9607 !! end
9608
9609 !! test
9610 Nested lists 4 (first element empty)
9611 !! wikitext
9612 **
9613 *bar
9614 !! html
9615 <ul><li><ul><li></li></ul></li>
9616 <li>bar</li></ul>
9617
9618 !! end
9619
9620 !! test
9621 Nested lists 5 (both elements empty)
9622 !! wikitext
9623 **
9624 *
9625 !! html
9626 <ul><li><ul><li></li></ul></li>
9627 <li></li></ul>
9628
9629 !! end
9630
9631 !! test
9632 Nested lists 6 (both elements empty)
9633 !! wikitext
9634 *
9635 **
9636 !! html
9637 <ul><li>
9638 <ul><li></li></ul></li></ul>
9639
9640 !! end
9641
9642 !! test
9643 Nested lists 7 (skip initial nesting levels)
9644 !! wikitext
9645 *** foo
9646 !! html
9647 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9648
9649 !! end
9650
9651 !! test
9652 Nested lists 8 (multiple nesting transitions)
9653 !! wikitext
9654 * foo
9655 *** bar
9656 ** baz
9657 * boo
9658 !! html
9659 <ul><li> foo
9660 <ul><li><ul><li> bar</li></ul></li>
9661 <li> baz</li></ul></li>
9662 <li> boo</li></ul>
9663
9664 !! end
9665
9666 !! test
9667 Nested lists 9 (extension interaction)
9668 !! options
9669 parsoid
9670 !! wikitext
9671 *<references />
9672 !! html/parsoid
9673 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9674 !! end
9675
9676 !! test
9677 1. Lists with start-of-line-transparent tokens before bullets: Comments
9678 !! wikitext
9679 *foo
9680 *<!--cmt-->bar
9681 <!--cmt-->*baz
9682 !! html
9683 <ul><li>foo</li>
9684 <li>bar</li>
9685 <li>baz</li></ul>
9686
9687 !! end
9688
9689 !! test
9690 2. Lists with start-of-line-transparent tokens before bullets: Template close
9691 !! wikitext
9692 *foo {{echo|bar
9693 }}*baz
9694 !! html
9695 <ul><li>foo bar</li>
9696 <li>baz</li></ul>
9697
9698 !! end
9699
9700 !! test
9701 List items are not parsed correctly following a <pre> block (T2785)
9702 !! wikitext
9703 * <pre>foo</pre>
9704 * <pre>bar</pre>
9705 * zar
9706 !! html/php
9707 <ul><li> <pre>foo</pre></li>
9708 <li> <pre>bar</pre></li>
9709 <li> zar</li></ul>
9710
9711 !! html/parsoid
9712 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9713 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9714 <li> zar</li></ul>
9715 !! end
9716
9717 !! test
9718 List items from template
9719 !! wikitext
9720
9721 {{inner list}}
9722 * item 2
9723
9724 * item 0
9725 {{inner list}}
9726 * item 2
9727
9728 * item 0
9729 * notSOL{{inner list}}
9730 * item 2
9731 !! html
9732 <ul><li> item 1</li>
9733 <li> item 2</li></ul>
9734 <ul><li> item 0</li>
9735 <li> item 1</li>
9736 <li> item 2</li></ul>
9737 <ul><li> item 0</li>
9738 <li> notSOL</li>
9739 <li> item 1</li>
9740 <li> item 2</li></ul>
9741
9742 !! end
9743
9744 !! test
9745 List interrupted by empty line or heading
9746 !! wikitext
9747 * foo
9748
9749 ** bar
9750 == A heading ==
9751 * Another list item
9752 !! html
9753 <ul><li> foo</li></ul>
9754 <ul><li><ul><li> bar</li></ul></li></ul>
9755 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9756 <ul><li> Another list item</li></ul>
9757
9758 !!end
9759
9760 !!test
9761 Multiple list tags generated by templates
9762 !! wikitext
9763 {{echo|<li>}}a
9764 {{echo|<li>}}b
9765 {{echo|<li>}}c
9766 !! html
9767 <li>a
9768 <li>b
9769 <li>c</li>
9770 </li>
9771 </li>
9772
9773 !! html+tidy
9774 <li>a
9775 </li><li>b
9776 </li><li>c
9777 </li>
9778 !!end
9779
9780 !!test
9781 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9782 !! wikitext
9783 *a
9784 <!--This line will NOT split the list-->
9785 *b
9786 <!--This line will NOT split the list either-->
9787 *c
9788 <!--foo--> <!----> <!--This line NOT split the list either-->
9789 *d
9790 !! html
9791 <ul><li>a</li>
9792 <li>b</li>
9793 <li>c</li>
9794 <li>d</li></ul>
9795
9796 !!end
9797
9798 !!test
9799 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9800 !! wikitext
9801 *a
9802 <!--This line will NOT split the list-->
9803 *b
9804 <!--This line will NOT split the list either-->
9805 *c
9806 <!--foo--> <!----> <!--This line NOT split the list
9807 either-->
9808 *d
9809 !! html
9810 <ul><li>a</li>
9811 <li>b</li>
9812 <li>c</li>
9813 <li>d</li></ul>
9814
9815 !!end
9816
9817 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9818 # That pass could possibly be removed.
9819 !!test
9820 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9821 !!options
9822 parsoid=wt2html,wt2wt
9823 !! wikitext
9824 * foo
9825 * <li>li-hack
9826 * {{echo|<li>templated li-hack}}
9827 * <!--foo--> <li> unsupported li-hack with preceding comments
9828
9829 <ul>
9830 <li><li>not a li-hack
9831 </li>
9832 </ul>
9833 !! html+tidy
9834 <ul><li> foo</li>
9835 <li class="mw-empty-elt"> </li><li>li-hack</li>
9836 <li class="mw-empty-elt"> </li><li>templated li-hack</li>
9837 <li class="mw-empty-elt"> </li><li> unsupported li-hack with preceding comments</li></ul>
9838 <ul>
9839 <li class="mw-empty-elt"></li><li>not a li-hack
9840 </li>
9841 </ul>
9842 !! html/parsoid
9843 <ul><li> foo</li>
9844 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"* "}'>li-hack</li>
9845 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["* ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
9846 <li data-parsoid='{"autoInsertedEnd":true}'> <!--foo--> </li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
9847
9848 <ul data-parsoid='{"stx":"html"}'>
9849 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9850 </li>
9851 </ul>
9852
9853 !!end
9854
9855 !! test
9856 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9857 !! options
9858 parsoid
9859 !! wikitext
9860 # foo
9861 ## bar
9862 * foo
9863 ** bar
9864 : foo
9865 :: bar
9866 !! html
9867 <ol>
9868 <li> foo<ol>
9869 <li> bar</li>
9870 </ol></li>
9871 </ol><ul>
9872 <li> foo<ul>
9873 <li> bar</li>
9874 </ul></li>
9875 </ul><dl>
9876 <dd> foo<dl>
9877 <dd> bar</dd>
9878 </dl></dd>
9879 </dl>
9880 !! end
9881
9882 !! test
9883 Parsoid: Test of whitespace serialization with Templated bullets
9884 !! options
9885 parsoid
9886 !! wikitext
9887 * {{bullet}}
9888 !! html/parsoid
9889 <ul>
9890 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9891 </ul>
9892 !! end
9893
9894 # ------------------------------------------------------------------------
9895 # The next set of tests are about Parsoid's ability to handle badly nested
9896 # tags (parse, minimize scope of fixup, and roundtrip back)
9897 # ------------------------------------------------------------------------
9898
9899 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9900 # Parsoid's list handling is more aware of block structure.
9901 !! test
9902 Unbalanced closing block tags break a list
9903 !! wikitext
9904 <div>
9905 *a</div><div>
9906 *b</div>
9907 !! html+tidy
9908 <div>
9909 <ul><li>a</li></ul></div><div>
9910 <li>b</li></div>
9911 !! html+parsoid
9912 <div><ul>
9913 <li>a</li>
9914 </ul></div>
9915 <div><ul>
9916 <li>b</li>
9917 </ul></div>
9918 !! end
9919
9920 !! test
9921 Unbalanced closing non-block tags don't break a list
9922 !! wikitext
9923 <span>
9924 *a</span><span>
9925 *b</span>
9926 !! html/php+tidy
9927 <p><span>
9928 </span></p>
9929 <ul><li>a<span></span></li>
9930 <li>b</li></ul>
9931 !! html/parsoid
9932 <span>
9933 <ul>
9934 <li>a<span></span></li>
9935 <li>b</li>
9936 </ul>
9937 </span>
9938 !! end
9939
9940 # Parsoid does some post-dom-building cleanup
9941 # which is why its output differs from Remex.
9942 !! test
9943 Unclosed formatting tags that straddle lists are closed and reopened
9944 !! options
9945 parsoid=wt2html,wt2wt,html2html
9946 !! wikitext
9947 # <s> a
9948 # b </s>
9949 !! html/php+tidy
9950 <ol><li> <s> a</s></li><s>
9951 </s><li><s> b </s></li></ol>
9952 !! html/parsoid
9953 <ol><li> <s> a</s><s></s></li>
9954 <li><s> b </s></li></ol>
9955 !! end
9956
9957 # Output is ugly because of all the misnested tag fixups.
9958 # Remex is wrapping p-tags around empty elements.
9959 # Parsoid has special-case handling of this pattern of
9960 # wrapping lists in formatting tags.
9961 # FIXME: Should we remove this code from Parsoid? Or add
9962 # special support in Remex? If the latter, maybe just wait
9963 # for Parsoid to become the default parser.
9964 # See T70395.
9965 !!test
9966 1. List embedded in a formatting tag
9967 !! wikitext
9968 <small>
9969 * foo
9970 </small>
9971 !! html/php+tidy
9972 <p><small>
9973 </small></p><small><ul><li> foo</li></ul></small><small></small><p><small></small>
9974 </p>
9975 !! html/parsoid
9976 <small>
9977 <ul>
9978 <li> foo</li>
9979 </ul>
9980 </small>
9981 !!end
9982
9983 # Output is ugly because of all the misnested tag fixups
9984 # Remex is wrapping p-tags around empty elements.
9985 # Parsoid has code that strips useless p-tags.
9986 !!test
9987 2. List embedded in a formatting tag in a misnested way
9988 !! wikitext
9989 <small>
9990 *a
9991 *b</small>
9992 !! html/php+tidy
9993 <p><small>
9994 </small></p><small></small><ul><small><li>a</li>
9995 </small><li><small>b</small></li></ul>
9996 !! html/parsoid
9997 <small></small>
9998 <ul><small>
9999 <li>a</li>
10000 </small>
10001 <li><small>b</small></li>
10002 </ul>
10003 !!end
10004
10005 !! test
10006 Table with missing opening <tr> tag
10007 !! options
10008 parsoid=wt2html,wt2wt
10009 !! wikitext
10010 <table>
10011 <td>foo</td>
10012 </tr>
10013 </table>
10014 !! html+tidy
10015 <table>
10016 <tbody><tr><td>foo</td>
10017 </tr>
10018 </tbody></table>
10019 !! end
10020
10021 ###
10022 ### Magic Words
10023 ###
10024
10025 # Note that the current date is hard-coded as
10026 # 1970-01-01T00:02:03Z (a Thursday)
10027 # when running parser tests. The timezone is also fixed to GMT, so
10028 # local date will be identical to current date.
10029
10030 !! test
10031 Magic Word: {{CURRENTDAY}}
10032 !! wikitext
10033 {{CURRENTDAY}}
10034 !! html
10035 <p>1
10036 </p>
10037 !! end
10038
10039 !! test
10040 Magic Word: {{CURRENTDAY2}}
10041 !! wikitext
10042 {{CURRENTDAY2}}
10043 !! html
10044 <p>01
10045 </p>
10046 !! end
10047
10048 !! test
10049 Magic Word: {{CURRENTDAYNAME}}
10050 !! wikitext
10051 {{CURRENTDAYNAME}}
10052 !! html
10053 <p>Thursday
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{CURRENTDOW}}
10059 !! wikitext
10060 {{CURRENTDOW}}
10061 !! html
10062 <p>4
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{CURRENTMONTH}}
10068 !! wikitext
10069 {{CURRENTMONTH}}
10070 !! html
10071 <p>01
10072 </p>
10073 !! end
10074
10075 !! test
10076 Magic Word: {{CURRENTMONTH1}}
10077 !! wikitext
10078 {{CURRENTMONTH1}}
10079 !! html
10080 <p>1
10081 </p>
10082 !! end
10083
10084 !! test
10085 Magic Word: {{CURRENTMONTHABBREV}}
10086 !! wikitext
10087 {{CURRENTMONTHABBREV}}
10088 !! html
10089 <p>Jan
10090 </p>
10091 !! end
10092
10093 !! test
10094 Magic Word: {{CURRENTMONTHNAME}}
10095 !! wikitext
10096 {{CURRENTMONTHNAME}}
10097 !! html
10098 <p>January
10099 </p>
10100 !! end
10101
10102 !! test
10103 Magic Word: {{CURRENTMONTHNAMEGEN}}
10104 !! wikitext
10105 {{CURRENTMONTHNAMEGEN}}
10106 !! html
10107 <p>January
10108 </p>
10109 !! end
10110
10111 !! test
10112 Magic Word: {{CURRENTTIME}}
10113 !! wikitext
10114 {{CURRENTTIME}}
10115 !! html
10116 <p>00:02
10117 </p>
10118 !! end
10119
10120 !! test
10121 Magic Word: {{CURRENTHOUR}}
10122 !! wikitext
10123 {{CURRENTHOUR}}
10124 !! html
10125 <p>00
10126 </p>
10127 !! end
10128
10129 !! test
10130 Magic Word: {{CURRENTWEEK}} (T6594)
10131 !! wikitext
10132 {{CURRENTWEEK}}
10133 !! html
10134 <p>1
10135 </p>
10136 !! end
10137
10138 !! test
10139 Magic Word: {{CURRENTYEAR}}
10140 !! wikitext
10141 {{CURRENTYEAR}}
10142 !! html
10143 <p>1970
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{CURRENTTIMESTAMP}}
10149 !! wikitext
10150 {{CURRENTTIMESTAMP}}
10151 !! html
10152 <p>19700101000203
10153 </p>
10154 !! end
10155
10156 !! test
10157 Magic Words LOCAL (UTC)
10158 !! wikitext
10159 * {{LOCALMONTH}}
10160 * {{LOCALMONTH1}}
10161 * {{LOCALMONTHNAME}}
10162 * {{LOCALMONTHNAMEGEN}}
10163 * {{LOCALMONTHABBREV}}
10164 * {{LOCALDAY}}
10165 * {{LOCALDAY2}}
10166 * {{LOCALDAYNAME}}
10167 * {{LOCALYEAR}}
10168 * {{LOCALTIME}}
10169 * {{LOCALHOUR}}
10170 * {{LOCALWEEK}}
10171 * {{LOCALDOW}}
10172 * {{LOCALTIMESTAMP}}
10173 !! html
10174 <ul><li> 01</li>
10175 <li> 1</li>
10176 <li> January</li>
10177 <li> January</li>
10178 <li> Jan</li>
10179 <li> 1</li>
10180 <li> 01</li>
10181 <li> Thursday</li>
10182 <li> 1970</li>
10183 <li> 00:02</li>
10184 <li> 00</li>
10185 <li> 1</li>
10186 <li> 4</li>
10187 <li> 19700101000203</li></ul>
10188
10189 !! end
10190
10191 !! test
10192 Magic Word: {{FULLPAGENAME}}
10193 !! options
10194 title=[[User:Ævar Arnfjörð Bjarmason]]
10195 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10196 !! wikitext
10197 {{FULLPAGENAME}}
10198 !! html/*
10199 <p>User:Ævar Arnfjörð Bjarmason
10200 </p>
10201 !! end
10202
10203 !! test
10204 Magic Word: {{FULLPAGENAMEE}}
10205 !! options
10206 title=[[User:Ævar Arnfjörð Bjarmason]]
10207 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10208 !! wikitext
10209 {{FULLPAGENAMEE}}
10210 !! html/*
10211 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10212 </p>
10213 !! end
10214
10215 !! test
10216 Magic Word: {{TALKSPACE}}
10217 !! options
10218 title=[[User:Ævar Arnfjörð Bjarmason]]
10219 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10220 !! wikitext
10221 {{TALKSPACE}}
10222 !! html/*
10223 <p>User talk
10224 </p>
10225 !! end
10226
10227 !! test
10228 Magic Word: {{TALKSPACE}}, same namespace
10229 !! options
10230 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10231 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10232 !! wikitext
10233 {{TALKSPACE}}
10234 !! html/*
10235 <p>User talk
10236 </p>
10237 !! end
10238
10239 !! test
10240 Magic Word: {{TALKSPACE}}, main namespace
10241 !! options
10242 title=[[Parser Test]]
10243 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10244 !! wikitext
10245 {{TALKSPACE}}
10246 !! html/*
10247 <p>Talk
10248 </p>
10249 !! end
10250
10251 !! test
10252 Magic Word: {{TALKSPACEE}}
10253 !! options
10254 title=[[User:Ævar Arnfjörð Bjarmason]]
10255 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10256 !! wikitext
10257 {{TALKSPACEE}}
10258 !! html/*
10259 <p>User_talk
10260 </p>
10261 !! end
10262
10263 !! test
10264 Magic Word: {{SUBJECTSPACE}}
10265 !! options
10266 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10267 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10268 !! wikitext
10269 {{SUBJECTSPACE}}
10270 !! html/*
10271 <p>User
10272 </p>
10273 !! end
10274
10275 !! test
10276 Magic Word: {{SUBJECTSPACE}}, same namespace
10277 !! options
10278 title=[[User:Ævar Arnfjörð Bjarmason]]
10279 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10280 !! wikitext
10281 {{SUBJECTSPACE}}
10282 !! html/*
10283 <p>User
10284 </p>
10285 !! end
10286
10287 !! test
10288 Magic Word: {{SUBJECTSPACE}}, main namespace
10289 !! options
10290 title=[[Parser Test]]
10291 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10292 !! wikitext
10293 {{SUBJECTSPACE}}
10294 !! html/*
10295
10296 !! end
10297
10298 !! test
10299 Magic Word: {{SUBJECTSPACEE}}
10300 !! options
10301 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10302 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10303 !! wikitext
10304 {{SUBJECTSPACEE}}
10305 !! html/*
10306 <p>User
10307 </p>
10308 !! end
10309
10310 !! test
10311 Magic Word: {{NAMESPACE}}
10312 !! options
10313 title=[[User:Ævar Arnfjörð Bjarmason]]
10314 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10315 !! wikitext
10316 {{NAMESPACE}}
10317 !! html/*
10318 <p>User
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{NAMESPACEE}}
10324 !! options
10325 title=[[User:Ævar Arnfjörð Bjarmason]]
10326 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10327 !! wikitext
10328 {{NAMESPACEE}}
10329 !! html/*
10330 <p>User
10331 </p>
10332 !! end
10333
10334 !! test
10335 Magic Word: {{NAMESPACENUMBER}}
10336 !! options
10337 title=[[User:Ævar Arnfjörð Bjarmason]]
10338 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10339 !! wikitext
10340 {{NAMESPACENUMBER}}
10341 !! html/*
10342 <p>2
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{SUBPAGENAME}}
10348 !! options
10349 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10350 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10351 !! wikitext
10352 {{SUBPAGENAME}}
10353 !! html/*
10354 <p>sub ö
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{SUBPAGENAMEE}}
10360 !! options
10361 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10362 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10363 !! wikitext
10364 {{SUBPAGENAMEE}}
10365 !! html/*
10366 <p>sub_%C3%B6
10367 </p>
10368 !! end
10369
10370 !! test
10371 Magic Word: {{ROOTPAGENAME}}
10372 !! options
10373 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10374 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10375 !! wikitext
10376 {{ROOTPAGENAME}}
10377 !! html/*
10378 <p>Ævar Arnfjörð Bjarmason
10379 </p>
10380 !! end
10381
10382 !! test
10383 Magic Word: {{ROOTPAGENAMEE}}
10384 !! options
10385 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10386 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10387 !! wikitext
10388 {{ROOTPAGENAMEE}}
10389 !! html/*
10390 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10391 </p>
10392 !! end
10393
10394 !! test
10395 Magic Word: {{BASEPAGENAME}}
10396 !! options
10397 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10398 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10399 !! wikitext
10400 {{BASEPAGENAME}}
10401 !! html/*
10402 <p>Ævar Arnfjörð Bjarmason
10403 </p>
10404 !! end
10405
10406 !! test
10407 Magic Word: {{BASEPAGENAMEE}}
10408 !! options
10409 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10410 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10411 !! wikitext
10412 {{BASEPAGENAMEE}}
10413 !! html/*
10414 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{TALKPAGENAME}}
10420 !! options
10421 title=[[User:Ævar Arnfjörð Bjarmason]]
10422 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10423 !! wikitext
10424 {{TALKPAGENAME}}
10425 !! html/*
10426 <p>User talk:Ævar Arnfjörð Bjarmason
10427 </p>
10428 !! end
10429
10430 !! test
10431 Magic Word: {{TALKPAGENAMEE}}
10432 !! options
10433 title=[[User:Ævar Arnfjörð Bjarmason]]
10434 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10435 !! wikitext
10436 {{TALKPAGENAMEE}}
10437 !! html/*
10438 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{SUBJECTPAGENAME}}
10444 !! options
10445 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10446 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10447 !! wikitext
10448 {{SUBJECTPAGENAME}}
10449 !! html/*
10450 <p>User:Ævar Arnfjörð Bjarmason
10451 </p>
10452 !! end
10453
10454 !! test
10455 Magic Word: {{SUBJECTPAGENAMEE}}
10456 !! options
10457 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10458 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10459 !! wikitext
10460 {{SUBJECTPAGENAMEE}}
10461 !! html/*
10462 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10463 </p>
10464 !! end
10465
10466 !! test
10467 Magic Word: {{NUMBEROFFILES}}
10468 !! options
10469 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10470 !! wikitext
10471 {{NUMBEROFFILES}}
10472 !! html/*
10473 <p>7
10474 </p>
10475 !! end
10476
10477 !! test
10478 Magic Word: {{PAGENAME}}
10479 !! options
10480 title=[[User:Ævar Arnfjörð Bjarmason]]
10481 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10482 !! wikitext
10483 {{PAGENAME}}
10484 !! html/*
10485 <p>Ævar Arnfjörð Bjarmason
10486 </p>
10487 !! end
10488
10489 !! test
10490 Magic Word: {{PAGENAME}} with metacharacters
10491 !! options
10492 title=[['foo & bar = baz']]
10493 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10494 !! wikitext
10495 ''{{PAGENAME}}''
10496 !! html+tidy
10497 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10498 </p>
10499 !! end
10500
10501 !! test
10502 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10503 !! options
10504 title=[[*RFC 1234 http://example.com/]]
10505 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10506 !! wikitext
10507 {{PAGENAME}}
10508 !! html+tidy
10509 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10510 </p>
10511 !! end
10512
10513 !! test
10514 Magic Word: {{PAGENAMEE}}
10515 !! options
10516 title=[[User:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{PAGENAMEE}}
10520 !! html/*
10521 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10527 !! options
10528 title=[[*RFC 1234 http://example.com/]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{PAGENAMEE}}
10532 !! html+tidy
10533 <p>&#42;RFC_1234_http&#58;//example.com/
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{REVISIONID}}
10539 !! options
10540 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10541 showflags
10542 !! wikitext
10543 {{REVISIONID}}
10544 !! html/*
10545 <p>1337
10546 </p>
10547 flags=vary-revision-id
10548 !! end
10549
10550 !! test
10551 Magic Word: {{SCRIPTPATH}}
10552 !! options
10553 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10554 !! wikitext
10555 {{SCRIPTPATH}}
10556 !! html/*
10557
10558 !! end
10559
10560 !! test
10561 Magic Word: {{STYLEPATH}}
10562 !! options
10563 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10564 !! wikitext
10565 {{STYLEPATH}}
10566 !! html/*
10567 <p>/skins
10568 </p>
10569 !! end
10570
10571 !! test
10572 Magic Word: {{SERVER}}
10573 !! options
10574 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10575 !! wikitext
10576 {{SERVER}}
10577 !! html/*
10578 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10579 </p>
10580 !! end
10581
10582 !! test
10583 Magic Word: {{SERVERNAME}}
10584 !! options
10585 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10586 !! wikitext
10587 {{SERVERNAME}}
10588 !! html/*
10589 <p>example.org
10590 </p>
10591 !! end
10592
10593 !! test
10594 Magic Word: {{SITENAME}}
10595 !! options
10596 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10597 !! wikitext
10598 {{SITENAME}}
10599 !! html/*
10600 <p>MediaWiki
10601 </p>
10602 !! end
10603
10604 !! test
10605 Magic Word: {{PAGELANGUAGE}}
10606 !! options
10607 language=fr
10608 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10609 !! wikitext
10610 {{PAGELANGUAGE}}
10611 !! html/*
10612 <p>fr
10613 </p>
10614 !! end
10615
10616 !! test
10617 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10618 !! options
10619 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10620 !! wikitext
10621 {{PAGELANGUAGE}}
10622 !! html/*
10623 <p>en
10624 </p>
10625 !! end
10626
10627 !! test
10628 Case-sensitive magic words, when cased differently, should just be template transclusions
10629 !! wikitext
10630 {{CurrentMonth}}
10631 {{currentday}}
10632 {{cURreNTweEK}}
10633 {{currentHour}}
10634 !! html
10635 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10636 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10637 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10638 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10639 </p>
10640 !! end
10641
10642 !! test
10643 Case-insensitive magic words should still work with weird casing.
10644 !! wikitext
10645 {{sErVeRNaMe}}
10646 {{LCFirst:AOEU}}
10647 {{ucFIRST:aoeu}}
10648 {{SERver}}
10649 !! html
10650 <p>example.org
10651 aOEU
10652 Aoeu
10653 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10654 </p>
10655 !! end
10656
10657 # From plwiki:PLOS_ONE
10658 !! test
10659 Parsoid: Page property magic word with magic word contents
10660 !! wikitext
10661 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10662 !! html/parsoid
10663 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10664 !! end
10665
10666 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10667 # But, this is a limitation of our representation and is documented in
10668 # TemplateHandler.js in processSpecialMagicWord
10669 !! test
10670 Parsoid: Template-generated DISPLAYTITLE
10671 !! wikitext
10672 {{{{echo|DISPLAYTITLE}}:Foo}}
10673 !! options
10674 showtitle
10675 !! config
10676 wgAllowDisplayTitle=true
10677 wgRestrictDisplayTitle=false
10678 !! html/php
10679 Foo
10680
10681 !! html/parsoid
10682 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10683 !! end
10684
10685 !! test
10686 Namespace 1 {{ns:1}}
10687 !! wikitext
10688 {{ns:1}}
10689 !! html
10690 <p>Talk
10691 </p>
10692 !! end
10693
10694 !! test
10695 Namespace 1 {{ns:01}}
10696 !! wikitext
10697 {{ns:01}}
10698 !! html
10699 <p>Talk
10700 </p>
10701 !! end
10702
10703 !! test
10704 Namespace 0 {{ns:0}} (T6783)
10705 !! wikitext
10706 {{ns:0}}
10707 !! html
10708
10709 !! end
10710
10711 !! test
10712 Namespace 0 {{ns:00}} (T6783)
10713 !! wikitext
10714 {{ns:00}}
10715 !! html
10716
10717 !! end
10718
10719 !! test
10720 Namespace -1 {{ns:-1}}
10721 !! wikitext
10722 {{ns:-1}}
10723 !! html
10724 <p>Special
10725 </p>
10726 !! end
10727
10728 !! test
10729 Namespace User {{ns:User}}
10730 !! wikitext
10731 {{ns:User}}
10732 !! html
10733 <p>User
10734 </p>
10735 !! end
10736
10737 !! test
10738 Namespace User talk {{ns:User_talk}}
10739 !! wikitext
10740 {{ns:User_talk}}
10741 !! html
10742 <p>User talk
10743 </p>
10744 !! end
10745
10746 !! test
10747 Namespace User talk {{ns:uSeR tAlK}}
10748 !! wikitext
10749 {{ns:uSeR tAlK}}
10750 !! html
10751 <p>User talk
10752 </p>
10753 !! end
10754
10755 !! test
10756 Namespace File {{ns:File}}
10757 !! wikitext
10758 {{ns:File}}
10759 !! html
10760 <p>File
10761 </p>
10762 !! end
10763
10764 !! test
10765 Namespace File {{ns:Image}}
10766 !! wikitext
10767 {{ns:Image}}
10768 !! html
10769 <p>File
10770 </p>
10771 !! end
10772
10773 !! test
10774 Namespace (lang=de) Benutzer {{ns:User}}
10775 !! options
10776 language=de
10777 !! wikitext
10778 {{ns:User}}
10779 !! html
10780 <p>Benutzer
10781 </p>
10782 !! end
10783
10784 !! test
10785 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10786 !! options
10787 language=de
10788 !! wikitext
10789 {{ns:3}}
10790 !! html
10791 <p>Benutzer Diskussion
10792 </p>
10793 !! end
10794
10795 !! test
10796 Urlencode
10797 !! wikitext
10798 {{urlencode:hi world?!}}
10799 {{urlencode:hi world?!|WIKI}}
10800 {{urlencode:hi world?!|PATH}}
10801 {{urlencode:hi world?!|QUERY}}
10802 !! html/php
10803 <p>hi+world%3F%21
10804 hi_world%3F!
10805 hi%20world%3F%21
10806 hi+world%3F%21
10807 </p>
10808 !! end
10809
10810 !! test
10811 Magic Word: prioritize type info over data-parsoid
10812 !! options
10813 parsoid=html2wt
10814 !! html/parsoid
10815 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10816 !! wikitext
10817 __FORCETOC__
10818 !! end
10819
10820 !! test
10821 Magic Word: serialize on separate line (parsoid)
10822 !! options
10823 parsoid=wt2wt,html2wt
10824 !! wikitext
10825 foo
10826 __NOTOC__
10827 bar
10828 !! html/parsoid
10829 foo<meta property="mw:PageProp/notoc"/>bar
10830 !! end
10831
10832 !! test
10833 Magic Word: rt non-english wikis
10834 !! options
10835 parsoid=wt2wt
10836 language=de
10837 !! wikitext
10838 __NOEDITSECTION__
10839 !! html/parsoid
10840 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10841 !! end
10842
10843 !!test
10844 __proto__ is treated as normal wikitext (T105997)
10845 !!wikitext
10846 __proto__
10847 !!html
10848 <p>__proto__
10849 </p>
10850 !!end
10851
10852 ###
10853 ### Magic links
10854 ###
10855 !! test
10856 Magic links: internal link to RFC (T2479)
10857 !! wikitext
10858 [[RFC 123]]
10859 !! html/php
10860 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
10861 </p>
10862 !! html/parsoid
10863 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10864 !! end
10865
10866 !! test
10867 Magic links: RFC (T2479)
10868 !! wikitext
10869 RFC 822
10870 !! html/php
10871 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10872 </p>
10873 !! html/parsoid
10874 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10875 !! end
10876
10877 !! test
10878 Magic links: RFC (T67278)
10879 !! wikitext
10880 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10881 !! html/php
10882 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10883 </p>
10884 !! html/parsoid
10885 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10886 !! end
10887
10888 !! test
10889 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10890 !! wikitext
10891 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10892 RFC
10893 822
10894 !! html/php
10895 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10896 RFC
10897 822
10898 </p>
10899 !! html/parsoid
10900 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10901 RFC
10902 822</p>
10903 !! end
10904
10905 !! test
10906 Magic links: ISBN (T3937)
10907 !! wikitext
10908 ISBN 0-306-40615-2
10909 !! html/php
10910 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10911 </p>
10912 !! html/parsoid
10913 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10914 !! end
10915
10916 !! test
10917 Magic links: ISBN (T67278)
10918 !! wikitext
10919 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10920 !! html/php
10921 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10922 </p>
10923 !! html/parsoid
10924 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10925 !! end
10926
10927 !! test
10928 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10929 !! wikitext
10930 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10931 ISBN
10932 9780316098113
10933 ISBN 978
10934 0316098113
10935 !! html/php
10936 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10937 ISBN
10938 9780316098113
10939 ISBN 978
10940 0316098113
10941 </p>
10942 !! html/parsoid
10943 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10944 ISBN
10945 9780316098113
10946 ISBN 978
10947 0316098113</p>
10948 !! end
10949
10950 !! test
10951 Magic links: PMID incorrectly converts space to underscore
10952 !! wikitext
10953 PMID 1234
10954 !! html/php
10955 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10956 </p>
10957 !! html/parsoid
10958 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10959 !! end
10960
10961 !! test
10962 Magic links: PMID (T67278)
10963 !! wikitext
10964 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10965 !! html/php
10966 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10967 </p>
10968 !! html/parsoid
10969 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10970 !! end
10971
10972 !! test
10973 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
10974 !! wikitext
10975 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10976 PMID
10977 1234
10978 !! html/php
10979 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10980 PMID
10981 1234
10982 </p>
10983 !! html/parsoid
10984 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10985 PMID
10986 1234</p>
10987 !! end
10988
10989 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10990 # since these are ExtLinkText, not MagicLinkText
10991 !! test
10992 Magic links: use appropriate serialization for "almost" magic links.
10993 !! wikitext
10994 X[[Special:BookSources/0978739256|foo]]
10995
10996 X[https://tools.ietf.org/html/rfc1234 foo]
10997 !! html/php
10998 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10999 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11000 </p>
11001 !! html/parsoid
11002 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11003 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11004 !! end
11005
11006 !! test
11007 Magic links: All disabled (T47942)
11008 !! options
11009 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11010 !! wikitext
11011 ISBN 0-306-40615-2
11012 PMID 1234
11013 RFC 4321
11014 !! html/php
11015 <p>ISBN 0-306-40615-2
11016 PMID 1234
11017 RFC 4321
11018 </p>
11019 !! end
11020
11021 ###
11022 ### Templates
11023 ####
11024
11025 !! test
11026 Nonexistent template
11027 !! wikitext
11028 {{thistemplatedoesnotexist}}
11029 !! html
11030 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11031 </p>
11032 !! end
11033
11034 !! test
11035 Template with invalid target containing tags
11036 !! wikitext
11037 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11038 !! html
11039 <p>{{a<b>b</b>|foo|a=b|a = b}}
11040 </p>
11041 !! end
11042
11043 !! test
11044 Template with invalid target containing unclosed tag
11045 !! wikitext
11046 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11047 !! html
11048 <p>{{a<b>|foo|a=b|a = b}}</b>
11049 </p>
11050 !! end
11051
11052 !! test
11053 Template with invalid target containing wikilink
11054 !! wikitext
11055 {{[[Main Page]]}}
11056 !! html/php
11057 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11058 </p>
11059 !! html/parsoid
11060 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11061 !! end
11062
11063 !! test
11064 Template with just whitespace in it, T70421
11065 !! wikitext
11066 {{echo|{{ }}}}
11067 !! html/parsoid
11068 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11069 !! end
11070
11071 !! article
11072 Template:test
11073 !! text
11074 This is a test template
11075 !! endarticle
11076
11077 !! test
11078 Simple template
11079 !! wikitext
11080 {{test}}
11081 !! html
11082 <p>This is a test template
11083 </p>
11084 !! end
11085
11086 !! test
11087 Template with explicit namespace
11088 !! wikitext
11089 {{Template:test}}
11090 !! html
11091 <p>This is a test template
11092 </p>
11093 !! end
11094
11095
11096 !! article
11097 Template:paramtest
11098 !! text
11099 This is a test template with parameter {{{param}}}
11100 !! endarticle
11101
11102 !! test
11103 Template parameter
11104 !! wikitext
11105 {{paramtest|param=foo}}
11106 !! html
11107 <p>This is a test template with parameter foo
11108 </p>
11109 !! end
11110
11111 !! article
11112 Template:paramtestnum
11113 !! text
11114 [[{{{1}}}|{{{2}}}]]
11115 !! endarticle
11116
11117 !! test
11118 Template unnamed parameter
11119 !! wikitext
11120 {{paramtestnum|Main Page|the main page}}
11121 !! html
11122 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11123 </p>
11124 !! end
11125
11126 !! article
11127 Template:templatesimple
11128 !! text
11129 (test)
11130 !! endarticle
11131
11132 !! article
11133 Template:templateredirect
11134 !! text
11135 #redirect [[Template:templatesimple]]
11136 !! endarticle
11137
11138 !! article
11139 Template:templateasargtestnum
11140 !! text
11141 {{{{{1}}}}}
11142 !! endarticle
11143
11144 !! article
11145 Template:templateasargtest
11146 !! text
11147 {{template{{{templ}}}}}
11148 !! endarticle
11149
11150 !! article
11151 Template:templateasargtest2
11152 !! text
11153 {{{{{templ}}}}}
11154 !! endarticle
11155
11156 !! test
11157 Template with template name as unnamed argument
11158 !! wikitext
11159 {{templateasargtestnum|templatesimple}}
11160 !! html
11161 <p>(test)
11162 </p>
11163 !! end
11164
11165 !! test
11166 Template with template name as argument
11167 !! wikitext
11168 {{templateasargtest|templ=simple}}
11169 !! html
11170 <p>(test)
11171 </p>
11172 !! end
11173
11174 !! test
11175 Template with template name as argument (2)
11176 !! wikitext
11177 {{templateasargtest2|templ=templatesimple}}
11178 !! html
11179 <p>(test)
11180 </p>
11181 !! end
11182
11183 !! article
11184 Template:templateasargtestdefault
11185 !! text
11186 {{{{{templ|templatesimple}}}}}
11187 !! endarticle
11188
11189 !! article
11190 Template:templa
11191 !! text
11192 '''templ'''
11193 !! endarticle
11194
11195 !! test
11196 Template with default value
11197 !! wikitext
11198 {{templateasargtestdefault}}
11199 !! html
11200 <p>(test)
11201 </p>
11202 !! end
11203
11204 !! test
11205 Template with default value (value set)
11206 !! wikitext
11207 {{templateasargtestdefault|templ=templa}}
11208 !! html
11209 <p><b>templ</b>
11210 </p>
11211 !! end
11212
11213 !! test
11214 Template redirect
11215 !! wikitext
11216 {{templateredirect}}
11217 !! html/php
11218 <p>(test)
11219 </p>
11220 !! html/parsoid
11221 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11222 !! end
11223
11224 !! test
11225 Template with argument in separate line
11226 !! wikitext
11227 {{ templateasargtest |
11228 templ = simple }}
11229 !! html
11230 <p>(test)
11231 </p>
11232 !! end
11233
11234 !! test
11235 Template with complex template as argument
11236 !! wikitext
11237 {{paramtest|
11238 param ={{ templateasargtest |
11239 templ = simple }}}}
11240 !! html
11241 <p>This is a test template with parameter (test)
11242 </p>
11243 !! end
11244
11245 !! test
11246 Templates with templated name
11247 !! wikitext
11248 {{{{echo|echo}}|foo}}
11249 {{{{echo|inner list}} }}
11250 !! html
11251 <p>foo
11252 </p>
11253 <ul><li> item 1</li></ul>
11254
11255 !! html/parsoid
11256 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11257 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li> item 1</li></ul>
11258 !! end
11259
11260 ## Regression test; the output here isn't really that interesting.
11261 !! test
11262 Templates with templated name and top level template args
11263 !! wikitext
11264 {{1{{2{{{3}}}|4=5}}}}
11265 !! html/parsoid
11266 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11267 !! end
11268
11269 # Parsoid markup is deliberate "broken". This is an edge case.
11270 # See long comment in TemplateHandler.js:convertAttribsToString.
11271 !! test
11272 Templates with invalid templated targets
11273 !! wikitext
11274 {{echo
11275 {{echo|foo}}
11276 }}
11277 !! html/php
11278 <p>{{echo
11279 foo
11280 }}
11281 </p>
11282 !! html/parsoid
11283 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11284 foo }}</p>
11285 !! end
11286
11287 !! test
11288 Template with thumb image (with link in description)
11289 !! wikitext
11290 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11291 !! html/php
11292 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11293
11294 !! html+tidy
11295 <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11296 !! html/parsoid
11297 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11298 !! end
11299
11300 !! article
11301 Template:complextemplate
11302 !! text
11303 {{{1}}} {{paramtest|
11304 param ={{{param}}}}}
11305 !! endarticle
11306
11307 !! test
11308 Template with complex arguments
11309 !! wikitext
11310 {{complextemplate|
11311 param ={{ templateasargtest |
11312 templ = simple }}|[[Template:complextemplate|link]]}}
11313 !! html
11314 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11315 </p>
11316 !! end
11317
11318 !! test
11319 T2553: link with two variables in a piped link
11320 !! wikitext
11321 {|
11322 |[[{{{1}}}|{{{2}}}]]
11323 |}
11324 !! html/php
11325 <table>
11326 <tr>
11327 <td>[[{{{1}}}|{{{2}}}]]
11328 </td></tr></table>
11329
11330 !! html/parsoid
11331 <table>
11332 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11333 </tbody></table>
11334 !! end
11335
11336 # See: T2553
11337 !! test
11338 Abort table cell attribute parsing on wikilink
11339 !! wikitext
11340 {|
11341 | testing [[one|two]] | three || four
11342 | testing one two | three || four
11343 | testing="[[one|two]]" | three || four
11344 |}
11345 !! html/php
11346 <table>
11347 <tr>
11348 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
11349 <td> four
11350 </td>
11351 <td> three </td>
11352 <td> four
11353 </td>
11354 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
11355 <td> four
11356 </td></tr></table>
11357
11358 !! html/parsoid
11359 <table>
11360 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td>
11361 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td>
11362 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'> four</td></tr>
11363 </tbody></table>
11364 !! end
11365
11366 !! test
11367 Don't abort table cell attribute parsing if wikilink is found in template arg
11368 !! wikitext
11369 {|
11370 | Test {{#tag:ref|One two "[[three]]" four}}
11371 |}
11372 !! html/parsoid
11373 <table>
11374 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11375 </tbody></table>
11376 !! end
11377
11378 !! test
11379 Magic variable as template parameter
11380 !! wikitext
11381 {{paramtest|param={{SITENAME}}}}
11382 !! html
11383 <p>This is a test template with parameter MediaWiki
11384 </p>
11385 !! end
11386
11387 !! article
11388 Template:linktest
11389 !! text
11390 [[{{{param}}}|link]]
11391 !! endarticle
11392
11393 !! test
11394 Template parameter as link source
11395 !! wikitext
11396 {{linktest|param=Main Page}}
11397 !! html
11398 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11399 </p>
11400 !! end
11401
11402 !!article
11403 Template:paramtest2
11404 !! text
11405 including another template, {{paramtest|param={{{arg}}}}}
11406 !! endarticle
11407
11408 !! test
11409 Template passing argument to another template
11410 !! wikitext
11411 {{paramtest2|arg='hmm'}}
11412 !! html
11413 <p>including another template, This is a test template with parameter 'hmm'
11414 </p>
11415 !! end
11416
11417 !! article
11418 Template:Linktest2
11419 !! text
11420 Main Page
11421 !! endarticle
11422
11423 !! test
11424 Template as link source
11425 !! wikitext
11426 [[{{linktest2}}]]
11427
11428 [[{{linktest2}}|Main Page]]
11429
11430 [[{{linktest2}}]]Page
11431 !! html
11432 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11433 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11434 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11435 </p>
11436 !! end
11437
11438
11439 !! article
11440 Template:loop1
11441 !! text
11442 {{loop2}}
11443 !! endarticle
11444
11445 !! article
11446 Template:loop2
11447 !! text
11448 {{loop1}}
11449 !! endarticle
11450
11451 !! test
11452 Template infinite loop
11453 !! wikitext
11454 {{loop1}}
11455 !! html
11456 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11457 </p>
11458 !! end
11459
11460 !! test
11461 Template from main namespace
11462 !! wikitext
11463 {{:Main Page}}
11464 !! html
11465 <p>blah blah
11466 </p>
11467 !! end
11468
11469 !! article
11470 Template:table
11471 !! text
11472 {|
11473 | 1 || 2
11474 |-
11475 | 3 || 4
11476 |}
11477 !! endarticle
11478
11479 !! test
11480 T2529: Template with table, not included at beginning of line
11481 !! wikitext
11482 foo {{table}}
11483 !! html
11484 <p>foo
11485 </p>
11486 <table>
11487 <tr>
11488 <td> 1 </td>
11489 <td> 2
11490 </td></tr>
11491 <tr>
11492 <td> 3 </td>
11493 <td> 4
11494 </td></tr></table>
11495
11496 !! end
11497
11498 !! test
11499 T2523: Template shouldn't eat newline (or add an extra one before table)
11500 !! wikitext
11501 foo
11502 {{table}}
11503 !! html
11504 <p>foo
11505 </p>
11506 <table>
11507 <tr>
11508 <td> 1 </td>
11509 <td> 2
11510 </td></tr>
11511 <tr>
11512 <td> 3 </td>
11513 <td> 4
11514 </td></tr></table>
11515
11516 !! end
11517
11518 !! test
11519 T2041: Template parameters shown as broken links
11520 !! wikitext
11521 {{{parameter}}}
11522 !! html
11523 <p>{{{parameter}}}
11524 </p>
11525 !! end
11526
11527 !! test
11528 Template with targets containing wikilinks
11529 !! options
11530 parsoid=wt2html
11531 !! wikitext
11532 {{[[foo]]}}
11533
11534 {{[[{{echo|foo}}]]}}
11535
11536 {{{{echo|[[foo}}]]}}
11537 !! html/php
11538 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11539 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11540 </p><p>{{[[foo}}]]
11541 </p>
11542 !! html/parsoid
11543 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11544 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11545 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11546 !! end
11547
11548 !! article
11549 Template:''
11550 !! text
11551 bar
11552 !! endarticle
11553
11554 !! test
11555 Templates: Double quotes as template target
11556 !! wikitext
11557 foo {{''}} baz
11558 !! html/php
11559 <p>foo bar baz
11560 </p>
11561 !! html/parsoid
11562 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11563 </p>
11564 !! end
11565
11566 ## This test is about making sure Parsoid's data-mw is well formed in the
11567 ## face of multiple templates with intersecting and overlapping ranges. The
11568 ## wikitext itself is wretched.
11569 !! test
11570 Templates with intersecting and overlapping ranges
11571 !! wikitext
11572 {|{{echo|
11573 <p>ha</p>}}
11574 {|{{echo|
11575 <p>ho</p>}}
11576 {{echo|{{!}}hi}}
11577 |}
11578 !! html/php+tidy
11579 <p>ha</p><table>
11580
11581 </table><p>ho</p><table>
11582
11583 <tbody><tr>
11584 <td>hi
11585 </td></tr></tbody></table>
11586 !! html/parsoid
11587 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11588
11589 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11590
11591 <tbody><tr><td>hi</td></tr>
11592 </tbody></table>
11593 !! end
11594
11595 !! article
11596 Template:MSGNW test
11597 !! text
11598 ''None'' of '''this''' should be
11599 * interpreted
11600 but rather passed unmodified
11601 {{test}}
11602 <gallery>
11603 File:Foobar.jpg
11604 </gallery>
11605 <!-- comment -->
11606 !! endarticle
11607
11608 # hmm, fix this or just deprecate msgnw and document its behavior?
11609 !! test
11610 msgnw keyword
11611 !! wikitext
11612 {{msgnw:MSGNW test}}
11613 !! html/php
11614 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11615 &#42; interpreted
11616 &#32;but rather passed unmodified
11617 &#123;&#123;test&#125;&#125;
11618 &#60;gallery&#62;
11619 File:Foobar.jpg
11620 &#60;/gallery&#62;
11621 &#60;!-- comment --&#62;
11622 </p>
11623 !! end
11624
11625 !! test
11626 int keyword
11627 !! wikitext
11628 {{int:youhavenewmessages|lots of money|not!}}
11629 !! html
11630 <p>You have lots of money (not!).
11631 </p>
11632 !! end
11633
11634 !! test
11635 int keyword - non-existing message
11636 !! wikitext
11637 {{int:var}}
11638 !! html
11639 <p>⧼var⧽
11640 </p>
11641 !! end
11642
11643 !! article
11644 Template:Includes
11645 !! text
11646 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11647 !! endarticle
11648
11649 !! test
11650 <includeonly> and <noinclude> being included
11651 !! wikitext
11652 {{Includes}}
11653 !! html
11654 <p>Foobar
11655 </p>
11656 !! end
11657
11658 !! article
11659 Template:Includes2
11660 !! text
11661 <onlyinclude>Foo</onlyinclude>bar
11662 !! endarticle
11663
11664 !! test
11665 <onlyinclude> being included
11666 !! wikitext
11667 {{Includes2}}
11668 !! html
11669 <p>Foo
11670 </p>
11671 !! end
11672
11673
11674 !! article
11675 Template:Includes3
11676 !! text
11677 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11678 !! endarticle
11679
11680 !! test
11681 <onlyinclude> and <includeonly> being included
11682 !! wikitext
11683 {{Includes3}}
11684 !! html
11685 <p>Foo
11686 </p>
11687 !! end
11688
11689 !! test
11690 <includeonly> and <noinclude> on a page
11691 !! wikitext
11692 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11693 !! html
11694 <p>Foozar
11695 </p>
11696 !! end
11697
11698 !! test
11699 Un-closed <noinclude>
11700 !! wikitext
11701 <noinclude>
11702 !! html
11703 !! end
11704
11705 !! test
11706 <onlyinclude> on a page
11707 !! wikitext
11708 <onlyinclude>Foo</onlyinclude>bar
11709 !! html
11710 <p>Foobar
11711 </p>
11712 !! end
11713
11714 !! test
11715 Un-closed <onlyinclude>
11716 !! wikitext
11717 <onlyinclude>
11718 !! html
11719 !! end
11720
11721 !!test
11722 Self-closed noinclude, includeonly, onlyinclude tags
11723 !! wikitext
11724 <noinclude />
11725 <includeonly />
11726 <onlyinclude />
11727 !! html
11728 <p><br />
11729 </p>
11730 !!end
11731
11732 !!test
11733 Unbalanced includeonly and noinclude tags
11734 !! wikitext
11735 {|
11736 |a</noinclude>
11737 |b</noinclude></noinclude>
11738 |c</noinclude></includeonly>
11739 |d</includeonly></includeonly>
11740 |}
11741 !! html
11742 <table>
11743 <tr>
11744 <td>a
11745 </td>
11746 <td>b
11747 </td>
11748 <td>c&lt;/includeonly&gt;
11749 </td>
11750 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11751 </td></tr></table>
11752
11753 !!end
11754
11755 !! article
11756 Template:Includeonly section
11757 !! text
11758 <includeonly>
11759 ==Includeonly section==
11760 </includeonly>
11761 ==Section T-1==
11762 !!endarticle
11763
11764 !! test
11765 T8563: Edit link generation for section shown by <includeonly>
11766 !! wikitext
11767 {{includeonly section}}
11768 !! html
11769 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11770 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11771
11772 !! end
11773
11774 # Uses same input as the contents of [[Template:Includeonly section]]
11775 !! test
11776 T8563: Section extraction for section shown by <includeonly>
11777 !! options
11778 section=T-2
11779 !! wikitext
11780 <includeonly>
11781 ==Includeonly section==
11782 </includeonly>
11783 ==Section T-2==
11784 !! html
11785 ==Section T-2==
11786 !! end
11787
11788 !! test
11789 T8563: Edit link generation for section suppressed by <includeonly>
11790 !! wikitext
11791 <includeonly>
11792 ==Includeonly section==
11793 </includeonly>
11794 ==Section 1==
11795 !! html
11796 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11797
11798 !! end
11799
11800 !! test
11801 T8563: Section extraction for section suppressed by <includeonly>
11802 !! options
11803 section=1
11804 !! wikitext
11805 <includeonly>
11806 ==Includeonly section==
11807 </includeonly>
11808 ==Section 1==
11809 !! html
11810 ==Section 1==
11811 !! end
11812
11813 !! test
11814 Un-closed <includeonly>
11815 !! wikitext
11816 <includeonly>
11817 !! html/php
11818 !! html/parsoid
11819 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11820 !! end
11821
11822 ## We used to, but no longer wt2wt this test since the default serializer
11823 ## will normalize the include directives to serialize on their own line.
11824 ## Selser will take care of preserving formatting in scenarios where they
11825 ## intermingled with other wikitext.
11826 !! test
11827 Includes and comments at SOL
11828 !! options
11829 parsoid=wt2html,html2html
11830 !! wikitext
11831 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11832
11833 <noinclude>
11834 some
11835 </noinclude>* stuff
11836 * here
11837
11838 <includeonly>can have stuff</includeonly>=== here ===
11839
11840 !! html/php
11841 <h2><span class="mw-headline" id="hu">hu</span></h2>
11842 <p>some
11843 </p>
11844 <ul><li> stuff</li>
11845 <li> here</li></ul>
11846 <h3><span class="mw-headline" id="here">here</span></h3>
11847
11848 !! html/parsoid
11849 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu"> hu </h2>
11850
11851 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11852 <p>some</p>
11853 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11854 <li> here</li></ul>
11855
11856 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here"> here </h3>
11857
11858 !! end
11859
11860 # TODO: test with DOM fragment reuse!
11861 !! test
11862 Parsoid: DOM fragment reuse
11863 !! options
11864 parsoid=wt2wt,wt2html
11865 !! wikitext
11866 a{{echo|b<table></table>c}}d
11867
11868 a{{echo|b
11869 <table></table>
11870 c}}d
11871
11872 {{echo|a
11873
11874 <table></table>
11875
11876 b}}
11877 !! html
11878 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11879
11880 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11881 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11882 </span><p about="#mwt2">cd</p>
11883
11884 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11885
11886 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11887
11888 </span><p about="#mwt3">b</p>
11889 !! end
11890
11891 !! test
11892 Parsoid: Merge double tds (T52603)
11893 !! options
11894 parsoid
11895 !! wikitext
11896 {|
11897 |{{echo|{{!}} foo}}
11898 |}
11899 !! html
11900 <table><tbody>
11901 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11902 </tbody></table>
11903 !! end
11904
11905 !! test
11906 Parsoid: Merge double tds in nested transclusion content (T52603)
11907 !! options
11908 parsoid
11909 !! wikitext
11910 {{echo|<div>}}
11911 {|
11912 |{{echo|{{!}} foo}}
11913 |}
11914 {{echo|</div>}}
11915 !! html
11916 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11917 <table><tbody>
11918 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11919 </tbody></table>
11920 </div>
11921 !! end
11922
11923 ###
11924 ### <includeonly> and <noinclude> in attributes
11925 ###
11926 !!test
11927 0. includeonly around the entire attribute
11928 !! wikitext
11929 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11930 !! html
11931 <p><span id="v2">bar</span>
11932 </p>
11933 !!end
11934
11935 !!test
11936 1. includeonly in html attr key
11937 !! wikitext
11938 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11939 !! html
11940 <p><span id="foo">bar</span>
11941 </p>
11942 !!end
11943
11944 !!test
11945 2. includeonly in html attr value
11946 !! wikitext
11947 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11948 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11949 !! html
11950 <p><span id="v1">bar</span>
11951 <span id="v1">bar</span>
11952 </p>
11953 !!end
11954
11955 !!test
11956 3. includeonly in part of an attr value
11957 !! wikitext
11958 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11959 !! html
11960 <p><span style="color:red;">bar</span>
11961 </p>
11962 !!end
11963
11964 !!test
11965 4. includeonly in table attributes
11966 !! wikitext
11967 {|
11968 |- <noinclude>
11969 |-
11970 |a
11971 </noinclude>
11972 |- <includeonly>
11973 |-
11974 |b
11975 </includeonly>
11976 |}
11977 !! html
11978 <table>
11979
11980
11981 <tr>
11982 <td>a
11983 </td></tr>
11984 </table>
11985
11986 !!end
11987
11988 ###
11989 ### Preprocessor precedence tests
11990 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
11991 ###
11992 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
11993 !! test
11994 Preprocessor precedence 1: link is rightmost opening
11995 !! options
11996 parsoid=wt2html
11997 !! wikitext
11998 {{[[Foo|bar}}]]
11999
12000 But close-brace is not a valid character in a link title:
12001 {{[[Foo}}|bar]]
12002
12003 However, we can still tell this was handled as a link in the preprocessor:
12004 {{echo|[[Foo}}|bar]]|bat}}
12005 !! html/php
12006 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12007 </p><p>But close-brace is not a valid character in a link title:
12008 {{[[Foo}}|bar]]
12009 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12010 [[Foo}}|bar]]
12011 </p>
12012 !! html/parsoid
12013 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12014 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12015 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12016 !! end
12017
12018 !! test
12019 Preprocessor precedence 2: template is rightmost opening
12020 !! options
12021 language=zh
12022 !! wikitext
12023 -{{echo|foo}-}}-
12024 !! html/php
12025 <p>-foo}--
12026 </p>
12027 !! html/parsoid
12028 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12029 !! end
12030
12031 !! test
12032 Preprocessor precedence 3: language converter is rightmost opening
12033 !! options
12034 language=zh
12035 parsoid=wt2html
12036 !! wikitext
12037 {{echo|hi}}
12038
12039 {{-{R|echo|hi}}}-
12040
12041 [[-{R|raw]]}-
12042 !! html/php
12043 <p>hi
12044 </p><p>{{echo|hi}}
12045 </p><p>[[raw]]
12046 </p>
12047 !! html/parsoid
12048 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12049 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12050 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12051 !! end
12052
12053 !! test
12054 Preprocessor precedence 4: left-most angle bracket
12055 !! options
12056 language=zh
12057 !! wikitext
12058 <!--{raw}-->
12059 !! html/php
12060 !! html/parsoid
12061 <!--{raw}-->
12062 !! end
12063
12064 !! article
12065 Template:Precedence5
12066 !! text
12067 {{{{{1}}}}}
12068 !! endarticle
12069
12070 !! test
12071 Preprocessor precedence 5: tplarg takes precedence over template
12072 !! wikitext
12073 {{Precedence5|Bullet}}
12074 !! html/php
12075 <ul><li> Bar</li></ul>
12076
12077 !! html/parsoid
12078 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12079 !! end
12080
12081 !! test
12082 Preprocessor precedence 6: broken link is rightmost opening
12083 !! options
12084 parsoid=wt2html
12085 !! wikitext
12086 {{echo|[[Foo}}
12087
12088 {{echo|[[Foo|bar|bat=baz}}
12089 !! html/php
12090 <p>{{echo|[[Foo}}
12091 </p><p>{{echo|[[Foo|bar|bat=baz}}
12092 </p>
12093 !! html/parsoid
12094 <p>{{echo|[[Foo}}</p>
12095 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12096 !! end
12097
12098 # This next test exposes a difference between PHP and Parsoid:
12099 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12100 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12101 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12102 # outer `[[Foo` extends until the `y]]`
12103 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12104 # intermediate result (after template expansion), and link processing
12105 # happens on this intermediate result, which moves the wikilink
12106 # boundary leftward to `[[Foo|Bar]]`
12107 # 2b) Parsoid works in a single step, so it's going to keep the
12108 # wikilink as extending to the `y]]`
12109 # 3a) Then PHP does linktrail processing which slurps up the trailing
12110 # `xy` inside the link.
12111 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12112 # `z` inside the link.
12113 # This is "correct" behavior. Parsoid's basic worldview is that the
12114 # `]]` inside the template shouldn't be allowed to leak out to affect
12115 # the surrounding wikilink. PHP may match Parsoid (in the future)
12116 # if you use {{#balance}} (T114445).
12117
12118 !! test
12119 Preprocessor precedence 7: broken template is rightmost opening
12120 !! options
12121 parsoid=wt2html
12122 !! wikitext
12123 [[Foo|{{echo|Bar]]
12124
12125 [[Foo|{{echo|Bar]]-x}}-y]]-z
12126
12127 Careful: linktrails can move the end of the wikilink:
12128 [[Foo|{{echo|y']]a}}l]]l
12129 !! html/php
12130 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12131 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12132 </p><p>Careful: linktrails can move the end of the wikilink:
12133 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12134 </p>
12135 !! html/parsoid
12136 <p>[[Foo|{{echo|Bar]]</p>
12137 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12138 <p>Careful: linktrails can move the end of the wikilink:
12139 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12140 !! end
12141
12142 !! test
12143 Preprocessor precedence 8: broken language converter is rightmost opening
12144 !! options
12145 language=zh
12146 !! wikitext
12147 [[Foo-{R|raw]]
12148 !! html
12149 <p>[[Foo-{R|raw]]
12150 </p>
12151 !! end
12152
12153 !! article
12154 Template:Preprocessor_precedence_9
12155 !! text
12156 ;4: {{{{1}}}}
12157 ;5: {{{{{2}}}}}
12158 ;6: {{{{{{3}}}}}}
12159 ;7: {{{{{{{4}}}}}}}
12160 !! endarticle
12161
12162 !! test
12163 Preprocessor precedence 9: groups of braces
12164 !! wikitext
12165 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12166 !! html/php
12167 <dl><dt>4</dt>
12168 <dd> {Four}</dd>
12169 <dt>5</dt>
12170 <dd> </dd></dl>
12171 <ul><li> Bar</li></ul>
12172 <dl><dt>6</dt>
12173 <dd> Four</dd>
12174 <dt>7</dt>
12175 <dd> {Bullet}</dd></dl>
12176
12177 !! html/parsoid
12178 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12179 <dt>4</dt>
12180 <dd>{Four}</dd>
12181 <dt>5</dt>
12182 <dd></dd>
12183 </dl><ul about="#mwt1">
12184 <li>Bar</li>
12185 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12186 <dt>6</dt>
12187 <dd>Four</dd>
12188 <dt>7</dt>
12189 <dd>{Bullet}</dd>
12190 </dl>
12191 !! end
12192
12193 !! article
12194 Template:Preprocessor_precedence_10
12195 !! text
12196 ;1: -{R|raw}-
12197 ;2: -{{Bullet}}-
12198 ;3: -{{{1}}}-
12199 ;4: -{{{{2}}}}-
12200 ;5: -{{{{{3}}}}}-
12201 ;6: -{{{{{{4}}}}}}-
12202 ;7: -{{{{{{{5}}}}}}}-
12203 !! endarticle
12204
12205 !! test
12206 Preprocessor precedence 10: groups of braces with leading dash
12207 !! options
12208 language=zh
12209 !! wikitext
12210 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12211 !! html/php
12212 <dl><dt>1</dt>
12213 <dd> raw</dd>
12214 <dt>2</dt>
12215 <dd> -</dd></dl>
12216 <ul><li> Bar-</li></ul>
12217 <dl><dt>3</dt>
12218 <dd> -Three-</dd>
12219 <dt>4</dt>
12220 <dd> raw2</dd>
12221 <dt>5</dt>
12222 <dd> -</dd></dl>
12223 <ul><li> Bar-</li></ul>
12224 <dl><dt>6</dt>
12225 <dd> -Three-</dd>
12226 <dt>7</dt>
12227 <dd> raw2</dd></dl>
12228
12229 !! html/parsoid
12230 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12231 <dt>1</dt>
12232 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12233 <dt>2</dt>
12234 <dd>-</dd>
12235 </dl><ul about="#mwt1">
12236 <li>Bar-</li>
12237 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12238 <dt>3</dt>
12239 <dd>-Three-</dd>
12240 <dt>4</dt>
12241 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12242 <dt>5</dt>
12243 <dd>-</dd>
12244 </dl><ul about="#mwt1">
12245 <li>Bar-</li>
12246 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12247 <dt>6</dt>
12248 <dd>-Three-</dd>
12249 <dt>7</dt>
12250 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12251 </dl>
12252 !! end
12253
12254 !! test
12255 Preprocessor precedence 11: found during visual diff testing
12256 !! wikitext
12257 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12258
12259 {{echo|-{{echo|-{{echo|x}}}}}}
12260
12261 {{echo|-{{echo|x}}}}
12262 !! html/php
12263 <p><span>-<span>-x</span></span>
12264 </p><p>--x
12265 </p><p>-x
12266 </p>
12267 !! html/parsoid
12268 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12269
12270 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12271
12272 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12273 !! end
12274
12275 !! test
12276 Preprocessor precedence 12: broken language converter closed by brace.
12277 !! options
12278 parsoid=wt2html
12279 !! wikitext
12280 This form breaks the template, which is unfortunate:
12281 * {{echo|foo-{bar}bat}}
12282
12283 But if the broken language converter markup is inside an extension
12284 tag, nothing bad happens:
12285 * <nowiki>foo-{bar}bat</nowiki>
12286 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12287 * <pre>foo-{bar}bat</pre>
12288 * {{echo|<pre>foo-{bar}bat</pre>}}
12289
12290 <tag>foo-{bar}bat</tag>
12291 {{echo|<tag>foo-{bar}bat</tag>}}
12292
12293 !! html/php+tidy
12294 <p>This form breaks the template, which is unfortunate:
12295 </p>
12296 <ul><li> {{echo|foo-{bar}bat}}</li></ul>
12297 <p>But if the broken language converter markup is inside an extension
12298 tag, nothing bad happens:
12299 </p>
12300 <ul><li> foo-&#123;bar}bat</li>
12301 <li> foo-&#123;bar}bat</li>
12302 <li> <pre>foo-{bar}bat</pre></li>
12303 <li> <pre>foo-{bar}bat</pre></li></ul>
12304 <pre>'foo-{bar}bat'
12305 array (
12306 )
12307 </pre>
12308 <pre>'foo-{bar}bat'
12309 array (
12310 )
12311 </pre>
12312 !! html/parsoid
12313 <p>This form breaks the template, which is unfortunate:</p>
12314 <ul>
12315 <li>{{echo|foo-{bar}bat}}</li>
12316 </ul>
12317 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12318 <ul>
12319 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12320 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12321 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12322 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12323 </ul>
12324 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12325 !! end
12326
12327 !! test
12328 Preprocessor precedence 13: broken language converter in external link
12329 !! options
12330 parsoid=wt2html
12331 !! wikitext
12332 * [http://example.com/-{foo Example in URL]
12333 * [http://example.com Example in -{link} description]
12334 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12335 !! html/php+tidy
12336 <ul><li> <a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12337 <li> <a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12338 <li> {{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12339 !! html/parsoid
12340 <ul>
12341 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12342 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12343 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12344 </ul>
12345 !! end
12346
12347 !! test
12348 Preprocessor precedence 14: broken language converter in comment
12349 !! wikitext
12350 * <!--{{foo}}--> ...should be ok
12351 * <!---{{foo}}--> ...extra dashes
12352 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12353 !! html/php+tidy
12354 <ul><li> ...should be ok</li>
12355 <li> ...extra dashes</li>
12356 <li> foobat ...should be ok</li></ul>
12357 !! html/parsoid
12358 <ul>
12359 <li><!--{{foo}}--> ...should be ok</li>
12360 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12361 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span> ...should be ok</li>
12362 </ul>
12363 !! end
12364
12365 !! test
12366 Preprocessor precedence 15: broken brace markup in headings
12367 !! config
12368 wgFragmentMode=[ 'html5', 'legacy' ]
12369 !! options
12370 parsoid=wt2html
12371 !! wikitext
12372 __NOTOC__ __NOEDITSECTION__
12373 ===1 foo[bar 1===
12374 1
12375 ===2 foo[[bar 2===
12376 2
12377 ===3 foo{bar 3===
12378 3
12379 ===4 foo{{bar 4===
12380 4
12381 ===5 foo{{{bar 5===
12382 5
12383 ===6 foo-{bar 6===
12384 6
12385 !! html/php+tidy
12386 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12387 <p>1
12388 </p>
12389 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12390 <p>2
12391 </p>
12392 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12393 <p>3
12394 </p>
12395 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12396 <p>4
12397 </p>
12398 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12399 <p>5
12400 </p>
12401 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12402 <p>6
12403 </p>
12404 !! html/parsoid
12405 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12406 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12407 <p>1</p>
12408 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12409 <p>2</p>
12410 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12411 <p>3</p>
12412 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12413 <p>4</p>
12414 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12415 <p>5</p>
12416 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12417 <p>6</p>
12418 !! end
12419
12420 !! test
12421 Preprocessor precedence 16: matching closing braces to opening braces
12422 !! options
12423 language=zh
12424 parsoid=wt2html
12425 !! wikitext
12426 -{{{echo|foo}}bar}-
12427 !! html/php
12428 <p>foobar
12429 </p>
12430 !! html/parsoid
12431 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12432 !! end
12433
12434 !! test
12435 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12436 !! options
12437 parsoid=wt2html
12438 !! wikitext
12439 {{echo|hi {{}}}}
12440 !! html/php
12441 <p>hi {{}}
12442 </p>
12443 !! html/parsoid
12444 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12445 !! end
12446
12447 ###
12448 ### Token Stream Patcher tests
12449 ###
12450 ### These tests won't always pass wt2wt and other modes because
12451 ### on serialization, the table will be output on a new line.
12452 ### For now, we are blacklisting them, and using this to test selser.
12453 ###
12454
12455 !!test
12456 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12457 !!options
12458 parsoid=wt2html,wt2wt
12459 !!wikitext
12460 {{echo|}}{| width = '100%'
12461 |foo
12462 |}
12463 !!html/parsoid
12464 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12465 <tbody><tr><td>foo</td></tr>
12466 </tbody></table>
12467 !!end
12468
12469 ## We used to, but no longer wt2wt this test since the default serializer
12470 ## will normalize the include directives to serialize on their own line.
12471 ## Selser will take care of preserving formatting in scenarios where they
12472 ## intermingled with other wikitext.
12473 !!test
12474 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12475 !!options
12476 parsoid=wt2html
12477 !!wikitext
12478 <includeonly>a</includeonly>{| {{{b}}}
12479 |c
12480 |}
12481 !!html/parsoid
12482 <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":""}]]}'>
12483 <tbody><tr><td>c</td></tr>
12484 </tbody></table>
12485 !!end
12486
12487 !! test
12488 Table wikitext syntax outside wiki-tables
12489 !! wikitext
12490 a
12491 |+ not a caption
12492 ! not a table heading
12493 |- not a table row
12494 | not a table cell
12495 | class="foo bar" | baz
12496 b
12497 |}
12498 |-
12499 c
12500 !! html
12501 <p>a
12502 |+ not a caption
12503 ! not a table heading
12504 |- not a table row
12505 | not a table cell
12506 | class="foo bar" | baz
12507 b
12508 |}
12509 |-
12510 c
12511 </p>
12512 !! end
12513
12514 ###
12515 ### Testing parsing of templates where a template arg
12516 ### has the same name as the template itself.
12517 ###
12518
12519 !! article
12520 Template:quote
12521 !! text
12522 {{{quote|{{{1}}}}}}
12523 !! endarticle
12524
12525 !!test
12526 Templates: Template Name/Arg clash: 1. Use of positional param
12527 !! wikitext
12528 {{quote|foo}}
12529 !! html
12530 <p>foo
12531 </p>
12532 !!end
12533
12534 !!test
12535 Templates: Template Name/Arg clash: 2. Use of named param
12536 !! wikitext
12537 {{quote|quote=foo}}
12538 !! html
12539 <p>foo
12540 </p>
12541 !!end
12542
12543 !!test
12544 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12545 !! wikitext
12546 {{quote|quote}}
12547 !! html
12548 <p>quote
12549 </p>
12550 !!end
12551
12552 ###
12553 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12554 ###
12555
12556 !!test
12557 Templates: 1. Simple use
12558 !! wikitext
12559 {{echo|Foo}}
12560 !! html
12561 <p>Foo
12562 </p>
12563 !!end
12564
12565 !!test
12566 Templates: 2. Inside a block tag
12567 !! wikitext
12568 <div>{{echo|Foo}}</div>
12569 <blockquote>{{echo|Foo}}</blockquote>
12570 !! html
12571 <div>Foo</div>
12572 <blockquote>Foo</blockquote>
12573
12574 !! html+tidy
12575 <div>Foo</div>
12576 <blockquote><p>Foo</p></blockquote>
12577 !!end
12578
12579 !!test
12580 Templates: P-wrapping: 1a. Templates on consecutive lines
12581 !! wikitext
12582 {{echo|Foo}}
12583 {{echo|bar}}
12584 !! html
12585 <p>Foo
12586 bar
12587 </p>
12588 !!end
12589
12590 !!test
12591 Templates: P-wrapping: 1b. Templates on consecutive lines
12592 !! wikitext
12593 Foo
12594
12595 {{echo|bar}}
12596 {{echo|baz}}
12597 !! html
12598 <p>Foo
12599 </p><p>bar
12600 baz
12601 </p>
12602 !!end
12603
12604 !!test
12605 Templates: P-wrapping: 1c. Templates on consecutive lines
12606 !! wikitext
12607 {{echo|Foo}}
12608 {{echo|bar}} <div>baz</div>
12609 !! html
12610 <p>Foo
12611 </p>
12612 bar <div>baz</div>
12613
12614 !! html+tidy
12615 <p>Foo
12616 </p><p>
12617 bar </p><div>baz</div>
12618 !! end
12619
12620 !!test
12621 Templates: P-wrapping: 1d. Template preceded by comment-only line
12622 !!options
12623 parsoid
12624 !! wikitext
12625 <!-- foo -->
12626 {{echo|Bar}}
12627 !! html
12628 <!-- foo -->
12629
12630 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12631 !!end
12632
12633 !!test
12634 Templates: Inline Text: 1. Multiple template uses
12635 !! wikitext
12636 {{echo|Foo}}bar{{echo|baz}}
12637 !! html
12638 <p>Foobarbaz
12639 </p>
12640 !!end
12641
12642 !!test
12643 Templates: Inline Text: 2. Back-to-back template uses
12644 !! wikitext
12645 {{echo|Foo}}{{echo|bar}}
12646 !! html
12647 <p>Foobar
12648 </p>
12649 !!end
12650
12651 !!test
12652 Templates: Block Tags: 1. Multiple template uses
12653 !! wikitext
12654 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12655 !! html
12656 <div>Foo</div><div>bar</div><div>baz</div>
12657
12658 !!end
12659
12660 !!test
12661 Templates: Block Tags: 2. Back-to-back template uses
12662 !! wikitext
12663 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12664 !! html
12665 <div>Foo</div><div>bar</div>
12666
12667 !!end
12668
12669 # This is an edge case relating to paragraph wrapping.
12670 !!test
12671 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12672 !! wikitext
12673 {{echo|a
12674 b</p>}}
12675 !! html/parsoid
12676 <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
12677 b</p>
12678 !!end
12679
12680 !!test
12681 Templates: Links: 1. Simple example
12682 !! wikitext
12683 {{echo|[[Foo|bar]]}}
12684 !! html
12685 <p><a href="/wiki/Foo" title="Foo">bar</a>
12686 </p>
12687 !!end
12688
12689 !!test
12690 Templates: Links: 2. Generation of link href
12691 !! wikitext
12692 [[{{echo|Foo}}|bar]]
12693 !! html
12694 <p><a href="/wiki/Foo" title="Foo">bar</a>
12695 </p>
12696 !!end
12697
12698 !!test
12699 Templates: Links: 3. Generation of part of a link href
12700 !! wikitext
12701 [[Fo{{echo|o}}|bar]]
12702
12703 [[Foo{{echo|bar}}]]
12704
12705 [[Foo{{echo|bar}}baz]]
12706
12707 [[Foo{{echo|bar}}|bar]]
12708
12709 [[:Foo{{echo|bar}}]]
12710
12711 [[:Foo{{echo|bar}}|bar]]
12712 !! html
12713 <p><a href="/wiki/Foo" title="Foo">bar</a>
12714 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12715 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12716 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12717 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12718 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12719 </p>
12720 !!end
12721
12722 !!test
12723 Templates: Links: 4. Multiple templates generating link href
12724 !! wikitext
12725 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12726 !! html
12727 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12728 </p>
12729 !!end
12730
12731 !!test
12732 Templates: Links: 5. Generation of link text
12733 !! wikitext
12734 [[Foo|{{echo|bar}}]]
12735 !! html
12736 <p><a href="/wiki/Foo" title="Foo">bar</a>
12737 </p>
12738 !!end
12739
12740 !!test
12741 Templates: Links: 5. Nested templates (only outermost template should be marked)
12742 !! wikitext
12743 {{echo|[[{{echo|Foo}}|bar]]}}
12744 !! html
12745 <p><a href="/wiki/Foo" title="Foo">bar</a>
12746 </p>
12747 !!end
12748
12749 !!test
12750 Templates: HTML Tag: 1. Generation of HTML attr. key
12751 !! wikitext
12752 <div {{echo|style}}="color:red;">foo</div>
12753 !! html
12754 <div style="color:red;">foo</div>
12755
12756 !!end
12757
12758 !!test
12759 Templates: HTML Tag: 2. Generation of HTML attr. value
12760 !! wikitext
12761 <div style={{echo|'color:red;'}}>foo</div>
12762 !! html
12763 <div style="color:red;">foo</div>
12764
12765 !!end
12766
12767 !!test
12768 Templates: HTML Tag: 3. Generation of HTML attr key and value
12769 !! wikitext
12770 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12771 !! html
12772 <div style="color:red;">foo</div>
12773
12774 !!end
12775
12776 !!test
12777 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12778 !! wikitext
12779 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12780 !! html
12781 <div title="This is a long title with just one piece templated">foo</div>
12782
12783 !!end
12784
12785 !!test
12786 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12787 !! wikitext
12788 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12789 !! html
12790 <div title="This is a long title with just one piece templated">foo</div>
12791
12792 !!end
12793
12794 !!test
12795 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12796 !! wikitext
12797 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12798 !! html
12799 <div title="This is a long title with just one piece templated">foo</div>
12800
12801 !!end
12802
12803 # SSS FIXME: While it is great we added support for all this,
12804 # do we want to make this part of the spec? Maybe we want to
12805 # deprecate this kind of usage in the future?
12806 !!test
12807 Templates: HTML Tag: 7. Generation of partial attribute key string
12808 !! wikitext
12809 <div st{{echo|yle}}="color:red;">foo</div>
12810 !! html
12811 <div style="color:red;">foo</div>
12812
12813 !!end
12814
12815 !! test
12816 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12817 !! wikitext
12818 <div {{echo|1=id="v1"}}>bar</div>
12819 !! html
12820 <div id="v1">bar</div>
12821
12822 !!end
12823
12824 !! test
12825 Templates: HTML Tag: 9. Multiple template-generated attributes
12826 !! wikitext
12827 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12828 !! html
12829 <div id="v1" title="foo">bar</div>
12830
12831 !!end
12832
12833 !! test
12834 Templates: Support for templates generating attributes and content
12835 !! wikitext
12836 {| {{mixed_attr_content_template}}
12837 |-
12838 |bar
12839 |}
12840 !! html/php
12841 <table style="color:red;" title="T48811">
12842
12843 <tr>
12844 <td>foo
12845 </td></tr>
12846 <tr>
12847 <td>bar
12848 </td></tr></table>
12849
12850 !! html/parsoid
12851 <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|}"]}'>
12852 <tbody><tr>
12853 <td>foo</td></tr>
12854 <tr>
12855 <td>bar</td></tr>
12856 </tbody></table>
12857 !!end
12858
12859 !! test
12860 1. Entities and nowikis inside templated attributes should be handled correctly
12861 !! wikitext
12862 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12863 !! html/php
12864 <div style="background:#f9f9f9;">foo</div>
12865
12866 !! html/parsoid
12867 <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>
12868 !! end
12869
12870 !! test
12871 2. Entities and nowikis inside templated attributes should be handled correctly
12872 !! wikitext
12873 {|
12874 |{{table_attribs_3}}
12875 |}
12876 !! html/php
12877 <table>
12878 <tr>
12879 <td style="background:#f9f9f9;">Foo
12880 </td></tr></table>
12881
12882 !! html/parsoid
12883 <table>
12884 <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>
12885 </tbody></table>
12886 !! end
12887
12888 !! test
12889 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12890 !! wikitext
12891 {{tbl-start}}
12892 |{{table_attribs_3}}
12893 {{tbl-end}}
12894 !! html/php
12895 <table>
12896 <tr>
12897 <td style="background:#f9f9f9;">Foo
12898 </td></tr></table>
12899
12900 !! html/parsoid
12901 <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}}]}'>
12902 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12903 </tbody></table>
12904 !! end
12905
12906 # T107622
12907 !! test
12908 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12909 !! wikitext
12910 {|
12911 | {{table_attribs_6}} hi
12912 |}
12913 !! html/php
12914 <table>
12915 <tr>
12916 <td style="background: red;"> hi
12917 </td></tr></table>
12918
12919 !! html/parsoid
12920 <table>
12921 <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>
12922 </tbody></table>
12923 !! end
12924
12925 !!test
12926 Templates: HTML Tables: 1. Generating start of a HTML table
12927 !! wikitext
12928 {{echo|<table><tr><td>foo</td>}}</tr></table>
12929 !! html
12930 <table><tr><td>foo</td></tr></table>
12931
12932 !!end
12933
12934 !!test
12935 Templates: HTML Tables: 2a. Generating middle of a HTML table
12936 !! wikitext
12937 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12938 !! html
12939 <table><tr><td>foo</td></tr></table>
12940
12941 !!end
12942
12943 !!test
12944 Templates: HTML Tables: 2b. Generating middle of a HTML table
12945 !! wikitext
12946 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12947 !! html
12948 <table><tr><td>foo</td></tr></table>
12949
12950 !!end
12951
12952 !!test
12953 Templates: HTML Tables: 3. Generating end of a HTML table
12954 !! wikitext
12955 <table><tr>{{echo|<td>foo</td></tr></table>}}
12956 !! html
12957 <table><tr><td>foo</td></tr></table>
12958
12959 !!end
12960
12961 !!test
12962 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12963 !! wikitext
12964 {{echo|<table>}}<tr><td>foo</td></tr></table>
12965 !! html
12966 <table><tr><td>foo</td></tr></table>
12967
12968 !!end
12969
12970 !!test
12971 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12972 !! wikitext
12973 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12974 !! html
12975 <table><tr><td>foo</td></tr></table>
12976
12977 !!end
12978
12979 !!test
12980 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12981 !! wikitext
12982 <table><tr>{{echo|<td>}}foo</td></tr></table>
12983 !! html
12984 <table><tr><td>foo</td></tr></table>
12985
12986 !!end
12987
12988 !!test
12989 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12990 !! wikitext
12991 <table><tr><td>foo{{echo|</td>}}</tr></table>
12992 !! html
12993 <table><tr><td>foo</td></tr></table>
12994
12995 !!end
12996
12997 !!test
12998 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12999 !! wikitext
13000 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13001 !! html
13002 <table><tr><td>foo</td></tr></table>
13003
13004 !!end
13005
13006 !!test
13007 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13008 !! wikitext
13009 <table><tr><td>foo</td></tr>{{echo|</table>}}
13010 !! html
13011 <table><tr><td>foo</td></tr></table>
13012
13013 !!end
13014
13015 !!test
13016 Templates: HTML Tables: 5. Proper fostering of categories from inside
13017 !!options
13018 parsoid=wt2html,wt2wt
13019 !! wikitext
13020 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13021 <!--Two categories (T52330)-->
13022 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13023 !! html
13024 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13025 <!--Two categories (T52330)-->
13026 <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>
13027 !!end
13028
13029 !!test
13030 Templates: Wiki Tables: 1a. Fostering of entire template content
13031 !! wikitext
13032 {|
13033 {{echo|a}}
13034 |}
13035 !! html
13036 <table>
13037 a
13038 <tr><td></td></tr></table>
13039
13040 !! html+tidy
13041
13042 a
13043 <table><tbody><tr><td></td></tr></tbody></table>
13044 !! end
13045
13046 !!test
13047 Templates: Wiki Tables: 1b. Fostering of entire template content
13048 !! wikitext
13049 {|
13050 {{echo|<div>}}
13051 foo
13052 {{echo|</div>}}
13053 |}
13054 !! html
13055 <table>
13056 <div>
13057 <p>foo
13058 </p>
13059 </div>
13060 <tr><td></td></tr></table>
13061
13062 !! html/php+tidy
13063 <div>
13064 <p>foo
13065 </p>
13066 </div><table>
13067
13068 <tbody><tr><td></td></tr></tbody></table>
13069 !! html/parsoid
13070 <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|}"]}'>
13071 <p>foo</p>
13072 </div><table about="#mwt3">
13073
13074 </table>
13075 !! end
13076
13077 !!test
13078 Templates: Wiki Tables: 2. Fostering of partial template content
13079 !! wikitext
13080 {|
13081 {{echo|a
13082 <div>b</div>}}
13083 |}
13084 !! html
13085 <table>
13086 a
13087 <div>b</div>
13088 <tr><td></td></tr></table>
13089
13090 !! html/php+tidy
13091
13092 a
13093 <div>b</div><table>
13094 <tbody><tr><td></td></tr></tbody></table>
13095 !! html/parsoid
13096 <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">
13097
13098
13099 </table>
13100 !! end
13101
13102 !!test
13103 Templates: Wiki Tables: 3. td-content via multiple templates
13104 !! wikitext
13105 {|
13106 {{echo|{{pipe}}a}}{{echo|b}}
13107 |}
13108 !! html
13109 <table>
13110 <tr>
13111 <td>ab
13112 </td></tr></table>
13113
13114 !!end
13115
13116 !!test
13117 Templates: Wiki Tables: 4. Templated tags, no content
13118 !! wikitext
13119 {{tbl-start}}
13120 {{tbl-end}}
13121 !! html
13122 <table>
13123 <tr><td></td></tr></table>
13124
13125 !!end
13126
13127 !!test
13128 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13129 !! wikitext
13130 {{tbl-start}}
13131 |foo
13132 {{tbl-end}}
13133 !! html
13134 <table>
13135 <tr>
13136 <td>foo
13137 </td></tr></table>
13138
13139 !!end
13140
13141 !!test
13142 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13143 !! wikitext
13144 {{tbl-start}}
13145 {{!}}foo
13146 {{tbl-end}}
13147 !! html
13148 <table>
13149 <tr>
13150 <td>foo
13151 </td></tr></table>
13152
13153 !!end
13154
13155 ## This test case is very specific to Parsoid's internals
13156 ## and is hence only tested for Parsoid's code. Parsoid uses
13157 ## a <meta> marker tag for <ref> tags and they are expanded
13158 ## much later. We are verifying that this <meta> tag usage
13159 ## doesn't prevent foster parenting.
13160 !!test
13161 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13162 !!wikitext
13163 {{PartialTable}}<ref>foo</ref>
13164 |}
13165
13166 <references />
13167 !!html/parsoid
13168 <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">
13169 <tbody>
13170 </tbody></table>
13171
13172 <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>
13173 !!end
13174
13175 !! test
13176 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13177 !! wikitext
13178 {{echo|
13179 {{{!}}
13180 {{!}}-}}
13181 <onlyinclude>
13182 |foo
13183 </onlyinclude>
13184 {{!}}}
13185 !! html/parsoid
13186 <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{{!}}}"]}'>
13187 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13188 <tbody><tr>
13189
13190 <td>foo
13191 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13192 </tbody></table>
13193 !! end
13194
13195 !!test
13196 Templates: Lists: Multi-line list-items via templates
13197 !! wikitext
13198 *{{echo|a {{nonexistent|
13199 unused}}}}
13200 *{{echo|b {{nonexistent|
13201 unused}}}}
13202 !! html
13203 <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>
13204 <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>
13205
13206 !!end
13207
13208 !!test
13209 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13210 !! wikitext
13211 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13212 !! html
13213 <p><i>ab</i>c<i>d</i>e
13214 </p>
13215 !!end
13216
13217 !!test
13218 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13219 (PHP parser generates misnested html)
13220 !! wikitext
13221 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13222 !! html/parsoid
13223 <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>
13224 !!end
13225
13226 !!test
13227 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13228 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13229 !! options
13230 parsoid=wt2html,wt2wt
13231 !! wikitext
13232 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13233 !! html
13234 <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>
13235 <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>
13236 <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>
13237 !!end
13238
13239 !!test
13240 Templates: Ugly nesting: 4. Divs opened/closed across templates
13241 !! wikitext
13242 a<div>b{{echo|c</div>d}}e
13243 !! html
13244 a<div>bc</div>de
13245
13246 !! html+tidy
13247 <p>a</p><div>bc</div><p>de
13248 </p>
13249 !! end
13250
13251 !! test
13252 Templates: Ugly templates: 3. newline-only template parameter
13253 !! wikitext
13254 foo {{echo|
13255 }}
13256 !! html
13257 <p>foo
13258 </p>
13259 !! end
13260
13261 # This looks like a bug: a single newline triggers p/br for some reason.
13262 !! test
13263 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13264 !! wikitext
13265 {{echo|
13266 }}
13267 !! html
13268 <p><br />
13269 </p>
13270 !! end
13271
13272 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13273 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13274 !! test
13275 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13276 !! wikitext
13277 {{echo|<table>}}
13278 {{echo|<div>foo}}
13279 {{echo|</table>}}
13280 !! html/parsoid
13281 <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
13282 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13283 </table>
13284 !! end
13285
13286 # T66017 -- ugly wikitext with fostered content generates two template ranges
13287 # that are "identical" and generate nesting cycles in the algorithm
13288 !! test
13289 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13290 !! wikitext
13291 {{echo|<table><tr><td><table>}}
13292 {{echo|<div>}}
13293 {{echo|</div>}}
13294 !! html/parsoid
13295 <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"}'>
13296 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13297 </table></td></tr></tbody></table>
13298 !! end
13299
13300 !! test
13301 Templates: Parameters substituted at the top-level
13302 !! wikitext
13303 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13304
13305 {{{foo|bar|baz}}}
13306 !! html/php
13307 <p><i>who</i> me? <b>never!</b>
13308 </p><p>bar
13309 </p>
13310 !! html/parsoid
13311 <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>
13312
13313 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13314 !! end
13315
13316 !! test
13317 Templates: Param with empty arg in the final position
13318 !! wikitext
13319 {{{hi|}}}
13320 !! html/parsoid
13321 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13322 !! end
13323
13324 !!test
13325 Parser Functions: 1. Simple example
13326 !! wikitext
13327 {{uc:foo}}
13328 !! html
13329 <p>FOO
13330 </p>
13331 !!end
13332
13333 !!test
13334 Parser Functions: 2. Nested use (only outermost should be marked up)
13335 !! wikitext
13336 {{uc:{{lc:FOO}}}}
13337 !! html
13338 <p>FOO
13339 </p>
13340 !!end
13341
13342 ###
13343 ### Pre-save transform tests
13344 ###
13345 !! test
13346 pre-save transform: subst:
13347 !! options
13348 pst
13349 !! wikitext
13350 {{subst:test}}
13351 !! html/php
13352 This is a test template
13353 !! end
13354
13355 !! test
13356 pre-save transform: normal template
13357 !! options
13358 pst
13359 !! wikitext
13360 {{test}}
13361 !! html/php
13362 {{test}}
13363 !! end
13364
13365 !! test
13366 pre-save transform: nonexistent template
13367 !! options
13368 pst
13369 !! wikitext
13370 {{thistemplatedoesnotexist}}
13371 !! html/php
13372 {{thistemplatedoesnotexist}}
13373 !! end
13374
13375 !! test
13376 pre-save transform: subst magic variables
13377 !! options
13378 pst
13379 !! wikitext
13380 {{subst:SITENAME}}
13381 !! html/php
13382 MediaWiki
13383 !! end
13384
13385 # This is T2089, which I fixed. -- wtm
13386 !! test
13387 pre-save transform: subst: templates with parameters
13388 !! options
13389 pst
13390 !! wikitext
13391 {{subst:paramtest|param="something else"}}
13392 !! html/php
13393 This is a test template with parameter "something else"
13394 !! end
13395
13396 !! article
13397 Template:nowikitest
13398 !! text
13399 <nowiki>'''not wiki'''</nowiki>
13400 !! endarticle
13401
13402 !! test
13403 pre-save transform: nowiki in subst (T3188)
13404 !! options
13405 pst
13406 !! wikitext
13407 {{subst:nowikitest}}
13408 !! html/php
13409 <nowiki>'''not wiki'''</nowiki>
13410 !! end
13411
13412 !! article
13413 Template:commenttest
13414 !! text
13415 This template has <!-- a comment --> in it.
13416 !! endarticle
13417
13418 !! test
13419 pre-save transform: comment in subst (T3936)
13420 !! options
13421 pst
13422 !! wikitext
13423 {{subst:commenttest}}
13424 !! html/php
13425 This template has <!-- a comment --> in it.
13426 !! end
13427
13428 !! test
13429 pre-save transform: unclosed tag
13430 !! options
13431 pst
13432 !! wikitext
13433 <nowiki>'''not wiki'''
13434 !! html/php
13435 <nowiki>'''not wiki'''
13436 !! end
13437
13438 !! test
13439 pre-save transform: mixed tag case
13440 !! options
13441 pst
13442 !! wikitext
13443 <NOwiki>'''not wiki'''</noWIKI>
13444 !! html/php
13445 <NOwiki>'''not wiki'''</noWIKI>
13446 !! end
13447
13448 !! test
13449 pre-save transform: unclosed comment in <nowiki>
13450 !! options
13451 pst
13452 !! wikitext
13453 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13454 !! html/php
13455 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13456 !!end
13457
13458 # Leading @ in this template definition works around a limitation
13459 # in parsoid's parserTests which otherwise strips the <span> from the
13460 # result (confusing it for a template wrapper)
13461 !! article
13462 Template:dangerous
13463 !!text
13464 @<span onmouseover="alert('crap')">Oh no</span>
13465 !!endarticle
13466
13467 !!test
13468 (confirming safety of fix for subst T3936)
13469 !! wikitext
13470 {{Template:dangerous}}
13471 !! html
13472 <p>@<span>Oh no</span>
13473 </p>
13474 !! end
13475
13476 !! test
13477 pre-save transform: comment containing gallery (T7024)
13478 !! options
13479 pst
13480 !! wikitext
13481 <!-- <gallery>data</gallery> -->
13482 !! html/php
13483 <!-- <gallery>data</gallery> -->
13484 !!end
13485
13486 !! test
13487 pre-save transform: comment containing extension
13488 !! options
13489 pst
13490 !! wikitext
13491 <!-- <tag>data</tag> -->
13492 !! html/php
13493 <!-- <tag>data</tag> -->
13494 !!end
13495
13496 !! test
13497 pre-save transform: comment containing nowiki
13498 !! options
13499 pst
13500 !! wikitext
13501 <!-- <nowiki>data</nowiki> -->
13502 !! html/php
13503 <!-- <nowiki>data</nowiki> -->
13504 !!end
13505
13506 !! test
13507 pre-save transform: <noinclude> in subst (T5298)
13508 !! options
13509 pst
13510 !! wikitext
13511 {{subst:Includes}}
13512 !! html/php
13513 Foobar
13514 !! end
13515
13516 !! test
13517 pre-save transform: <onlyinclude> in subst (T5298)
13518 !! options
13519 pst
13520 !! wikitext
13521 {{subst:Includes2}}
13522 !! html/php
13523 Foo
13524 !! end
13525
13526 !! article
13527 Template:SubstTest
13528 !!text
13529 {{<includeonly>subst:</includeonly>Includes}}
13530 !! endarticle
13531
13532 !! article
13533 Template:SafeSubstTest
13534 !! text
13535 {{<includeonly>safesubst:</includeonly>Includes}}
13536 !! endarticle
13537
13538 !! test
13539 T24297: safesubst: works during PST
13540 !! options
13541 pst
13542 !! wikitext
13543 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13544 !! html/php
13545 FoobarFoobar
13546 !! end
13547
13548 !! test
13549 T24297: safesubst: works during normal parse
13550 !! wikitext
13551 {{SafeSubstTest}}
13552 !! html
13553 <p>Foobar
13554 </p>
13555 !! end
13556
13557 !! test
13558 subst: does not work during normal parse
13559 !! wikitext
13560 {{SubstTest}}
13561 !! html
13562 <p>{{subst:Includes}}
13563 </p>
13564 !! end
13565
13566 !! test
13567 pre-save transform: context links ("pipe trick")
13568 !! options
13569 pst
13570 !! wikitext
13571 [[Article (context)|]]
13572 [[Bar:Article|]]
13573 [[:Bar:Article|]]
13574 [[Bar:Article (context)|]]
13575 [[:Bar:Article (context)|]]
13576 [[|Article]]
13577 [[|Article (context)]]
13578 [[Bar:X (Y) Z|]]
13579 [[:Bar:X (Y) Z|]]
13580 !! html/php
13581 [[Article (context)|Article]]
13582 [[Bar:Article|Article]]
13583 [[:Bar:Article|Article]]
13584 [[Bar:Article (context)|Article]]
13585 [[:Bar:Article (context)|Article]]
13586 [[Article]]
13587 [[Article (context)]]
13588 [[Bar:X (Y) Z|X (Y) Z]]
13589 [[:Bar:X (Y) Z|X (Y) Z]]
13590 !! end
13591
13592 !! test
13593 pre-save transform: context links ("pipe trick") with interwiki prefix
13594 !! options
13595 pst
13596 !! wikitext
13597 [[interwiki:Article|]]
13598 [[:interwiki:Article|]]
13599 [[interwiki:Bar:Article|]]
13600 [[:interwiki:Bar:Article|]]
13601 !! html/php
13602 [[interwiki:Article|Article]]
13603 [[:interwiki:Article|Article]]
13604 [[interwiki:Bar:Article|Bar:Article]]
13605 [[:interwiki:Bar:Article|Bar:Article]]
13606 !! end
13607
13608 !! test
13609 pre-save transform: context links ("pipe trick") with parens in title
13610 !! options
13611 pst title=[[Somearticle (context)]]
13612 !! wikitext
13613 [[|Article]]
13614 !! html/php
13615 [[Article (context)|Article]]
13616 !! end
13617
13618 !! test
13619 pre-save transform: context links ("pipe trick") with comma in title
13620 !! options
13621 pst title=[[Someplace, Somewhere]]
13622 !! wikitext
13623 [[|Otherplace]]
13624 [[Otherplace, Elsewhere|]]
13625 [[Otherplace, Elsewhere, Anywhere|]]
13626 !! html/php
13627 [[Otherplace, Somewhere|Otherplace]]
13628 [[Otherplace, Elsewhere|Otherplace]]
13629 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13630 !! end
13631
13632 !! test
13633 pre-save transform: context links ("pipe trick") with parens and comma
13634 !! options
13635 pst title=[[Someplace (IGNORED), Somewhere]]
13636 !! wikitext
13637 [[|Otherplace]]
13638 [[Otherplace (place), Elsewhere|]]
13639 !! html/php
13640 [[Otherplace, Somewhere|Otherplace]]
13641 [[Otherplace (place), Elsewhere|Otherplace]]
13642 !! end
13643
13644 !! test
13645 pre-save transform: context links ("pipe trick") with comma and parens
13646 !! options
13647 pst title=[[Who, me? (context)]]
13648 !! wikitext
13649 [[|Yes, you.]]
13650 [[Me, Myself, and I (1937 song)|]]
13651 !! html/php
13652 [[Yes, you. (context)|Yes, you.]]
13653 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13654 !! end
13655
13656 !! test
13657 pre-save transform: context links ("pipe trick") with namespace
13658 !! options
13659 pst title=[[Ns:Somearticle]]
13660 !! wikitext
13661 [[|Article]]
13662 !! html/php
13663 [[Ns:Article|Article]]
13664 !! end
13665
13666 !! test
13667 pre-save transform: context links ("pipe trick") with namespace and parens
13668 !! options
13669 pst title=[[Ns:Somearticle (context)]]
13670 !! wikitext
13671 [[|Article]]
13672 !! html/php
13673 [[Ns:Article (context)|Article]]
13674 !! end
13675
13676 !! test
13677 pre-save transform: context links ("pipe trick") with namespace and comma
13678 !! options
13679 pst title=[[Ns:Somearticle, Context, Whatever]]
13680 !! wikitext
13681 [[|Article]]
13682 !! html/php
13683 [[Ns:Article, Context, Whatever|Article]]
13684 !! end
13685
13686 !! test
13687 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13688 !! options
13689 pst title=[[Ns:Somearticle, Context (context)]]
13690 !! wikitext
13691 [[|Article]]
13692 !! html/php
13693 [[Ns:Article (context)|Article]]
13694 !! end
13695
13696 !! test
13697 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13698 !! options
13699 pst title=[[Ns:Somearticle (IGNORED), Context]]
13700 !! wikitext
13701 [[|Article]]
13702 !! html/php
13703 [[Ns:Article, Context|Article]]
13704 !! end
13705
13706 !! test
13707 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13708 !! options
13709 pst
13710 !! wikitext
13711 [[Article(context)|]]
13712 [[Bar:Article(context)|]]
13713 [[:Bar:Article(context)|]]
13714 [[|Article(context)]]
13715 [[Bar:X(Y)Z|]]
13716 [[:Bar:X(Y)Z|]]
13717 !! html/php
13718 [[Article(context)|Article]]
13719 [[Bar:Article(context)|Article]]
13720 [[:Bar:Article(context)|Article]]
13721 [[Article(context)]]
13722 [[Bar:X(Y)Z|X(Y)Z]]
13723 [[:Bar:X(Y)Z|X(Y)Z]]
13724 !! end
13725
13726 !! test
13727 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13728 !! options
13729 pst
13730 !! wikitext
13731 [[Article (context)|]]
13732 [[Bar:Article (context)|]]
13733 [[:Bar:Article (context)|]]
13734 [[|Article (context)]]
13735 [[Bar:X (Y) Z|]]
13736 [[:Bar:X (Y) Z|]]
13737 !! html/php
13738 [[Article (context)|Article]]
13739 [[Bar:Article (context)|Article]]
13740 [[:Bar:Article (context)|Article]]
13741 [[Article (context)]]
13742 [[Bar:X (Y) Z|X (Y) Z]]
13743 [[:Bar:X (Y) Z|X (Y) Z]]
13744 !! end
13745
13746 !! test
13747 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13748 !! options
13749 pst
13750 !! wikitext
13751 [[Article(context)|]]
13752 [[Bar:Article(context)|]]
13753 [[:Bar:Article(context)|]]
13754 [[|Article(context)]]
13755 [[Bar:X(Y)Z|]]
13756 [[:Bar:X(Y)Z|]]
13757 !! html/php
13758 [[Article(context)|Article]]
13759 [[Bar:Article(context)|Article]]
13760 [[:Bar:Article(context)|Article]]
13761 [[Article(context)]]
13762 [[Bar:X(Y)Z|X(Y)Z]]
13763 [[:Bar:X(Y)Z|X(Y)Z]]
13764 !! end
13765
13766 !! test
13767 pre-save transform: context links ("pipe trick") with commas (T23660)
13768 !! options
13769 pst
13770 !! wikitext
13771 [[Article (context), context|]]
13772 [[Article (context),context|]]
13773 [[Bar:Article (context), context|]]
13774 [[Bar:Article (context),context|]]
13775 [[:Bar:Article (context), context|]]
13776 [[:Bar:Article (context),context|]]
13777 !! html/php
13778 [[Article (context), context|Article]]
13779 [[Article (context),context|Article]]
13780 [[Bar:Article (context), context|Article]]
13781 [[Bar:Article (context),context|Article]]
13782 [[:Bar:Article (context), context|Article]]
13783 [[:Bar:Article (context),context|Article]]
13784 !! end
13785
13786 !! test
13787 Parsoid: backwards pipe trick
13788 !! wikitext
13789 [[|'''bar''']]
13790 !! html/php
13791 <p>[[|<b>bar</b>]]
13792 </p>
13793 !! html/parsoid
13794 <p>[[|<b>bar</b>]]</p>
13795 !! end
13796
13797 !! test
13798 pre-save transform: trim trailing empty lines
13799 !! options
13800 pst
13801 !! wikitext
13802 Empty lines are trimmed
13803
13804
13805
13806
13807 !! html/php
13808 Empty lines are trimmed
13809 !! end
13810
13811 !! test
13812 pre-save transform: Signature expansion
13813 !! options
13814 pst
13815 !! wikitext
13816 * ~~~
13817 * ~~~~
13818 * ~~~~~
13819 * <noinclude>~~~</noinclude>
13820 * <includeonly>~~~</includeonly>
13821 * <onlyinclude>~~~</onlyinclude>
13822 !! html/php
13823 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13824 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13825 * 00:02, 1 January 1970 (UTC)
13826 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13827 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13828 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13829 !! end
13830
13831
13832 !! test
13833 ParserOutput flags from signature expansion (T84843)
13834 !! options
13835 pst
13836 showflags
13837 !! wikitext
13838 ~~~~
13839 !! html/php
13840 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13841 flags=user-signature
13842 !! end
13843
13844
13845 !! test
13846 pre-save transform: Signature expansion in nowiki tags (T2093)
13847 !! options
13848 pst disabled
13849 !! wikitext
13850 Shall not expand:
13851
13852 <nowiki>~~~~</nowiki>
13853
13854 <includeonly><nowiki>~~~~</nowiki></includeonly>
13855
13856 <noinclude><nowiki>~~~~</nowiki></noinclude>
13857
13858 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13859
13860 {{subst:Foo}} shall be converted to FOO
13861
13862 As well as inside noinclude/onlyinclude
13863 <noinclude>{{subst:Foo}}</noinclude>
13864 <onlyinclude>{{subst:Foo}}</onlyinclude>
13865
13866 But not inside includeonly
13867 <includeonly>{{subst:Foo}}</includeonly>
13868 !! html/php
13869 Shall not expand:
13870
13871 <nowiki>~~~~</nowiki>
13872
13873 <includeonly><nowiki>~~~~</nowiki></includeonly>
13874
13875 <noinclude><nowiki>~~~~</nowiki></noinclude>
13876
13877 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13878
13879 FOO shall be converted to FOO
13880
13881 As well as inside noinclude/onlyinclude
13882 <noinclude>FOO</noinclude>
13883 <onlyinclude>FOO</onlyinclude>
13884
13885 But not inside includeonly
13886 <includeonly>{{subst:Foo}}</includeonly>
13887 !! end
13888
13889 !! test
13890 Parsoid: Recognize nowiki with trailing space in tags
13891 !! options
13892 parsoid=wt2html
13893 !! wikitext
13894 <nowiki ><div>[[foo]]</nowiki >
13895
13896 a<nowiki / >b
13897
13898 c<nowiki />d
13899
13900 e<nowiki/ >f
13901 !! html
13902 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13903 <p>ab</p>
13904 <p>cd</p>
13905 <p>ef</p>
13906 !! end
13907
13908 !! test
13909 Parsoid: Recognize nowiki with odd capitalization
13910 !! options
13911 parsoid=wt2html
13912 !! wikitext
13913 <noWikI ><div>[[foo]]</Nowiki >
13914 !! html
13915 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13916 !! end
13917
13918
13919 !! test
13920 Parsoid: Escape nowiki with trailing space in tags
13921 !! options
13922 parsoid=html2wt
13923 !! html/parsoid
13924 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13925 <p>a&lt;nowiki /&gt;b</p>
13926 <p>c&lt;nowiki/ &gt;d</p>
13927 !! wikitext
13928 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13929
13930 a&lt;nowiki /&gt;b
13931
13932 c&lt;nowiki/ &gt;d
13933 !! end
13934
13935 !! test
13936 Parsoid: Escape weird noWikI capitalizations
13937 !! options
13938 parsoid=html2wt
13939 !! html/parsoid
13940 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13941 !! wikitext
13942 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13943 !! end
13944
13945 ###
13946 ### Message transform tests
13947 ###
13948 !! test
13949 message transform: magic variables
13950 !! options
13951 msg
13952 !! wikitext
13953 {{SITENAME}}
13954 !! html
13955 MediaWiki
13956 !! end
13957
13958 !! test
13959 message transform: should not transform wiki markup
13960 !! options
13961 msg
13962 !! wikitext
13963 ''test''
13964 !! html
13965 ''test''
13966 !! end
13967
13968 !! test
13969 message transform: <noinclude> in transcluded template (T6926)
13970 !! options
13971 msg
13972 !! wikitext
13973 {{Includes}}
13974 !! html
13975 Foobar
13976 !! end
13977
13978 !! test
13979 message transform: <onlyinclude> in transcluded template (T6926)
13980 !! options
13981 msg
13982 !! wikitext
13983 {{Includes2}}
13984 !! html
13985 Foo
13986 !! end
13987
13988 !! test
13989 {{#special:}} page name, known
13990 !! options
13991 msg
13992 !! wikitext
13993 {{#special:Recentchanges}}
13994 !! html
13995 Special:RecentChanges
13996 !! end
13997
13998 !! test
13999 {{#special:}} page name with subpage, known
14000 !! options
14001 msg
14002 !! wikitext
14003 {{#special:Recentchanges/param}}
14004 !! html
14005 Special:RecentChanges/param
14006 !! end
14007
14008 !! test
14009 {{#special:}} page name, unknown
14010 !! options
14011 msg
14012 !! wikitext
14013 {{#special:foobar nonexistent}}
14014 !! html
14015 Special:Foobar nonexistent
14016 !! end
14017
14018 !! test
14019 {{#speciale:}} page name, known
14020 !! options
14021 msg
14022 !! wikitext
14023 {{#speciale:Recentchanges}}
14024 !! html
14025 Special:RecentChanges
14026 !! end
14027
14028 !! test
14029 {{#speciale:}} page name with subpage, known
14030 !! options
14031 msg
14032 !! wikitext
14033 {{#speciale:Recentchanges/param}}
14034 !! html
14035 Special:RecentChanges/param
14036 !! end
14037
14038 !! test
14039 {{#speciale:}} page name, unknown
14040 !! options
14041 msg
14042 !! wikitext
14043 {{#speciale:foobar nonexistent}}
14044 !! html
14045 Special:Foobar_nonexistent
14046 !! end
14047
14048 ###
14049 ### Images
14050 ###
14051 ### For Parsoid-specific tests, see
14052 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14053
14054 !! test
14055 Simple image
14056 !! options
14057 parsoid=wt2html,wt2wt,html2html
14058 !! wikitext
14059 [[Image:foobar.jpg]]
14060 !! html/php
14061 <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>
14062 </p>
14063 !! html/parsoid
14064 <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>
14065 !! end
14066
14067 !! test
14068 Serialize simple image with span wrapper
14069 !! options
14070 parsoid=html2wt
14071 !! html/parsoid
14072 <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>
14073 !! wikitext
14074 [[File:Foobar.jpg]]
14075 !! end
14076
14077 !! test
14078 Simple image (using File: namespace, now canonical)
14079 !! wikitext
14080 [[File:Foobar.jpg]]
14081 !! html/php
14082 <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>
14083 </p>
14084 !! html/parsoid
14085 <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>
14086 !! end
14087
14088 !! test
14089 Right-aligned image
14090 !! wikitext
14091 [[File:Foobar.jpg|right]]
14092 !! html/php
14093 <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>
14094
14095 !! html/parsoid
14096 <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>
14097 !! end
14098
14099 !! test
14100 Image with caption
14101 !! wikitext
14102 [[File:Foobar.jpg|right|Caption text]]
14103 !! html/php
14104 <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>
14105
14106 !! html/parsoid
14107 <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>
14108 !! end
14109
14110 !! test
14111 Image with caption, T55312 #1
14112 !! wikitext
14113 [[File:Foobar.jpg|right|Caption page stuff]]
14114 !! html/php
14115 <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>
14116
14117 !! html/parsoid
14118 <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>
14119 !! end
14120
14121 !! test
14122 Image with caption, T55312 #2
14123 !! wikitext
14124 [[File:Foobar.jpg|right|Caption page=]]
14125 !! html/php
14126 <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>
14127
14128 !! html/parsoid
14129 <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>
14130 !! end
14131
14132 !! test
14133 Image with caption, T55312 #3
14134 !! wikitext
14135 [[File:Foobar.jpg|right|Caption page=stuff]]
14136 !! html/php
14137 <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>
14138
14139 !! html/parsoid
14140 <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>
14141 !! end
14142
14143 !! test
14144 Image caption with pipe entity
14145 !! wikitext
14146 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14147 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14148 !! html/php
14149 <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>
14150 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14151
14152 !! html/parsoid
14153 <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>
14154 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14155 !! end
14156
14157 !! test
14158 Allow empty links in image captions (T62753)
14159 !! options
14160 thumbsize=220
14161 !! wikitext
14162 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14163 [[]]
14164 [[Link2]]
14165 ]]
14166 !! html/php
14167 <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>
14168
14169 !! html/parsoid
14170 <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>
14171 [[]]
14172 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14173 </figcaption></figure>
14174 !! end
14175
14176 !! test
14177 Titles in unlinked images (T23454)
14178 !! wikitext
14179 [[File:Foobar.jpg|link=|stuff]]
14180 !! html/php
14181 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14182 </p>
14183 !! html/parsoid
14184 <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>
14185 !! end
14186
14187 !! test
14188 Link with empty target
14189 !! wikitext
14190 [[]]
14191 !! html
14192 <p>[[]]
14193 </p>
14194 !! end
14195
14196 !! test
14197 Image with link trail
14198 !! wikitext
14199 Linktrails should not work for images: [[File:Foobar.jpg]]s
14200 !! html/php
14201 <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
14202 </p>
14203 !! html/parsoid
14204 <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>
14205 !! end
14206
14207 !! test
14208 Image with empty attribute
14209 !! options
14210 parsoid=wt2html,wt2wt,html2html
14211 !! wikitext
14212 [[File:Foobar.jpg|right||Caption text]]
14213 !! html/php
14214 <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>
14215
14216 !! html/parsoid
14217 <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>
14218 !! end
14219
14220 !! test
14221 1. Block image with individual attributes from templates
14222 !! wikitext
14223 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14224 !! html/php
14225 <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>
14226
14227 !! html/parsoid
14228 <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>
14229 !! end
14230
14231 !! test
14232 2. Block Image with individual attributes from templates
14233 !! wikitext
14234 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14235 !! html/php
14236 <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>
14237
14238 !! html/parsoid
14239 <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>
14240 !! end
14241
14242 !! test
14243 3. Inline image with individual attributes from templates
14244 !! wikitext
14245 [[File:Foobar.jpg|{{echo|50px}}]]
14246 !! html/php
14247 <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>
14248 </p>
14249 !! html/parsoid
14250 <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>
14251 !! end
14252
14253 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14254 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14255 !! test
14256 Image with multiple attributes from the same template
14257 !! wikitext
14258 [[File:Foobar.jpg|{{image_attribs}}]]
14259 !! html/php
14260 <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>
14261
14262 !! html/parsoid
14263 <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>
14264 !! end
14265
14266 !! test
14267 Image with link tails
14268 !! options
14269 thumbsize=220
14270 !! wikitext
14271 123[[File:Foobar.jpg]]456
14272 123[[File:Foobar.jpg|right]]456
14273 123[[File:Foobar.jpg|thumb]]456
14274 !! html/php
14275 <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
14276 </p>
14277 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
14278 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
14279
14280 !! html/php+tidy
14281 <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
14282 </p><p>
14283 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
14284 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
14285 </p>
14286 !! html/parsoid
14287 <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>
14288 <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>
14289 <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>
14290 !! end
14291
14292 !! test
14293 Image with multiple captions -- only last one is accepted
14294 !! wikitext
14295 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14296 !! html/php
14297 <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>
14298
14299 !! html/parsoid
14300 <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>
14301 !! end
14302
14303 !! test
14304 Image with multiple widths -- use last
14305 !! wikitext
14306 [[File:Foobar.jpg|200px|300px|caption]]
14307 !! html/php
14308 <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>
14309 </p>
14310 !! html/parsoid
14311 <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>
14312 !! end
14313
14314 !! test
14315 Image with multiple alignments -- use first (T50664)
14316 !! options
14317 thumbsize=220
14318 !! wikitext
14319 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14320
14321 [[File:Foobar.jpg|middle|text-top|caption]]
14322 !! html/php
14323 <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>
14324 <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>
14325 </p>
14326 !! html/parsoid
14327 <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>
14328 <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>
14329 !! end
14330
14331 !! test
14332 Image with width attribute at different positions
14333 !! wikitext
14334 [[File:Foobar.jpg|200px|right|Caption]]
14335 [[File:Foobar.jpg|right|200px|Caption]]
14336 [[File:Foobar.jpg|right|Caption|200px]]
14337 !! html/php
14338 <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>
14339 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14340 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14341
14342 !! html/parsoid
14343 <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>
14344 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14345 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14346 !! end
14347
14348 # a sad bit of backward-compatibility
14349 !! test
14350 Image with size specified with pxpx (T15500, T53628)
14351 !! options
14352 parsoid=wt2html,wt2wt,html2html
14353 !! wikitext
14354 [[File:Foobar.jpg|20pxpx]]
14355 [[File:Foobar.jpg|200x20pxpx]]
14356 !! html/php
14357 <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>
14358 <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>
14359 </p>
14360 !! html/parsoid
14361 <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>
14362 !! end
14363
14364 !! test
14365 Image with link parameter, wiki target
14366 !! wikitext
14367 [[File:Foobar.jpg|link=Main Page]]
14368 !! html/php
14369 <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>
14370 </p>
14371 !! html/parsoid
14372 <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>
14373 !! end
14374
14375 # parsoid T51293 (part 1)
14376 !! test
14377 Image with link parameter, URL target
14378 !! wikitext
14379 [[File:Foobar.jpg|link=http://example.com/]]
14380 !! html/php
14381 <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>
14382 </p>
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 # parsoid T51293 (part 2)
14388 !! test
14389 Image with link parameter, protocol-less URL target
14390 !! wikitext
14391 [[File:Foobar.jpg|link=//example.com/]]
14392 !! html/php
14393 <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>
14394 </p>
14395 !! html/parsoid
14396 <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>
14397 !! end
14398
14399 !! test
14400 Escaping non-block captions (T107435)
14401 !! options
14402 parsoid={
14403 "modes": ["wt2wt"],
14404 "changes": [
14405 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14406 ]
14407 }
14408 !! wikitext
14409 [[Image:Foobar.jpg|caption]]
14410 !! wikitext/edited
14411 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14412 !! end
14413
14414 # wgExternalLinkTarget not supported by Parsoid
14415 !! test
14416 Image with link parameter, wgExternalLinkTarget
14417 !! wikitext
14418 [[Image:foobar.jpg|link=http://example.com/]]
14419 !! config
14420 wgExternalLinkTarget='foobar'
14421 !! html/php
14422 <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>
14423 </p>
14424 !! end
14425
14426 !! test
14427 Image with link parameter, wgNoFollowLinks set to false
14428 !! wikitext
14429 [[Image:foobar.jpg|link=http://example.com/]]
14430 !! config
14431 wgNoFollowLinks=false
14432 !! html/php
14433 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14434 </p>
14435 !! end
14436
14437 !! test
14438 Image with link parameter, wgNoFollowDomainExceptions
14439 !! wikitext
14440 [[Image:foobar.jpg|link=http://example.com/]]
14441 !! config
14442 wgNoFollowDomainExceptions='example.com'
14443 !! html/php
14444 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14445 </p>
14446 !! end
14447
14448 # wgExternalLinkTarget not supported by Parsoid
14449 !! test
14450 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14451 !! wikitext
14452 [[Image:foobar.jpg|link=http://example.com/|Title]]
14453 !! config
14454 wgExternalLinkTarget='foobar'
14455 !! html/php
14456 <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>
14457 </p>
14458 !! end
14459
14460 !! test
14461 Image with empty link parameter
14462 !! wikitext
14463 [[File:Foobar.jpg|link=]]
14464 !! html/php
14465 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14466 </p>
14467 !! html/parsoid
14468 <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>
14469 !! end
14470
14471 !! test
14472 Image with link parameter (wiki target) and unnamed parameter
14473 !! wikitext
14474 [[File:Foobar.jpg|link=Main_Page|Title]]
14475 !! html/php
14476 <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>
14477 </p>
14478 !! html/parsoid
14479 <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>
14480 !! end
14481
14482 !! test
14483 Image with link parameter (URL target) and unnamed parameter
14484 !! wikitext
14485 [[File:Foobar.jpg|link=http://example.com/|Title]]
14486 !! html/php
14487 <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>
14488 </p>
14489 !! html/parsoid
14490 <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>
14491 !! end
14492
14493 !! test
14494 Thumbnail image with link parameter
14495 !! options
14496 thumbsize=220
14497 parsoid=wt2html,wt2wt,html2html
14498 !! wikitext
14499 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14500 !! html/php
14501 <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>
14502
14503 !! html/parsoid
14504 <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>
14505 !! end
14506
14507 !! test
14508 Manually-specified thumbnail image
14509 !! options
14510 thumbsize=220
14511 !! wikitext
14512 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14513 !! html/php
14514 <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>
14515
14516 !! html/parsoid
14517 <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>
14518 !! end
14519
14520 !! test
14521 Manually-specified thumbnail image with explicit link to wiki page
14522 !! options
14523 thumbsize=220
14524 parsoid=wt2html,wt2wt,html2html
14525 !! wikitext
14526 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14527 !! html/php
14528 <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>
14529
14530 !! html/parsoid
14531 <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>
14532 !! end
14533
14534 !! test
14535 Manually-specified thumbnail image with explicit link to url
14536 !! options
14537 thumbsize=220
14538 parsoid=wt2html,wt2wt,html2html
14539 !! wikitext
14540 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14541 !! html/php
14542 <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>
14543
14544 !! html/parsoid
14545 <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>
14546 !! end
14547
14548 !! test
14549 Manually-specified thumbnail image with explicit no link
14550 !! options
14551 thumbsize=220
14552 parsoid=wt2html,wt2wt,html2html
14553 !! wikitext
14554 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14555 !! html/php
14556 <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>
14557
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 !! test
14563 Manually-specified thumbnail image with explicit link and alt text
14564 !! options
14565 thumbsize=220
14566 parsoid=wt2html,wt2wt,html2html
14567 !! wikitext
14568 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14569 !! html/php
14570 <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>
14571
14572 !! html/parsoid
14573 <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>
14574 !! end
14575
14576 !! test
14577 Image with frame and link
14578 !! options
14579 parsoid=wt2html,wt2wt,html2html
14580 !! wikitext
14581 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14582 !! html/php
14583 <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>
14584
14585 !! html/parsoid
14586 <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>
14587 !! end
14588
14589 !! test
14590 Image with frame and link and explicit alt
14591 !! options
14592 parsoid=wt2html,wt2wt,html2html
14593 !! wikitext
14594 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14595 !! html/php
14596 <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>
14597
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Image with wiki markup in implicit alt
14604 !! wikitext
14605 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14606
14607 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14608 !! html/php
14609 <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>
14610 </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>
14611 </p>
14612 !! html/parsoid
14613 <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>
14614
14615 <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>
14616 !! end
14617
14618 !! test
14619 Alt image option should handle most kinds of wikitext without barfing
14620 !! wikitext
14621 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14622 !! html/php
14623 <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>
14624
14625 !! html/parsoid
14626 <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>
14627 !! end
14628
14629 !! test
14630 Image with table with attributes in caption
14631 !! options
14632 parsoid=wt2html,html2html
14633 !! wikitext
14634 [[File:Foobar.jpg|thumb|
14635 {| class="123" |
14636 |- class="456" |
14637 | ha
14638 |}
14639 ]]
14640 !! html/parsoid
14641 <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>
14642 <table class="123">
14643 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14644 <td> ha</td></tr>
14645 </tbody></table>
14646 </figcaption></figure>
14647 !! end
14648
14649 !! test
14650 Image with table with rows from templates in caption
14651 !! wikitext
14652 [[File:Foobar.jpg|thumb|
14653 {|
14654 {{echo|{{!}} hi}}
14655 |}
14656 ]]
14657 !! html/parsoid
14658 <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>
14659 <table>
14660 <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>
14661 </tbody></table>
14662 </figcaption></figure>
14663 !! end
14664
14665 !! test
14666 Image with nested tables in caption
14667 !! wikitext
14668 [[File:Foobar.jpg|thumb|Foo<br />
14669 {|
14670 |
14671 {|
14672 |z
14673 |}
14674 |}
14675 ]]
14676 !! html/parsoid
14677 <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}'/>
14678 <table>
14679 <tbody><tr><td>
14680 <table>
14681 <tbody><tr><td>z</td></tr>
14682 </tbody></table></td></tr>
14683 </tbody></table>
14684 </figcaption></figure>
14685 !! end
14686
14687 ###################
14688 # Conflicting image format options.
14689 # First option specified should 'win'.
14690 # All three cases in each test should be identical.
14691
14692 !! test
14693 Image with 'frameless' first.
14694 !! options
14695 parsoid=wt2html,wt2wt,html2html
14696 !! wikitext
14697 [[File:Foobar.jpg|frameless|caption]]
14698
14699 [[File:Foobar.jpg|frameless|frame|caption]]
14700
14701 [[File:Foobar.jpg|frameless|thumb|caption]]
14702 !! html/php
14703 <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>
14704 </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>
14705 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
14706 </p>
14707 !! html/parsoid
14708 <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>
14709 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
14710 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
14711 !! end
14712
14713 !! test
14714 Image with 'frame' first.
14715 !! options
14716 parsoid=wt2html,wt2wt,html2html
14717 !! wikitext
14718 [[File:Foobar.jpg|frame|caption]]
14719 [[File:Foobar.jpg|frame|frameless|caption]]
14720 [[File:Foobar.jpg|frame|thumb|caption]]
14721 !! html/php
14722 <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>
14723 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14724 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
14725
14726 !! html/parsoid
14727 <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>
14728 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14729 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14730 !! end
14731
14732 !! test
14733 Image with 'thumb' first.
14734 !! options
14735 parsoid=wt2html,wt2wt,html2html
14736 !! wikitext
14737 [[File:Foobar.jpg|thumb|caption]]
14738 [[File:Foobar.jpg|thumb|frameless|caption]]
14739 [[File:Foobar.jpg|thumb|frame|caption]]
14740 !! html/php
14741 <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>
14742 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14743 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14744
14745 !! html/parsoid
14746 <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>
14747 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14748 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14749 !! end
14750
14751 ###################
14752 # Image sizing.
14753 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14754 # and https://phabricator.wikimedia.org/T64258
14755 # Foobar has actual size of 1941x220
14756 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14757 # a scalable format.
14758 # 2. Framed images always ignore size options; always render at default size.
14759 # 3. "Unspecified format" and border are the only types which can be
14760 # enlarged.
14761
14762 !! test
14763 Image: unspecified format and border enlarge
14764 !! options
14765 parsoid=wt2html,wt2wt,html2html
14766 !! wikitext
14767 [[File:Foobar.jpg|2000px]]
14768
14769 [[File:Foobar.jpg|border|2000px]]
14770 !! html/php
14771 <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>
14772 </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>
14773 </p>
14774 !! html/parsoid
14775 <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>
14776 <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>
14777 !! end
14778
14779 !! test
14780 Image: "unspecified format" and border reduce
14781 !! options
14782 parsoid=wt2html,wt2wt,html2html
14783 !! wikitext
14784 [[File:Foobar.jpg|1000px]]
14785
14786 [[File:Foobar.jpg|border|1000px]]
14787 !! html/php
14788 <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>
14789 </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>
14790 </p>
14791 !! html/parsoid
14792 <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>
14793 <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>
14794 !! end
14795
14796 !! test
14797 Image: thumbs reduce
14798 !! options
14799 parsoid=wt2html,wt2wt,html2html
14800 !! wikitext
14801 [[File:Foobar.jpg|thumb|50px]]
14802 !! html/php
14803 <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>
14804
14805 !! html/parsoid
14806 <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>
14807 !! end
14808
14809 !! test
14810 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14811 !! options
14812 parsoid=wt2html,wt2wt,html2html
14813 !! wikitext
14814 [[File:Foobar.jpg|thumb|2000px]]
14815
14816 [[File:Foobar.svg|thumb|2000px]]
14817 !! html/php
14818 <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>
14819 <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>
14820
14821 !! html/parsoid
14822 <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>
14823 <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>
14824 !! end
14825
14826 !! test
14827 Image: frameless can reduce in size
14828 !! options
14829 parsoid=wt2html,wt2wt,html2html
14830 !! wikitext
14831 [[File:Foobar.jpg|frameless|50px]]
14832 !! html/php
14833 <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>
14834 </p>
14835 !! html/parsoid
14836 <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>
14837 !! end
14838
14839 !! test
14840 Image: bitmap frameless can't be enlarged past original size, but vector can
14841 !! options
14842 parsoid=wt2html,wt2wt,html2html
14843 !! wikitext
14844 [[File:Foobar.jpg|frameless|2000px]]
14845
14846 [[File:Foobar.svg|frameless|2000px]]
14847 !! html/php
14848 <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>
14849 </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>
14850 </p>
14851 !! html/parsoid
14852 <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>
14853 <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>
14854 !! end
14855
14856 !! test
14857 Image: framed images are always unscaled.
14858 !! options
14859 parsoid=wt2html,wt2wt,html2html
14860 !! wikitext
14861 [[File:Foobar.jpg|frame]]
14862
14863 [[File:Foobar.jpg|frame|50px]]
14864
14865 [[File:Foobar.jpg|frame|50x50px]]
14866
14867 [[File:Foobar.jpg|frame|2000px]]
14868 !! html/php
14869 <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>
14870 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14871 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14872 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
14873
14874 !! html/parsoid
14875 <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>
14876 <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>
14877 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14878 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14879 !! end
14880
14881 ###################
14882
14883 !! test
14884 Link to image page- image page normally doesn't exists, hence edit link
14885 Add test with existing image page
14886 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14887 !! wikitext
14888 [[:Image:test]]
14889 !! html
14890 <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>
14891 </p>
14892 !! end
14893
14894 !! test
14895 T20784 Link to non-existent image page with caption should use caption as link text
14896 !! wikitext
14897 [[:Image:test|caption]]
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)">caption</a>
14900 </p>
14901 !! end
14902
14903 !! test
14904 Frameless image caption with a free URL
14905 !! wikitext
14906 [[File:Foobar.jpg|http://example.com]]
14907 !! html/php
14908 <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>
14909 </p>
14910 !! html/parsoid
14911 <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>
14912 !! end
14913
14914 !! test
14915 Thumbnail image caption with a free URL
14916 !! options
14917 thumbsize=220
14918 !! wikitext
14919 [[File:Foobar.jpg|thumb|http://example.com]]
14920 !! html/php
14921 <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>
14922
14923 !! html/parsoid
14924 <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>
14925 !! end
14926
14927 !! test
14928 Thumbnail image caption with a free URL and explicit alt
14929 !! options
14930 thumbsize=220
14931 parsoid=wt2html,wt2wt,html2html
14932 !! wikitext
14933 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14934 !! html/php
14935 <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>
14936
14937 !! html/parsoid
14938 <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>
14939 !! end
14940
14941 !! test
14942 SVG thumbnails with no language set
14943 !! options
14944 !! wikitext
14945 [[File:Foobar.svg|thumb|caption]]
14946 !! html/php
14947 <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>
14948
14949 !! html/parsoid
14950 <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>
14951 !! end
14952
14953 !! test
14954 SVG thumbnails with language de
14955 !! options
14956 parsoid=wt2html,wt2wt,html2html
14957 !! wikitext
14958 [[File:Foobar.svg|thumb|caption|lang=de]]
14959 !! html/php
14960 <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>
14961
14962 !! html/parsoid
14963 <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>
14964 !! end
14965
14966 !! test
14967 SVG thumbnails with invalid language code
14968 !! options
14969 parsoid=wt2html,wt2wt,html2html
14970 !! wikitext
14971 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
14972 !! html/php
14973 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid:language:code</div></div></div>
14974
14975 !! html/parsoid
14976 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
14977 !! end
14978
14979 !! test
14980 T3887: A ISBN with a thumbnail
14981 !! wikitext
14982 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14983 !! html/php
14984 <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>
14985
14986 !! html/parsoid
14987 <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>
14988 !! end
14989
14990 !! test
14991 T3887: A RFC with a thumbnail
14992 !! wikitext
14993 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14994 !! html/php
14995 <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>
14996
14997 !! html/parsoid
14998 <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>
14999 !! end
15000
15001 !! test
15002 T3887: A mailto link with a thumbnail
15003 !! wikitext
15004 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15005 !! html/php
15006 <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>
15007
15008 !! html/parsoid
15009 <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>
15010 !! end
15011
15012 # Pending resolution to T2368
15013 !! test
15014 T2648: Frameless image caption with a link
15015 !! wikitext
15016 [[File:Foobar.jpg|text with a [[link]] in it]]
15017 !! html/php
15018 <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>
15019 </p>
15020 !! html/parsoid
15021 <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>
15022 !! end
15023
15024 !! test
15025 T2648: Frameless image caption with a link (suffix)
15026 !! wikitext
15027 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15028 !! html/php
15029 <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>
15030 </p>
15031 !! html/parsoid
15032 <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>
15033 !! end
15034
15035 !! test
15036 T2648: Frameless image caption with an interwiki link
15037 !! wikitext
15038 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15039 !! html/php
15040 <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>
15041 </p>
15042 !! html/parsoid
15043 <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>
15044 !! end
15045
15046 !! test
15047 T2648: Frameless image caption with a piped interwiki link
15048 !! wikitext
15049 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15050 !! html/php
15051 <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>
15052 </p>
15053 !! html/parsoid
15054 <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>
15055 !! end
15056
15057 !! test
15058 T107474: Frameless image caption with <nowiki>
15059 !! wikitext
15060 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15061 !! html/parsoid
15062 <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>
15063 !! end
15064
15065 !! test
15066 Escape HTML special chars in image alt text
15067 !! wikitext
15068 [[File:Foobar.jpg|& < > "]]
15069 !! html/php
15070 <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>
15071 </p>
15072 !! html/parsoid
15073 <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>
15074 !! end
15075
15076 !! test
15077 Escape HTML special chars in image alt text with LanguageConverter
15078 !! options
15079 language=zh
15080 !! wikitext
15081 [[File:Foobar.jpg|& < > "]]
15082 !! html/php
15083 <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>
15084 </p>
15085 !! html/parsoid
15086 <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>
15087 !! end
15088
15089 !! test
15090 Entities in file name and attributes
15091 !! wikitext
15092 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15093 !! html/php
15094 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15095 </p>
15096 !! html/parsoid
15097 <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>
15098 !! end
15099
15100 !! test
15101 T2499: Alt text should have &#1234;, not &amp;1234;
15102 !! wikitext
15103 [[File:Foobar.jpg|&#9792;]]
15104 !! html/php
15105 <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>
15106 </p>
15107 !! html/parsoid
15108 <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>
15109 !! end
15110
15111 !! test
15112 Broken image caption with link
15113 !! options
15114 parsoid=wt2html,wt2wt,html2html
15115 !! wikitext
15116 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15117 !! html/php
15118 <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.
15119 </p>
15120 !! html/parsoid
15121 <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>
15122 !! end
15123
15124 !! test
15125 Image caption containing another image
15126 !! wikitext
15127 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15128 !! html/php
15129 <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>
15130
15131 !! html/parsoid
15132 <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>
15133 !! end
15134
15135 !! test
15136 Image: caption containing a newline
15137 !! wikitext
15138 [[File:Foobar.jpg|This
15139 *is some text]]
15140 !! html/php
15141 <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>
15142 </p>
15143 !! html/parsoid
15144 <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>
15145 !!end
15146
15147 !!test
15148 Image: caption containing leading space
15149 (The leading space should not trigger nowiki escaping in wt2wt mode)
15150 !! wikitext
15151 [[File:Foobar.jpg|thumb| bar]]
15152 !! html/php
15153 <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>
15154
15155 !! html/parsoid
15156 <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>
15157 !!end
15158
15159 !! test
15160 Image: caption containing a table
15161 !! options
15162 parsoid=wt2html,wt2wt,html2html
15163 !! wikitext
15164 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15165 {|
15166 ! Foo !! Bar
15167 |-
15168 | Foo1 || Bar1
15169 |}
15170 and some more text.]]
15171 !! html/php
15172 <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>
15173
15174 !! html/parsoid
15175 <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
15176 <table>
15177 <tbody>
15178 <tr><th>Foo </th><th>Bar</th></tr>
15179 <tr>
15180 <td>Foo1 </td>
15181 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15182 !! end
15183
15184 !! test
15185 T5090: External links other than http: in image captions
15186 !! wikitext
15187 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15188 !! html/php
15189 <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>
15190
15191 !! html/parsoid
15192 <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>
15193 !! end
15194
15195 !! test
15196 Custom class
15197 !! options
15198 parsoid=wt2html,wt2wt,html2html
15199 !! wikitext
15200 [[Image:foobar.jpg|a|class=b]]
15201 !! html/php
15202 <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>
15203 </p>
15204 !! html/parsoid
15205 <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>
15206 !! end
15207
15208 !! test
15209 Localized image handling (1).
15210 !! options
15211 parsoid=wt2html,wt2wt,html2html
15212 language=es
15213 !! wikitext
15214 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15215 !! html/php
15216 <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>
15217
15218 !! html/parsoid
15219 <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>
15220 !! end
15221
15222 !! test
15223 Localized image handling (2).
15224 !! options
15225 thumbsize=220
15226 parsoid=wt2html,wt2wt,html2html
15227 language=es
15228 !! wikitext
15229 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15230 !! html/php
15231 <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>
15232
15233 !! html/parsoid
15234 <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>
15235 !! end
15236
15237 !! test
15238 Localized image handling (3).
15239 !! options
15240 language=fa
15241 parsoid=html2wt
15242 !! html/parsoid
15243 <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>
15244 !! wikitext
15245 [[File:Foobar.jpg|بندانگشتی]]
15246 !! end
15247
15248 !! test
15249 "border", "frameless" and "class" attributes on an image.
15250 !! options
15251 thumbsize=220
15252 parsoid=wt2html,wt2wt,html2html
15253 !! wikitext
15254 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15255 !! html/php
15256 <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>
15257 </p>
15258 !! html/parsoid
15259 <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>
15260 !! end
15261
15262 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15263 !! test
15264 Invalid image attributes (T64500)
15265 !! options
15266 thumbsize=220
15267 parsoid=wt2html,wt2wt,html2html
15268 !! wikitext
15269 [[File:Foobar.jpg|thumb|float|left|caption]]
15270
15271 [[File:Foobar.jpg|thumb|righ|caption]]
15272
15273 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15274 !! html/php
15275 <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>
15276 <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>
15277 <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>
15278
15279 !! html/parsoid
15280 <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>
15281 <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>
15282 <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>
15283 !! end
15284
15285 !! article
15286 File:Barfoo.jpg
15287 !! text
15288 #REDIRECT [[File:Barfoo.jpg]]
15289 !! endarticle
15290
15291 # FIXME: Parsoid should run this test -- but we'd need to teach the
15292 # mockAPI about the redirected Barfoo.jpg image.
15293 !! test
15294 Redirected image
15295 !! wikitext
15296 [[Image:Barfoo.jpg]]
15297 !! html/php
15298 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15299 </p>
15300 !! end
15301
15302 !! test
15303 Missing image with uploads disabled
15304 !! options
15305 wgEnableUploads=0
15306 !! wikitext
15307 [[File:Foobaz.jpg]]
15308 !! html/php
15309 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15310 </p>
15311 !! html/parsoid
15312 <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>
15313 !! end
15314
15315 # Parsoid-specific testing for images
15316 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15317 # Currently imperfect due to a flaw in the Parsoid testrunner
15318 # Work in progress
15319 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15320 # image tests.
15321
15322 !! test
15323 Parsoid-specific image handling - simple image with size and middle alignment
15324 !! wikitext
15325 [[File:Foobar.jpg|middle|50px]]
15326 !! html/parsoid
15327 <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>
15328 !! end
15329
15330 !! test
15331 Parsoid-specific image handling - simple image with size, middle alignment,
15332 non-standard namespace alias
15333 !! options
15334 parsoid=wt2wt,wt2html,html2html
15335 !! wikitext
15336 [[Image:Foobar.jpg|middle|50px]]
15337 !! html/parsoid
15338 <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>
15339 !! end
15340
15341 !! test
15342 Parsoid-specific image handling - simple image with size and middle alignment
15343 (existing content)
15344 !! wikitext
15345 [[File:Foobar.jpg|50px|middle]]
15346 !! html/parsoid
15347 <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>
15348 !! end
15349
15350 !! test
15351 Parsoid-specific image handling - simple image with size and middle alignment
15352 and non-standard namespace name
15353 !! options
15354 parsoid=wt2html,wt2wt,html2html
15355 !! wikitext
15356 [[Image:Foobar.jpg|50px|middle]]
15357 !! html/parsoid
15358 <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>
15359 !! end
15360
15361 !! test
15362 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15363 !! wikitext
15364 [[File:Foobar.jpg|500x10px|baseline|caption]]
15365 !! html/parsoid
15366 <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>
15367 !! end
15368
15369 !! test
15370 Parsoid-specific image handling - simple image with border and size spec
15371 !! wikitext
15372 [[File:Foobar.jpg|50px|border|caption]]
15373 !! html/parsoid
15374 <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>
15375 !! end
15376
15377 !! test
15378 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15379 !! wikitext
15380 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15381 !! html/parsoid
15382 <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>
15383 !! end
15384
15385 !! test
15386 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15387 (existing content)
15388 !! wikitext
15389 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15390 !! html/parsoid
15391 <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>
15392 !! end
15393
15394 !! test
15395 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15396 !! wikitext
15397 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15398 !! html/parsoid
15399 <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>
15400 !! end
15401
15402 !! test
15403 Parsoid-specific image handling - thumbnail with specific size, halign,
15404 valign, and caption (existing content)
15405 !! wikitext
15406 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15407 !! html/parsoid
15408 <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>
15409 !! end
15410
15411 !! test
15412 Parsoid-specific image handling - framed image with specific size and caption
15413 (size is ignored)
15414 !! options
15415 parsoid=wt2html,wt2wt,html2html
15416 !! wikitext
15417 [[File:Foobar.jpg|frame|500x50px|caption]]
15418 !! html/parsoid
15419 <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>
15420 !! end
15421
15422 !! test
15423 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15424 (size is ignored)
15425 !! options
15426 parsoid=wt2html,wt2wt,html2html
15427 !! wikitext
15428 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15429 !! html/parsoid
15430 <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>
15431 !! end
15432
15433 !! test
15434 Parsoid-specific image handling - frameless image with specific size, border, and caption
15435 !! wikitext
15436 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15437 !! html/parsoid
15438 <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>
15439 !! end
15440
15441 !! test
15442 Parsoid-specific image handling - simple image with a formatted caption
15443 !! wikitext
15444 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15445 !! html/parsoid
15446 <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>
15447 !! end
15448
15449 !! test
15450 Parsoid-specific image handling - caption with a template in it
15451 !! wikitext
15452 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15453 !! html/parsoid
15454 <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>
15455 !! end
15456
15457 !! test
15458 Parsoid-specific image handling - caption with unbalanced tags in it
15459 !! options
15460 parsoid=wt2html,wt2wt,html2html
15461 !! wikitext
15462 foo
15463 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15464 bar
15465 !! html/parsoid
15466 <p>foo</p>
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 <center>unbalanced tag in it.</center></figcaption></figure>
15468 <p>bar</p>
15469 !! end
15470
15471 !! test
15472 Parsoid-specific image handling - empty caption (1)
15473 !! options
15474 parsoid=wt2html,wt2wt
15475 !! wikitext
15476 [[File:Foobar.jpg|thumb|]]
15477 !! html/parsoid
15478 <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>
15479 !! end
15480
15481 # empty captions don't get serialized unless we're in the "round trip" case
15482 !! test
15483 Parsoid-specific image handling - empty caption (2)
15484 !! options
15485 parsoid=html2wt
15486 !! html/parsoid
15487 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15488 <a href="./File:Foobar.jpg">
15489 <img resource="./File:Foobar.jpg"
15490 src="//example.com/images/3/3a/Foobar.jpg"
15491 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15492 height="25" width="220"/>
15493 </a>
15494 <figcaption></figcaption>
15495 </figure>
15496 !! wikitext
15497 [[File:Foobar.jpg|thumb]]
15498 !! end
15499
15500 !! test
15501 Parsoid-specific image handling - whitespace caption
15502 !! wikitext
15503 [[File:Foobar.jpg|thumb| ]]
15504 !! html/parsoid
15505 <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>
15506 !! end
15507
15508 !! test
15509 Parsoid-specific image handling - lang option
15510 !! wikitext
15511 foo
15512 [[File:Foobar.svg|lang=de|caption]]
15513 bar
15514 !! html/parsoid
15515 <p>foo
15516 <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>
15517 bar</p>
15518 !! end
15519
15520 ## Edge case bugs in Parsoid from T93580
15521 !! test
15522 T93580: 1. Templated <ref> inside block images
15523 !! wikitext
15524 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15525
15526 <references />
15527 !! html/parsoid
15528 <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>
15529
15530 <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>
15531 !! end
15532
15533 !! test
15534 T93580: 2. <ref> inside inline images
15535 !! wikitext
15536 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15537
15538 <references />
15539 !! html/parsoid
15540 <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>
15541
15542 <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>
15543 !! end
15544
15545 !! test
15546 T93580: 3. Templated <ref> inside inline images
15547 !! wikitext
15548 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15549
15550 <references />
15551 !! html/parsoid
15552 <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>
15553
15554 <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>
15555 !! end
15556
15557 ###
15558 ### Subpages
15559 ###
15560 !! article
15561 Subpage test/subpage
15562 !! text
15563 foo
15564 !! endarticle
15565
15566 !! test
15567 Subpage link
15568 !! options
15569 subpage title=[[Subpage test]]
15570 !! wikitext
15571 [[/subpage]]
15572 !! html
15573 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15574 </p>
15575 !! end
15576
15577 !! test
15578 Subpage noslash link
15579 !! options
15580 subpage title=[[Subpage test]]
15581 !! wikitext
15582 [[/subpage/]]
15583 !! html
15584 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15585 </p>
15586 !! end
15587
15588 !! article
15589 Subpage test/1/2/subpage
15590 !! text
15591 blah
15592 !! endarticle
15593
15594 !! test
15595 Relative subpage noslash link
15596 !! options
15597 parsoid=wt2wt,wt2html,html2html
15598 subpage title=[[Subpage test/1/2/3/4]]
15599 !! wikitext
15600 [[../../subpage/]]
15601
15602 [[../../subpage]]
15603 !! html/php
15604 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15605 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15606 </p>
15607 !! html/parsoid
15608 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15609 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15610 !! end
15611
15612 !! test
15613 Parsoid: dot-slash prefixed wikilinks
15614 !! wikitext
15615 [[./foo]]
15616
15617 [[././bar]]
15618
15619 [[././baz/]]
15620 !! html/php
15621 <p>[[./foo]]
15622 </p><p>[[././bar]]
15623 </p><p>[[././baz/]]
15624 </p>
15625 !! html/parsoid
15626 <p>[[./foo]]
15627 </p><p>[[././bar]]
15628 </p><p>[[././baz/]]
15629 </p>
15630 !! end
15631
15632 !! test
15633 Render invalid page names as plain text (T53090)
15634 !! wikitext
15635 [[./../foo|bar]]
15636 [[foo�|bar]]
15637 [[foo/.|bar]]
15638 [[foo/..|bar]]
15639 [[foo~~~bar]]
15640 [[foo>bar]]
15641 [[foo[bar]]
15642 [[.]]
15643 [[..]]
15644 [[foo././bar]]
15645 [[foo[http://example.com]xyz]]
15646
15647 [[{{echo|./../foo}}|bar]]
15648 [[{{echo|foo/.}}|bar]]
15649 [[{{echo|foo/..}}|bar]]
15650 [[{{echo|foo~~~~bar}}]]
15651 [[{{echo|foo>bar}}]]
15652 [[{{echo|foo././bar}}]]
15653 [[{{echo|foo{bar}}]]
15654 [[{{echo|foo}bar}}]]
15655 [[{{echo|foo[bar}}]]
15656 [[{{echo|foo]bar}}]]
15657 [[{{echo|foo<bar}}]]
15658 !!html/php
15659 <p>[[./../foo|bar]]
15660 [[foo�|bar]]
15661 [[foo/.|bar]]
15662 [[foo/..|bar]]
15663 [[foo~~~bar]]
15664 [[foo&gt;bar]]
15665 [[foo[bar]]
15666 [[.]]
15667 [[..]]
15668 [[foo././bar]]
15669 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15670 </p><p>[[./../foo|bar]]
15671 [[foo/.|bar]]
15672 [[foo/..|bar]]
15673 [[foo~~~~bar]]
15674 [[foo&gt;bar]]
15675 [[foo././bar]]
15676 [[foo{bar]]
15677 [[foo}bar]]
15678 [[foo[bar]]
15679 [[foo]bar]]
15680 [[foo&lt;bar]]
15681 </p>
15682 !!html/parsoid
15683 <p>[[./../foo|bar]]
15684 [[foo�|bar]]
15685 [[foo/.|bar]]
15686 [[foo/..|bar]]
15687 [[foo~~~bar]]
15688 [[foo>bar]]
15689 [[foo[bar]]
15690 [[.]]
15691 [[..]]
15692 [[foo././bar]]
15693 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15694
15695 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15696 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15697 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15698 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15699 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15700 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15701 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15702 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15703 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15704 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15705 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
15706 !!end
15707
15708 !! test
15709 Disabled subpages
15710 !! wikitext
15711 [[/subpage]]
15712 !! html
15713 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15714 </p>
15715 !! end
15716
15717 !! test
15718 T2561: {{/Subpage}}
15719 !! options
15720 subpage title=[[Page]]
15721 !! wikitext
15722 {{/Subpage}}
15723 !! html
15724 <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>
15725 </p>
15726 !! end
15727
15728 ###
15729 ### Categories
15730 ###
15731 !! article
15732 Category:MediaWiki User's Guide
15733 !! text
15734 blah
15735 !! endarticle
15736
15737 !! test
15738 Link to category
15739 !! wikitext
15740 [[:Category:MediaWiki User's Guide]]
15741 !! html
15742 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15743 </p>
15744 !! end
15745
15746 !! test
15747 Simple category
15748 !! options
15749 cat
15750 !! wikitext
15751 [[Category:MediaWiki User's Guide]]
15752 !! html/php
15753 cat=MediaWiki_User's_Guide sort=
15754 !! html/parsoid
15755 <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"}}'/>
15756 !! end
15757
15758 !! test
15759 PAGESINCATEGORY invalid title fatal (r33546 fix)
15760 !! wikitext
15761 {{PAGESINCATEGORY:<bogus>}}
15762 !! html
15763 <p>0
15764 </p>
15765 !! end
15766
15767 !! test
15768 Category with different sort key
15769 !! options
15770 cat
15771 !! wikitext
15772 [[Category:MediaWiki User's Guide|Foo]]
15773 !! html/php
15774 cat=MediaWiki_User's_Guide sort=Foo
15775 !! html/parsoid
15776 <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"}}'/>
15777 !! end
15778
15779 !! test
15780 Category with identical sort key
15781 !! options
15782 cat
15783 !! wikitext
15784 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15785 !! html/php
15786 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15787 !! html/parsoid
15788 <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"}}'/>
15789 !! end
15790
15791 !! test
15792 Category with empty sort key
15793 !! options
15794 cat
15795 pst
15796 !! wikitext
15797 [[Category:MediaWiki User's Guide|]]
15798 !! html/php
15799 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15800 !! end
15801
15802 !! test
15803 Category with empty sort key and parentheses
15804 !! options
15805 cat
15806 pst
15807 !! wikitext
15808 [[Category:Foo (bar)|]]
15809 !! html/php
15810 [[Category:Foo (bar)|Foo]]
15811 !! end
15812
15813 !! test
15814 Category with link tail
15815 !! options
15816 cat
15817 pst
15818 !! wikitext
15819 123[[Category:Foo]]456
15820 !! html/php
15821 123[[Category:Foo]]456
15822 !! end
15823
15824 !! test
15825 Category with template
15826 !! options
15827 cat
15828 pst
15829 !! wikitext
15830 [[Category:{{echo|Foo}}]]
15831 !! html/php
15832 [[Category:{{echo|Foo}}]]
15833 !! end
15834
15835 !! test
15836 Category with template in sort key
15837 !! options
15838 cat
15839 pst
15840 !! wikitext
15841 [[Category:Foo|{{echo|Bar}}]]
15842 !! html/php
15843 [[Category:Foo|{{echo|Bar}}]]
15844 !! end
15845
15846 !! test
15847 Category with template in sort key and title
15848 !! options
15849 cat
15850 pst
15851 !! wikitext
15852 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15853 !! html/php
15854 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15855 !! end
15856
15857 ## We used to, but no longer wt2wt this test since the default serializer
15858 ## will normalize all categories to serialize on their own line.
15859 ## This wikitext usage is going to be fairly uncommon in production and
15860 ## selser will take care of preserving formatting in those scenarios.
15861 !! test
15862 Category / paragraph interactions
15863 !! options
15864 parsoid=wt2html
15865 !! wikitext
15866 Foo [[Category:Baz]] Bar
15867
15868 Foo [[Category:Baz]]
15869 Bar
15870
15871 Foo
15872 [[Category:Baz]]
15873 Bar
15874
15875 Foo
15876 [[Category:Baz]] Bar
15877
15878 Foo
15879 [[Category:Baz]]
15880 [[Category:Baz]]
15881 [[Category:Baz]]
15882 Bar
15883
15884 [[Category:Baz]]
15885 [[Category:Baz]]
15886 [[Category:Baz]]
15887
15888 [[Category:Baz]]
15889 {{echo|[[Category:Baz]]}}
15890 [[Category:Baz]]
15891 !! html/php
15892 <p>Foo Bar
15893 </p><p>Foo
15894 Bar
15895 </p><p>Foo
15896 Bar
15897 </p><p>Foo Bar
15898 </p><p>Foo
15899 Bar
15900 </p>
15901 !! html/parsoid
15902 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15903 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15904 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15905 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15906 <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>
15907 <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}}]}'/>
15908 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15909 !! end
15910
15911 ## We used to, but no longer wt2wt this test since the default serializer
15912 ## will normalize all categories to serialize on their own line.
15913 ## This wikitext usage is going to be fairly uncommon in production and
15914 ## selser will take care of preserving formatting in those scenarios.
15915 ##
15916 ## The whitespace on the empty line is part of the test. Please do not delete
15917 !! test
15918 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15919 !! options
15920 parsoid=wt2html
15921 !! wikitext
15922 This
15923
15924 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15925
15926 {{echo|[[Category:Foo]] and so should this!}}
15927 !! html/php
15928 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15929 </p>
15930 !! html/parsoid
15931 <p>This
15932
15933 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15934
15935 <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>
15936 !! end
15937
15938 ## Parsoid will not try to wt2wt this while preserving newlines because
15939 ## it suppresses excess newlines within list items -- and we don't want to
15940 ## introduce a special case just for categories, which is, in reality somewhat
15941 ## odd behavior -- categories are unlikely to be used in list items like this
15942 ## in top-level pages and are only likely to show up in template-generated
15943 ## list items where this RT-ing is a non-issue.
15944 ##
15945 ## The whitespace on the empty line is part of the test. Please do not delete
15946 !! test
15947 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15948 !! options
15949 parsoid=wt2html
15950 !! wikitext
15951 * This
15952
15953 [[Category:Foo]] and this should be part of the same list item
15954 * So should this
15955
15956 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15957 !! html
15958 <ul><li>This and this should be part of the same list item</li>
15959 <li>So should this and this should be part of the same list item</li></ul>
15960 !! html/parsoid
15961 <ul>
15962 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15963 <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>
15964 </ul>
15965 !! end
15966
15967 ## Newlines and categories that follow the last item of a list
15968 ## are treated differently because this (list followed by categories)
15969 ## is an extremely common pattern on wikis.
15970 !! test
15971 3. Categories and newlines: newline suppression for last list item should RT properly
15972 !! wikitext
15973 * a
15974 * b
15975
15976 [[Category:Foo]]
15977
15978 [[Category:Bar]]
15979 [[Category:Baz]]
15980 !! html/parsoid
15981 <ul><li> a</li>
15982 <li> b</li></ul>
15983
15984 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15985
15986 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15987 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15988 !! end
15989
15990 !! test
15991 4. Categories and newlines: newline suppression for last list item should RT properly
15992 !! wikitext
15993 * a
15994 **** b
15995
15996 [[Category:Foo]]
15997 !! html/parsoid
15998 <ul><li> a
15999 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16000
16001 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16002 !! end
16003
16004 ## only wt2html for this to make sure the algo only applies to the rightmost path
16005 !! test
16006 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16007 !! options
16008 parsoid=wt2html
16009 !! wikitext
16010 * a
16011 ** b
16012 [[Category:Foo]]
16013 * c
16014 ** d
16015 [[Category:Foo]]
16016 !! html/parsoid
16017 <ul><li> a
16018 <ul><li> b
16019 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16020 <li> c
16021 <ul><li> d</li></ul></li></ul>
16022 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16023 !! end
16024
16025 ## We used to, but no longer wt2wt this test since the default serializer
16026 ## will normalize all categories to serialize on their own line.
16027 ## This wikitext usage is going to be fairly uncommon in production and
16028 ## selser will take care of preserving formatting in those scenarios.
16029 !! test
16030 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16031 !! options
16032 parsoid=wt2html
16033 !! wikitext
16034 * a [[Category:Foo]]
16035 !! html/parsoid
16036 <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>
16037 !! end
16038
16039 # This test also demonstrates because of newline+category tunneling
16040 # through the list hander, template wrapping doesn't expand to the
16041 # containing list when the list item swallows the category.
16042 !! test
16043 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16044 !! wikitext
16045 * {{echo|a
16046 [[Category:Foo]]}}
16047 !! html/parsoid
16048 <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
16049 </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>
16050 !! end
16051
16052 !! test
16053 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16054 !! wikitext
16055 * a
16056
16057 {{echo|[[Category:Foo]]
16058 [[Category:Bar]]}}
16059 [[Category:Baz]]
16060 !! html/parsoid
16061 <ul><li> a</li></ul>
16062
16063 <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">
16064 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16065 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16066 !! end
16067
16068 !! test
16069 9. Categories and newlines: should behave properly with linkprefix (T87753)
16070 !! options
16071 language=ar
16072 !! wikitext
16073 foo bar
16074 foo bar
16075 [[تصنيف:Foo]]
16076 [[تصنيف:Bar]]
16077 !! html/php
16078 <p>foo bar
16079 foo bar
16080 </p>
16081 !! html/parsoid
16082 <p>foo bar
16083 foo bar</p>
16084 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16085 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16086 !! end
16087
16088 !! test
16089 10. No regressions on internal links following category (T174639)
16090 !! options
16091 parsoid=wt2html,html2html
16092 !! wikitext
16093 [[Category:Foo]]<div>a
16094
16095 [[Foo]]</div>
16096 !! html/php
16097 <div>a
16098 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16099
16100 !! html/parsoid
16101 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16102
16103 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16104 !! end
16105
16106 # Note that Parsoid differs slightly from PHP due to T175421
16107 !! test
16108 11. Special case where only newlines separate links (T175416)
16109 !! options
16110 parsoid=wt2html,html2html
16111 !! wikitext
16112 [[Category:Foo]]
16113
16114 [[Foo]][[es:Alimento]]
16115
16116 [[Foo]]
16117 !! html/php
16118 <p><br />
16119 <a href="/wiki/Foo" title="Foo">Foo</a>
16120 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16121 </p>
16122 !! html/parsoid
16123 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16124
16125 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16126
16127 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16128 !! end
16129
16130 !! test
16131 Category links with multiple namespaces
16132 !! wikitext
16133 [[Category:Project:Foo]]
16134 !! html/parsoid
16135 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16136 !! end
16137
16138 !! test
16139 Parsoid: Serialize link to category page with colon escape
16140 !! options
16141 parsoid
16142 !! wikitext
16143
16144 [[:Category:Foo]]
16145 [[:Category:Foo|Bar]]
16146 !! html
16147 <p>
16148 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16149 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16150 </p>
16151 !! end
16152
16153 # We used to, but no longer wt2wt this test since the default serializer
16154 # will normalize all categories to serialize on their own line.
16155 # This wikitext usage is going to be fairly uncommon in production and
16156 # selser will take care of preventing whitespace insertion if this
16157 # occurs in an article.
16158 #
16159 # html2html disabled for the same reason (whitespace insertion between
16160 # x and y).
16161 #
16162 # html2wt disabled because it localizes the "Category" namespace.
16163 !! test
16164 Link prefix/suffixes aren't applied to category links
16165 !! options
16166 parsoid=wt2html
16167 language=is
16168 !! wikitext
16169 x[[Category:Foo]]y
16170 !! html/php
16171 <p>xy
16172 </p>
16173 !! html/parsoid
16174 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16175 !! end
16176
16177 !! test
16178 Link prefix/suffixes aren't applied to language links
16179 !! options
16180 parsoid=wt2html
16181 language=is
16182 !! wikitext
16183 x[[es:Foo]]y
16184 !! html/php
16185 <p>xy
16186 </p>
16187 !! html/parsoid
16188 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16189 !! end
16190
16191 !! test
16192 Parsoid: Serialize link to file page with colon escape
16193 !! options
16194 parsoid
16195 !! wikitext
16196
16197 [[:File:Foo.png]]
16198 [[:File:Foo.png|Bar]]
16199 !! html
16200 <p>
16201 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16202 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16203 </p>
16204 !! end
16205
16206 !! test
16207 Parsoid: Serialize a genuine category link without colon escape
16208 !! options
16209 parsoid
16210 !! wikitext
16211 [[Category:Foo]]
16212 [[Category:Foo|Bar]]
16213 !! html
16214 <link rel="mw:PageProp/Category" href="./Category:Foo">
16215 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16216 !! end
16217
16218 !! test
16219 Normalize hrefs properly before testing for invalid link targets (T72894)
16220 !! options
16221 parsoid=html2wt
16222 !! html/parsoid
16223 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16224 !! wikitext
16225 [[Category:Toxine bactérienne]]
16226 !! end
16227
16228 !! test
16229 Parsoid: Defaultsort
16230 !! wikitext
16231 {{DEFAULTSORT:Foo}}
16232 !! html/parsoid
16233 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16234 !! end
16235
16236 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16237 # But, this is a limitation of our representation and is documented in
16238 # TemplateHandler.js in processSpecialMagicWord
16239 !! test
16240 Parsoid: Defaultsort (template-generated)
16241 !! wikitext
16242 {{{{echo|DEFAULTSORT}}:Foo}}
16243 !! html/parsoid
16244 <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"}]]}'/>
16245 !! end
16246
16247 ###
16248 ### Inter-language links
16249 ###
16250 !! test
16251 Interlanguage links
16252 !! options
16253 ill
16254 !! wikitext
16255 [[es:Alimento]]
16256 [[fr:Nourriture]]
16257 [[zh:食品]]
16258 !! html/php
16259 es:Alimento fr:Nourriture zh:食品
16260 !! html/parsoid
16261 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16262 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16263 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16264 !! end
16265
16266 !! test
16267 Duplicate interlanguage links (T26502)
16268 !! options
16269 ill
16270 !! wikitext
16271 [[es:1]]
16272 [[es:2]]
16273 [[fr:1]]
16274 [[fr:2]]
16275 !! html/php
16276 es:1 fr:1
16277 !! html/parsoid
16278 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16279 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16280 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16281 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16282 !! end
16283
16284 ###
16285 ### Sections
16286 ###
16287 !! test
16288 Basic section headings
16289 !! wikitext
16290 == Headline 1 ==
16291 Some text
16292
16293 ==Headline 2==
16294 More
16295 ===Smaller headline===
16296 Blah blah
16297 !! html
16298 <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>
16299 <p>Some text
16300 </p>
16301 <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>
16302 <p>More
16303 </p>
16304 <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>
16305 <p>Blah blah
16306 </p>
16307 !! end
16308
16309 !! test
16310 Section headings with TOC
16311 !! wikitext
16312 == Headline 1 ==
16313 === Subheadline 1 ===
16314 ===== Skipping a level =====
16315 ====== Skipping a level ======
16316
16317 == Headline 2 ==
16318 Some text
16319 ===Another headline===
16320 !! html
16321 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16322 <ul>
16323 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16324 <ul>
16325 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16326 <ul>
16327 <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>
16328 <ul>
16329 <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>
16330 </ul>
16331 </li>
16332 </ul>
16333 </li>
16334 </ul>
16335 </li>
16336 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16337 <ul>
16338 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16339 </ul>
16340 </li>
16341 </ul>
16342 </div>
16343
16344 <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>
16345 <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>
16346 <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>
16347 <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>
16348 <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>
16349 <p>Some text
16350 </p>
16351 <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>
16352
16353 !! end
16354
16355 !! test
16356 TOC anchors don't collide
16357 !! wikitext
16358 __FORCETOC__
16359 == Headline 2 ==
16360 == Headline ==
16361 == Headline 2 ==
16362 == Headline ==
16363 !! html/php
16364 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16365 <ul>
16366 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16367 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16368 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16369 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16370 </ul>
16371 </div>
16372
16373 <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>
16374 <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>
16375 <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>
16376 <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>
16377
16378 !! end
16379
16380 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16381 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16382 !! test
16383 Handling of sections up to level 6 and beyond
16384 !! options
16385 parsoid=wt2html
16386 !! wikitext
16387 = Level 1 Heading=
16388 == Level 2 Heading==
16389 === Level 3 Heading===
16390 ==== Level 4 Heading====
16391 ===== Level 5 Heading=====
16392 ====== Level 6 Heading======
16393 ======= Level 7 Heading=======
16394 ======== Level 8 Heading========
16395 ========= Level 9 Heading=========
16396 ========== Level 10 Heading==========
16397 !! html/php
16398 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16399 <ul>
16400 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16401 <ul>
16402 <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>
16403 <ul>
16404 <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>
16405 <ul>
16406 <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>
16407 <ul>
16408 <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>
16409 <ul>
16410 <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>
16411 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
16412 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
16413 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
16414 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
16415 </ul>
16416 </li>
16417 </ul>
16418 </li>
16419 </ul>
16420 </li>
16421 </ul>
16422 </li>
16423 </ul>
16424 </li>
16425 </ul>
16426 </div>
16427
16428 <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>
16429 <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>
16430 <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>
16431 <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>
16432 <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>
16433 <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>
16434 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16435 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16436 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16437 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16438
16439 !! html/parsoid
16440 <h1 id="Level_1_Heading" data-parsoid='{}'> Level 1 Heading</h1>
16441 <h2 id="Level_2_Heading" data-parsoid='{}'> Level 2 Heading</h2>
16442 <h3 id="Level_3_Heading" data-parsoid='{}'> Level 3 Heading</h3>
16443 <h4 id="Level_4_Heading" data-parsoid='{}'> Level 4 Heading</h4>
16444 <h5 id="Level_5_Heading" data-parsoid='{}'> Level 5 Heading</h5>
16445 <h6 id="Level_6_Heading" data-parsoid='{}'> Level 6 Heading</h6>
16446 <h6 id="=_Level_7_Heading=" data-parsoid='{}'><span id=".3D_Level_7_Heading.3D" typeof="mw:FallbackId"></span>= Level 7 Heading=</h6>
16447 <h6 id="==_Level_8_Heading==" data-parsoid='{}'><span id=".3D.3D_Level_8_Heading.3D.3D" typeof="mw:FallbackId"></span>== Level 8 Heading==</h6>
16448 <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>
16449 <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>
16450 !! end
16451
16452 !! test
16453 TOC regression (T11764)
16454 !! wikitext
16455 == title 1 ==
16456 === title 1.1 ===
16457 ==== title 1.1.1 ====
16458 === title 1.2 ===
16459 == title 2 ==
16460 === title 2.1 ===
16461 !! html
16462 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16463 <ul>
16464 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16465 <ul>
16466 <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>
16467 <ul>
16468 <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>
16469 </ul>
16470 </li>
16471 <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>
16472 </ul>
16473 </li>
16474 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16475 <ul>
16476 <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>
16477 </ul>
16478 </li>
16479 </ul>
16480 </div>
16481
16482 <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>
16483 <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>
16484 <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>
16485 <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>
16486 <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>
16487 <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>
16488
16489 !! end
16490
16491 !! test
16492 TOC for heading containing <span id="..."></span> (T96153)
16493 !! wikitext
16494 __FORCETOC__
16495 ==<span id="old-anchor"></span>New title==
16496 !! html/php
16497 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16498 <ul>
16499 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16500 </ul>
16501 </div>
16502
16503 <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>
16504
16505 !! end
16506
16507 !! test
16508 TOC with wgMaxTocLevel=3 (T8204)
16509 !! options
16510 wgMaxTocLevel=3
16511 !! wikitext
16512 == title 1 ==
16513 === title 1.1 ===
16514 ==== title 1.1.1 ====
16515 === title 1.2 ===
16516 == title 2 ==
16517 === title 2.1 ===
16518 !! html
16519 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16520 <ul>
16521 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16522 <ul>
16523 <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>
16524 <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>
16525 </ul>
16526 </li>
16527 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16528 <ul>
16529 <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>
16530 </ul>
16531 </li>
16532 </ul>
16533 </div>
16534
16535 <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>
16536 <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>
16537 <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>
16538 <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>
16539 <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>
16540 <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>
16541
16542 !! end
16543
16544 !! test
16545 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16546 !! options
16547 wgMaxTocLevel=3
16548 !! wikitext
16549 ==Section 1==
16550 ===Section 1.1===
16551 ====Section 1.1.1====
16552 ====Section 1.1.1.1====
16553 ==Section 2==
16554 !! html
16555 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16556 <ul>
16557 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16558 <ul>
16559 <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>
16560 </ul>
16561 </li>
16562 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16563 </ul>
16564 </div>
16565
16566 <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>
16567 <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>
16568 <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>
16569 <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>
16570 <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>
16571
16572 !! end
16573
16574
16575 !! test
16576 Resolving duplicate section names
16577 !! wikitext
16578 == Foo bar ==
16579 == Foo bar ==
16580 !! html
16581 <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>
16582 <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>
16583
16584 !! end
16585
16586 !! test
16587 Resolving duplicate section names with differing case (T12721)
16588 !! wikitext
16589 == Foo bar ==
16590 == Foo Bar ==
16591 !! html
16592 <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>
16593 <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>
16594
16595 !! end
16596
16597 !! article
16598 Template:sections
16599 !! text
16600 ===Section 1===
16601 ==Section 2==
16602 !! endarticle
16603
16604 !! test
16605 Template with sections, __NOTOC__
16606 !! wikitext
16607 __NOTOC__
16608 ==Section 0==
16609 {{sections}}
16610 ==Section 4==
16611 !! html
16612 <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>
16613 <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>
16614 <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>
16615 <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>
16616
16617 !! end
16618
16619 !! test
16620 __NOEDITSECTION__ keyword
16621 !! wikitext
16622 __NOEDITSECTION__
16623 ==Section 1==
16624 ==Section 2==
16625 !! html
16626 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16627 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16628
16629 !! end
16630
16631 !! test
16632 Link inside a section heading
16633 !! wikitext
16634 ==Section with a [[Main Page|link]] in it==
16635 !! html
16636 <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>
16637
16638 !! end
16639
16640 !! test
16641 TOC regression (T14077)
16642 !! wikitext
16643 __TOC__
16644 == title 1 ==
16645 === title 1.1 ===
16646 == title 2 ==
16647 !! html
16648 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16649 <ul>
16650 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16651 <ul>
16652 <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>
16653 </ul>
16654 </li>
16655 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16656 </ul>
16657 </div>
16658
16659 <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>
16660 <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>
16661 <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>
16662
16663 !! end
16664
16665 !! test
16666 T3219 URL next to image (good)
16667 !! wikitext
16668 http://example.com [[File:Foobar.jpg]]
16669 !! html/php
16670 <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>
16671 </p>
16672 !! html/parsoid
16673 <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>
16674 !!end
16675
16676 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16677 !! test
16678 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16679 !! options
16680 parsoid=wt2html,html2html
16681 !! wikitext
16682 ===
16683 The line above must have a trailing space!
16684 === <!--
16685 --> <!-- -->
16686 But just in case it doesn't...
16687 !! html/php
16688 <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>
16689 <p>The line above must have a trailing space!
16690 </p>
16691 <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>
16692 <p>But just in case it doesn't...
16693 </p>
16694 !! html/parsoid
16695 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16696 <p>The line above must have a trailing space!</p>
16697 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16698 --> <!-- -->
16699 <p>But just in case it doesn't...</p>
16700 !! end
16701
16702 !! test
16703 Header with special characters (T27462)
16704 !! wikitext
16705 The tooltips shall not show entities to the user (ie. be double escaped)
16706
16707 == text > text ==
16708 section 1
16709
16710 == text < text ==
16711 section 2
16712
16713 == text & text ==
16714 section 3
16715
16716 == text ' text ==
16717 section 4
16718
16719 == text " text ==
16720 section 5
16721 !! html/php
16722 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16723 </p>
16724 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16725 <ul>
16726 <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>
16727 <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>
16728 <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>
16729 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16730 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16731 </ul>
16732 </div>
16733
16734 <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>
16735 <p>section 1
16736 </p>
16737 <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>
16738 <p>section 2
16739 </p>
16740 <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>
16741 <p>section 3
16742 </p>
16743 <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>
16744 <p>section 4
16745 </p>
16746 <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>
16747 <p>section 5
16748 </p>
16749 !! html/parsoid
16750 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16751
16752 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span> text > text </h2>
16753 <p>section 1</p>
16754
16755 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span> text &lt; text </h2>
16756 <p>section 2</p>
16757
16758 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span> text &amp; text </h2>
16759 <p>section 3</p>
16760
16761 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span> text ' text </h2>
16762 <p>section 4</p>
16763
16764 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span> text " text </h2>
16765 <p>section 5</p>
16766 !! end
16767
16768 !! test
16769 Header with space, plus and underscore as entity
16770 !! wikitext
16771 Id should not contain + for spaces
16772
16773 == Space between Text ==
16774 section 1
16775
16776 == Space-Entity&#32;between&#32;Text ==
16777 section 2
16778
16779 == Plus+between+Text ==
16780 section 3
16781
16782 == Plus-Entity&#43;between&#43;Text ==
16783 section 4
16784
16785 == Underscore_between_Text ==
16786 section 5
16787
16788 == Underscore-Entity&#95;between&#95;Text ==
16789 section 6
16790
16791 [[#Space between Text]]
16792 [[#Space-Entity&#32;between&#32;Text]]
16793 [[#Plus+between+Text]]
16794 [[#Plus-Entity&#43;between&#43;Text]]
16795 [[#Underscore_between_Text]]
16796 [[#Underscore-Entity&#95;between&#95;Text]]
16797 !! html/php
16798 <p>Id should not contain + for spaces
16799 </p>
16800 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16801 <ul>
16802 <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>
16803 <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>
16804 <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>
16805 <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>
16806 <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>
16807 <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>
16808 </ul>
16809 </div>
16810
16811 <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>
16812 <p>section 1
16813 </p>
16814 <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>
16815 <p>section 2
16816 </p>
16817 <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>
16818 <p>section 3
16819 </p>
16820 <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>
16821 <p>section 4
16822 </p>
16823 <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>
16824 <p>section 5
16825 </p>
16826 <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>
16827 <p>section 6
16828 </p><p><a href="#Space_between_Text">#Space between Text</a>
16829 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16830 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16831 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16832 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16833 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16834 </p>
16835 !! html/parsoid
16836 <p>Id should not contain + for spaces</p>
16837
16838 <h2 id="Space_between_Text"> Space between Text </h2>
16839 <p>section 1</p>
16840
16841 <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>
16842 <p>section 2</p>
16843
16844 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span> Plus+between+Text </h2>
16845 <p>section 3</p>
16846
16847 <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>
16848 <p>section 4</p>
16849
16850 <h2 id="Underscore_between_Text"> Underscore_between_Text </h2>
16851 <p>section 5</p>
16852
16853 <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>
16854 <p>section 6</p>
16855
16856 <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>
16857 <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>
16858 <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>
16859 <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>
16860 <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>
16861 <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>
16862 !! end
16863
16864 # Parsoid html2wt disabled because it adds padding spaces around =
16865 !! test
16866 Headers with excess '=' characters
16867 (Are similar tests necessary beyond the 1st level?)
16868 !! options
16869 parsoid=wt2html,wt2wt,html2html
16870 !! wikitext
16871 =foo==
16872 ==foo=
16873 =''italic'' heading==
16874 ==''italic'' heading=
16875 !! html/php
16876 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16877 <ul>
16878 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16879 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16880 <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>
16881 <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>
16882 </ul>
16883 </div>
16884
16885 <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>
16886 <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>
16887 <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>
16888 <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>
16889
16890 !! html/parsoid
16891 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16892 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16893 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16894 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16895 !! end
16896
16897 !! test
16898 HTML headers vs TOC (T25393)
16899 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16900 !! wikitext
16901 <h1>Header 1</h1>
16902 == Header 1.1 ==
16903 == Header 1.2 ==
16904
16905 <h1>Header 2
16906 </h1>
16907 == Header 2.1 ==
16908 == Header 2.2 ==
16909 __NOEDITSECTION__
16910 !! html/php
16911 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16912 <ul>
16913 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16914 <ul>
16915 <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>
16916 <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>
16917 </ul>
16918 </li>
16919 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16920 <ul>
16921 <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>
16922 <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>
16923 </ul>
16924 </li>
16925 </ul>
16926 </div>
16927
16928 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16929 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16930 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16931 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16932 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16933 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16934
16935 !! html/parsoid
16936 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
16937 <h2 id="Header_1.1" data-parsoid='{}'> Header 1.1 </h2>
16938 <h2 id="Header_1.2" data-parsoid='{}'> Header 1.2 </h2>
16939
16940 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
16941 </h1>
16942 <h2 id="Header_2.1" data-parsoid='{}'> Header 2.1 </h2>
16943 <h2 id="Header_2.2" data-parsoid='{}'> Header 2.2 </h2>
16944 <meta property="mw:PageProp/noeditsection"/>
16945 !! end
16946
16947 !! test
16948 Single-line or multiline-comments can follow headings
16949 !! options
16950 parsoid=wt2html,wt2wt
16951 !! wikitext
16952 ==foo==<!---->
16953 ==bar==<!--c1-->
16954 ==baz==<!--
16955 c2
16956 c3-->
16957 !! html/php
16958 <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>
16959 <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>
16960 <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>
16961
16962 !! html/parsoid
16963 <h2 id="foo">foo</h2><!---->
16964 <h2 id="bar">bar</h2><!--c1-->
16965 <h2 id="baz">baz</h2><!--
16966 c2
16967 c3-->
16968 !! end
16969
16970 !! test
16971 T3219 URL next to image (broken)
16972 !! wikitext
16973 http://example.com[[File:Foobar.jpg]]
16974 !! html/php
16975 <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>
16976 </p>
16977 !! html/parsoid
16978 <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>
16979 !!end
16980
16981 !! test
16982 T3186 news: in the middle of text
16983 !! wikitext
16984 http://en.wikinews.org/wiki/Wikinews:Workplace
16985 !! html
16986 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16987 </p>
16988 !!end
16989
16990
16991 !! test
16992 Namespaced link must have a title
16993 !! wikitext
16994 [[Project:]]
16995 !! html
16996 <p>[[Project:]]
16997 </p>
16998 !!end
16999
17000 !! test
17001 Namespaced link must have a title (bad fragment version)
17002 !! wikitext
17003 [[Project:#fragment]]
17004 !! html
17005 <p>[[Project:#fragment]]
17006 </p>
17007 !!end
17008
17009
17010 ###
17011 ### HTML tags and HTML attributes
17012 ###
17013
17014 !! test
17015 div with no attributes
17016 !! wikitext
17017 <div>HTML rocks</div>
17018 !! html
17019 <div>HTML rocks</div>
17020
17021 !! end
17022
17023 !! test
17024 div with double-quoted attribute
17025 !! wikitext
17026 <div id="rock">HTML rocks</div>
17027 !! html
17028 <div id="rock">HTML rocks</div>
17029
17030 !! end
17031
17032 !! test
17033 div with single-quoted attribute
17034 !! wikitext
17035 <div id='rock'>HTML rocks</div>
17036 !! html
17037 <div id="rock">HTML rocks</div>
17038
17039 !! end
17040
17041 !! test
17042 div with unquoted attribute
17043 !! wikitext
17044 <div id=rock>HTML rocks</div>
17045 !! html
17046 <div id="rock">HTML rocks</div>
17047
17048 !! end
17049
17050 !! test
17051 div with illegal double attributes
17052 !! wikitext
17053 <div id="a" id="b">HTML rocks</div>
17054 !! html
17055 <div id="b">HTML rocks</div>
17056
17057 !!end
17058
17059 !! test
17060 div with empty attribute value, space before equals
17061 !! options
17062 parsoid=wt2html,html2html
17063 !! wikitext
17064 <div class =>HTML rocks</div>
17065 !! html/php
17066 <div class="">HTML rocks</div>
17067
17068 !! html/parsoid
17069 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17070 !! end
17071
17072 !! test
17073 div with multiple empty attribute values
17074 !! config
17075 wgFragmentMode=[ 'html5', 'legacy' ]
17076 !! options
17077 parsoid=wt2html,html2html
17078 !! wikitext
17079 <div id= title=>HTML rocks</div>
17080 !! html/php
17081 <div id="title=">HTML rocks</div>
17082
17083 !! html/parsoid
17084 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17085 !! end
17086
17087 # FIXME Parsoid doesn't actually match PHP here.
17088 # Probably we should use the synthetic <foo /> or <indicator>
17089 # extensions for this test, which are enabled when running parser tests.
17090 !! test
17091 Extension tag in attribute value
17092 !! wikitext
17093 <span title="<translate>123</translate>">ok</span>
17094 !! html/php+disabled
17095 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17096 </p>
17097 !! html/parsoid
17098 <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>
17099 !! end
17100
17101 !! test
17102 table with multiple empty attribute values
17103 !! options
17104 parsoid=wt2html,html2html
17105 !! wikitext
17106 {| title= id=
17107 | hi
17108 |}
17109 !! html/php
17110 <table title="id=">
17111 <tr>
17112 <td> hi
17113 </td></tr></table>
17114
17115 !! html/parsoid
17116 <table title="id=">
17117 <tbody><tr><td> hi</td></tr>
17118 </tbody></table>
17119 !! end
17120
17121 !! test
17122 div with braces in attribute value
17123 !! wikitext
17124 <div title="{}">Foo</div>
17125 !! html/php
17126 <div title="&#123;&#125;">Foo</div>
17127
17128 !! html/parsoid
17129 <div title="{}">Foo</div>
17130 !! end
17131
17132 !! test
17133 div with empty attribute value, no space before equals
17134 !! options
17135 parsoid=wt2html,html2html
17136 !! wikitext
17137 <div class=>HTML rocks</div>
17138 !! html/php
17139 <div class="">HTML rocks</div>
17140
17141 !! html/parsoid
17142 <div class="">HTML rocks</div>
17143 !! end
17144
17145 !! test
17146 HTML multiple attributes correction
17147 !! wikitext
17148 <p class="error" class="awesome">Awesome!</p>
17149 !! html
17150 <p class="awesome">Awesome!</p>
17151
17152 !!end
17153
17154 !! test
17155 Table multiple attributes correction
17156 !! wikitext
17157 {|
17158 !+ class="error" class="awesome"| status
17159 |}
17160 !! html
17161 <table>
17162 <tr>
17163 <th class="awesome"> status
17164 </th></tr></table>
17165
17166 !!end
17167
17168 !! test
17169 DIV IN UPPERCASE
17170 !! wikitext
17171 <DIV ID="x">HTML ROCKS</DIV>
17172 !! html
17173 <div id="x">HTML ROCKS</div>
17174
17175 !!end
17176
17177 !! test
17178 Non-ASCII pseudo-tags are rendered as text
17179 !! wikitext
17180 <khyô>
17181 !! html
17182 <p>&lt;khyô&gt;
17183 </p>
17184 !! end
17185
17186 !! test
17187 Pseudo-tag with URL 'name' renders as url link
17188 !! wikitext
17189 <http://example.com/>
17190 !! html
17191 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17192 </p>
17193 !! end
17194
17195 !! test
17196 text with amp in the middle of nowhere
17197 !! wikitext
17198 Remember AT&T?
17199 !! html
17200 <p>Remember AT&amp;T?
17201 </p>
17202 !! end
17203
17204 !! test
17205 text with character entity: eacute
17206 !! wikitext
17207 I always thought &eacute; was a cute letter.
17208 !! html+tidy
17209 <p>I always thought &#233; was a cute letter.
17210 </p>
17211 !! end
17212
17213 !! test
17214 text with entity-escaped character entity-like string: eacute
17215 !! wikitext
17216 I always thought &amp;eacute; was a cute letter.
17217 !! html
17218 <p>I always thought &amp;eacute; was a cute letter.
17219 </p>
17220 !! end
17221
17222 !! test
17223 text with undefined character entity: xacute
17224 !! wikitext
17225 I always thought &xacute; was a cute letter.
17226 !! html
17227 <p>I always thought &amp;xacute; was a cute letter.
17228 </p>
17229 !! end
17230
17231 !! test
17232 HTML5 tags
17233 !! wikitext
17234 <data value="5">five</data>
17235 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17236 <mark>This highlighted text</mark>
17237 !! html
17238 <p><data value="5">five</data>
17239 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17240 <mark>This highlighted text</mark>
17241 </p>
17242 !! end
17243
17244 !! test
17245 HTML tag with leading space is parsed as text
17246 !! wikitext
17247 < div>foo< /div>
17248 !! html
17249 <p>&lt; div&gt;foo&lt; /div&gt;
17250 </p>
17251 !! end
17252
17253 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17254 ## the HTML5 parsing spec.
17255 !! test
17256 Element with broken attribute syntax
17257 !! options
17258 parsoid=wt2html
17259 !! wikitext
17260 <div style=" style="123">hi</div>
17261 <div =>ho</div>
17262 !! html/php
17263 <div style="123">hi</div>
17264 <div>ho</div>
17265
17266 !! html/parsoid
17267 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17268 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17269 !! end
17270
17271 ###
17272 ### Nesting tests (see T43545, T52604, T53081)
17273 ###
17274
17275 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17276 # Note that html2wt is considerably more difficult if we use <b> in
17277 # the test case, instead of <small>
17278 !! test
17279 Ensure that HTML adoption agency algorithm is properly implemented.
17280 !! wikitext
17281 <small>X<small>Y</small>Z</small>
17282 !! html
17283 <p><small>X<small>Y</small>Z</small>
17284 </p>
17285 !! end
17286
17287 # This was T43545 in the PHP parser.
17288 !! test
17289 Nesting of <kbd>
17290 !! wikitext
17291 <kbd>X<kbd>Y</kbd>Z</kbd>
17292 !! html+tidy
17293 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17294 </p>
17295 !! end
17296
17297 # The following cases were T53081 in the PHP parser.
17298 # Note that there are some other nestable tags (b, i, etc) which are
17299 # not covered; see T53081 for discussion.
17300
17301 !! test
17302 Nesting of <em>
17303 !! wikitext
17304 <em>X<em>Y</em>Z</em>
17305 !! html+tidy
17306 <p><em>X<em>Y</em>Z</em>
17307 </p>
17308 !! end
17309
17310 !! test
17311 Nesting of <strong>
17312 !! wikitext
17313 <strong>X<strong>Y</strong>Z</strong>
17314 !! html+tidy
17315 <p><strong>X<strong>Y</strong>Z</strong>
17316 </p>
17317 !! end
17318
17319 !! test
17320 Nesting of <q>
17321 !! wikitext
17322 <q>X<q>Y</q>Z</q>
17323 !! html+tidy
17324 <p><q>X<q>Y</q>Z</q>
17325 </p>
17326 !! end
17327
17328 !! test
17329 Nesting of <ruby>
17330 !! wikitext
17331 <ruby>X<ruby>Y</ruby>Z</ruby>
17332 !! html
17333 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17334 </p>
17335 !! end
17336
17337 !! test
17338 Nesting of <bdo>
17339 !! wikitext
17340 <bdo>X<bdo>Y</bdo>Z</bdo>
17341 !! html
17342 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17343 </p>
17344 !! end
17345
17346
17347 ###
17348 ### Media links
17349 ###
17350
17351 !! test
17352 Media link
17353 !! wikitext
17354 [[Media:Foobar.jpg]]
17355 [[Media:Video.ogv]]
17356 [[:Media:Video.ogv]]
17357 !! html/php
17358 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17359 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17360 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17361 </p>
17362 !! html/parsoid
17363 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17364 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17365 <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>
17366 !! end
17367
17368 !! test
17369 Media link with text
17370 !! wikitext
17371 [[Media:Foobar.jpg|A neat file to look at]]
17372 !! html/php
17373 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17374 </p>
17375 !! html/parsoid
17376 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17377 !! end
17378
17379 # FIXME: this is still bad HTML tag nesting
17380 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17381 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17382 !! test
17383 Media link with nasty text
17384 !! wikitext
17385 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17386 !! html/php
17387 <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>
17388
17389 !! html+php/tidy
17390 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17391 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17392 !! html/parsoid
17393 <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>
17394
17395 !! end
17396
17397 !! test
17398 Media link to nonexistent file (T3702)
17399 !! wikitext
17400 [[Media:No such.jpg]]
17401 [[Media:No_such file.jpg]]
17402 !! html/php
17403 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17404 <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>
17405 </p>
17406 !! html/parsoid
17407 <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>
17408 <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>
17409 !! end
17410
17411 !! test
17412 Image link to nonexistent file (T3850 - good)
17413 !! wikitext
17414 [[File:No_such.jpg]]
17415 !! html/php
17416 <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>
17417 </p>
17418 !! html/parsoid
17419 <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>
17420 !! end
17421
17422 !! test
17423 :Image link to nonexistent file (T3850 - bad)
17424 !! wikitext
17425 [[:Image:No such.jpg]]
17426 !! html/php
17427 <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>
17428 </p>
17429 !! html/parsoid
17430 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17431 !! end
17432
17433 !! test
17434 Character reference normalization in link text (T3938)
17435 !! wikitext
17436 [[Main Page|this&that]]
17437 !! html
17438 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17439 </p>
17440 !!end
17441
17442 !! article
17443 אַ
17444 !! text
17445 Test for unicode normalization
17446
17447 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17448 !! endarticle
17449
17450 !! test
17451 (T21451) Links should refer to the normalized form.
17452 !! wikitext
17453 [[&#xFB2E;]]
17454 [[&#x5d0;&#x5b7;]]
17455 [[&#x5d0;ַ]]
17456 [[א&#x5b7;]]
17457 [[אַ]]
17458 !! html
17459 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17460 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17461 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17462 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17463 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17464 </p>
17465 !! end
17466
17467 !! test
17468 Empty attribute crash test (T4067)
17469 !! wikitext
17470 <font color="">foo</font>
17471 !! html
17472 <p><font color="">foo</font>
17473 </p>
17474 !! end
17475
17476 !! test
17477 Empty attribute crash test single-quotes (T4067)
17478 !! wikitext
17479 <font color=''>foo</font>
17480 !! html
17481 <p><font color="">foo</font>
17482 </p>
17483 !! end
17484
17485 !! test
17486 Attribute test: equals, then nothing
17487 !! options
17488 parsoid=wt2html,html2html
17489 !! wikitext
17490 <font color=>foo</font>
17491 !! html/php
17492 <p><font color="">foo</font>
17493 </p>
17494 !! html/parsoid
17495 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17496 !! end
17497
17498 !! test
17499 Attribute test: unquoted value
17500 !! options
17501 parsoid=wt2html,html2html
17502 !! wikitext
17503 <font color=x>foo</font>
17504 !! html/php
17505 <p><font color="x">foo</font>
17506 </p>
17507 !! html/parsoid
17508 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17509 !! end
17510
17511 !! test
17512 Attribute test: unquoted but illegal value (hash)
17513 !! wikitext
17514 <font color=#x>foo</font>
17515 !! html
17516 <p><font color="#x">foo</font>
17517 </p>
17518 !! end
17519
17520 # Parsoid does not serialize to empty attribute syntax,
17521 # so wt2wt and html2wt cases are skipped
17522 !! test
17523 Attribute test: no value (T54330)
17524 !! options
17525 parsoid=wt2html,html2html
17526 !! wikitext
17527 <font color>foo</font>
17528 !! html/php
17529 <p><font color="">foo</font>
17530 </p>
17531 !! html/parsoid
17532 <p><font color="">foo</font></p>
17533 !! end
17534
17535 !! test
17536 T4095: link with three closing brackets
17537 !! wikitext
17538 [[Main Page]]]
17539 !! html/php
17540 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17541 </p>
17542 !! html/parsoid
17543 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17544 !! end
17545
17546 !! test
17547 T4095: link with pipe and three closing brackets
17548 !! wikitext
17549 [[Main Page|link]]]
17550 !! html/php
17551 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17552 </p>
17553 !! html/parsoid
17554 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17555 !! end
17556
17557 !! test
17558 T4095: link with pipe and three closing brackets, version 2
17559 !! wikitext
17560 [[Main Page|[http://example.com/]]]
17561 !! html/php
17562 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17563 </p>
17564 !! html/parsoid
17565 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17566 !! end
17567
17568
17569 ###
17570 ### Safety
17571 ###
17572
17573 !! article
17574 Template:Dangerous attribute
17575 !! text
17576 " onmouseover="alert(document.cookie)
17577 !! endarticle
17578
17579 !! article
17580 Template:Dangerous style attribute
17581 !! text
17582 border-size: expression(alert(document.cookie))
17583 !! endarticle
17584
17585 !! article
17586 Template:Div style
17587 !! text
17588 <div style="float: right; {{{1}}}">Magic div</div>
17589 !! endarticle
17590
17591 !! test
17592 T4304: HTML attribute safety (safe template; regression T4309)
17593 !! wikitext
17594 <div title="{{test}}"></div>
17595 !! html/php
17596 <div title="This is a test template"></div>
17597
17598 !! html/parsoid
17599 <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>
17600 !! end
17601
17602 # Parsoid has enough context to handle this case
17603 !! test
17604 T4304: HTML attribute safety (dangerous template; 2309)
17605 !! wikitext
17606 <div title="{{dangerous attribute}}"></div>
17607 !! html/php
17608 <div title=""></div>
17609
17610 !! html/parsoid
17611 <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>
17612 !! end
17613
17614 !! test
17615 T4304: HTML attribute safety (dangerous style template; 2309)
17616 !! wikitext
17617 <div style="{{dangerous style attribute}}"></div>
17618 !! html/php
17619 <div style="/* insecure input */"></div>
17620
17621 !! html/parsoid
17622 <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>
17623 !! end
17624
17625 !! test
17626 T4304: HTML attribute safety (safe parameter; 2309)
17627 !! wikitext
17628 {{div style|width: 200px}}
17629 !! html/php
17630 <div style="float: right; width: 200px">Magic div</div>
17631
17632 !! html/parsoid
17633 <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>
17634 !! end
17635
17636 !! test
17637 T4304: HTML attribute safety (unsafe parameter; 2309)
17638 !! wikitext
17639 {{div style|width: expression(alert(document.cookie))}}
17640 !! html/php
17641 <div style="/* insecure input */">Magic div</div>
17642
17643 !! html/parsoid
17644 <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>
17645 !! end
17646
17647 ## Parsoid output here differs; needs investigation.
17648 !! test
17649 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17650 !! wikitext
17651 {{div style|"><script>alert(document.cookie)</script>}}
17652 !! html
17653 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17654
17655 !! end
17656
17657 ## Parsoid output here differs; needs investigation.
17658 !! test
17659 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17660 !! wikitext
17661 {{div style|" ><script>alert(document.cookie)</script>}}
17662 !! html
17663 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17664
17665 !! end
17666
17667 !! test
17668 T4304: HTML attribute safety (link)
17669 !! wikitext
17670 <div title="[[Main Page]]"></div>
17671 !! html/php
17672 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17673
17674 !! html/parsoid
17675 <div title="[[Main Page]]"></div>
17676 !! end
17677
17678 !! test
17679 T4304: HTML attribute safety (italics)
17680 !! wikitext
17681 <div title="''foobar''"></div>
17682 !! html
17683 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17684
17685 !! end
17686
17687 !! test
17688 T4304: HTML attribute safety (bold)
17689 !! wikitext
17690 <div title="'''foobar'''"></div>
17691 !! html
17692 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17693
17694 !! end
17695
17696 !! test
17697 T4304: HTML attribute safety (ISBN)
17698 !! wikitext
17699 <div title="ISBN 1234567890"></div>
17700 !! html
17701 <div title="&#73;SBN 1234567890"></div>
17702
17703 !! end
17704
17705 !! test
17706 T4304: HTML attribute safety (RFC)
17707 !! wikitext
17708 <div title="RFC 1234"></div>
17709 !! html
17710 <div title="&#82;FC 1234"></div>
17711
17712 !! end
17713
17714 !! test
17715 T4304: HTML attribute safety (PMID)
17716 !! wikitext
17717 <div title="PMID 1234567890"></div>
17718 !! html
17719 <div title="&#80;MID 1234567890"></div>
17720
17721 !! end
17722
17723 !! test
17724 T4304: HTML attribute safety (web link)
17725 !! wikitext
17726 <div title="http://example.com/"></div>
17727 !! html
17728 <div title="http&#58;//example.com/"></div>
17729
17730 !! end
17731
17732 !! test
17733 T4304: HTML attribute safety (named web link)
17734 !! wikitext
17735 <div title="[http://example.com/ link]"></div>
17736 !! html/php
17737 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17738
17739 !! html/parsoid
17740 <div title="[http://example.com/ link]"></div>
17741 !! end
17742
17743 !! test
17744 T5244: HTML attribute safety (extension; safe)
17745 !! wikitext
17746 <div style="<nowiki>background:blue</nowiki>"></div>
17747 !! html/php
17748 <div style="background:blue"></div>
17749
17750 !! html/parsoid
17751 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17752 !! end
17753
17754 !! test
17755 T5244: HTML attribute safety (extension; unsafe)
17756 !! wikitext
17757 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17758 !! html/php
17759 <div style="/* insecure input */"></div>
17760
17761 !! html/parsoid
17762 <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>
17763 !! end
17764
17765 # More MSIE fun discovered by Tom Gilder
17766
17767 !! test
17768 MSIE CSS safety test: spurious slash
17769 !! wikitext
17770 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17771 !! html/php
17772 <div style="/* insecure input */">evil</div>
17773
17774 !! html/parsoid
17775 <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>
17776 !! end
17777
17778 !! test
17779 MSIE CSS safety test: hex code
17780 !! wikitext
17781 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17782 !! html/php
17783 <div style="/* insecure input */">evil</div>
17784
17785 !! html/parsoid
17786 <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>
17787 !! end
17788
17789 !! test
17790 MSIE CSS safety test: comment in url
17791 !! wikitext
17792 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17793 !! html/php
17794 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17795
17796 !! html/parsoid
17797 <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>
17798 !! end
17799
17800 !! test
17801 MSIE CSS safety test: comment in expression
17802 !! wikitext
17803 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17804 !! html/php
17805 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17806
17807 !! html/parsoid
17808 <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>
17809 !! end
17810
17811 !! test
17812 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17813 !! wikitext
17814 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17815 !! html/php
17816 <p style="/* invalid control char */">A</p>
17817
17818 !! html/parsoid
17819 <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>
17820 !! end
17821
17822 !! test
17823 MSIE 6 CSS safety test: Fullwidth (T57332)
17824 !! wikitext
17825 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17826 <div style="top:EXPRESSION(alert())">B</div>
17827 !! html/php
17828 <p style="/* insecure input */">A</p>
17829 <div style="/* insecure input */">B</div>
17830
17831 !! html/parsoid
17832 <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>
17833 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17834 !! end
17835
17836 !! test
17837 MSIE 6 CSS safety test: IPA extensions (T57332)
17838 !! wikitext
17839 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17840 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17841 !! html/php
17842 <div style="/* insecure input */">A</div>
17843 <p style="/* insecure input */">B</p>
17844
17845 !! html/parsoid
17846 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17847 <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>
17848 !! end
17849
17850 !! test
17851 MSIE 6 CSS safety test: sup/sub script (T57332)
17852 !! wikitext
17853 <div style="background-image:url⁽javascript:alert())">A</div>
17854 <div style="background-image:url₍javascript:alert())">B</div>
17855 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17856 !! html/php
17857 <div style="/* insecure input */">A</div>
17858 <div style="/* insecure input */">B</div>
17859 <p style="/* insecure input */">C</p>
17860
17861 !! html/parsoid
17862 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17863 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17864 <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>
17865 !! end
17866
17867 !! test
17868 Opera -o-link CSS
17869 !! options
17870 parsoid=wt2html,html2html
17871 !! wikitext
17872 <div
17873 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;"
17874 style="-o-link:attr(title);-o-link-source:current">X</div>
17875 !! html/php
17876 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17877
17878 !! html/parsoid
17879 <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>
17880 !! end
17881
17882 !! test
17883 MSIE 6 CSS safety test: Repetition markers (T57332)
17884 !! wikitext
17885 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17886 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17887 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17888 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17889 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17890 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17891 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17892 !! html/php
17893 <p style="/* insecure input */">A</p>
17894 <p style="/* insecure input */">B</p>
17895 <p style="/* insecure input */">C</p>
17896 <p style="/* insecure input */">D</p>
17897 <p style="/* insecure input */">E</p>
17898 <p style="/* insecure input */">F</p>
17899 <p style="/* insecure input */">G</p>
17900
17901 !! html/parsoid
17902 <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>
17903 <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>
17904 <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>
17905 <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>
17906 <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>
17907 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
17908 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
17909 !! end
17910
17911 !! test
17912 Table attribute legitimate extension
17913 !! wikitext
17914 {|
17915 !+ style="<nowiki>color:blue</nowiki>"| status
17916 |}
17917 !! html
17918 <table>
17919 <tr>
17920 <th style="color:blue"> status
17921 </th></tr></table>
17922
17923 !!end
17924
17925 !! test
17926 Table attribute safety
17927 !! wikitext
17928 {|
17929 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17930 |}
17931 !! html
17932 <table>
17933 <tr>
17934 <th style="/* insecure input */"> status
17935 </th></tr></table>
17936
17937 !! end
17938
17939 !! test
17940 CSS line continuation 1
17941 !! wikitext
17942 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17943 !! html
17944 <div style="/* insecure input */"></div>
17945
17946 !! end
17947
17948 !! test
17949 CSS line continuation 2
17950 !! wikitext
17951 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17952 !! html
17953 <div style="/* invalid control char */"></div>
17954
17955 !! end
17956
17957 !! article
17958 Template:Identity
17959 !! text
17960 {{{1}}}
17961 !! endarticle
17962
17963 !! test
17964 Expansion of multi-line templates in attribute values (T8255)
17965 !! wikitext
17966 <div style="background: {{identity|#00FF00}}">-</div>
17967 !! html
17968 <div style="background: #00FF00">-</div>
17969
17970 !! end
17971
17972 !! test
17973 Expansion of multi-line templates in attribute values (T8255 sanity check)
17974 !! wikitext
17975 <div style="background:
17976 #00FF00">-</div>
17977 !! html/php
17978 <div style="background: #00FF00">-</div>
17979
17980 !! html/parsoid
17981 <div style="background:
17982 #00FF00">-</div>
17983 !! end
17984
17985 !! test
17986 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17987 !! wikitext
17988 <div style="background: &#10;#00FF00">-</div>
17989 !! html
17990 <div style="background: &#10;#00FF00">-</div>
17991
17992 !! end
17993
17994 !! test
17995 Tags which are hidden from tidiers cannot pass through the Sanitizer
17996 !! wikitext
17997 <mw:toc><script>alert();</script></mw:toc>
17998 !! html+tidy
17999 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18000 </p>
18001 !! end
18002
18003 ###
18004 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18005 ###
18006
18007 !! test
18008 Parser hook: empty input
18009 !! wikitext
18010 <tag></tag>
18011 !! html/php
18012 <pre>
18013 ''
18014 array (
18015 )
18016 </pre>
18017
18018 !! html/parsoid
18019 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18020 !! end
18021
18022 ## Don't expect parsoid to rt this form.
18023 !! test
18024 Parser hook: empty input using terminated empty elements
18025 !! options
18026 parsoid=wt2html,html2html
18027 !! wikitext
18028 <tag/>
18029 !! html/php
18030 <pre>
18031 NULL
18032 array (
18033 )
18034 </pre>
18035
18036 !! html/parsoid
18037 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18038 !! end
18039
18040 !! test
18041 Parser hook: empty input using terminated empty elements (space before)
18042 !! wikitext
18043 <tag />
18044 !! html/php
18045 <pre>
18046 NULL
18047 array (
18048 )
18049 </pre>
18050
18051 !! html/parsoid
18052 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18053 !! end
18054
18055 !! test
18056 Parser hook: basic input
18057 !! wikitext
18058 <tag>input</tag>
18059 !! html/php
18060 <pre>
18061 'input'
18062 array (
18063 )
18064 </pre>
18065
18066 !! html/parsoid
18067 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18068 !! end
18069
18070 ## Don't expect parsoid to rt this form.
18071 !! test
18072 Parser hook: case insensitive
18073 !! options
18074 parsoid=wt2html,html2html
18075 !! wikitext
18076 <TAG>input</TAG>
18077 !! html/php
18078 <pre>
18079 'input'
18080 array (
18081 )
18082 </pre>
18083
18084 !! html/parsoid
18085 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18086 !! end
18087
18088 ## Don't expect parsoid to rt this form.
18089 !! test
18090 Parser hook: case insensitive, redux
18091 !! options
18092 parsoid=wt2html,html2html
18093 !! wikitext
18094 <TaG>input</TAg>
18095 !! html/php
18096 <pre>
18097 'input'
18098 array (
18099 )
18100 </pre>
18101
18102 !! html/parsoid
18103 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18104 !! end
18105
18106 !! test
18107 Parser hook: nested tags
18108 !! wikitext
18109 <tag><tag></tag></tag>
18110 !! html/php
18111 <pre>
18112 '<tag>'
18113 array (
18114 )
18115 </pre>&lt;/tag&gt;
18116
18117 !! html/parsoid
18118 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18119 !! end
18120
18121 !! test
18122 Parser hook: basic arguments
18123 !! wikitext
18124 <tag width="200" height="100" depth="50" square=""></tag>
18125 !! html/php
18126 <pre>
18127 ''
18128 array (
18129 'width' => '200',
18130 'height' => '100',
18131 'depth' => '50',
18132 'square' => '',
18133 )
18134 </pre>
18135
18136 !! html/parsoid
18137 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18138 !! end
18139
18140 ## Don't expect parsoid to rt this form.
18141 !! test
18142 Parser hook: basic arguments, variations
18143 !! options
18144 parsoid=wt2html,html2html
18145 !! wikitext
18146 <tag width=200 height = "100" depth = '50' square></tag>
18147 !! html/php
18148 <pre>
18149 ''
18150 array (
18151 'width' => '200',
18152 'height' => '100',
18153 'depth' => '50',
18154 'square' => '',
18155 )
18156 </pre>
18157
18158 !! html/parsoid
18159 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18160 !! end
18161
18162 !! test
18163 Parser hook: argument containing a forward slash (T7344)
18164 !! wikitext
18165 <tag filename="/tmp/bla"></tag>
18166 !! html/php
18167 <pre>
18168 ''
18169 array (
18170 'filename' => '/tmp/bla',
18171 )
18172 </pre>
18173
18174 !! html/parsoid
18175 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18176 !! end
18177
18178 ## Don't expect parsoid to rt this form.
18179 !! test
18180 Parser hook: empty input using terminated empty elements (T4374)
18181 !! options
18182 parsoid=wt2html,html2html
18183 !! wikitext
18184 <tag foo=bar/>text
18185 !! html/php
18186 <pre>
18187 NULL
18188 array (
18189 'foo' => 'bar',
18190 )
18191 </pre>text
18192
18193 !! html/parsoid
18194 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18195 !! end
18196
18197 ## </tag> should be output literally since there is no matching tag that begins it
18198 ## Don't expect parsoid to rt this form.
18199 !! test
18200 Parser hook: basic arguments using terminated empty elements (T4374)
18201 !! options
18202 parsoid=wt2html
18203 !! wikitext
18204 <tag width=200 height = "100" depth = '50' square/>
18205 other stuff
18206 </tag>
18207 !! html/php
18208 <pre>
18209 NULL
18210 array (
18211 'width' => '200',
18212 'height' => '100',
18213 'depth' => '50',
18214 'square' => '',
18215 )
18216 </pre>
18217 <p>other stuff
18218 &lt;/tag&gt;
18219 </p>
18220 !! html/parsoid
18221 <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
18222 &lt;/tag></p>
18223 !! end
18224
18225 ## Don't expect parsoid to rt this form.
18226 !! test
18227 Parser hook: Don't allow unclosed extension tags
18228 !! options
18229 parsoid=wt2html
18230 !! wikitext
18231 test <tag>123
18232
18233 this is a '''test'''
18234 !! html/php
18235 <p>test &lt;tag&gt;123
18236 </p><p>this is a <b>test</b>
18237 </p>
18238 !! html/parsoid
18239 <p>test &lt;tag>123</p>
18240
18241 <p>this is a <b>test</b></p>
18242 !! end
18243
18244 ###
18245 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18246 ###
18247
18248 !! test
18249 Parser hook: static parser hook not inside a comment
18250 !! wikitext
18251 <statictag>hello, world</statictag>
18252
18253 <statictag action="flush" />
18254 !! html/php
18255 <p><br />
18256 hello, world
18257 </p>
18258 !! html/parsoid
18259 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18260 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18261 !! end
18262
18263 !! test
18264 Parser hook: static parser hook inside a comment
18265 !! wikitext
18266 <!-- <statictag>hello, world</statictag> -->
18267 <statictag action="flush" />
18268 !! html/php
18269 <p><br />
18270 </p>
18271 !! html/parsoid
18272 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18273 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18274 !! end
18275
18276 # Nested template calls; this case was broken by Parser.php rev 1.506,
18277 # since reverted.
18278
18279 !! article
18280 Template:One-parameter
18281 !! text
18282 (My parameter is: {{{1}}})
18283 !! endarticle
18284
18285 !! article
18286 Template:Map-one-parameter
18287 !! text
18288 {{{{{1}}}|{{{2}}}}}
18289 !! endarticle
18290
18291 !! test
18292 Nested template calls
18293 !! wikitext
18294 {{Map-one-parameter|One-parameter|param}}
18295 !! html
18296 <p>(My parameter is: param)
18297 </p>
18298 !! end
18299
18300
18301 ###
18302 ### Sanitizer
18303 ###
18304
18305 # Remex wraps empty tag runs with p-tags.
18306 # Parsoid strips them out during p-wrapping.
18307 !! test
18308 Sanitizer: Closing of open tags
18309 !! wikitext
18310 <s></s><table></table>
18311 !! html/php+tidy
18312 <p><s></s></p><table></table>
18313 !! html/parsoid
18314 <s></s><table></table>
18315 !! end
18316
18317 !! test
18318 Sanitizer: Closing of open but not closed tags
18319 !! wikitext
18320 <s>foo
18321 !! html
18322 <p><s>foo</s>
18323 </p>
18324 !! end
18325
18326 !! test
18327 Sanitizer: Closing of closed but not open tags
18328 !! options
18329 parsoid=wt2html
18330 !! wikitext
18331 </s>
18332 !! html/php+tidy
18333 <p class="mw-empty-elt">
18334 </p>
18335 !! html/parsoid
18336 !! end
18337
18338 !! test
18339 Sanitizer: Closing of closed but not open table tags
18340 !! options
18341 parsoid=wt2html
18342 !! wikitext
18343 Table not started</td></tr></table>
18344 !! html+tidy
18345 <p>Table not started
18346 </p>
18347 !! end
18348
18349 !! test
18350 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18351 !! config
18352 wgFragmentMode=[ 'html5', 'legacy' ]
18353 !! wikitext
18354 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18355 !! html/php
18356 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18357 </p>
18358 !! html/parsoid
18359 <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>
18360 !! end
18361
18362 !! test
18363 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18364 !! config
18365 wgFragmentMode=[ 'legacy' ]
18366 !! wikitext
18367 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18368 !! html/php
18369 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18370 </p>
18371 !! end
18372
18373 # In HTML5, the restrictions are that id must contain at least one character,
18374 # and must not contain any space characters.
18375 !! test
18376 Sanitizer: Validating the contents of the id attribute (T6515)
18377 !! options
18378 disabled
18379 !! wikitext
18380 <br id="" /><br id="a space" />
18381 !! html
18382 Something ...
18383 !! end
18384
18385 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18386 !! test
18387 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18388 !! options
18389 disabled
18390 !! wikitext
18391 <br id="foo" /><br id="foo" />
18392 !! html
18393 Something need to be done. foo-2 ?
18394 !! end
18395
18396 !! test
18397 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18398 !! wikitext
18399 <div itemscope>
18400 <meta itemprop="hello" content="world">
18401 <meta http-equiv="refresh" content="5">
18402 <meta itemprop="hello" http-equiv="refresh" content="5">
18403 <link itemprop="hello" href="{{SERVER}}">
18404 <link rel="stylesheet" href="{{SERVER}}">
18405 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18406 </div>
18407 !! html
18408 <div itemscope="">
18409 <p> <meta itemprop="hello" content="world" />
18410 &lt;meta http-equiv="refresh" content="5"&gt;
18411 <meta itemprop="hello" content="5" />
18412 <link itemprop="hello" href="http&#58;//example.org" />
18413 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18414 <link itemprop="hello" href="http&#58;//example.org" />
18415 </p>
18416 </div>
18417
18418 !! end
18419
18420 !! test
18421 Sanitizer: Strip comments from CSS attributes
18422 !! options
18423 parsoid=wt2html,wt2wt
18424 !! wikitext
18425 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18426 !! html/php
18427 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18428 </p>
18429 !! html/parsoid
18430 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18431 !! end
18432
18433 !! test
18434 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18435 !! wikitext
18436 [[meatball:Soft"Security]]
18437 !! html/php
18438 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18439 </p>
18440 !! html/parsoid
18441 <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>
18442 !! end
18443
18444 !! test
18445 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18446 !! wikitext
18447 [[meatball:Foo<Bar]]
18448 [[meatball:Foo>Bar]]
18449 [[meatball:Foo&lt;bar]]
18450 [[meatball:Foo&gt;bar]]
18451 !! html/php
18452 <p>[[meatball:Foo&lt;Bar]]
18453 [[meatball:Foo&gt;Bar]]
18454 [[meatball:Foo&lt;bar]]
18455 [[meatball:Foo&gt;bar]]
18456 </p>
18457 !! html/parsoid
18458 <p>[[meatball:Foo&lt;Bar]]
18459 [[meatball:Foo>Bar]]
18460 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18461 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18462 !! end
18463
18464 !! test
18465 Language converter: output gets cut off unexpectedly (T7757)
18466 !! options
18467 language=zh
18468 !! wikitext
18469 this bit is safe: }-
18470
18471 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18472
18473 then we get cut off here: }-
18474
18475 all additional text is vanished
18476 !! html/php
18477 <p>this bit is safe: }-
18478 </p><p>but if we add a conversion instance: xxx
18479 </p><p>then we get cut off here: }-
18480 </p><p>all additional text is vanished
18481 </p>
18482 !! html/parsoid
18483 <p>this bit is safe: }-</p>
18484 <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>
18485 <p>then we get cut off here: }-</p>
18486 <p>all additional text is vanished</p>
18487 !! end
18488
18489 !! test
18490 Language converter glossary rules inside attributes (T119158)
18491 !! options
18492 language=sr variant=sr-el
18493 !! wikitext
18494 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18495
18496 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18497 !! html/php
18498 <p>
18499 </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>
18500 </p>
18501 !! html/parsoid
18502 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18503
18504 <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>
18505 !! end
18506
18507 !! test
18508 Self closed html pairs (T7487)
18509 !! wikitext
18510 <center><font id="bug" />Centered text</center>
18511 <div><font id="bug2" />In div text</div>
18512 !! html+tidy
18513 <center><font id="bug"></font>Centered text</center>
18514 <div><font id="bug2"></font>In div text</div>
18515 !! end
18516
18517 !! test
18518 Punctuation: nbsp before exclamation
18519 !! wikitext
18520 C'est grave !
18521 !! html
18522 <p>C'est grave&#160;!
18523 </p>
18524 !! end
18525
18526 !! test
18527 Punctuation: CSS !important (T13874)
18528 !! wikitext
18529 <div style="width:50% !important">important</div>
18530 !! html
18531 <div style="width:50% !important">important</div>
18532
18533 !!end
18534
18535 !! test
18536 Punctuation: CSS ! important (T13874; with space after)
18537 !! wikitext
18538 <div style="width:50% ! important">important</div>
18539 !! html
18540 <div style="width:50% ! important">important</div>
18541
18542 !!end
18543
18544 !! test
18545 HTML bullet list, closed tags (T7497)
18546 !! wikitext
18547 <ul>
18548 <li>One</li>
18549 <li>Two</li>
18550 </ul>
18551 !! html/php
18552 <ul>
18553 <li>One</li>
18554 <li>Two</li>
18555 </ul>
18556
18557 !! html/parsoid
18558 <ul data-parsoid='{"stx":"html"}'>
18559 <li data-parsoid='{"stx":"html"}'>One</li>
18560 <li data-parsoid='{"stx":"html"}'>Two</li>
18561 </ul>
18562
18563 !! end
18564
18565 !! test
18566 HTML bullet list, unclosed tags (T7497)
18567 !! wikitext
18568 <ul>
18569 <li>One
18570 <li>Two
18571 </ul>
18572 !! html/php+tidy
18573 <ul>
18574 <li>One
18575 </li><li>Two
18576 </li></ul>
18577 !! html/parsoid
18578 <ul data-parsoid='{"stx":"html"}'>
18579 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18580 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18581 </ul>
18582
18583 !! end
18584
18585 !! test
18586 HTML ordered list, closed tags (T7497)
18587 !! wikitext
18588 <ol>
18589 <li>One</li>
18590 <li>Two</li>
18591 </ol>
18592 !! html/php
18593 <ol>
18594 <li>One</li>
18595 <li>Two</li>
18596 </ol>
18597
18598 !! html/parsoid
18599 <ol data-parsoid='{"stx":"html"}'>
18600 <li data-parsoid='{"stx":"html"}'>One</li>
18601 <li data-parsoid='{"stx":"html"}'>Two</li>
18602 </ol>
18603
18604 !! end
18605
18606 !! test
18607 HTML ordered list, unclosed tags (T7497)
18608 !! options
18609 !! wikitext
18610 <ol>
18611 <li>One
18612 <li>Two
18613 </ol>
18614 !! html/php+tidy
18615 <ol>
18616 <li>One
18617 </li><li>Two
18618 </li></ol>
18619 !! html/parsoid
18620 <ol data-parsoid='{"stx":"html"}'>
18621 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18622 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18623 </ol>
18624
18625 !! end
18626
18627 !! test
18628 HTML nested bullet list, closed tags (T7497)
18629 !! wikitext
18630 <ul>
18631 <li>One</li>
18632 <li>Two:
18633 <ul>
18634 <li>Sub-one</li>
18635 <li>Sub-two</li>
18636 </ul>
18637 </li>
18638 </ul>
18639 !! html/php
18640 <ul>
18641 <li>One</li>
18642 <li>Two:
18643 <ul>
18644 <li>Sub-one</li>
18645 <li>Sub-two</li>
18646 </ul>
18647 </li>
18648 </ul>
18649
18650 !! html/parsoid
18651 <ul data-parsoid='{"stx":"html"}'>
18652 <li data-parsoid='{"stx":"html"}'>One</li>
18653 <li data-parsoid='{"stx":"html"}'>Two:
18654 <ul data-parsoid='{"stx":"html"}'>
18655 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18656 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18657 </ul>
18658 </li>
18659 </ul>
18660 !! end
18661
18662 !! test
18663 HTML nested bullet list, open tags (T7497)
18664 !! wikitext
18665 <ul>
18666 <li>One
18667 <li>Two:
18668 <ul>
18669 <li>Sub-one
18670 <li>Sub-two
18671 </ul>
18672 </ul>
18673 !! html+tidy
18674 <ul>
18675 <li>One
18676 </li><li>Two:
18677 <ul>
18678 <li>Sub-one
18679 </li><li>Sub-two
18680 </li></ul>
18681 </li></ul>
18682 !! end
18683
18684 !! test
18685 HTML nested ordered list, closed tags (T7497)
18686 !! wikitext
18687 <ol>
18688 <li>One</li>
18689 <li>Two:
18690 <ol>
18691 <li>Sub-one</li>
18692 <li>Sub-two</li>
18693 </ol>
18694 </li>
18695 </ol>
18696 !! html
18697 <ol>
18698 <li>One</li>
18699 <li>Two:
18700 <ol>
18701 <li>Sub-one</li>
18702 <li>Sub-two</li>
18703 </ol>
18704 </li>
18705 </ol>
18706
18707 !! end
18708
18709 !! test
18710 HTML nested ordered list, open tags (T7497)
18711 !! wikitext
18712 <ol>
18713 <li>One
18714 <li>Two:
18715 <ol>
18716 <li>Sub-one
18717 <li>Sub-two
18718 </ol>
18719 </ol>
18720 !! html/php
18721 <ol>
18722 <li>One
18723 <li>Two:
18724 <ol>
18725 <li>Sub-one
18726 <li>Sub-two
18727 </ol>
18728 </ol>
18729
18730 !! html/parsoid
18731 <ol>
18732 <li>One
18733 </li>
18734 <li>Two:
18735 <ol>
18736 <li>Sub-one
18737 </li>
18738 <li>Sub-two
18739 </li>
18740 </ol>
18741 </li>
18742 </ol>
18743
18744 !! end
18745
18746 !! test
18747 HTML ordered list item with parameters oddity
18748 !! wikitext
18749 <ol><li id="fragment">One</li>
18750 </ol>
18751 !! html
18752 <ol><li id="fragment">One</li>
18753 </ol>
18754
18755 !! end
18756
18757 # parsoid doesn't explicitly mark autonumbered links, see T55505
18758 !!test
18759 T7918: autonumbering
18760 !! wikitext
18761 [http://first/] [http://second] [ftp://ftp]
18762
18763 ftp://inlineftp
18764
18765 [mailto:enclosed@mail.tld With target]
18766
18767 [mailto:enclosed@mail.tld]
18768
18769 mailto:inline@mail.tld
18770 !! html/php
18771 <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>
18772 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18773 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18774 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18775 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18776 </p>
18777 !! html/parsoid
18778 <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>
18779 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18780 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18781 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18782 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18783 !! end
18784
18785
18786 #
18787 # Security and HTML correctness
18788 # From Nick Jenkins' fuzz testing
18789 #
18790
18791 !! test
18792 Fuzz testing: Parser13
18793 !! wikitext
18794 {|
18795 | http://a|
18796 !! html
18797 <table>
18798 <tr>
18799 <td>
18800 </td>
18801 </tr>
18802 </table>
18803
18804 !! end
18805
18806 # Note that Parsoid output differs from the PHP parser here: the PHP
18807 # parser breaks the URL for the magic word, while in Parsoid the URL
18808 # production takes precedence.
18809 !! test
18810 Fuzz testing: Parser14
18811 !! wikitext
18812 == onmouseover= ==
18813 http://__TOC__
18814 !! html/php
18815 <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>
18816 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18817 <ul>
18818 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18819 </ul>
18820 </div>
18821
18822
18823 !! html/php+tidy
18824 <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>
18825 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18826 <ul>
18827 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18828 </ul>
18829 </div>
18830 !! html/parsoid
18831 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span> onmouseover= </h2>
18832 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18833 !! end
18834
18835 !! test
18836 Fuzz testing: Parser14-table
18837 !! options
18838 parsoid=wt2html,html2html
18839 !! wikitext
18840 ==a==
18841 {| STYLE=__TOC__
18842 !! html
18843 <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>
18844 <table style="&#95;_TOC&#95;_">
18845 <tr><td></td></tr>
18846 </table>
18847
18848 !! html+tidy
18849 <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>
18850 <table style="__TOC__">
18851 <tr>
18852 <td></td>
18853 </tr>
18854 </table>
18855 !! html/parsoid
18856 <h2 id="a">a</h2>
18857 <table style="__TOC__"></table>
18858 !! end
18859
18860 # Known to produce bogus xml (extra </td>)
18861 # Don't add the html/php section since it generates broken HTML
18862 !! test
18863 Fuzz testing: Parser16
18864 !! wikitext
18865 {|
18866 !https://||||||
18867 !! html+tidy
18868 <table>
18869 <tbody><tr>
18870 <th>https://</th>
18871 <th></th>
18872 <th></th>
18873 <th>
18874
18875 </th></tr>
18876 </tbody></table>
18877 !! end
18878
18879 !! test
18880 Fuzz testing: Parser21
18881 !! wikitext
18882 {|
18883 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18884 |
18885 !! html
18886 <table>
18887 <tr>
18888 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18889 </th>
18890 <td>
18891 </td>
18892 </tr>
18893 </table>
18894
18895 !! end
18896
18897 !! test
18898 Fuzz testing: Parser22
18899 !! wikitext
18900 http://===r:::https://b
18901
18902 {|
18903 !! html
18904 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18905 </p>
18906 <table>
18907 <tr><td></td></tr>
18908 </table>
18909
18910 !! end
18911
18912 # Known to produce bad XML for now
18913 !! test
18914 Fuzz testing: Parser24
18915 !! options
18916 parsoid=wt2html
18917 !! wikitext
18918 {|
18919 {{{|
18920 <u CLASS=
18921 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18922 <br style="onmouseover='alert(document.cookie);' " />
18923
18924 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18925 |
18926 !! html/php
18927 <table>
18928 {{{|
18929 <u class="&#124;">}}}} &gt;
18930 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18931
18932 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18933 <tr>
18934 <td></u>
18935 </td>
18936 </tr>
18937 </table>
18938
18939 !! html/parsoid
18940 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18941 <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>"}'/>}}}} >
18942 <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}'>
18943
18944
18945
18946 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18947 !! end
18948
18949 # Note: the current result listed for this is not what the original one was,
18950 # but the original bug was JavaScript injection, which is fixed in any case.
18951 # It's not clear that the original result listed was any more correct than the
18952 # current one. Original result:
18953 # <p>{{{|
18954 # </p>
18955 # <li class="&#124;&#124;">
18956 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18957 !!test
18958 Fuzz testing: Parser25 (T8055)
18959 !! wikitext
18960 {{{
18961 |
18962 <LI CLASS=||
18963 >
18964 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18965 !! html/php
18966 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18967 </p>
18968 !! html/parsoid
18969 <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"]}'>
18970 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18971 !! end
18972
18973 !!test
18974 Fuzz testing: URL adjacent extension (with space, clean)
18975 !! wikitext
18976 http://example.com <nowiki>junk</nowiki>
18977 !! html/php
18978 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18979 </p>
18980 !! html/parsoid
18981 <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>
18982 !! end
18983
18984 !!test
18985 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18986 !! wikitext
18987 http://example.com<nowiki>junk</nowiki>
18988 !! html/php
18989 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18990 </p>
18991 !! html/parsoid
18992 <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>
18993 !! end
18994
18995 !! test
18996 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18997 !! wikitext
18998 http://example.com<pre>junk</pre>
18999 !! html/php
19000 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19001
19002 !! html/php+tidy
19003 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19004 !! html/parsoid
19005 <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>
19006 !! end
19007
19008 !! test
19009 Fuzz testing: image with bogus manual thumbnail
19010 !! wikitext
19011 [[Image:foobar.jpg|thumbnail= ]]
19012 !! html/php
19013 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19014
19015 !! html/parsoid
19016 <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>
19017 !! end
19018
19019 # Parsoid will emit the newline literally in wt2wt; see next test case.
19020 !! test
19021 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19022 !! options
19023 parsoid=wt2html
19024 !! wikitext
19025 <pre dir="&#10;"></pre>
19026 !! html/php
19027 <pre dir="&#10;"></pre>
19028
19029 !! html/parsoid
19030 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19031 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19032 !! end
19033
19034 !! test
19035 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19036 !! options
19037 parsoid=html2wt
19038 !! html/parsoid
19039 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19040 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19041 !! wikitext
19042 <pre dir="
19043 "></pre>
19044 !! html/php
19045 <pre dir=""></pre>
19046
19047 !! end
19048
19049 !! test
19050 Templates in extension attributes are not expanded
19051 !! wikitext
19052 <pre dir="{{echo|ltr}}"></pre>
19053 !! html/php
19054 <pre dir="{{echo|ltr}}"></pre>
19055
19056 !! html/parsoid
19057 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19058 !! end
19059
19060 !! test
19061 Parsing optional HTML elements (T8171)
19062 !! options
19063 !! wikitext
19064 <table>
19065 <tr>
19066 <td> Some tabular data</td>
19067 <td> More tabular data ...
19068 <td> And yet som tabular data</td>
19069 </tr>
19070 </table>
19071 !! html
19072 <table>
19073 <tr>
19074 <td> Some tabular data</td>
19075 <td> More tabular data ...
19076 </td><td> And yet som tabular data</td>
19077 </tr>
19078 </table>
19079
19080 !! end
19081
19082 !! test
19083 Correct handling of <td>, <tr> (T8171)
19084 !! options
19085 !! wikitext
19086 <table>
19087 <tr>
19088 <td> Some tabular data</td>
19089 <td> More tabular data ...</td>
19090 <td> And yet som tabular data</td>
19091 </tr>
19092 </table>
19093 !! html
19094 <table>
19095 <tr>
19096 <td> Some tabular data</td>
19097 <td> More tabular data ...</td>
19098 <td> And yet som tabular data</td>
19099 </tr>
19100 </table>
19101
19102 !! end
19103
19104
19105 !! test
19106 Parsing crashing regression (fr:JavaScript)
19107 !! wikitext
19108 </body></x>
19109 !! html
19110 <p>&lt;/body&gt;&lt;/x&gt;
19111 </p>
19112 !! end
19113
19114 !! test
19115 Inline wiki vs wiki block nesting
19116 !! wikitext
19117 '''Bold paragraph
19118
19119 New wiki paragraph
19120 !! html
19121 <p><b>Bold paragraph</b>
19122 </p><p>New wiki paragraph
19123 </p>
19124 !! end
19125
19126 # FIXME: The current php output is documented
19127 # and desired output is the parsoid target.
19128 !! test
19129 Inline HTML vs wiki block nesting
19130 !! wikitext
19131 <b>Bold paragraph
19132
19133 New wiki paragraph
19134 !! html/php
19135 <p><b>Bold paragraph
19136 </p><p>New wiki paragraph</b>
19137 </p>
19138 !! html/parsoid
19139 <p><b>Bold paragraph</b>
19140 </p><p>New wiki paragraph
19141 </p>
19142 !! end
19143
19144 # Original result was this:
19145 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19146 # </p>
19147 # While that might be marginally more intuitive, maybe, the six-apostrophe
19148 # construct is clearly pathological and the result stated here (which is what
19149 # the parser actually does) is about as reasonable as anything.
19150 !!test
19151 Mixing markup for italics and bold
19152 !! options
19153 !! wikitext
19154 '''bold''''''bold''bolditalics'''''
19155 !! html
19156 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19157 </p>
19158 !! end
19159
19160
19161 !! article
19162 Xyzzyx
19163 !! text
19164 Article for special page transclusion test
19165 !! endarticle
19166
19167 !! test
19168 Special page transclusion
19169 !! options
19170 !! wikitext
19171 {{Special:Prefixindex/Xyzzyx}}
19172 !! html
19173 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19174 </ul>
19175
19176 !! end
19177
19178 !! test
19179 Special page transclusion twice (T7021)
19180 !! options
19181 !! wikitext
19182 {{Special:Prefixindex/Xyzzyx}}
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 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19188 </ul>
19189
19190 !! end
19191
19192 !! test
19193 Transclusion of default MediaWiki message
19194 !! wikitext
19195 {{MediaWiki:Mainpage}}
19196 !! html
19197 <p>Main Page
19198 </p>
19199 !! end
19200
19201 !! test
19202 Transclusion of nonexistent MediaWiki message
19203 !! wikitext
19204 {{MediaWiki:Mainpagexxx}}
19205 !! html
19206 <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>
19207 </p>
19208 !! end
19209
19210 !! test
19211 Transclusion of MediaWiki message with underscore
19212 !! wikitext
19213 {{MediaWiki:history_short}}
19214 !! html
19215 <p>History
19216 </p>
19217 !! end
19218
19219 !! test
19220 Transclusion of MediaWiki message with space
19221 !! wikitext
19222 {{MediaWiki:history short}}
19223 !! html
19224 <p>History
19225 </p>
19226 !! end
19227
19228 !! test
19229 Invalid header with following text
19230 !! wikitext
19231 = x = y
19232 !! html
19233 <p>= x = y
19234 </p>
19235 !! end
19236
19237
19238 !! test
19239 Section extraction test (section 0)
19240 !! options
19241 section=0
19242 !! wikitext
19243 start
19244 ==a==
19245 ===aa===
19246 ====aaa====
19247 ==b==
19248 ===ba===
19249 ===bb===
19250 ====bba====
19251 ===bc===
19252 ==c==
19253 ===ca===
19254 !! html/php
19255 start
19256 !! end
19257
19258 !! test
19259 Section extraction test (section 1)
19260 !! options
19261 section=1
19262 !! wikitext
19263 start
19264 ==a==
19265 ===aa===
19266 ====aaa====
19267 ==b==
19268 ===ba===
19269 ===bb===
19270 ====bba====
19271 ===bc===
19272 ==c==
19273 ===ca===
19274 !! html/php
19275 ==a==
19276 ===aa===
19277 ====aaa====
19278 !! end
19279
19280 !! test
19281 Section extraction test (section 2)
19282 !! options
19283 section=2
19284 !! wikitext
19285 start
19286 ==a==
19287 ===aa===
19288 ====aaa====
19289 ==b==
19290 ===ba===
19291 ===bb===
19292 ====bba====
19293 ===bc===
19294 ==c==
19295 ===ca===
19296 !! html/php
19297 ===aa===
19298 ====aaa====
19299 !! end
19300
19301 !! test
19302 Section extraction test (section 3)
19303 !! options
19304 section=3
19305 !! wikitext
19306 start
19307 ==a==
19308 ===aa===
19309 ====aaa====
19310 ==b==
19311 ===ba===
19312 ===bb===
19313 ====bba====
19314 ===bc===
19315 ==c==
19316 ===ca===
19317 !! html/php
19318 ====aaa====
19319 !! end
19320
19321 !! test
19322 Section extraction test (section 4)
19323 !! options
19324 section=4
19325 !! wikitext
19326 start
19327 ==a==
19328 ===aa===
19329 ====aaa====
19330 ==b==
19331 ===ba===
19332 ===bb===
19333 ====bba====
19334 ===bc===
19335 ==c==
19336 ===ca===
19337 !! html/php
19338 ==b==
19339 ===ba===
19340 ===bb===
19341 ====bba====
19342 ===bc===
19343 !! end
19344
19345 !! test
19346 Section extraction test (section 5)
19347 !! options
19348 section=5
19349 !! wikitext
19350 start
19351 ==a==
19352 ===aa===
19353 ====aaa====
19354 ==b==
19355 ===ba===
19356 ===bb===
19357 ====bba====
19358 ===bc===
19359 ==c==
19360 ===ca===
19361 !! html/php
19362 ===ba===
19363 !! end
19364
19365 !! test
19366 Section extraction test (section 6)
19367 !! options
19368 section=6
19369 !! wikitext
19370 start
19371 ==a==
19372 ===aa===
19373 ====aaa====
19374 ==b==
19375 ===ba===
19376 ===bb===
19377 ====bba====
19378 ===bc===
19379 ==c==
19380 ===ca===
19381 !! html/php
19382 ===bb===
19383 ====bba====
19384 !! end
19385
19386 !! test
19387 Section extraction test (section 7)
19388 !! options
19389 section=7
19390 !! wikitext
19391 start
19392 ==a==
19393 ===aa===
19394 ====aaa====
19395 ==b==
19396 ===ba===
19397 ===bb===
19398 ====bba====
19399 ===bc===
19400 ==c==
19401 ===ca===
19402 !! html/php
19403 ====bba====
19404 !! end
19405
19406 !! test
19407 Section extraction test (section 8)
19408 !! options
19409 section=8
19410 !! wikitext
19411 start
19412 ==a==
19413 ===aa===
19414 ====aaa====
19415 ==b==
19416 ===ba===
19417 ===bb===
19418 ====bba====
19419 ===bc===
19420 ==c==
19421 ===ca===
19422 !! html/php
19423 ===bc===
19424 !! end
19425
19426 !! test
19427 Section extraction test (section 9)
19428 !! options
19429 section=9
19430 !! wikitext
19431 start
19432 ==a==
19433 ===aa===
19434 ====aaa====
19435 ==b==
19436 ===ba===
19437 ===bb===
19438 ====bba====
19439 ===bc===
19440 ==c==
19441 ===ca===
19442 !! html/php
19443 ==c==
19444 ===ca===
19445 !! end
19446
19447 !! test
19448 Section extraction test (section 10)
19449 !! options
19450 section=10
19451 !! wikitext
19452 start
19453 ==a==
19454 ===aa===
19455 ====aaa====
19456 ==b==
19457 ===ba===
19458 ===bb===
19459 ====bba====
19460 ===bc===
19461 ==c==
19462 ===ca===
19463 !! html/php
19464 ===ca===
19465 !! end
19466
19467 !! test
19468 Section extraction test (nonexistent section 11)
19469 !! options
19470 section=11
19471 !! wikitext
19472 start
19473 ==a==
19474 ===aa===
19475 ====aaa====
19476 ==b==
19477 ===ba===
19478 ===bb===
19479 ====bba====
19480 ===bc===
19481 ==c==
19482 ===ca===
19483 !! html/php
19484 !! end
19485
19486 !! test
19487 Section extraction test with bogus heading (section 1)
19488 !! options
19489 section=1
19490 !! wikitext
19491 ==a==
19492 ==bogus== not a legal section
19493 ==b==
19494 !! html/php
19495 ==a==
19496 ==bogus== not a legal section
19497 !! end
19498
19499 !! test
19500 Section extraction test with bogus heading (section 2)
19501 !! options
19502 section=2
19503 !! wikitext
19504 ==a==
19505 ==bogus== not a legal section
19506 ==b==
19507 !! html/php
19508 ==b==
19509 !! end
19510
19511 !! test
19512 Section extraction test with comment after heading (section 1)
19513 !! options
19514 section=1
19515 !! wikitext
19516 ==a==
19517 ==b== <!-- -->
19518 ==c==
19519 !! html/php
19520 ==a==
19521 !! end
19522
19523 !! test
19524 Section extraction test with comment after heading (section 2)
19525 !! options
19526 section=2
19527 !! wikitext
19528 ==a==
19529 ==b== <!-- -->
19530 ==c==
19531 !! html/php
19532 ==b== <!-- -->
19533 !! end
19534
19535 !! test
19536 Section extraction test with bogus <nowiki> heading (section 1)
19537 !! options
19538 section=1
19539 !! wikitext
19540 ==a==
19541 ==bogus== <nowiki>not a legal section</nowiki>
19542 ==b==
19543 !! html/php
19544 ==a==
19545 ==bogus== <nowiki>not a legal section</nowiki>
19546 !! end
19547
19548 !! test
19549 Section extraction test with bogus <nowiki> heading (section 2)
19550 !! options
19551 section=2
19552 !! wikitext
19553 ==a==
19554 ==bogus== <nowiki>not a legal section</nowiki>
19555 ==b==
19556 !! html/php
19557 ==b==
19558 !! end
19559
19560 # Formerly testing for T4587, now resolved by the use of unmarked sections
19561 # instead of respecting commented sections
19562 !! test
19563 Section extraction prefixed by comment (section 1)
19564 !! options
19565 section=1
19566 !! wikitext
19567 <!-- -->==sec1==
19568 ==sec2==
19569 !! html/php
19570 ==sec2==
19571 !!end
19572
19573 !! test
19574 Section extraction prefixed by comment (section 2)
19575 !! options
19576 section=2
19577 !! wikitext
19578 <!-- -->==sec1==
19579 ==sec2==
19580 !! html/php
19581
19582 !!end
19583
19584 # Formerly testing for T4607, now resolved by the use of unmarked sections
19585 # instead of respecting HTML-style headings
19586 !! test
19587 Section extraction, mixed wiki and html (section 1)
19588 !! options
19589 section=1
19590 !! wikitext
19591 <h2>unmarked</h2>
19592 unmarked
19593 ==1==
19594 one
19595 ==2==
19596 two
19597 !! html/php
19598 ==1==
19599 one
19600 !! end
19601
19602 !! test
19603 Section extraction, mixed wiki and html (section 2)
19604 !! options
19605 section=2
19606 !! wikitext
19607 <h2>unmarked</h2>
19608 unmarked
19609 ==1==
19610 one
19611 ==2==
19612 two
19613 !! html/php
19614 ==2==
19615 two
19616 !! end
19617
19618
19619 # Formerly testing for T5342
19620 !! test
19621 Section extraction, heading surrounded by <noinclude>
19622 !! options
19623 section=1
19624 !! wikitext
19625 <noinclude>==unmarked==</noinclude>
19626 ==marked==
19627 !! html/php
19628 ==marked==
19629 !!end
19630
19631 # Test behavior of T21910
19632 !! test
19633 Sectiion with all-equals
19634 !! options
19635 section=2
19636 !! wikitext
19637 ===
19638 The line above must have a trailing space
19639 === <!--
19640 --> <!-- -->
19641 But just in case it doesn't...
19642 !! html/php
19643 === <!--
19644 --> <!-- -->
19645 But just in case it doesn't...
19646 !! end
19647
19648 !! test
19649 Section replacement test (section 0)
19650 !! options
19651 replace=0,"xxx"
19652 !! wikitext
19653 start
19654 ==a==
19655 ===aa===
19656 ====aaa====
19657 ==b==
19658 ===ba===
19659 ===bb===
19660 ====bba====
19661 ===bc===
19662 ==c==
19663 ===ca===
19664 !! html/php
19665 xxx
19666
19667 ==a==
19668 ===aa===
19669 ====aaa====
19670 ==b==
19671 ===ba===
19672 ===bb===
19673 ====bba====
19674 ===bc===
19675 ==c==
19676 ===ca===
19677 !! end
19678
19679 !! test
19680 Section replacement test (section 1)
19681 !! options
19682 replace=1,"xxx"
19683 !! wikitext
19684 start
19685 ==a==
19686 ===aa===
19687 ====aaa====
19688 ==b==
19689 ===ba===
19690 ===bb===
19691 ====bba====
19692 ===bc===
19693 ==c==
19694 ===ca===
19695 !! html/php
19696 start
19697 xxx
19698
19699 ==b==
19700 ===ba===
19701 ===bb===
19702 ====bba====
19703 ===bc===
19704 ==c==
19705 ===ca===
19706 !! end
19707
19708 !! test
19709 Section replacement test (section 2)
19710 !! options
19711 replace=2,"xxx"
19712 !! wikitext
19713 start
19714 ==a==
19715 ===aa===
19716 ====aaa====
19717 ==b==
19718 ===ba===
19719 ===bb===
19720 ====bba====
19721 ===bc===
19722 ==c==
19723 ===ca===
19724 !! html/php
19725 start
19726 ==a==
19727 xxx
19728
19729 ==b==
19730 ===ba===
19731 ===bb===
19732 ====bba====
19733 ===bc===
19734 ==c==
19735 ===ca===
19736 !! end
19737
19738 !! test
19739 Section replacement test (section 3)
19740 !! options
19741 replace=3,"xxx"
19742 !! wikitext
19743 start
19744 ==a==
19745 ===aa===
19746 ====aaa====
19747 ==b==
19748 ===ba===
19749 ===bb===
19750 ====bba====
19751 ===bc===
19752 ==c==
19753 ===ca===
19754 !! html/php
19755 start
19756 ==a==
19757 ===aa===
19758 xxx
19759
19760 ==b==
19761 ===ba===
19762 ===bb===
19763 ====bba====
19764 ===bc===
19765 ==c==
19766 ===ca===
19767 !! end
19768
19769 !! test
19770 Section replacement test (section 4)
19771 !! options
19772 replace=4,"xxx"
19773 !! wikitext
19774 start
19775 ==a==
19776 ===aa===
19777 ====aaa====
19778 ==b==
19779 ===ba===
19780 ===bb===
19781 ====bba====
19782 ===bc===
19783 ==c==
19784 ===ca===
19785 !! html/php
19786 start
19787 ==a==
19788 ===aa===
19789 ====aaa====
19790 xxx
19791
19792 ==c==
19793 ===ca===
19794 !! end
19795
19796 !! test
19797 Section replacement test (section 5)
19798 !! options
19799 replace=5,"xxx"
19800 !! wikitext
19801 start
19802 ==a==
19803 ===aa===
19804 ====aaa====
19805 ==b==
19806 ===ba===
19807 ===bb===
19808 ====bba====
19809 ===bc===
19810 ==c==
19811 ===ca===
19812 !! html/php
19813 start
19814 ==a==
19815 ===aa===
19816 ====aaa====
19817 ==b==
19818 xxx
19819
19820 ===bb===
19821 ====bba====
19822 ===bc===
19823 ==c==
19824 ===ca===
19825 !! end
19826
19827 !! test
19828 Section replacement test (section 6)
19829 !! options
19830 replace=6,"xxx"
19831 !! wikitext
19832 start
19833 ==a==
19834 ===aa===
19835 ====aaa====
19836 ==b==
19837 ===ba===
19838 ===bb===
19839 ====bba====
19840 ===bc===
19841 ==c==
19842 ===ca===
19843 !! html/php
19844 start
19845 ==a==
19846 ===aa===
19847 ====aaa====
19848 ==b==
19849 ===ba===
19850 xxx
19851
19852 ===bc===
19853 ==c==
19854 ===ca===
19855 !! end
19856
19857 !! test
19858 Section replacement test (section 7)
19859 !! options
19860 replace=7,"xxx"
19861 !! wikitext
19862 start
19863 ==a==
19864 ===aa===
19865 ====aaa====
19866 ==b==
19867 ===ba===
19868 ===bb===
19869 ====bba====
19870 ===bc===
19871 ==c==
19872 ===ca===
19873 !! html/php
19874 start
19875 ==a==
19876 ===aa===
19877 ====aaa====
19878 ==b==
19879 ===ba===
19880 ===bb===
19881 xxx
19882
19883 ===bc===
19884 ==c==
19885 ===ca===
19886 !! end
19887
19888 !! test
19889 Section replacement test (section 8)
19890 !! options
19891 replace=8,"xxx"
19892 !! wikitext
19893 start
19894 ==a==
19895 ===aa===
19896 ====aaa====
19897 ==b==
19898 ===ba===
19899 ===bb===
19900 ====bba====
19901 ===bc===
19902 ==c==
19903 ===ca===
19904 !! html/php
19905 start
19906 ==a==
19907 ===aa===
19908 ====aaa====
19909 ==b==
19910 ===ba===
19911 ===bb===
19912 ====bba====
19913 xxx
19914
19915 ==c==
19916 ===ca===
19917 !!end
19918
19919 !! test
19920 Section replacement test (section 9)
19921 !! options
19922 replace=9,"xxx"
19923 !! wikitext
19924 start
19925 ==a==
19926 ===aa===
19927 ====aaa====
19928 ==b==
19929 ===ba===
19930 ===bb===
19931 ====bba====
19932 ===bc===
19933 ==c==
19934 ===ca===
19935 !! html/php
19936 start
19937 ==a==
19938 ===aa===
19939 ====aaa====
19940 ==b==
19941 ===ba===
19942 ===bb===
19943 ====bba====
19944 ===bc===
19945 xxx
19946 !! end
19947
19948 !! test
19949 Section replacement test (section 10)
19950 !! options
19951 replace=10,"xxx"
19952 !! wikitext
19953 start
19954 ==a==
19955 ===aa===
19956 ====aaa====
19957 ==b==
19958 ===ba===
19959 ===bb===
19960 ====bba====
19961 ===bc===
19962 ==c==
19963 ===ca===
19964 !! html/php
19965 start
19966 ==a==
19967 ===aa===
19968 ====aaa====
19969 ==b==
19970 ===ba===
19971 ===bb===
19972 ====bba====
19973 ===bc===
19974 ==c==
19975 xxx
19976 !! end
19977
19978 !! test
19979 Section replacement test with initial whitespace (T15728)
19980 !! options
19981 replace=2,"xxx"
19982 !! wikitext
19983 Preformatted initial line
19984 ==a==
19985 ===a===
19986 !! html/php
19987 Preformatted initial line
19988 ==a==
19989 xxx
19990 !! end
19991
19992
19993 !! test
19994 Section extraction, heading followed by pre with 20 spaces (T8398)
19995 !! options
19996 section=1
19997 !! wikitext
19998 ==a==
19999 a
20000 !! html/php
20001 ==a==
20002 a
20003 !! end
20004
20005 !! test
20006 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20007 !! options
20008 section=1
20009 !! wikitext
20010 ==a==
20011 a
20012 !! html/php
20013 ==a==
20014 a
20015 !! end
20016
20017
20018 !! test
20019 Section extraction, <pre> around bogus header (T12309)
20020 !! options
20021 section=2
20022 !! wikitext
20023 == Section One ==
20024 <pre>
20025 =======
20026 </pre>
20027
20028 == Section Two ==
20029 stuff
20030 !! html/php
20031 == Section Two ==
20032 stuff
20033 !! end
20034
20035 !! test
20036 Section replacement, <pre> around bogus header (T12309)
20037 !! options
20038 replace=2,"xxx"
20039 !! wikitext
20040 == Section One ==
20041 <pre>
20042 =======
20043 </pre>
20044
20045 == Section Two ==
20046 stuff
20047 !! html/php
20048 == Section One ==
20049 <pre>
20050 =======
20051 </pre>
20052
20053 xxx
20054 !! end
20055
20056 !! test
20057 Handling of &#x0A; in URLs
20058 !! wikitext
20059 ** irc://&#x0A;a
20060 !! html/php
20061 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20062
20063 !! html/parsoid
20064 <ul><li><ul><li> <a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
20065 !! end
20066
20067 !! test
20068 Handling of %0A in URLs
20069 !! wikitext
20070 ** irc://%0Aa
20071 !! html/php
20072 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20073
20074 !! html/parsoid
20075 <ul><li><ul><li> <a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
20076 !! end
20077
20078 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20079 !! test
20080 5 quotes, code coverage +1 line
20081 !! options
20082 parsoid=wt2html
20083 !! wikitext
20084 '''''
20085 !! html/php
20086 !! html/parsoid
20087 <b><i></i></b>
20088 !! end
20089
20090 # same html as previous, but wikitext adjusted to match parsoid html2wt
20091 # note that wt2html and html2html will put the <i> before the <b>
20092 !! test
20093 5 quotes, code coverage +1 line w/ nowiki (1)
20094 !! options
20095 parsoid=wt2wt,html2wt
20096 !! wikitext
20097 '''''<nowiki/>'''''
20098 !! html/php
20099 <p><i></i>
20100 </p>
20101 !! html/parsoid
20102 <p><b><i></i></b></p>
20103 !! end
20104
20105 # same as previous, just swapping the <i> and <b>
20106 !! test
20107 5 quotes, code coverage +1 line w/ nowiki (2)
20108 !! wikitext
20109 '''''<nowiki/>'''''
20110 !! html/php
20111 <p><i></i>
20112 </p>
20113 !! html/parsoid
20114 <p><i><b></b></i></p>
20115 !! end
20116
20117 !! test
20118 Special:Search page linking.
20119 !! wikitext
20120 {{Special:search}}
20121 !! html
20122 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20123 </p>
20124 !! end
20125
20126 !! test
20127 {{!}} is a magic word
20128 !! wikitext
20129 {{!}} is a magic word there and {{!}} is still a magic word here
20130 | is not a magic word here but {{!}} is still a magic word here
20131 !! html/php
20132 <p>| is a magic word there and | is still a magic word here
20133 | is not a magic word here but | is still a magic word here
20134 </p>
20135 !! html/parsoid
20136 <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
20137 | 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>
20138 !! end
20139
20140 !! test
20141 Say the magic word
20142 !! options
20143 title=[[Parser test]]
20144 !! wikitext
20145 * {{PAGENAME}}
20146 * {{PAGENAMEE}}
20147 * {{FULLPAGENAME}}
20148 * {{FULLPAGENAMEE}}
20149 * {{BASEPAGENAME}}
20150 * {{BASEPAGENAMEE}}
20151 * {{SUBPAGENAME}}
20152 * {{SUBPAGENAMEE}}
20153 * {{ROOTPAGENAME}}
20154 * {{ROOTPAGENAMEE}}
20155 * {{TALKPAGENAME}}
20156 * {{TALKPAGENAMEE}}
20157 * {{SUBJECTPAGENAME}}
20158 * {{SUBJECTPAGENAMEE}}
20159 * {{NAMESPACEE}}
20160 * {{NAMESPACE}}
20161 * {{NAMESPACENUMBER}}
20162 * {{TALKSPACE}}
20163 * {{TALKSPACEE}}
20164 * {{SUBJECTSPACE}}
20165 * {{SUBJECTSPACEE}}
20166 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20167 !! html
20168 <ul><li> Parser test</li>
20169 <li> Parser_test</li>
20170 <li> Parser test</li>
20171 <li> Parser_test</li>
20172 <li> Parser test</li>
20173 <li> Parser_test</li>
20174 <li> Parser test</li>
20175 <li> Parser_test</li>
20176 <li> Parser test</li>
20177 <li> Parser_test</li>
20178 <li> Talk:Parser test</li>
20179 <li> Talk:Parser_test</li>
20180 <li> Parser test</li>
20181 <li> Parser_test</li>
20182 <li> </li>
20183 <li> </li>
20184 <li> 0</li>
20185 <li> Talk</li>
20186 <li> Talk</li>
20187 <li> </li>
20188 <li> </li>
20189 <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>
20190
20191 !! end
20192 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20193
20194 !! test
20195 Gallery with valid attributes
20196 !! wikitext
20197 <gallery type="123" summary="345">
20198 File:File:Foobar.jpg
20199 </gallery>
20200 !! html/php
20201 <ul class="gallery mw-gallery-traditional" type="123">
20202 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20203 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20204 <div class="gallerytext">
20205 </div>
20206 </div></li>
20207 </ul>
20208
20209 !! html/parsoid
20210 <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"}}'>
20211 <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>
20212 </ul>
20213 !! end
20214
20215 ## Parsoid thinks the "centre" here is a property, not a caption.
20216 !! test
20217 Gallery
20218 !! options
20219 parsoid={
20220 "modes": ["wt2html"],
20221 "nativeGallery": true
20222 }
20223 !! wikitext
20224 <gallery>
20225 image1.png |
20226 image2.gif|||||
20227
20228 image3|
20229 image4 |300px| centre
20230 image5.svg| http://///////
20231 [[x|xx]]]]
20232 * image6
20233 </gallery>
20234 !! html/php
20235 <ul class="gallery mw-gallery-traditional">
20236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20237 <div class="thumb" style="height: 150px;">Image1.png</div>
20238 <div class="gallerytext">
20239 </div>
20240 </div></li>
20241 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20242 <div class="thumb" style="height: 150px;">Image2.gif</div>
20243 <div class="gallerytext">
20244 </div>
20245 </div></li>
20246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20247 <div class="thumb" style="height: 150px;">Image3</div>
20248 <div class="gallerytext">
20249 </div>
20250 </div></li>
20251 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20252 <div class="thumb" style="height: 150px;">Image4</div>
20253 <div class="gallerytext">
20254 <pre>centre
20255 </pre>
20256 </div>
20257 </div></li>
20258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20259 <div class="thumb" style="height: 150px;">Image5.svg</div>
20260 <div class="gallerytext">
20261 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20262 </p>
20263 </div>
20264 </div></li>
20265 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20266 <div class="thumb" style="height: 150px;">* image6</div>
20267 <div class="gallerytext">
20268 </div>
20269 </div></li>
20270 </ul>
20271
20272 !! html/parsoid
20273 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20274 <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>
20275 <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>
20276 <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>
20277 <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>
20278 <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>
20279 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20280 </ul>
20281 !! end
20282
20283 !! test
20284 Gallery (with options, html)
20285 !! options
20286 parsoid={
20287 "modes": ["wt2html", "html2html"],
20288 "nativeGallery": true
20289 }
20290 !! wikitext
20291 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20292 File:Nonexistent.jpg|caption
20293 File:Nonexistent.jpg
20294 image:foobar.jpg|some '''caption''' [[Main Page]]
20295 image:foobar.jpg
20296 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20297 </gallery>
20298 !! html/php
20299 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20300 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20301 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20302 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20303 <div class="gallerytext">
20304 <p>caption
20305 </p>
20306 </div>
20307 </div></li>
20308 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20309 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20310 <div class="gallerytext">
20311 </div>
20312 </div></li>
20313 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20314 <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>
20315 <div class="gallerytext">
20316 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20317 </p>
20318 </div>
20319 </div></li>
20320 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20321 <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>
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="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>
20327 <div class="gallerytext">
20328 <p>blabla.
20329 </p>
20330 </div>
20331 </div></li>
20332 </ul>
20333
20334 !! html/parsoid
20335 <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":{}}'>
20336 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20337 <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>
20338 <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>
20339 <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>
20340 <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>
20341 <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>
20342 </ul>
20343 !! end
20344
20345 !! test
20346 Gallery (with options, extsrc)
20347 !! options
20348 parsoid={
20349 "nativeGallery": false
20350 }
20351 !! wikitext
20352 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20353 File:Nonexistent.jpg|caption
20354 File:Nonexistent.jpg
20355 image:foobar.jpg|some '''caption''' [[Main Page]]
20356 image:foobar.jpg
20357 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20358 </gallery>
20359 !! html/php
20360 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20361 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20362 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20363 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20364 <div class="gallerytext">
20365 <p>caption
20366 </p>
20367 </div>
20368 </div></li>
20369 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20370 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20371 <div class="gallerytext">
20372 </div>
20373 </div></li>
20374 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20375 <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>
20376 <div class="gallerytext">
20377 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20378 </p>
20379 </div>
20380 </div></li>
20381 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20382 <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>
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="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>
20388 <div class="gallerytext">
20389 <p>blabla.
20390 </p>
20391 </div>
20392 </div></li>
20393 </ul>
20394
20395 !! html/parsoid
20396 <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"}}'>
20397 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20398 <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>
20399 <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>
20400 <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>
20401 <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>
20402 <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>
20403 </ul>
20404 !! end
20405
20406 !! test
20407 Gallery (without px units)
20408 !! wikitext
20409 <gallery widths="70" heights="40">
20410 File:Foobar.jpg
20411 </gallery>
20412 !! html/php
20413 <ul class="gallery mw-gallery-traditional">
20414 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20415 <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>
20416 <div class="gallerytext">
20417 </div>
20418 </div></li>
20419 </ul>
20420
20421 !! html/parsoid
20422 <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"}}'>
20423 <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>
20424 </ul>
20425 !! end
20426
20427 !! test
20428 Gallery (with invalid units)
20429 !! wikitext
20430 <gallery widths="70em" heights="40em">
20431 File:Foobar.jpg
20432 </gallery>
20433 !! html/php
20434 <ul class="gallery mw-gallery-traditional">
20435 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20436 <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>
20437 <div class="gallerytext">
20438 </div>
20439 </div></li>
20440 </ul>
20441
20442 !! html/parsoid
20443 <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"}}'>
20444 <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>
20445 </ul>
20446 !! end
20447
20448 !! test
20449 Gallery with link that has fragment
20450 !! options
20451 parsoid={
20452 "modes": ["wt2html", "html2html"],
20453 "nativeGallery": true
20454 }
20455 !! wikitext
20456 <gallery>
20457 image:foobar.jpg|link=Main_Page
20458 image:foobar.jpg|link=Main_Page#section
20459 image:foobar.jpg|link=Main Page#section|caption
20460 </gallery>
20461 !! html/php
20462 <ul class="gallery mw-gallery-traditional">
20463 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20464 <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>
20465 <div class="gallerytext">
20466 </div>
20467 </div></li>
20468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20469 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#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>
20470 <div class="gallerytext">
20471 </div>
20472 </div></li>
20473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20474 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20475 <div class="gallerytext">
20476 <p>caption
20477 </p>
20478 </div>
20479 </div></li>
20480 </ul>
20481
20482 !! html/parsoid
20483 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20484 <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>
20485 <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>
20486 <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>
20487 </ul>
20488 !! end
20489
20490 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20491 !! test
20492 Gallery with template inside caption
20493 !! options
20494 parsoid={
20495 "nativeGallery": true
20496 }
20497 !! wikitext
20498 <gallery caption="{{echo|hi}}">
20499 File:Foobar.jpg|{{echo|ho}}
20500 </gallery>
20501 !! html/php
20502 <ul class="gallery mw-gallery-traditional">
20503 <li class='gallerycaption'>{{echo|hi}}</li>
20504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20505 <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>
20506 <div class="gallerytext">
20507 <p>ho
20508 </p>
20509 </div>
20510 </div></li>
20511 </ul>
20512
20513 !! html/parsoid
20514 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20515 <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>
20516 <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>
20517 </ul>
20518 !! end
20519
20520 !! test
20521 Gallery with wikitext inside caption
20522 !! options
20523 parsoid={
20524 "nativeGallery": true
20525 }
20526 !! wikitext
20527 <gallery>
20528 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20529 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20530 </gallery>
20531 !! html/php
20532 <ul class="gallery mw-gallery-traditional">
20533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20534 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
20535 <div class="gallerytext">
20536 <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>
20537 </p>
20538 </div>
20539 </div></li>
20540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20541 <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>
20542 <div class="gallerytext">
20543 <p>This is a test template
20544 </p>
20545 </div>
20546 </div></li>
20547 </ul>
20548
20549 !! html/parsoid
20550 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20551 <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>
20552 <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>
20553 </ul>
20554 !! end
20555
20556 !! test
20557 Gallery (with showfilename option)
20558 !! options
20559 parsoid={
20560 "nativeGallery": true
20561 }
20562 !! wikitext
20563 <gallery showfilename="">
20564 File:Nonexistent.jpg|caption
20565 File:Nonexistent.jpg
20566 File:Foobar.jpg|some '''caption''' [[Main Page]]
20567 File:Foobar.jpg
20568 </gallery>
20569 !! html/php
20570 <ul class="gallery mw-gallery-traditional">
20571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20572 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20573 <div class="gallerytext">
20574 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20575 caption
20576 </p>
20577 </div>
20578 </div></li>
20579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20580 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20581 <div class="gallerytext">
20582 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20583 </p>
20584 </div>
20585 </div></li>
20586 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20587 <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>
20588 <div class="gallerytext">
20589 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20590 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20591 </p>
20592 </div>
20593 </div></li>
20594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20595 <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>
20596 <div class="gallerytext">
20597 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20598 </p>
20599 </div>
20600 </div></li>
20601 </ul>
20602
20603 !! html/parsoid
20604 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20605 <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>
20606 <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>
20607 <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>
20608 <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>
20609 </ul>
20610 !! end
20611
20612 ## Should Parsoid be preserving these variations? See T151367
20613 !! test
20614 Gallery (with namespace-less filenames)
20615 !! options
20616 parsoid={
20617 "modes": ["wt2html", "html2html"],
20618 "nativeGallery": true
20619 }
20620 !! wikitext
20621 <gallery>
20622 File:Nonexistent.jpg
20623 Nonexistent.jpg
20624 image:foobar.jpg
20625 foobar.jpg
20626 </gallery>
20627 !! html/php
20628 <ul class="gallery mw-gallery-traditional">
20629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20630 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20631 <div class="gallerytext">
20632 </div>
20633 </div></li>
20634 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20635 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20636 <div class="gallerytext">
20637 </div>
20638 </div></li>
20639 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20640 <div class="thumb" style="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>
20641 <div class="gallerytext">
20642 </div>
20643 </div></li>
20644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20645 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20646 <div class="gallerytext">
20647 </div>
20648 </div></li>
20649 </ul>
20650
20651 !! html/parsoid
20652 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20653 <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>
20654 <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>
20655 <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>
20656 <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>
20657 </ul>
20658 !! end
20659
20660 !! test
20661 Gallery override link with wikilink (T36852)
20662 !! options
20663 parsoid={
20664 "nativeGallery": true
20665 }
20666 !! wikitext
20667 <gallery>
20668 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20669 </gallery>
20670 !! html/php
20671 <ul class="gallery mw-gallery-traditional">
20672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20673 <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>
20674 <div class="gallerytext">
20675 </div>
20676 </div></li>
20677 </ul>
20678
20679 !! html/parsoid
20680 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20681 <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>
20682 </ul>
20683 !! end
20684
20685 !! test
20686 Gallery override link with absolute external link (T36852)
20687 !! options
20688 parsoid={
20689 "nativeGallery": true
20690 }
20691 !! wikitext
20692 <gallery>
20693 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20694 </gallery>
20695 !! html/php
20696 <ul class="gallery mw-gallery-traditional">
20697 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20698 <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>
20699 <div class="gallerytext">
20700 </div>
20701 </div></li>
20702 </ul>
20703
20704 !! html/parsoid
20705 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20706 <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>
20707 </ul>
20708 !! end
20709
20710 !! test
20711 Gallery override link with absolute external link with LanguageConverter
20712 !! options
20713 language=zh
20714 !! wikitext
20715 <gallery>
20716 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20717 </gallery>
20718 !! html/php
20719 <ul class="gallery mw-gallery-traditional">
20720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20721 <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>
20722 <div class="gallerytext">
20723 <p>caption
20724 </p>
20725 </div>
20726 </div></li>
20727 </ul>
20728
20729 !! html/parsoid
20730 <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"}}'>
20731 <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>
20732 </ul>
20733 !! end
20734
20735 !! test
20736 Gallery override link with malicious javascript (T36852)
20737 !! options
20738 parsoid={
20739 "modes": ["wt2html", "html2html"],
20740 "nativeGallery": true
20741 }
20742 !! wikitext
20743 <gallery>
20744 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20745 </gallery>
20746 !! html/php
20747 <ul class="gallery mw-gallery-traditional">
20748 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20749 <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>
20750 <div class="gallerytext">
20751 </div>
20752 </div></li>
20753 </ul>
20754
20755 !! html/parsoid
20756 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20757 <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>
20758 </ul>
20759 !! end
20760
20761 # Note that parsoid uses the invalid link as a caption, PHP does not.
20762 !! test
20763 Gallery with invalid title as link (T45964)
20764 !! options
20765 parsoid={
20766 "modes": ["wt2html", "html2html"],
20767 "nativeGallery": true
20768 }
20769 !! wikitext
20770 <gallery>
20771 File:Foobar.jpg|link=<
20772 </gallery>
20773 !! html/php
20774 <ul class="gallery mw-gallery-traditional">
20775 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20776 <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>
20777 <div class="gallerytext">
20778 </div>
20779 </div></li>
20780 </ul>
20781
20782 !! html/parsoid
20783 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20784 <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>
20785 </ul>
20786 !! end
20787
20788 !! test
20789 Serialize gallery without attrs in data-mw
20790 !! options
20791 parsoid={
20792 "modes": ["html2wt"],
20793 "nativeGallery": true
20794 }
20795 !! html/parsoid
20796 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20797 <li class="gallerycaption">123</li>
20798 <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>
20799 </ul>
20800 !! wikitext
20801 <gallery caption="123">
20802 File:Test.png
20803 </gallery>
20804 !! end
20805
20806 !! test
20807 Gallery with class and style attributes
20808 !! options
20809 parsoid={
20810 "nativeGallery": true
20811 }
20812 !! wikitext
20813 <gallery class="center" style="text-align: center;">
20814 File:Foobar.jpg
20815 </gallery>
20816 !! html/php
20817 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20818 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20819 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
20820 <div class="gallerytext">
20821 </div>
20822 </div></li>
20823 </ul>
20824
20825 !! html/parsoid
20826 <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":{}}'>
20827 <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>
20828 </ul>
20829 !! end
20830
20831 !! test
20832 Gallery in slideshow mode
20833 !! options
20834 parsoid={
20835 "nativeGallery": true
20836 }
20837 !! wikitext
20838 <gallery mode="slideshow" showthumbnails="">
20839 File:Foobar.jpg
20840 </gallery>
20841 !! html/php
20842 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20843 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20844 <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>
20845 <div class="gallerytext">
20846 </div>
20847 </div></li>
20848 </ul>
20849
20850 !! html/parsoid
20851 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20852 <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>
20853 </ul>
20854 !! end
20855
20856 !! test
20857 HTML Hex character encoding (spells the word "JavaScript")
20858 !! options
20859 parsoid=wt2html,wt2wt,html2html
20860 !! wikitext
20861 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20862 !! html/php
20863 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20864 </p>
20865 !! html/parsoid
20866 <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>
20867 !! end
20868
20869 !! test
20870 HTML Hex character encoding bogus encoding (T28437 regression check)
20871 !! wikitext
20872 &#xsee;&#XSEE;
20873 !! html
20874 <p>&amp;#xsee;&amp;#XSEE;
20875 </p>
20876 !! end
20877
20878 !! test
20879 HTML Hex character encoding mixed case
20880 !! options
20881 parsoid=wt2html,wt2wt,html2html
20882 !! wikitext
20883 &#xEE;&#Xee;
20884 !! html/php
20885 <p>&#xee;&#xee;
20886 </p>
20887 !! html/parsoid
20888 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20889 !! end
20890
20891 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20892 # Note that U+000C (form feed) is not a valid XML character, so
20893 # it is banned even though allowed in HTML5.
20894 !! test
20895 Illegal character references (T106578)
20896 !! wikitext
20897 ; Null: &#00;
20898 ; FF: &#xC;
20899 ; CR: &#xD;
20900 ; Control (low): &#8;
20901 ; Control (high): &#x7F; &#x9F;
20902 ; Surrogate: &#xD83D;&#xDCA9;
20903 ; This is an okay astral character: &#x1F4A9;
20904 !! html+tidy
20905 <dl><dt> Null</dt>
20906 <dd> &amp;#00;</dd>
20907 <dt> FF</dt>
20908 <dd> &amp;#xC;</dd>
20909 <dt> CR</dt>
20910 <dd> &amp;#xD;</dd>
20911 <dt> Control (low)</dt>
20912 <dd> &amp;#8;</dd>
20913 <dt> Control (high)</dt>
20914 <dd> &amp;#x7F; &amp;#x9F;</dd>
20915 <dt> Surrogate</dt>
20916 <dd> &amp;#xD83D;&amp;#xDCA9;</dd>
20917 <dt> This is an okay astral character</dt>
20918 <dd> &#x1f4a9;</dd></dl>
20919 !! end
20920
20921 !! test
20922 __FORCETOC__ override
20923 !! wikitext
20924 __NEWSECTIONLINK__
20925 __FORCETOC__
20926 !! html/php
20927 <p><br />
20928 </p>
20929 !! end
20930
20931 !! test
20932 ISBN code coverage
20933 !! wikitext
20934 ISBN 978-0-1234-56&#x20;789
20935 !! html/php
20936 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20937 </p>
20938 !! html/parsoid
20939 <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>
20940 !! end
20941
20942 !! test
20943 ISBN followed by 5 spaces
20944 !! wikitext
20945 ISBN
20946 !! html
20947 <p>ISBN
20948 </p>
20949 !! end
20950
20951 !! test
20952 Double ISBN
20953 !! wikitext
20954 ISBN ISBN 1234567890
20955 !! html/php
20956 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20957 </p>
20958 !! html/parsoid
20959 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20960 !! end
20961
20962 # Uppercase X and lowercase x as well
20963 !! test
20964 ISBN with an X
20965 !! wikitext
20966 ISBN 3-462-04561-X
20967 ISBN 3-462-04561-x
20968 ISBN 080442957X
20969 ISBN 080442957x
20970 ISBN 978080442957X
20971 ISBN 978080442957x
20972 !! html/php
20973 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20974 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20975 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20976 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20977 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20978 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20979 </p>
20980 !! html/parsoid
20981 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20982 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20983 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20984 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20985 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20986 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20987 !! end
20988
20989 !! test
20990 ISBN with empty prefix (parsoid test)
20991 !! wikitext
20992 ISBN 1234567890
20993 !! html/php
20994 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20995 </p>
20996 !! html/parsoid
20997 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20998 !! end
20999
21000 !! test
21001 T24905: <abbr> followed by ISBN followed by </a>
21002 !! wikitext
21003 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21004 !! html/php
21005 <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>
21006 </p>
21007 !! html/parsoid
21008 <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>
21009 !! end
21010
21011 !! test
21012 Double RFC
21013 !! wikitext
21014 RFC RFC 1234
21015 !! html
21016 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21017 </p>
21018 !! end
21019
21020 !! test
21021 Double RFC with a wiki link
21022 !! wikitext
21023 RFC [[RFC 1234]]
21024 !! html
21025 <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>
21026 </p>
21027 !! end
21028
21029 !! test
21030 RFC code coverage
21031 !! wikitext
21032 RFC 983&#x20;987
21033 !! html/php
21034 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21035 </p>
21036 !! html/parsoid
21037 <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>
21038 !! end
21039
21040 !! test
21041 Centre-aligned image
21042 !! wikitext
21043 [[Image:foobar.jpg|centre]]
21044 !! html/php
21045 <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>
21046
21047 !! html/parsoid
21048 <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>
21049 !! end
21050
21051 !! test
21052 None-aligned image
21053 !! wikitext
21054 [[Image:foobar.jpg|none]]
21055 !! html/php
21056 <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>
21057
21058 !! html/parsoid
21059 <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>
21060 !! end
21061
21062 !! test
21063 Width + Height sized image (using px) (height is ignored)
21064 !! wikitext
21065 [[Image:foobar.jpg|640x480px]]
21066 !! html/php
21067 <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>
21068 </p>
21069 !! html/parsoid
21070 <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>
21071 !! end
21072
21073 !! test
21074 Width-sized image (using px, no following whitespace)
21075 !! wikitext
21076 [[Image:foobar.jpg|640px]]
21077 !! html/php
21078 <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>
21079 </p>
21080 !! html/parsoid
21081 <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>
21082 !! end
21083
21084 !! test
21085 Width-sized image (using px, with following whitespace - test regression from r39467)
21086 !! wikitext
21087 [[Image:foobar.jpg|640px ]]
21088 !! html/php
21089 <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>
21090 </p>
21091 !! html/parsoid
21092 <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>
21093 !!end
21094
21095 !! test
21096 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21097 !! wikitext
21098 [[Image:foobar.jpg| 640px]]
21099 !! html/php
21100 <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>
21101 </p>
21102 !! html/parsoid
21103 <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>
21104 !! end
21105
21106 !! test
21107 Image with page parameter
21108 !! options
21109 djvu
21110 !! wikitext
21111 [[File:LoremIpsum.djvu|page=2]]
21112 !! html/php
21113 <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>
21114 </p>
21115 !! html/parsoid
21116 <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>
21117 !! end
21118
21119 !! test
21120 Another italics / bold test
21121 !! wikitext
21122 ''' ''x'
21123 !! html
21124 <pre>'<i> </i>x'
21125 </pre>
21126 !!end
21127
21128 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21129 !! test
21130 dt/dd/dl test
21131 !! wikitext
21132 :;;;::
21133 !! html/php
21134 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21135
21136 !! html/parsoid
21137 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21138
21139 !!end
21140
21141 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21142 !! test
21143 Images with the "|" character in the comment
21144 !! wikitext
21145 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21146 !! html/php
21147 <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>
21148
21149 !! html/parsoid
21150 <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>
21151 !! end
21152
21153 !! test
21154 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21155 !! wikitext
21156 <html><script>alert(1);</script></html>
21157 !! html
21158 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21159 </p>
21160 !! end
21161
21162 !! test
21163 HTML with raw HTML ($wgRawHtml==true)
21164 !! options
21165 wgRawHtml=1
21166 !! wikitext
21167 <html><script>alert(1);</script></html>
21168 !! html/php
21169 <p><script>alert(1);</script>
21170 </p>
21171 !! end
21172
21173 !! test
21174 Parents of subpages, one level up
21175 !! options
21176 subpage title=[[Subpage test/L1/L2/L3]]
21177 !! wikitext
21178 [[../|L2]]
21179 !! html
21180 <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>
21181 </p>
21182 !! end
21183
21184
21185 !! test
21186 Parents of subpages, one level up, not named
21187 !! options
21188 subpage title=[[Subpage test/L1/L2/L3]]
21189 !! wikitext
21190 [[../]]
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)">Subpage test/L1/L2</a>
21193 </p>
21194 !! end
21195
21196
21197
21198 !! test
21199 Parents of subpages, two levels up
21200 !! options
21201 subpage title=[[Subpage test/L1/L2/L3]]
21202 !! wikitext
21203 [[../../|L1]]2
21204
21205 [[../../|L1]]l
21206 !! html
21207 <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
21208 </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>
21209 </p>
21210 !! end
21211
21212 !! test
21213 Parents of subpages, two levels up, without trailing slash or name.
21214 !! options
21215 subpage title=[[Subpage test/L1/L2/L3]]
21216 !! wikitext
21217 [[../..]]
21218 !! html
21219 <p>[[../..]]
21220 </p>
21221 !! end
21222
21223 !! test
21224 Parents of subpages, two levels up, with lots of extra trailing slashes.
21225 !! options
21226 subpage title=[[Subpage test/L1/L2/L3]]
21227 !! wikitext
21228 [[../../////]]
21229 !! html
21230 <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>
21231 </p>
21232 !! end
21233
21234 !! article
21235 Subpage test/L1/L2/L3Sibling
21236 !! text
21237 Sibling article
21238 !! endarticle
21239
21240 !! test
21241 Transclusion of a sibling page (one level up)
21242 !! options
21243 subpage title=[[Subpage test/L1/L2/L3]]
21244 !! wikitext
21245 {{../L3Sibling}}
21246 !! html
21247 <p>Sibling article
21248 </p>
21249 !! end
21250
21251 !! test
21252 Transclusion of a child page
21253 !! options
21254 subpage title=[[Subpage test/L1/L2]]
21255 !! wikitext
21256 {{/L3Sibling}}
21257 !! html
21258 <p>Sibling article
21259 </p>
21260 !! end
21261
21262 # This is wt2html only in Parsoid because we add <nowiki>
21263 # because of {{..}} and we don't expect to fix that to
21264 # eliminate the nowikis selective for {{..}} markup.
21265 !! test
21266 Non-transclusion because of too many up levels
21267 !! options
21268 subpage title=[[Subpage test/L1/L2/L3]]
21269 parsoid=wt2html
21270 !! wikitext
21271 {{../../../../More than parent}}
21272 !! html/php
21273 <p>{{../../../../More than parent}}
21274 </p>
21275 !! html/parsoid
21276 <p>{{../../../../More than parent}}</p>
21277 !! end
21278
21279 !! test
21280 Definition list code coverage
21281 !! wikitext
21282 ; title : def
21283 ; title : def
21284 ;title: def
21285 !! html/php
21286 <dl><dt> title &#160;</dt>
21287 <dd> def</dd>
21288 <dt> title&#160;</dt>
21289 <dd> def</dd>
21290 <dt>title</dt>
21291 <dd> def</dd></dl>
21292
21293 !! html/parsoid
21294 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21295 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21296 <dt>title</dt><dd> def</dd></dl>
21297 !! end
21298
21299 !! test
21300 Don't fall for the self-closing div
21301 !! wikitext
21302 <div>hello world</div/>
21303 !! html
21304 <div>hello world</div>
21305
21306 !! end
21307
21308 !! test
21309 MSGNW magic word
21310 !! wikitext
21311 {{MSGNW:msg}}
21312 !! html/php
21313 <p>&#91;&#91;:Template:Msg&#93;&#93;
21314 </p>
21315 !! end
21316
21317 !! test
21318 RAW magic word
21319 !! wikitext
21320 {{RAW:QUERTY}}
21321 !! html
21322 <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>
21323 </p>
21324 !! end
21325
21326 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21327 !! test
21328 Always escape literal '>' in output, not just after '<'
21329 !! wikitext
21330 ><>
21331 !! html
21332 <p>&gt;&lt;&gt;
21333 </p>
21334 !! end
21335
21336 !! test
21337 Template caching
21338 !! wikitext
21339 {{Test}}
21340 {{Test}}
21341 !! html
21342 <p>This is a test template
21343 This is a test template
21344 </p>
21345 !! end
21346
21347
21348 !! article
21349 MediaWiki:Fake
21350 !! text
21351 ==header==
21352 !! endarticle
21353
21354 !! test
21355 Inclusion of !userCanEdit() content
21356 !! wikitext
21357 {{MediaWiki:Fake}}
21358 !! html
21359 <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>
21360
21361 !! end
21362
21363
21364 !! test
21365 Out-of-order TOC heading levels
21366 !! wikitext
21367 ==2==
21368 ======6======
21369 ===3===
21370 =1=
21371 =====5=====
21372 ==2==
21373 !! html
21374 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21375 <ul>
21376 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21377 <ul>
21378 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21379 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21380 </ul>
21381 </li>
21382 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21383 <ul>
21384 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21385 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21386 </ul>
21387 </li>
21388 </ul>
21389 </div>
21390
21391 <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>
21392 <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>
21393 <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>
21394 <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>
21395 <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>
21396 <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>
21397
21398 !! end
21399
21400
21401 !! test
21402 ISBN with a dummy number
21403 !! wikitext
21404 ISBN ---
21405 !! html
21406 <p>ISBN ---
21407 </p>
21408 !! end
21409
21410
21411 !! test
21412 ISBN with space-delimited number
21413 !! wikitext
21414 ISBN 92 9017 032 8
21415 !! html/php
21416 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21417 </p>
21418 !! html/parsoid
21419 <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>
21420 !! end
21421
21422
21423 !! test
21424 ISBN with multiple spaces, no number
21425 !! wikitext
21426 ISBN foo
21427 !! html
21428 <p>ISBN foo
21429 </p>
21430 !! end
21431
21432
21433 !! test
21434 ISBN length
21435 !! wikitext
21436 ISBN 123456789
21437
21438 ISBN 1234567890
21439
21440 ISBN 12345678901
21441 !! html/php
21442 <p>ISBN 123456789
21443 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21444 </p><p>ISBN 12345678901
21445 </p>
21446 !! html/parsoid
21447 <p>ISBN 123456789</p>
21448
21449 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21450
21451 <p>ISBN 12345678901</p>
21452 !! end
21453
21454
21455 !! test
21456 ISBN with trailing year (T9110)
21457 !! wikitext
21458 ISBN 1-234-56789-0 - 2006
21459
21460 ISBN 1 234 56789 0 - 2006
21461 !! html/php
21462 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21463 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21464 </p>
21465 !! html/parsoid
21466 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21467
21468 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21469 !! end
21470
21471
21472 !! test
21473 anchorencode
21474 !! config
21475 wgFragmentMode=[ 'html5', 'legacy' ]
21476 !! wikitext
21477 {{anchorencode:foo bar©#%n}}
21478 !! html/php
21479 <p>foo_bar©#%n
21480 </p>
21481 !! html/parsoid
21482 <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>
21483 !! end
21484
21485 !! test
21486 anchorencode (legacy)
21487 !! config
21488 wgFragmentMode=[ 'legacy' ]
21489 !! wikitext
21490 {{anchorencode:foo bar©#%n}}
21491 !! html/php
21492 <p>foo_bar.C2.A9.23.25n
21493 </p>
21494 !! end
21495
21496 !! test
21497 anchorencode trims spaces
21498 !! config
21499 wgFragmentMode=[ 'html5', 'legacy' ]
21500 !! wikitext
21501 {{anchorencode: __pretty__please__}}
21502 !! html/php
21503 <p>pretty_please
21504 </p>
21505 !! html/parsoid
21506 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21507 !! end
21508
21509 !! test
21510 anchorencode deals with links
21511 !! config
21512 wgFragmentMode=[ 'html5', 'legacy' ]
21513 !! wikitext
21514 {{anchorencode: [[hello|world]] [[hi]]}}
21515 !! html/php
21516 <p>world_hi
21517 </p>
21518 !! html/parsoid
21519 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21520 !! end
21521
21522 !! test
21523 anchorencode deals with templates
21524 !! config
21525 wgFragmentMode=[ 'html5', 'legacy' ]
21526 !! wikitext
21527 {{anchorencode: {{Foo}} x}}
21528 !! html/php
21529 <p>FOO_x
21530 </p>
21531 !! html/parsoid
21532 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21533 !! end
21534
21535 !! test
21536 anchorencode encodes like the TOC generator: (T20431)
21537 !! config
21538 wgFragmentMode=[ 'html5', 'legacy' ]
21539 !! wikitext
21540 === _ +:.3A%3A _ &&amp;]] x ===
21541 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21542 __NOEDITSECTION__
21543 !! html/php
21544 <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>
21545 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21546 </p>
21547 !! html/parsoid
21548 <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>
21549 <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>
21550 <meta property="mw:PageProp/noeditsection"/>
21551 !! end
21552
21553 !! test
21554 anchorencode encodes like the TOC generator: (T20431) (legacy)
21555 !! config
21556 wgFragmentMode=[ 'legacy' ]
21557 !! wikitext
21558 === _ +:.3A%3A&&amp;]] ===
21559 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21560 __NOEDITSECTION__
21561 !! html/php
21562 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21563 <p>.2B:.3A.253A.26.26.5D.5D
21564 </p>
21565 !! end
21566
21567 !! test
21568 T8200: blockquotes and paragraph formatting
21569 !! wikitext
21570 <blockquote>
21571 foo
21572 </blockquote>
21573
21574 bar
21575
21576 baz
21577 !! html
21578 <blockquote>
21579 <p>foo
21580 </p>
21581 </blockquote>
21582 <p>bar
21583 </p>
21584 <pre>baz
21585 </pre>
21586 !! end
21587
21588 !! test
21589 T10293: Use of center tag ruins paragraph formatting
21590 !! wikitext
21591 <center>
21592 foo
21593 </center>
21594
21595 bar
21596
21597 baz
21598 !! html
21599 <center>
21600 <p>foo
21601 </p>
21602 </center>
21603 <p>bar
21604 </p>
21605 <pre>baz
21606 </pre>
21607 !! end
21608
21609 !!test
21610 Parsing of overlapping (improperly nested) inline html tags
21611 !! wikitext
21612 <span><s>x</span></s>
21613 !! html/php
21614 <p><span><s>x&lt;/span&gt;</s></span>
21615 </p>
21616 !! html/parsoid
21617 <p><span><s>x</s></span>
21618 </p>
21619 !!end
21620
21621 ###
21622 ### Language variants related tests
21623 ###
21624
21625 # Parsoid does not mark self-links.
21626 # Parsoid does not convert links; PHP will do any necessary redirects.
21627
21628 !! test
21629 Self-link in language variants
21630 !! options
21631 title=[[Dunav]] language=sr
21632 !! wikitext
21633 Both [[Dunav]] and [[Дунав]] are names for this river.
21634 !! html/php
21635 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21636 </p>
21637 !! html/parsoid
21638 <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>
21639 !! end
21640
21641 !! article
21642 Дуна
21643 !! text
21644 content
21645 !! endarticle
21646
21647 !! test
21648 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21649 !! options
21650 title=[[Duna]] language=sr
21651 !! wikitext
21652 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21653 !! html/php
21654 <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.
21655 </p>
21656 !! html/parsoid
21657 <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>
21658 !! end
21659
21660 !! test
21661 Link to a section of a variant of this title shouldn't be parsed as self-link
21662 !! options
21663 title=[[Duna]] language=sr
21664 !! wikitext
21665 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21666 !! html/php
21667 <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.
21668 </p>
21669 !! html/parsoid
21670 <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>
21671 !! end
21672
21673 !! test
21674 Link to pages in language variants
21675 !! options
21676 language=sr
21677 !! wikitext
21678 Main Page can be written as [[Маин Паге]]
21679 !! html/php
21680 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21681 </p>
21682 !! html/parsoid
21683 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21684 !! end
21685
21686
21687 !! test
21688 Multiple links to pages in language variants
21689 !! options
21690 language=sr
21691 !! wikitext
21692 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21693 !! html/php
21694 <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>.
21695 </p>
21696 !! html/parsoid
21697 <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>
21698 !! end
21699
21700
21701 !! test
21702 Simple template in language variants
21703 !! options
21704 language=sr
21705 !! wikitext
21706 {{тест}}
21707 !! html/php
21708 <p>This is a test template
21709 </p>
21710 !! end
21711
21712
21713 !! test
21714 Template with explicit namespace in language variants
21715 !! options
21716 language=sr
21717 !! wikitext
21718 {{Template:тест}}
21719 !! html/php
21720 <p>This is a test template
21721 </p>
21722 !! end
21723
21724
21725 !! test
21726 Basic test for template parameter in language variants
21727 !! options
21728 language=sr
21729 !! wikitext
21730 {{парамтест|param=foo}}
21731 !! html/php
21732 <p>This is a test template with parameter foo
21733 </p>
21734 !! end
21735
21736 !! test
21737 Simple category in language variants
21738 !! options
21739 language=sr cat
21740 !! wikitext
21741 [[Category:МедиаWики Усер'с Гуиде]]
21742 !! html/php
21743 cat=МедиаWики_Усер'с_Гуиде sort=
21744 !! html/parsoid
21745 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21746 !! end
21747
21748 !! article
21749 Category:分类
21750 !! text
21751 blah
21752 !! endarticle
21753
21754 !! article
21755 Category:分類
21756 !! text
21757 blah
21758 !! endarticle
21759
21760 ## We used to, but no longer wt2wt this test since the default serializer
21761 ## will normalize all categories to serialize on their own line.
21762 ## This wikitext usage is going to be fairly uncommon in production and
21763 ## selser will take care of preserving formatting in those scenarios.
21764 !! test
21765 Don't convert blue categorylinks to another variant (T35210)
21766 !! options
21767 cat
21768 language=zh
21769 parsoid=wt2html
21770 !! wikitext
21771 [[A]][[Category:分类]]
21772 !! html/php
21773 cat=分类 sort=
21774 !! html/parsoid
21775 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21776 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21777 !! end
21778
21779 !! test
21780 Stripping -{}- tags (language variants)
21781 !! options
21782 language=sr
21783 !! wikitext
21784 Latin proverb: -{Ne nuntium necare}-
21785 !! html/php
21786 <p>Latin proverb: Ne nuntium necare
21787 </p>
21788 !! html/parsoid
21789 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21790 !! end
21791
21792
21793 !! test
21794 Prevent conversion with -{}- tags (language variants)
21795 !! options
21796 language=sr variant=sr-ec
21797 !! wikitext
21798 Latinski: -{Ne nuntium necare}-
21799 !! html/php
21800 <p>Латински: Ne nuntium necare
21801 </p>
21802 !! html/parsoid
21803 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21804 !! end
21805
21806
21807 !! test
21808 Prevent conversion of text with -{}- tags (language variants)
21809 !! options
21810 language=sr variant=sr-ec
21811 !! wikitext
21812 Latinski: -{Ne nuntium necare}-
21813 !! html/php
21814 <p>Латински: Ne nuntium necare
21815 </p>
21816 !! html/parsoid
21817 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21818 !! end
21819
21820
21821 !! test
21822 Prevent conversion of links with -{}- tags (language variants)
21823 !! options
21824 language=sr variant=sr-ec
21825 !! wikitext
21826 -{[[Main Page]]}-
21827 !! html/php
21828 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21829 </p>
21830 !! html/parsoid
21831 <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>
21832 !! end
21833
21834
21835 !! test
21836 -{}- tags within headlines (within html for parserConvert())
21837 !! config
21838 wgFragmentMode=[ 'html5', 'legacy' ]
21839 !! options
21840 language=sr variant=sr-ec
21841 !! wikitext
21842 == -{Naslov}- ==
21843
21844 Note that even an unprotected headline ID is not affected by language
21845 conversion:
21846
21847 == Latinski ==
21848 !! html/php
21849 <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>
21850 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21851 цонверсион:
21852 </p>
21853 <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>
21854
21855 !! html/parsoid
21856 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span> </h2>
21857
21858 <p>Note that even an unprotected headline ID is not affected by language
21859 conversion:</p>
21860
21861 <h2 id="Latinski">Latinski</h2>
21862 !! end
21863
21864 !! test
21865 Explicit definition of language variant alternatives
21866 !! options
21867 language=zh variant=zh-tw
21868 !! wikitext
21869 -{zh:China;zh-tw:Taiwan}-, not China
21870 !! html/php
21871 <p>Taiwan, not China
21872 </p>
21873 !! html/parsoid
21874 <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>
21875 !! end
21876
21877 !! test
21878 Filter syntax for language variants
21879 !! options
21880 language=zh variant=zh-tw
21881 !! wikitext
21882 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21883 !! html/php
21884 <p>fooblog, WEBJOURNAL, WEBLOGquux
21885 </p>
21886 !! html/parsoid
21887 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21888 !! end
21889
21890 # Note that Parsoid post-processing for language variants needs to
21891 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21892 !! test
21893 Conversion around HTML tags
21894 !! options
21895 language=sr variant=sr-ec
21896 !! wikitext
21897 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21898 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21899 !! html/php
21900 <p>
21901 <span title="ЛаCтин">ски</span>
21902 </p>
21903 !! html/parsoid
21904 <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"}]}'/>
21905 <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>
21906 !! end
21907
21908 !! test
21909 Explicit session-wise two-way language variant mapping (A flag and - flag)
21910 !! options
21911 language=zh variant=zh-tw
21912 !! wikitext
21913 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21914
21915 Taiwan is not China.
21916
21917 But -{A|zh:China; zh-tw:Taiwan}- is China,
21918
21919 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21920
21921 and -{China}- is China.
21922 !! html/php
21923 <p>This is Taiwan, but we'll forget that now.
21924 </p><p>Taiwan is not China.
21925 </p><p>But Taiwan is Taiwan,
21926 </p><p>(This should be stripped!)
21927 </p><p>and China is China.
21928 </p>
21929 !! html/parsoid
21930 <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>
21931 <p>Taiwan is not China.</p>
21932 <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>
21933 <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>
21934 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21935 !! end
21936
21937 !! test
21938 Explicit session-wise one-way language variant mapping (A flag and - flag)
21939 !! options
21940 language=zh variant=zh-tw
21941 !! wikitext
21942 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21943
21944 COUNTRY is China or Taiwan.
21945
21946 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21947
21948 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21949
21950 and -{COUNTRY}- is COUNTRY.
21951 !! html/php
21952 <p>This is Taiwan, but we'll forget that now.
21953 </p><p>COUNTRY is China or Taiwan.
21954 </p><p>But Taiwan is Taiwan,
21955 </p><p>(This should be stripped!)
21956 </p><p>and COUNTRY is COUNTRY.
21957 </p>
21958 !! html/parsoid
21959 <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>
21960 <p>COUNTRY is China or Taiwan.</p>
21961 <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>
21962 <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>
21963 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21964 !! end
21965
21966 !! test
21967 Explicit session-wise two-way language variant mapping (H flag for hide)
21968 !! options
21969 language=zh variant=zh-tw
21970 !! wikitext
21971 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21972
21973 Taiwan is China.
21974 !! html/php
21975 <p>(This should be stripped!)
21976 </p><p>Taiwan is Taiwan.
21977 </p>
21978 !! html/parsoid
21979 <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>
21980 <p>Taiwan is China.</p>
21981 !! end
21982
21983 !! test
21984 Explicit session-wise one-way language variant mapping (H flag for hide)
21985 !! options
21986 language=zh variant=zh-tw
21987 !! wikitext
21988 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21989
21990 COUNTRY is Taiwan or China.
21991 !! html/php
21992 <p>(This should be stripped!)
21993 </p><p>Taiwan is Taiwan or China.
21994 </p>
21995 !! html/parsoid
21996 <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>
21997 <p>COUNTRY is Taiwan or China.</p>
21998 !! end
21999
22000 ## Note that parsoid test runner does not support 'showtitle' option.
22001 !! test
22002 Adding explicit conversion rule for title (T flag)
22003 !! options
22004 language=zh variant=zh-tw showtitle
22005 !! wikitext
22006 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22007
22008 Taiwan is China.
22009 !! html/php
22010 Taiwan
22011 <p>Should be stripped!
22012 </p><p>Taiwan is China.
22013 </p>
22014 !! html/parsoid
22015 <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>
22016 <p>Taiwan is China.</p>
22017 !! end
22018
22019 !! test
22020 Code coverage: T combined with H flag
22021 !! options
22022 language=zh variant=zh-tw showtitle
22023 !! wikitext
22024 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22025
22026 Taiwan is China.
22027 !! html/php
22028 Taiwan
22029 <p>Should be stripped!
22030 </p><p>Taiwan is Taiwan.
22031 </p>
22032 !! html/parsoid
22033 <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>
22034 <p>Taiwan is China.</p>
22035 !! end
22036
22037 !! test
22038 Code coverage: T with no variants
22039 !! options
22040 language=zh variant=zh-tw showtitle
22041 !! wikitext
22042 -{H|zh:China; zh-tw:Taiwan}-
22043 Taiwan is China.-{T|Taiwan is China}-
22044 !! html/php
22045 Taiwan is China
22046 <p>
22047 Taiwan is Taiwan.
22048 </p>
22049 !! html/parsoid
22050 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22051 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22052 !! end
22053
22054 !! test
22055 Code coverage: rules with no variants
22056 !! options
22057 language=zh variant=zh-tw
22058 !! wikitext
22059 -{H|zh:China; zh-tw:Taiwan}-
22060 Taiwan is China.
22061 -{H|China}-
22062 Taiwan is China.
22063 !! html/php
22064 <p>
22065 Taiwan is Taiwan.
22066
22067 Taiwan is China.
22068 </p>
22069 !! html/parsoid
22070 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22071 Taiwan is China.
22072 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22073 Taiwan is China.</p>
22074 !! end
22075
22076
22077 !! test
22078 Code coverage: D flag for conversion rule
22079 !! options
22080 language=zh variant=zh-tw
22081 !! wikitext
22082 -{D|zh-cn:XA; zh-tw:YA}-
22083 -{A;D|zh-cn:XB; zh-tw:YB}-
22084 -{D;H|zh-cn:XC; zh-tw:YC}-
22085
22086 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22087
22088 -{D|0=>zh-tw:1}-
22089 -{A;D|2=>zh-tw:3}-
22090 -{D;H|4=>zh-tw:5}-
22091
22092 XA XB XC YA YB YC FOO BAR BAT 012345
22093 !! html/php
22094 <p>大陆:XA;台灣:YA;
22095
22096 大陆:XC;台灣:YC;
22097 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22098 </p><p>0⇒台灣:1;
22099
22100 4⇒台灣:5;
22101 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22102 </p>
22103 !! html/parsoid
22104 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22105 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22106 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22107 <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>
22108 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22109 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22110 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22111 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22112 !! end
22113
22114 !! test
22115 Code coverage: N flag for conversion rule
22116 !! options
22117 language=zh variant=zh-cn
22118 !! wikitext
22119 -{N|zh-cn}-
22120
22121 -{N|zh-tw}-
22122
22123 -{N|sr-ec}-
22124 !! html/php
22125 <p>大陆
22126 </p><p>台灣
22127 </p><p>српски (ћирилица)‎
22128 </p>
22129 !! html/parsoid
22130 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22131 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22132 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22133 !! end
22134
22135 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22136 !! test
22137 Code coverage: N flag for conversion rule (wt2html only)
22138 !! options
22139 language=zh variant=zh-cn
22140 parsoid=wt2html,html2html
22141 !! wikitext
22142 -{D;N|en}-
22143 !! html/php
22144 <p>English
22145 </p>
22146 !! html/parsoid
22147 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22148 !! end
22149
22150 !! test
22151 Testing that changing the language variant here in the tests actually works
22152 !! options
22153 language=zh variant=zh showtitle
22154 !! wikitext
22155 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22156 !! html/php
22157 China
22158 <p>Should be stripped!
22159 </p>
22160 !! html/parsoid
22161 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22162 !! end
22163
22164 !! test
22165 Recursive conversion of alt and title attrs shouldn't clear converter state
22166 !! options
22167 language=zh variant=zh-cn
22168 showtitle
22169 !! wikitext
22170 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22171 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22172 !! html/php
22173 China
22174 <p>
22175 Should be stripped<span title="Exclamation">!</span>
22176 </p>
22177 !! html/parsoid
22178 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22179 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>
22180 !! end
22181
22182 !! test
22183 T26072: more test on conversion rule for title
22184 !! options
22185 language=zh variant=zh-tw showtitle
22186 !! wikitext
22187 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22188
22189 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22190 !! html/php
22191 Taiwan
22192 <p>This should be stripped!
22193 </p><p>This won't take interferes with the title rule.
22194 </p>
22195 !! html/parsoid
22196 <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>
22197 <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>
22198 !! end
22199
22200 !! test
22201 Partly disable title conversion if variant == main language code
22202 !! options
22203 language=zh variant=zh title=[[ZH]] showtitle
22204 !! wikitext
22205 -{T|zh-cn:CN;zh-tw:TW}-
22206 !! html/php
22207 ZH
22208 <p>
22209 </p>
22210 !! html/parsoid
22211 <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>
22212 !! end
22213
22214 !! test
22215 Partly disable title conversion if variant == main language code, more
22216 !! options
22217 language=zh variant=zh title=[[ZH]] showtitle
22218 !! wikitext
22219 -{T|TW}-
22220 !! html/php
22221 ZH
22222 <p>
22223 </p>
22224 !! html/parsoid
22225 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22226 !! end
22227
22228 !! test
22229 Raw output of variant escape tags (R flag)
22230 !! options
22231 language=zh variant=zh-tw
22232 !! wikitext
22233 Raw: -{R|zh:China;zh-tw:Taiwan}-
22234 !! html/php
22235 <p>Raw: zh:China;zh-tw:Taiwan
22236 </p>
22237 !! html/parsoid
22238 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22239 !! end
22240
22241 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22242 !! test
22243 Raw output of variant escape tags (R flag) (wt2html only)
22244 !! options
22245 language=zh variant=zh-tw
22246 parsoid=wt2html,html2html
22247 !! wikitext
22248 -{Variant}- -{D|syntax}- -{D;R|options}-
22249 !! html/php
22250 <p>Variant syntax options
22251 </p>
22252 !! html/parsoid
22253 <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>
22254 !! end
22255
22256 !! test
22257 Nested markup inside raw output of variant escape tags (R flag)
22258 !! options
22259 language=zh variant=zh-tw
22260 !! wikitext
22261 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22262 !! html/php
22263 <p>Nested raw: nested Taiwan nested
22264 </p>
22265 !! html/parsoid
22266 <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>
22267 !! end
22268
22269 !! test
22270 Nested markup and spaces inside raw output of variant escape tags (R flag)
22271 !! options
22272 language=zh variant=zh-tw
22273 !! wikitext
22274 X-{ outer -{ inner }- outer }-X
22275 !! html/php
22276 <p>X outer inner outer X
22277 </p>
22278 !! html/parsoid
22279 <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>
22280 !! end
22281
22282 !! test
22283 Templates inside raw output of variant escape tags (R flag)
22284 !! options
22285 language=zh variant=zh-tw
22286 !! wikitext
22287 Nested raw: -{R|nested {{echo|hi}} templates}-
22288 !! html/php
22289 <p>Nested raw: nested hi templates
22290 </p>
22291 !! html/parsoid
22292 <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>
22293 !! end
22294
22295 !! test
22296 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22297 !! options
22298 language=zh variant=zh-cn
22299 !! wikitext
22300 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22301 !! html/php
22302 <p>0
22303 </p>
22304 !! html/parsoid
22305 <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>
22306 !! end
22307
22308 !! test
22309 Conversion rules from [numeric-only string] to [something else] (T48634)
22310 !! options
22311 language=zh variant=zh-cn
22312 !! wikitext
22313 -{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
22314 !! html/php
22315 <p>D12345EE12345
22316 </p>
22317 !! html/parsoid
22318 <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>
22319 !! end
22320
22321 !! test
22322 Two-way converter rule entries with an empty value should be ignored (T53551)
22323 !! options
22324 language=zh variant=zh-cn
22325 !! wikitext
22326 -{H|zh-cn:foo;zh-tw:;}-foobar
22327 !! html/php
22328 <p>foobar
22329 </p>
22330 !! html/parsoid
22331 <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>
22332 !! end
22333
22334 !! test
22335 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22336 !! options
22337 language=zh variant=zh-cn
22338 !! wikitext
22339 -{H|=>zh-cn:foo;}-foobar
22340 !! html/php
22341 <p>foobar
22342 </p>
22343 !! html/parsoid
22344 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22345 !! end
22346
22347 !! test
22348 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22349 !! options
22350 language=zh variant=zh-cn
22351 !! wikitext
22352 -{H|}-foobar
22353 !! html/php
22354 <p>foobar
22355 </p>
22356 !! html/parsoid
22357 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22358 !! end
22359
22360 !! test
22361 Nested using of manual convert syntax
22362 !! options
22363 language=zh variant=zh-hk
22364 !! wikitext
22365 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22366 !! html/php
22367 <p>Nested: Hello Hong Kong!
22368 </p>
22369 !! html/parsoid
22370 <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>
22371 !! end
22372
22373 !! test
22374 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22375 !! options
22376 language=zh variant=zh-cn
22377 !! wikitext
22378 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22379 !! html/php
22380 <p><span title="X">A</span>
22381 </p>
22382 !! html/parsoid
22383 <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>
22384 !! end
22385
22386 !! test
22387 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22388 !! options
22389 language=zh variant=zh-cn
22390 !! wikitext
22391 -{<span title="-{X}-">A</span>}-
22392 !! html/php+disabled
22393 <p><span title="X">A</span>
22394 </p>
22395 !! html/parsoid
22396 <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>
22397 !! end
22398
22399 # Parsoid and PHP disagree on how to parse this example: Parsoid
22400 # insists that the content of a language converter element be a valid
22401 # DOM fragment or attribute string
22402 !! test
22403 Language converter markup with block content
22404 !! options
22405 language=zh variant=zh-cn
22406 !! wikitext
22407 <span>a-{b<div>c}-d
22408
22409 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22410
22411 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22412 !! html/php+tidy
22413 <span>ab<div>cd
22414 <span>ab<div>cd
22415 <span>ad
22416 </span></div></span></div></span>
22417 !! html/parsoid
22418 <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>
22419
22420 <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>
22421
22422 <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>
22423 !! end
22424
22425 !! test
22426 LanguageConverter selser (1)
22427 !! options
22428 language=zh variant=zh-cn
22429 parsoid={
22430 "modes": ["wt2wt", "selser"],
22431 "changes": [
22432 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22433 ]
22434 }
22435 !! wikitext
22436 -{raw}-
22437 !! wikitext/edited
22438 -{edited}-
22439 !! end
22440
22441 !! test
22442 LanguageConverter selser (2)
22443 !! options
22444 language=zh variant=zh-cn
22445 parsoid={
22446 "modes": ["wt2wt", "selser"],
22447 "changes": [
22448 ["span[class='x']", "contents", "text", "-{foo}-"],
22449 ["a", "contents", "text", "-{"],
22450 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22451 ]
22452 }
22453 !! wikitext
22454 <span class="x">TEXT1</span>
22455 [http://example.com TEXT2]
22456 [[Foo|TEXT3]]
22457 {{echo|TEXT4}}
22458 !! wikitext/edited
22459 <span class="x"><nowiki>-{foo}-</nowiki></span>
22460 [http://example.com -{]
22461 [[Foo|<nowiki>-{</nowiki>]]
22462 {{1x|<nowiki>-{</nowiki>}}
22463 !! end
22464
22465 # Tests LanguageVariantText in ConstrainedText
22466 !! test
22467 LanguageConverter selser (3)
22468 !! options
22469 language=zh variant=zh-cn
22470 parsoid={
22471 "modes": ["wt2wt", "selser"],
22472 "changes": [
22473 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22474 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22475 ]
22476 }
22477 !! wikitext
22478 {|
22479 |-
22480 |<span>Foo</span>
22481 |}
22482 !! wikitext/edited
22483 {|
22484 |-
22485 |<nowiki/>-{edited}-
22486 |}
22487 !! end
22488
22489 # Tests LanguageVariantText._fromSelSer
22490 !! test
22491 LanguageConverter selser (4)
22492 !! options
22493 language=zh variant=zh-cn
22494 parsoid={
22495 "modes": ["wt2wt", "selser"],
22496 "changes": [
22497 ["td > span.x", "remove"]
22498 ]
22499 }
22500 !! wikitext
22501 {|
22502 |-
22503 |<span class="x">Foo</span>-{Bar}-
22504 ||<span class="x">Foo</span>-{Bar}-
22505 |}
22506 !! wikitext/edited
22507 {|
22508 |-
22509 |<nowiki/>-{Bar}-
22510 ||-{Bar}-
22511 |}
22512 !! end
22513
22514 # Since Parsoid is starting to emit canonical wikitext for links,
22515 # [http://example.com http://example.com] will not RT back to that
22516 # form anymore.
22517 # Parsoid does not language-convert links (it is done in a
22518 # post-processing step)
22519 !! test
22520 Proper conversion of text in external links
22521 !! options
22522 language=sr variant=sr-ec
22523 parsoid=wt2html
22524 !! wikitext
22525 http://www.google.com
22526 gopher://www.google.com
22527 [http://www.google.com http://www.google.com]
22528 [gopher://www.google.com gopher://www.google.com]
22529 [https://www.google.com irc://www.google.com]
22530 [ftp://www.google.com www.google.com/ftp://dir]
22531 [//www.google.com www.google.com]
22532 !! html/php
22533 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22534 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22535 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22536 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22537 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22538 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22539 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22540 </p>
22541 !! html/parsoid
22542 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22543 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22544 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22545 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22546 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22547 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22548 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22549 !! end
22550
22551 !! test
22552 Do not convert roman numbers to language variants
22553 !! options
22554 language=sr variant=sr-ec
22555 !! wikitext
22556 Fridrih IV je car.
22557 !! html/php
22558 <p>Фридрих IV је цар.
22559 </p>
22560 !! html/parsoid
22561 <p>Fridrih IV je car.</p>
22562 !! end
22563
22564 !! test
22565 Unclosed language converter markup "-{"
22566 !! options
22567 language=sr
22568 !! wikitext
22569 -{T|hello
22570 !! html
22571 <p>-{T|hello
22572 </p>
22573 !! end
22574
22575 !! test
22576 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22577 !! options
22578 language=sr
22579 !! wikitext
22580 -{R|=&gt;}-
22581 !! html/php
22582 <p>=&gt;
22583 </p>
22584 !! html/parsoid
22585 <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>
22586 !!end
22587
22588 !! test
22589 Don't break link parsing if language converter markup is in the caption.
22590 !! options
22591 language=sr variant=sr-ec
22592 !! wikitext
22593 [[Main Page|-{R|main page}-]]
22594 !! html/php
22595 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22596 </p>
22597 !! html/parsoid
22598 <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>
22599 !! end
22600
22601 !! test
22602 T146304: Don't break template parsing if language converter markup is in the parameter.
22603 !! options
22604 language=sr variant=sr-ec
22605 !! wikitext
22606 {{echo|-{R|foo}-}}
22607 !! html/php
22608 <p>foo
22609 </p>
22610 !! html/parsoid
22611 <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>
22612 !! end
22613
22614 !! test
22615 T146305: Don't break image parsing if language converter markup is in the caption.
22616 !! options
22617 language=sr
22618 !! wikitext
22619 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22620 !! html/php
22621 <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>
22622
22623 !! html/parsoid
22624 <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>
22625 !! end
22626
22627 !! test
22628 T146305: Don't break image parsing if nested language converter markup is in the caption.
22629 !! options
22630 language=zh variant=zh-cn
22631 !! wikitext
22632 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22633 !! html/php
22634 <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>
22635
22636 !! html/parsoid
22637 <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>
22638 !! end
22639
22640 # XXX html2wt disabled because rich markup in alt is not preserved.
22641 !! test
22642 Don't break gallery if language converter markup is inside.
22643 !! options
22644 language=zh
22645 !! wikitext
22646 <gallery>
22647 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22648 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22649 </gallery>
22650 !! html/php
22651 <ul class="gallery mw-gallery-traditional">
22652 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22653 <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>
22654 <div class="gallerytext">
22655 <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>
22656 </p>
22657 </div>
22658 </div></li>
22659 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22660 <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>
22661 <div class="gallerytext">
22662 <p>This is a test template
22663 </p>
22664 </div>
22665 </div></li>
22666 </ul>
22667
22668 !! html/parsoid
22669 <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"}}'>
22670 <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>
22671 <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>
22672 </ul>
22673 !! end
22674
22675 !! test
22676 T153135: Don't break list handling if language converter markup is in the item.
22677 !! options
22678 language=zh variant=zh-cn
22679 !! wikitext
22680 ;-{zh-cn:AAA;zh-tw:BBB}-
22681 ;-{R|foo:bar}-
22682 !! html/php
22683 <dl><dt>AAA</dt>
22684 <dt>foo:bar</dt></dl>
22685
22686 !! html/parsoid
22687 <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>
22688 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22689 </dl>
22690 !! end
22691
22692 // Note that parsoid does not protect colons unless language converter
22693 // markup is properly nested, because it is a backtracking parser.
22694 !! test
22695 T153135: Unclosed markup in definition list (code coverage)
22696 !! options
22697 language=zh variant=zh-cn
22698 !! wikitext
22699 ;<b>foo:bar
22700 ;-{zh-cn:AAA
22701 !! html/php+tidy
22702 <dl><dt><b>foo:bar</b></dt><b>
22703 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22704 </b></p>
22705 !! html/parsoid
22706 <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}'>
22707 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22708 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22709 </b></dl>
22710 !! end
22711
22712 !! test
22713 T153135: Nested language converter markup in definition list (code coverage)
22714 !! options
22715 language=zh variant=zh-cn
22716 !! wikitext
22717 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22718 !! html/php
22719 <dl><dt>AAA foo:bar bat:baz</dt>
22720 <dd>def</dd></dl>
22721
22722 !! html/parsoid
22723 <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>
22724 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22725 </dl>
22726 !! end
22727
22728 # html2wt mode disabled due to <nowiki> insertion.
22729 !! test
22730 T153140: Don't break table handling if language converter markup is in the cell.
22731 !! options
22732 language=sr variant=sr-ec
22733 parsoid=wt2html,wt2wt,html2html
22734 !! wikitext
22735 {|
22736 |-
22737 | -{R|B}-
22738 |}
22739 !! html/php
22740 <table>
22741
22742 <tr>
22743 <td> B
22744 </td></tr></table>
22745
22746 !! html/parsoid
22747 <table>
22748 <tbody>
22749 <tr>
22750 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22751 </tr>
22752 </tbody>
22753 </table>
22754 !! end
22755
22756 !! test
22757 Language converter tricky html2wt cases (1)
22758 !! options
22759 language=sr
22760 parsoid=html2wt,wt2wt
22761 !! html/parsoid
22762 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22763 !! wikitext
22764 -{<nowiki>}-</nowiki>}-
22765 !! html/php
22766 <p>&#125;-
22767 </p>
22768 !! end
22769
22770 !! test
22771 Language converter tricky html2wt cases (2)
22772 !! options
22773 language=sr
22774 parsoid=html2wt,wt2wt
22775 !! html/parsoid
22776 <p>-{foo}-</p>
22777 !! wikitext
22778 <nowiki>-{foo}-</nowiki>
22779 !! html/php
22780 <p>-&#123;foo&#125;-
22781 </p>
22782 !! end
22783
22784 !! test
22785 Language converter tricky html2wt cases (3)
22786 !! options
22787 language=sr
22788 parsoid=html2wt,wt2wt
22789 !! html/parsoid
22790 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22791 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22792 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22793 !! wikitext
22794 -{R||}-
22795
22796 -{R|R|raw}-
22797
22798 -{<nowiki>-{foo}-</nowiki>}-
22799 !! html/php
22800 <p>|
22801 </p><p>R|raw
22802 </p><p>-&#123;foo&#125;-
22803 </p>
22804 !! end
22805
22806 !! test
22807 Language converter tricky html2wt cases (4)
22808 !! options
22809 language=sr
22810 parsoid=html2wt,wt2wt
22811 !! html/parsoid
22812 <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>
22813 !! wikitext
22814 -{R|{{echo|hey}}}-
22815 !! html/php
22816 <p>hey
22817 </p>
22818 !! end
22819
22820 # Note that the <nowiki> escaping added by parsoid for source text,
22821 # destination text, and language names only works on the PHP side
22822 # for *destination text*. (HTML entity escaping wouldn't work
22823 # any better.) This is probably a bug, at least for source texts.
22824 # (For language names PHP uses a precise regexp based on the languages
22825 # it currently knows have variants, which is fragile since this set
22826 # can grow/shrink over time.)
22827 !! test
22828 Language converter tricky html2wt cases (5)
22829 !! options
22830 language=zh variant=zh-cn
22831 !! html/parsoid
22832 <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>
22833 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22834 <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>
22835 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22836 <p>a:b=>c xyz</p>
22837 !! wikitext
22838 -{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
22839
22840 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22841
22842 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22843
22844 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22845
22846 a:b=>c xyz
22847 !! html/php+disabled
22848 <p>foobat;xyz=&gt;zh-cn:abc
22849 </p><p>A
22850 </p><p>0;zh-tw:bar
22851 </p><p>abc
22852 </p><p>a:b=&gt;c 0;zh-tw:bar
22853 </p>
22854 !! end
22855
22856 !! test
22857 T179579: Nowiki and lc interaction
22858 !! options
22859 parsoid=wt2html
22860 language=sr
22861 !! wikitext
22862 -{</nowiki>123}-
22863
22864 -{123<nowiki>|</nowiki>456}-
22865 !! html/parsoid
22866 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22867
22868 <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>
22869 !! end
22870
22871 !! test
22872 T2529: Uncovered bullet
22873 !! wikitext
22874 * Foo {{bullet}}
22875 !! html
22876 <ul><li> Foo </li>
22877 <li> Bar</li></ul>
22878
22879 !! end
22880
22881 !! test
22882 T2529: Uncovered bullet in a deeply nested list
22883 !! wikitext
22884 ******* Foo {{bullet}}
22885 !! html
22886 <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>
22887 <li> Bar</li></ul>
22888
22889 !! end
22890
22891 !! test
22892 T2529: Uncovered table already at line-start
22893 !! wikitext
22894 x
22895
22896 {{table}}
22897 y
22898 !! html
22899 <p>x
22900 </p>
22901 <table>
22902 <tr>
22903 <td> 1 </td>
22904 <td> 2
22905 </td></tr>
22906 <tr>
22907 <td> 3 </td>
22908 <td> 4
22909 </td></tr></table>
22910 <p>y
22911 </p>
22912 !! end
22913
22914 !! test
22915 T2529: Uncovered bullet in parser function result
22916 !! wikitext
22917 * Foo {{lc:{{bullet}} }}
22918 !! html
22919 <ul><li> Foo </li>
22920 <li> bar</li></ul>
22921
22922 !! end
22923
22924 !! test
22925 T7678: Double-parsed template argument
22926 !! wikitext
22927 {{lc:{{{1}}}|hello}}
22928 !! html
22929 <p>{{{1}}}
22930 </p>
22931 !! end
22932
22933 !! test
22934 T7678: Double-parsed template invocation
22935 !! wikitext
22936 {{lc:{{paramtest {{!}} param = hello }} }}
22937 !! html
22938 <p>{{paramtest | param = hello }}
22939 </p>
22940 !! end
22941
22942 !! test
22943 Case insensitivity of parser functions for non-ASCII characters (T10143)
22944 !! options
22945 language=cs
22946 title=[[Main Page]]
22947 !! wikitext
22948 {{PRVNÍVELKÉ:ěščř}}
22949 {{prvnívelké:ěščř}}
22950 {{PRVNÍMALÉ:ěščř}}
22951 {{prvnímalé:ěščř}}
22952 {{MALÁ:ěščř}}
22953 {{malá:ěščř}}
22954 {{VELKÁ:ěščř}}
22955 {{velká:ěščř}}
22956 !! html
22957 <p>Ěščř
22958 Ěščř
22959 ěščř
22960 ěščř
22961 ěščř
22962 ěščř
22963 ĚŠČŘ
22964 ĚŠČŘ
22965 </p>
22966 !! end
22967
22968 !! test
22969 Morwen/13: Unclosed link followed by heading
22970 !! wikitext
22971 [[link
22972 ==heading==
22973 !! html
22974 <p>[[link
22975 </p>
22976 <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>
22977
22978 !! end
22979
22980 !! test
22981 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22982 !! wikitext
22983 {{foo|
22984 =heading=
22985 !! html
22986 <p>{{foo|
22987 </p>
22988 <h1><span class="mw-headline" id="heading">heading</span></h1>
22989
22990 !! end
22991
22992 !! test
22993 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22994 !! wikitext
22995 {{foo|
22996 ==heading==
22997 !! html
22998 <p>{{foo|
22999 </p>
23000 <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>
23001
23002 !! end
23003
23004 !! test
23005 Tildes in comments
23006 !! options
23007 pst
23008 !! wikitext
23009 <!-- ~~~~ -->
23010 !! html/php
23011 <!-- ~~~~ -->
23012 !! end
23013
23014 !! test
23015 Paragraphs inside divs (no extra line breaks)
23016 !! wikitext
23017 <div>Line one
23018
23019 Line two</div>
23020 !! html
23021 <div>Line one
23022 Line two</div>
23023
23024 !! end
23025
23026 !! test
23027 Paragraphs inside divs (extra line break on open)
23028 !! wikitext
23029 <div>
23030 Line one
23031
23032 Line two</div>
23033 !! html
23034 <div>
23035 <p>Line one
23036 </p>
23037 Line two</div>
23038
23039 !! end
23040
23041 !! test
23042 Paragraphs inside divs (extra line break on close)
23043 !! wikitext
23044 <div>Line one
23045
23046 Line two
23047 </div>
23048 !! html
23049 <div>Line one
23050 <p>Line two
23051 </p>
23052 </div>
23053
23054 !! end
23055
23056 !! test
23057 Paragraphs inside divs (extra line break on open and close)
23058 !! wikitext
23059 <div>
23060 Line one
23061
23062 Line two
23063 </div>
23064 !! html
23065 <div>
23066 <p>Line one
23067 </p><p>Line two
23068 </p>
23069 </div>
23070
23071 !! end
23072
23073 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23074 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23075 !! test
23076 Nesting tags, paragraphs on lines which begin with <div>
23077 !! wikitext
23078 <div></div><strong>A
23079 B</strong>
23080 !! html/php+tidy
23081 <div></div><p><strong>A
23082 </strong></p><strong></strong><p><strong>B</strong>
23083 </p>
23084 !! html/parsoid
23085 <div></div>
23086 <p><strong>A
23087 B</strong>
23088 </p>
23089 !! end
23090
23091 # T8200: <blockquote> should behave like <div> with respect to line breaks
23092 !! test
23093 T8200: paragraphs inside blockquotes (no extra line breaks)
23094 !! wikitext
23095 <blockquote>Line one
23096
23097 Line two</blockquote>
23098 !! html
23099 <blockquote>Line one
23100 Line two</blockquote>
23101
23102 !! html+tidy
23103 <blockquote><p>Line one
23104 Line two</p></blockquote>
23105 !! end
23106
23107 !! test
23108 T8200: paragraphs inside blockquotes (extra line break on open)
23109 !! wikitext
23110 <blockquote>
23111 Line one
23112
23113 Line two</blockquote>
23114 !! html
23115 <blockquote>
23116 <p>Line one
23117 </p>
23118 Line two</blockquote>
23119
23120 !! html+tidy
23121 <blockquote>
23122 <p>Line one
23123 </p><p>
23124 Line two</p></blockquote>
23125 !! end
23126
23127 !! test
23128 T8200: paragraphs inside blockquotes (extra line break on close)
23129 !! wikitext
23130 <blockquote>Line one
23131
23132 Line two
23133 </blockquote>
23134 !! html
23135 <blockquote>Line one
23136 <p>Line two
23137 </p>
23138 </blockquote>
23139
23140 !! html+tidy
23141 <blockquote><p>Line one
23142 </p><p>Line two
23143 </p>
23144 </blockquote>
23145 !! end
23146
23147 !! test
23148 T8200: paragraphs inside blockquotes (extra line break on open and close)
23149 !! wikitext
23150 <blockquote>
23151 Line one
23152
23153 Line two
23154 </blockquote>
23155 !! html
23156 <blockquote>
23157 <p>Line one
23158 </p><p>Line two
23159 </p>
23160 </blockquote>
23161
23162 !! end
23163
23164 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23165 !! test
23166 Paragraphs inside blockquotes/divs (no extra line breaks)
23167 !! wikitext
23168 <blockquote><div>Line one
23169
23170 Line two</div></blockquote>
23171 !! html
23172 <blockquote><div>Line one
23173 Line two</div></blockquote>
23174
23175 !! end
23176
23177 !! test
23178 Paragraphs inside blockquotes/divs (extra line break on open)
23179 !! wikitext
23180 <blockquote><div>
23181 Line one
23182
23183 Line two</div></blockquote>
23184 !! html
23185 <blockquote><div>
23186 <p>Line one
23187 </p>
23188 Line two</div></blockquote>
23189
23190 !! end
23191
23192 !! test
23193 Paragraphs inside blockquotes/divs (extra line break on close)
23194 !! wikitext
23195 <blockquote><div>Line one
23196
23197 Line two
23198 </div></blockquote>
23199 !! html
23200 <blockquote><div>Line one
23201 <p>Line two
23202 </p>
23203 </div></blockquote>
23204
23205 !! end
23206
23207 !! test
23208 Paragraphs inside blockquotes/divs (extra line break on open and close)
23209 !! wikitext
23210 <blockquote><div>
23211 Line one
23212
23213 Line two
23214 </div></blockquote>
23215 !! html
23216 <blockquote><div>
23217 <p>Line one
23218 </p><p>Line two
23219 </p>
23220 </div></blockquote>
23221
23222 !! end
23223
23224 !! test
23225 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23226 !! options
23227 wgLinkHolderBatchSize=0
23228 !! wikitext
23229 [[meatball:1]]
23230 [[meatball:2]]
23231 [[meatball:3]]
23232 !! html
23233 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23234 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23235 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23236 </p>
23237 !! end
23238
23239 !! test
23240 Free external link invading image caption
23241 !! wikitext
23242 [[Image:Foobar.jpg|thumb|http://x|hello]]
23243 !! html/php
23244 <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>
23245
23246 !! html/parsoid
23247 <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>
23248 !! end
23249
23250 !! test
23251 T17196: localised external link numbers
23252 !! options
23253 language=fa
23254 !! wikitext
23255 [http://en.wikipedia.org/]
23256 !! html/php
23257 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23258 </p>
23259 !! html/parsoid
23260 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23261 !! end
23262
23263 !! test
23264 Multibyte character in padleft
23265 !! wikitext
23266 {{padleft:-Hello|7|Æ}}
23267 !! html/php
23268 <p>Æ-Hello
23269 </p>
23270 !! html/parsoid
23271 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23272 !! end
23273
23274 !! test
23275 Multibyte character in padright
23276 !! wikitext
23277 {{padright:Hello-|7|Æ}}
23278 !! html/php
23279 <p>Hello-Æ
23280 </p>
23281 !! html/parsoid
23282 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23283 !! end
23284
23285 !!test
23286 formatdate parser function
23287 !! wikitext
23288 {{#formatdate:2009-03-24}}
23289 !! html
23290 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23291 </p>
23292 !! end
23293
23294 !!test
23295 formatdate parser function, with default format
23296 !! wikitext
23297 {{#formatdate:2009-03-24|mdy}}
23298 !! html
23299 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23300 </p>
23301 !! end
23302
23303 !! test
23304 Spacing of numbers in formatted dates
23305 !! wikitext
23306 {{#formatdate:January 15}}
23307 !! html
23308 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23309 </p>
23310 !! end
23311
23312 !! test
23313 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
23314 !! options
23315 language=nl title=[[MediaWiki:Common.css]]
23316 !! wikitext
23317 {{#formatdate:2009-03-24|dmy}}
23318 !! html
23319 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23320 </p>
23321 !! end
23322
23323 #
23324 #
23325 #
23326
23327 #
23328 # Edit comments
23329 #
23330
23331 !! test
23332 Edit comment with link
23333 !! options
23334 comment
23335 !! wikitext
23336 I like the [[Main Page]] a lot
23337 !! html/php
23338 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23339 !!end
23340
23341 !! test
23342 Edit comment with link and link text
23343 !! options
23344 comment
23345 !! wikitext
23346 I like the [[Main Page|best pages]] a lot
23347 !! html/php
23348 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23349 !!end
23350
23351 !! test
23352 Edit comment with link and link text with suffix
23353 !! options
23354 comment
23355 !! wikitext
23356 I like the [[Main Page|best page]]s a lot
23357 !! html/php
23358 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23359 !!end
23360
23361 !! test
23362 Edit comment with section link (non-local, eg in history list)
23363 !! options
23364 comment title=[[Main Page]]
23365 !! wikitext
23366 /* External links */ removed bogus entries
23367 !! html/php
23368 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23369 !!end
23370
23371 !! test
23372 Edit comment with section link and text before it (non-local, eg in history list)
23373 !! options
23374 comment title=[[Main Page]]
23375 !! wikitext
23376 pre-comment text /* External links */ removed bogus entries
23377 !! html/php
23378 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>
23379 !!end
23380
23381 !! test
23382 Edit comment with section link (local, eg in diff view)
23383 !! options
23384 comment local title=[[Main Page]]
23385 !! wikitext
23386 /* External links */ removed bogus entries
23387 !! html/php
23388 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23389 !!end
23390
23391 !! test
23392 Edit comment with subpage link (T16080)
23393 !! options
23394 comment
23395 subpage
23396 title=[[Subpage test]]
23397 !! wikitext
23398 Poked at a [[/subpage]] here...
23399 !! html/php
23400 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23401 !!end
23402
23403 !! test
23404 Edit comment with subpage link and link text (T16080)
23405 !! options
23406 comment
23407 subpage
23408 title=[[Subpage test]]
23409 !! wikitext
23410 Poked at a [[/subpage|neat little page]] here...
23411 !! html/php
23412 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23413 !!end
23414
23415 !! test
23416 Edit comment with bogus subpage link in non-subpage NS (T16080)
23417 !! options
23418 comment
23419 title=[[Subpage test]]
23420 !! wikitext
23421 Poked at a [[/subpage]] here...
23422 !! html/php
23423 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...
23424 !!end
23425
23426 !! test
23427 Edit comment with bare anchor link (local, as on diff)
23428 !! options
23429 comment
23430 local
23431 title=[[Main Page]]
23432 !! wikitext
23433 [[#section]]
23434 !! html/php
23435 <a href="#section">#section</a>
23436 !! end
23437
23438 !! test
23439 Edit comment with bare anchor link (non-local, as on history)
23440 !! options
23441 comment
23442 title=[[Main Page]]
23443 !! wikitext
23444 [[#section]]
23445 !! html/php
23446 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23447 !! end
23448
23449 !! test
23450 Anchor starting with underscore
23451 !! options
23452 title=[[Foo]]
23453 !! wikitext
23454 [[#_ref|One]]
23455 !! html/php
23456 <p><a href="#_ref">One</a>
23457 </p>
23458 !! html/parsoid
23459 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23460 !! end
23461
23462 !! test
23463 Id starting with underscore
23464 !! wikitext
23465 <div id="_ref"></div>
23466 !! html/*
23467 <div id="_ref"></div>
23468
23469 !! end
23470
23471 !! test
23472 Edit comment with link with more than one pipe (T99346)
23473 !! options
23474 comment
23475 !! wikitext
23476 [[Main Page|Many|pipes]]
23477 !! html/php
23478 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23479 !! end
23480
23481 !! test
23482 Complex edit comment with link with more than one pipe (T99346)
23483 !! options
23484 comment
23485 !! wikitext
23486 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23487 !! html/php
23488 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;
23489 !! end
23490
23491 !! test
23492 Space normalisation on autocomment (T24784)
23493 !! options
23494 comment
23495 title=[[Main Page]]
23496 !! wikitext
23497 /* __hello__world__ */
23498 !! html/php
23499 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23500 !! end
23501
23502 !! test
23503 percent-encoding and + signs in comments (T28410)
23504 !! options
23505 comment
23506 !! wikitext
23507 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23508 !! html/php
23509 <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>
23510 !! end
23511
23512 # Parsoid doesn't support this yet: see T75581
23513 # but it *should* omit the 'src' attribute if the image is bad.
23514 # PHP side of tests was disabled in
23515 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23516 # because of issues in the PHP parserTests infrastructure
23517 # (but the output below is indeed what the PHP side emits)
23518 !! test
23519 Bad images - basic functionality
23520 !! wikitext
23521 [[File:Bad.jpg]]
23522 !! DISABLED/html/php
23523 !! html/parsoid
23524 <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>
23525 !! end
23526
23527 !! test
23528 Bad images - T18039: text after bad image disappears
23529 !! wikitext
23530 Foo bar
23531 [[File:Bad.jpg]]
23532 Bar foo
23533 !! DISABLED/html/php
23534 <p>Foo bar
23535 </p><p>Bar foo
23536 </p>
23537 !! html/parsoid
23538 <p>Foo bar
23539 <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>
23540 Bar foo</p>
23541 !! end
23542
23543 !! test
23544 Verify that displaytitle works (T24501) no displaytitle
23545 !! options
23546 showtitle
23547 !! config
23548 wgAllowDisplayTitle=true
23549 wgRestrictDisplayTitle=false
23550 !! wikitext
23551 this is not the the title
23552 !! html/php
23553 Parser test
23554 <p>this is not the the title
23555 </p>
23556 !! end
23557
23558 !! test
23559 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23560 !! options
23561 showtitle
23562 title=[[Screen]]
23563 !! config
23564 wgAllowDisplayTitle=true
23565 wgRestrictDisplayTitle=false
23566 !! wikitext
23567 this is not the the title
23568 {{DISPLAYTITLE:whatever}}
23569 !! html/php
23570 whatever
23571 <p>this is not the the title
23572 </p>
23573 !! end
23574
23575 !! test
23576 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23577 !! options
23578 showtitle
23579 title=[[Screen]]
23580 !! config
23581 wgAllowDisplayTitle=true
23582 wgRestrictDisplayTitle=true
23583 !! wikitext
23584 this is not the the title
23585 {{DISPLAYTITLE:whatever}}
23586 !! html/php
23587 Screen
23588 <p>this is not the the title
23589 </p>
23590 !! end
23591
23592 !! test
23593 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23594 !! options
23595 showtitle
23596 title=[[Screen]]
23597 !! config
23598 wgAllowDisplayTitle=true
23599 wgRestrictDisplayTitle=true
23600 !! wikitext
23601 this is not the the title
23602 {{DISPLAYTITLE:screen}}
23603 !! html/php
23604 screen
23605 <p>this is not the the title
23606 </p>
23607 !! end
23608
23609 !! test
23610 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23611 !! options
23612 showtitle
23613 title=[[Screen]]
23614 !! config
23615 wgAllowDisplayTitle=false
23616 !! wikitext
23617 this is not the the title
23618 {{DISPLAYTITLE:screen}}
23619 !! html/php
23620 Screen
23621 <p>this is not the the title
23622 <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>
23623 </p>
23624 !! end
23625
23626 !! test
23627 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23628 !! options
23629 showtitle
23630 title=[[Screen]]
23631 !! config
23632 wgAllowDisplayTitle=false
23633 !! wikitext
23634 this is not the the title
23635 !! html/php
23636 Screen
23637 <p>this is not the the title
23638 </p>
23639 !! end
23640
23641 !! test
23642 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23643 !! options
23644 showtitle
23645 title=[[Screen]]
23646 !! config
23647 wgAllowDisplayTitle=true
23648 wgRestrictDisplayTitle=true
23649 !! wikitext
23650 this is not the the title
23651 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23652 !! html/php
23653 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23654 <p>this is not the the title
23655 </p>
23656 !! end
23657
23658 !! test
23659 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23660 !! options
23661 showtitle
23662 title=[[Screen]]
23663 !! config
23664 wgAllowDisplayTitle=true
23665 wgRestrictDisplayTitle=true
23666 !! wikitext
23667 this is not the the title
23668 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23669 !! html/php
23670 <span style="color: red;">s</span>creen
23671 <p>this is not the the title
23672 </p>
23673 !! end
23674
23675 !! test
23676 Page status indicators: Empty name is invalid
23677 !! options
23678 showindicators
23679 !! wikitext
23680 <indicator name=" "></indicator>
23681 <indicator></indicator>
23682 !! html/php
23683 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23684 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23685 </p>
23686 !! end
23687
23688 !! test
23689 Page status indicators: Weird syntaxes that are okay
23690 !! options
23691 showindicators
23692 !! wikitext
23693 <indicator name="empty" />
23694 <indicator name="name"></indicator>
23695 !! html/php
23696 empty=
23697 name=
23698 <p><br />
23699 </p>
23700 !! end
23701
23702 !! test
23703 Page status indicators: Torture test
23704 !! options
23705 showindicators
23706 !! wikitext
23707 <indicator name="01">hello world</indicator>
23708 <indicator name="02">[[Main Page]]</indicator>
23709 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23710 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23711 <indicator name="05">* foo
23712 * bar</indicator>
23713 <indicator name="06"><nowiki>foo</nowiki></indicator>
23714 <indicator name="07"> Preformatted</indicator>
23715 <indicator name="08"><div>Broken tag</indicator>
23716 <indicator name="09">{| class=wikitable
23717 | cell
23718 |}</indicator>
23719 <indicator name="10">Two
23720
23721 paragraphs</indicator>
23722 !! html/php
23723 01=hello world
23724 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23725 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" />
23726 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>
23727 05=<ul><li> foo</li>
23728 <li> bar</li></ul>
23729
23730 06=foo
23731 07=<pre>Preformatted
23732 </pre>
23733 08=<div>Broken tag</div>
23734
23735 09=<table class="wikitable">
23736 <tr>
23737 <td> cell
23738 </td></tr></table>
23739
23740 10=<p>Two
23741 </p><p>paragraphs
23742 </p>
23743 <p><br />
23744 </p><p><br />
23745 </p><p><br />
23746 </p><p><br />
23747 </p><p><br />
23748 </p>
23749 !! end
23750
23751 !! test
23752 preload: check <noinclude> and <includeonly>
23753 !! options
23754 preload
23755 !! wikitext
23756 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23757 !! html/php
23758 Hello kind world.
23759 !! end
23760
23761 !! test
23762 preload: check <onlyinclude>
23763 !! options
23764 preload
23765 !! wikitext
23766 Goodbye <onlyinclude>Hello world</onlyinclude>
23767 !! html/php
23768 Hello world
23769 !! end
23770
23771 !! test
23772 preload: can pass tags through if we want to
23773 !! options
23774 preload
23775 !! wikitext
23776 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23777 !! html/php
23778 <includeonly>Hello world</includeonly>
23779 !! end
23780
23781 !! test
23782 preload: check that it doesn't try to do tricks
23783 !! options
23784 preload
23785 !! wikitext
23786 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23787 !! html/php
23788 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23789 !! end
23790
23791 !! test
23792 Play a bit with r67090 and T5158
23793 !! wikitext
23794 <div style="width:50% !important">&nbsp;</div>
23795 <div style="width:50%&nbsp;!important">&nbsp;</div>
23796 <div style="width:50%&#160;!important">&nbsp;</div>
23797 <div style="border : solid;">&nbsp;</div>
23798 !! html/php
23799 <div style="width:50% !important">&#160;</div>
23800 <div style="width:50% !important">&#160;</div>
23801 <div style="width:50% !important">&#160;</div>
23802 <div style="border&#160;: solid;">&#160;</div>
23803
23804 !! html/parsoid
23805 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23806 <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>
23807 <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>
23808 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23809
23810 !! end
23811
23812 !! test
23813 HTML5 data attributes
23814 !! wikitext
23815 <span data-foo="bar">Baz</span>
23816 <p data-abc-def_hij="">Quuz</p>
23817 !! html/php
23818 <p><span data-foo="bar">Baz</span>
23819 </p>
23820 <p data-abc-def_hij="">Quuz</p>
23821
23822 !! html/parsoid
23823 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23824 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23825 !! end
23826
23827 !! test
23828 Strip reserved data attributes
23829 !! wikitext
23830 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23831 !! html/php
23832 <div data-ok="fred">d</div>
23833
23834 !! html/parsoid
23835 <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>
23836 !! end
23837
23838 !! test
23839 percent-encoding and + signs in internal links (T28410)
23840 !! wikitext
23841 [[User:+%]] [[Page+title%]]
23842 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23843 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23844 [[%33%45]] [[%33%45+]]
23845 !! html/php
23846 <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>
23847 <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>
23848 <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>
23849 <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>
23850 </p>
23851 !! html/parsoid
23852 <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>
23853 <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>
23854 <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>
23855 <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>
23856 !! end
23857
23858 !! test
23859 Special characters in embedded file links (T29679)
23860 !! wikitext
23861 [[File:Contains & ampersand.jpg]]
23862 [[File:Does not exist.jpg|Title with & ampersand]]
23863 !! html/php
23864 <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>
23865 <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>
23866 </p>
23867 !! html/parsoid
23868 <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>
23869 <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>
23870 !! end
23871
23872 !! test
23873 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23874 !! wikitext
23875 Text&apos;s been normalized?
23876 !! html
23877 <p>Text&#39;s been normalized?
23878 </p>
23879 !! end
23880
23881 !! test
23882 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23883 !! wikitext
23884 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23885 !! html
23886 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23887 </p>
23888 !! end
23889
23890 !! test
23891 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23892 !! wikitext
23893 [http://www.example.org/ ideograms]
23894 !! html
23895 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23896 </p>
23897 !! end
23898
23899 !! test
23900 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23901 !! wikitext
23902 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23903 !! html
23904 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23905 </p>
23906 !! end
23907
23908 !! article
23909 Mediawiki:loop1
23910 !! text
23911 {{Identical|A}}
23912 !! endarticle
23913
23914 !! article
23915 Mediawiki:loop2
23916 !! text
23917 {{Identical|B}}
23918 !! endarticle
23919
23920 !! article
23921 Template:Identical
23922 !! text
23923 {{int:loop1}}
23924 {{int:loop2}}
23925 !! endarticle
23926
23927 !! test
23928 T33098 Template which includes system messages which includes the template
23929 !! wikitext
23930 {{Identical}}
23931 !! html
23932 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23933 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23934 </p>
23935 !! end
23936
23937 !! test
23938 T33490 Turkish: ucfirst 'blah'
23939 !! options
23940 language=tr
23941 !! wikitext
23942 {{ucfirst:blah}}
23943 !! html
23944 <p>Blah
23945 </p>
23946 !! end
23947
23948 !! test
23949 T33490 Turkish: ucfirst 'ix'
23950 !! options
23951 language=tr
23952 !! wikitext
23953 {{ucfirst:ix}}
23954 !! html
23955 <p>İx
23956 </p>
23957 !! end
23958
23959 !! test
23960 T33490 Turkish: lcfirst 'BLAH'
23961 !! options
23962 language=tr
23963 !! wikitext
23964 {{lcfirst:BLAH}}
23965 !! html
23966 <p>bLAH
23967 </p>
23968 !! end
23969
23970 !! test
23971 T33490 Turkish: ucfırst (with a dotless i)
23972 !! options
23973 language=tr
23974 !! wikitext
23975 {{ucfırst:blah}}
23976 !! html
23977 <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>
23978 </p>
23979 !! end
23980
23981 !! test
23982 T33490 ucfırst (with a dotless i) with English language
23983 !! options
23984 language=en
23985 !! wikitext
23986 {{ucfırst:blah}}
23987 !! html
23988 <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>
23989 </p>
23990 !! end
23991
23992 # Note that Parsoid doesn't emit an explicit TOC.
23993 # Note also that the html2wt direction tends to emit an extra newline
23994 # between the __TOC__ magicword and the first heading unless *both*
23995 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23996 # it's "{}").
23997
23998 !! test
23999 T28375: TOC with italics
24000 !! options
24001 title=[[Main Page]]
24002 !! wikitext
24003 __TOC__
24004 == ''Lost'' episodes ==
24005 !! html/php
24006 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24007 <ul>
24008 <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>
24009 </ul>
24010 </div>
24011
24012 <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>
24013
24014 !! html/parsoid
24015 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24016 <h2 id="Lost_episodes" data-parsoid='{}'> <i>Lost</i> episodes </h2>
24017 !! end
24018
24019 !! test
24020 T28375: TOC with bold
24021 !! options
24022 title=[[Main Page]]
24023 !! wikitext
24024 __TOC__
24025 == '''should be bold''' then normal text ==
24026 !! html/php
24027 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24028 <ul>
24029 <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>
24030 </ul>
24031 </div>
24032
24033 <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>
24034
24035 !! html/parsoid
24036 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24037 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
24038 !! end
24039
24040 !! test
24041 T35845: Headings become cursive in TOC when they contain an image
24042 !! options
24043 title=[[Main Page]]
24044 !! wikitext
24045 __TOC__
24046 == Image [[Image:foobar.jpg]] ==
24047 !! html/php
24048 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24049 <ul>
24050 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24051 </ul>
24052 </div>
24053
24054 <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>
24055
24056 !! html/parsoid
24057 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24058 <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>
24059 !! end
24060
24061 !! test
24062 T35845 (2): Headings become bold in TOC when they contain a blockquote
24063 !! options
24064 title=[[Main Page]]
24065 !! wikitext
24066 __TOC__
24067 == <blockquote>Quote</blockquote> ==
24068 !! html/php
24069 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24070 <ul>
24071 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24072 </ul>
24073 </div>
24074
24075 <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>
24076
24077 !! html/php+tidy
24078 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24079 <ul>
24080 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24081 </ul>
24082 </div>
24083
24084 <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>
24085 !! html/parsoid
24086 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24087 <h2 id="Quote" data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
24088 !! end
24089
24090 !! test
24091 Unclosed tags in TOC
24092 !! config
24093 wgFragmentMode=[ 'html5', 'legacy' ]
24094 !! options
24095 title=[[Main Page]]
24096 !! wikitext
24097 __TOC__
24098 == Proof: 2 < 3 ==
24099 <small>Hanc marginis exiguitas non caperet.</small>
24100 QED
24101 !! html/php
24102 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24103 <ul>
24104 <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>
24105 </ul>
24106 </div>
24107
24108 <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>
24109 <p><small>Hanc marginis exiguitas non caperet.</small>
24110 QED
24111 </p>
24112 !! html/parsoid
24113 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24114 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span> Proof: 2 &lt; 3 </h2>
24115 <p><small>Hanc marginis exiguitas non caperet.</small>
24116 QED</p>
24117 !! end
24118
24119 !! test
24120 Multiple tags in TOC
24121 !! wikitext
24122 __TOC__
24123 == <i>Foo</i> <b>Bar</b> ==
24124
24125 == <i>Foo</i> <blockquote>Bar</blockquote> ==
24126 !! html/php
24127 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24128 <ul>
24129 <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>
24130 <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>
24131 </ul>
24132 </div>
24133
24134 <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>
24135 <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>
24136
24137 !! html/php+tidy
24138 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24139 <ul>
24140 <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>
24141 <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>
24142 </ul>
24143 </div>
24144
24145 <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>
24146 <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>
24147 !! html/parsoid
24148 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24149 <h2 id="Foo_Bar" data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
24150
24151 <h2 id="Foo_Bar_2" data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
24152 !! end
24153
24154 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24155 # html5 tag parsing.
24156 !! test
24157 Tags with parameters in TOC
24158 !! options
24159 parsoid=wt2html
24160 !! wikitext
24161 __TOC__
24162 == <sup class="in-h2">Hello</sup> ==
24163
24164 == <sup class="a > b">Evilbye</sup> ==
24165 !! html/php
24166 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24167 <ul>
24168 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24169 <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>
24170 </ul>
24171 </div>
24172
24173 <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>
24174 <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>
24175
24176 !! html/parsoid
24177 <meta property="mw:PageProp/toc" />
24178 <h2 id="Hello"> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
24179
24180 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
24181 !! end
24182
24183 !! test
24184 span tags with directionality in TOC
24185 !! wikitext
24186 __TOC__
24187 == <span dir="ltr">C++</span> ==
24188
24189 == <span dir="rtl">זבנג!</span> ==
24190
24191 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
24192
24193 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
24194
24195 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
24196 !! html/php
24197 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24198 <ul>
24199 <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>
24200 <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>
24201 <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>
24202 <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>
24203 <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>
24204 </ul>
24205 </div>
24206
24207 <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>
24208 <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>
24209 <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>
24210 <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>
24211 <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>
24212
24213 !! html/parsoid
24214 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24215 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span> <span dir="ltr">C++</span> </h2>
24216 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span> <span dir="rtl">זבנג!</span> </h2>
24217 <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>
24218 <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>
24219 <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>
24220 !! end
24221
24222 !! test
24223 T74884: bdi element in ToC
24224 !! wikitext
24225 __TOC__
24226 == <bdi>test</bdi> ==
24227 !! html/php
24228 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24229 <ul>
24230 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24231 </ul>
24232 </div>
24233
24234 <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>
24235
24236 !! html/parsoid
24237 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24238 <h2 id="test" data-parsoid='{}'> <bdi>test</bdi> </h2>
24239 !! end
24240
24241 !! test
24242 T35715: s/strike element in ToC
24243 !! wikitext
24244 __TOC__
24245 == <s>test</s> test <strike>test</strike> ==
24246 !! html/php
24247 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24248 <ul>
24249 <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>
24250 </ul>
24251 </div>
24252
24253 <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>
24254
24255 !! html/parsoid
24256 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24257 <h2 id="test_test_test" data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
24258 !! end
24259
24260 !! test
24261 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24262 !! wikitext
24263 __TOC__
24264 == x ==
24265 !! html/php
24266 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24267 <ul>
24268 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24269 </ul>
24270 </div>
24271
24272 <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>
24273
24274 !! html/parsoid
24275 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24276 <h2 id="x" data-parsoid='{}'> x </h2>
24277 !! end
24278
24279 !! article
24280 MediaWiki:T34057
24281 !! text
24282 == {{int:headline_sample}} ==
24283 !! endarticle
24284
24285 !! test
24286 T34057: Title needed when expanding <h> nodes.
24287 !! options
24288 title=[[Main Page]]
24289 !! wikitext
24290 {{int:T34057}}
24291 !! html
24292 <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>
24293
24294 !! end
24295
24296 !! test
24297 Strip marker in urlencode
24298 !! wikitext
24299 {{urlencode:x<nowiki/>y}}
24300 {{urlencode:x<nowiki/>y|wiki}}
24301 {{urlencode:x<nowiki/>y|path}}
24302 {{urlencode:x<pre id="one">two</pre>y}}
24303 !! html/php
24304 <p>xy
24305 xy
24306 xy
24307 xy
24308 </p>
24309 !! end
24310
24311 !! test
24312 Strip marker in lc
24313 !! wikitext
24314 {{lc:x<nowiki/>y}}
24315 !! html
24316 <p>xy
24317 </p>
24318 !! end
24319
24320 !! test
24321 Strip marker in uc
24322 !! wikitext
24323 {{uc:x<nowiki/>y}}
24324 !! html
24325 <p>XY
24326 </p>
24327 !! end
24328
24329 !! test
24330 Strip marker in formatNum
24331 !! wikitext
24332 {{formatnum:1<nowiki/>2}}
24333 {{formatnum:1<nowiki/>2|R}}
24334 !! html
24335 <p>12
24336 12
24337 </p>
24338 !! end
24339
24340 !! test
24341 Check noCommafy in formatNum
24342 !! options
24343 language=be-tarask
24344 !! wikitext
24345 {{formatnum:123456.78}}
24346 {{formatnum:123456.78|NOSEP}}
24347 !! html
24348 <p>123 456,78
24349 123456.78
24350 </p>
24351 !! end
24352
24353 !! test
24354 Wrong option for formatNum (T58199)
24355 !! wikitext
24356 {{formatnum:1,234.56|Random}}
24357 {{formatnum:1,234.56|EVERYTHING}}
24358 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24359 !! html
24360 <p>1,234.56
24361 1,234.56
24362 1,234.56
24363 </p>
24364 !! end
24365
24366 !! test
24367 Strip marker in grammar
24368 !! options
24369 language=fi
24370 !! wikitext
24371 {{grammar:elative|foo<nowiki/>bar}}
24372 !! html
24373 <p>foobarista
24374 </p>
24375 !! end
24376
24377 !! test
24378 Strip marker in padleft
24379 !! wikitext
24380 {{padleft:|2|x<nowiki/>y}}
24381 !! html
24382 <p>xy
24383 </p>
24384 !! end
24385
24386 !! test
24387 Strip marker in padright
24388 !! wikitext
24389 {{padright:|2|x<nowiki/>y}}
24390 !! html
24391 <p>xy
24392 </p>
24393 !! end
24394
24395 !! test
24396 Strip marker in anchorencode
24397 !! wikitext
24398 {{anchorencode:x<nowiki/>y}}
24399 !! html/php
24400 <p>xy
24401 </p>
24402 !! html/parsoid
24403 <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>
24404 !! end
24405
24406 !! test
24407 nowiki inside link inside heading (T20295)
24408 !! wikitext
24409 ==[[foo|x<nowiki>y</nowiki>z]]==
24410 !! html
24411 <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>
24412
24413 !! end
24414
24415 !! test
24416 new support for bdi element (T33817)
24417 !! wikitext
24418 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24419 !! html
24420 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24421
24422 !!end
24423
24424 !! test
24425 Ignore pipe between table row attributes
24426 !! wikitext
24427 {|
24428 | quux
24429 |- id=foo | style='color: red'
24430 | bar
24431 |}
24432 !! html
24433 <table>
24434 <tr>
24435 <td> quux
24436 </td></tr>
24437 <tr id="foo" style="color: red">
24438 <td> bar
24439 </td></tr></table>
24440
24441 !! end
24442
24443 !!test
24444 Language parser function
24445 !! wikitext
24446 {{#language:ar}}
24447 !! html
24448 <p>العربية
24449 </p>
24450 !! end
24451
24452 !!test
24453 Padleft and padright (default 0-padding)
24454 !! wikitext
24455 {{padleft:xyz|5}}
24456 {{padright:xyz|5}}
24457 !! html/php
24458 <p>00xyz
24459 xyz00
24460 </p>
24461 !! html/parsoid
24462 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24463 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24464 !! end
24465
24466 !!test
24467 Padleft and padright (partial fill)
24468 !! wikitext
24469 {{padleft:xyz|6|ab}}
24470 {{padright:xyz|6|ab}}
24471 !! html/php
24472 <p>abaxyz
24473 xyzaba
24474 </p>
24475 !! html/parsoid
24476 <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>
24477 <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>
24478 !! end
24479
24480 !!test
24481 Padleft and padright as substr
24482 !! wikitext
24483 {{padleft:|3|abcde}}
24484 {{padright:|3|abcde}}
24485 !! html/php
24486 <p>abc
24487 abc
24488 </p>
24489 !! html/parsoid
24490 <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>
24491 <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>
24492 !! end
24493
24494 !!test
24495 Special parser function
24496 !! wikitext
24497 {{#special:RandomPage}}
24498 {{#special:BaDtItLe}}
24499 {{#special:Foobar}}
24500 !! html
24501 <p>Special:Random
24502 Special:Badtitle
24503 Special:Foobar
24504 </p>
24505 !! end
24506
24507 !!test
24508 T36939 - Case insensitive link parsing ([HttP://])
24509 !! wikitext
24510 [HttP://MediaWiki.Org/]
24511 !! html/php
24512 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24513 </p>
24514 !! html/parsoid
24515 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24516 !! end
24517
24518 !!test
24519 T36939 - Case insensitive link parsing ([HttP:// title])
24520 !! wikitext
24521 [HttP://MediaWiki.Org/ MediaWiki]
24522 !! html
24523 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24524 </p>
24525 !! end
24526
24527 !!test
24528 T36939 - Case insensitive link parsing (HttP://)
24529 !! wikitext
24530 HttP://MediaWiki.Org/
24531 !! html/php
24532 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24533 </p>
24534 !! html/parsoid
24535 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24536 !! end
24537
24538 !!test
24539 Disable TOC
24540 !! options
24541 notoc
24542 !! wikitext
24543 Lead
24544 == Section 1 ==
24545 == Section 2 ==
24546 == Section 3 ==
24547 == Section 4 ==
24548 == Section 5 ==
24549 !! html
24550 <p>Lead
24551 </p>
24552
24553 <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>
24554 <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>
24555 <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>
24556 <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>
24557 <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>
24558
24559 !! end
24560
24561
24562 ###
24563 ### Parsoid-specific tests
24564 ### Parsoid-PHP parser incompatibilities
24565 ###
24566 !!test
24567 1. SOL-sensitive wikitext tokens as template-args
24568 !!options
24569 parsoid=wt2html,wt2wt
24570 !! wikitext
24571 {{echo|*a}}
24572 {{echo|#a}}
24573 {{echo|:a}}
24574 !! html
24575 <span about="#mwt1" typeof="mw:Transclusion">
24576 </span><ul about="#mwt1"><li>a</li>
24577 </ul>
24578 <span about="#mwt2" typeof="mw:Transclusion">
24579 </span><ol about="#mwt2"><li>a</li>
24580 </ol>
24581 <span about="#mwt3" typeof="mw:Transclusion">
24582 </span><dl about="#mwt3"><dd>a</dd>
24583 </dl>
24584 !!end
24585
24586 #### -----------------------------------------------------------------
24587 #### Parsoid-specific functionality tests
24588 #### -----------------------------------------------------------------
24589
24590 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24591 # We know wt2wt will fail, but we expect selser to pass.
24592 # Due to the nature of our testing, wt2wt and selser tests will enter the
24593 # blacklist and we'll catch selser regressions based on changes to the
24594 # blacklist entries for selser tests.
24595 !! test
24596 1. Bad treebuilder fixup of formatting elt is cleaned up
24597 !! options
24598 parsoid=wt2html,wt2wt
24599 !! wikitext
24600 {|
24601 |
24602 <small>
24603 [[Image:Foobar.jpg|right|Test]]
24604 </small>
24605 |}
24606 !! html/parsoid
24607 <table>
24608 <tbody><tr><td>
24609 <small>
24610 <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>
24611 </small>
24612 </td></tr>
24613 </tbody></table>
24614 !! end
24615
24616 !! test
24617 2. Bad treebuilder fixup of formatting elt is cleaned up
24618 !! options
24619 parsoid=wt2html,wt2wt
24620 !! wikitext
24621 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24622
24623 <small>[[Image:Foobar.jpg|right|300px]]</small>
24624 !! html/parsoid
24625
24626 <p><b>foo</b></p>
24627 <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>
24628 <p><b>bar</b></p>
24629 <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>
24630 !! end
24631
24632 !! test
24633 3. Bad treebuilder fixup of formatting elt is cleaned up
24634 !! options
24635 parsoid=wt2html,wt2wt
24636 !! wikitext
24637 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24638 !! html/parsoid
24639 <p><small><b>foo</b></small></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><small><b>caption</b></small></figcaption></figure>
24641 <p><small><b>bar</b></small></p>
24642 !! end
24643
24644 !! test
24645 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24646 !! options
24647 parsoid=wt2html,wt2wt
24648 !! wikitext
24649 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24650 !! html/parsoid
24651 <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>
24652 !! end
24653
24654 #### ----------------------------------------------------------------
24655 #### Parsoid-only testing of Parsoid's impl of LST
24656 #### Not implemented yet, see
24657 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24658 #### ----------------------------------------------------------------
24659
24660 ## We still need to support serializing the older format while content is stored.
24661 !! test
24662 LST Sections: Backwards compatibility
24663 !! options
24664 parsoid={
24665 "suppressErrors": true,
24666 "modes": ["html2wt"]
24667 }
24668 !! wikitext
24669 <section begin="2011-05-16" />
24670 <section end="2014-04-10 (MW 1.23wmf22)" />
24671 !! html/parsoid
24672 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24673 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24674 !! end
24675
24676 !! test
24677 LST Sections: Newfangled approach
24678 !! wikitext
24679 <section begin="2011-05-16" />
24680 <section end="2014-04-10 (MW 1.23wmf22)" />
24681 !! html/parsoid
24682 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24683 </span>
24684 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24685 </span></p>
24686 !! end
24687
24688 #--------- Test stripping of empty nodes in template content ----------
24689
24690 !! test
24691 Empty LI and TR nodes should be stripped from template content
24692 !! wikitext
24693 {{EmptyLITest}}
24694 {{EmptyTRTest}}
24695 !! html/parsoid
24696 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24697 <li>a</li>
24698 <li>b</li>
24699 </ul>
24700 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24701 <tbody>
24702 <tr>
24703 <td>foo</td>
24704 </tr>
24705 <tr>
24706 <td>bar</td>
24707 </tr>
24708 </tbody>
24709 </table>
24710 !! end
24711
24712 !! test
24713 Empty LI and TR nodes should not be stripped from top-level content
24714 !! wikitext
24715 * a
24716 *
24717 * b
24718 {|
24719 |-
24720 |-
24721 |foo
24722 |}
24723 !! html/parsoid
24724 <ul>
24725 <li> a</li>
24726 <li class='mw-empty-elt'></li>
24727 <li> b</li>
24728 </ul>
24729 <table>
24730 <tbody>
24731 <tr class='mw-empty-elt'></tr>
24732 <tr>
24733 <td>foo</td>
24734 </tr>
24735 </tbody>
24736 </table>
24737 !! end
24738
24739 !! test
24740 Empty TR nodes should not be stripped if they have any attributes set
24741 !! wikitext
24742 {{EmptyTRWithHTMLAttrTest}}
24743 !! html/parsoid
24744 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24745 <tr align='center'></tr>
24746 <tr><td>foo</td></tr>
24747 <tr align='center'></tr>
24748 <tr><td>bar</td></tr>
24749 </table>
24750 !! end
24751
24752 #### ----------------------------------------------------------------
24753 #### The following section of tests are primarily to test
24754 #### wikitext escaping capabilities of Parsoid. Given that
24755 #### escaping can be done any number of ways, the wikitext (input)
24756 #### is always adjusted to reflect how Parsoid adds nowiki
24757 #### escape tags.
24758 ####
24759 #### We are marking several tests as parsoid-only since the
24760 #### HTML in the result section is different from what the
24761 #### PHP parser generates for it.
24762 #### ----------------------------------------------------------------
24763
24764
24765 #### --------------- Headings ---------------
24766 #### 0. Unnested
24767 #### 1. Nested inside html <h1>=foo=</h1>
24768 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24769 #### 3. Nested inside html with wikitext split by html tags
24770 #### 4. No escape needed
24771 #### 5. Empty headings <h1></h1>
24772 #### 6. Heading chars in SOL context
24773 #### ----------------------------------------
24774 !! test
24775 Headings: 0. Unnested
24776 !! options
24777 parsoid=html2wt
24778 !! html/parsoid
24779 <p>=foo=</p>
24780
24781 <p> =foo=
24782 <!--cmt-->
24783 =foo=</p>
24784
24785 <p>=foo<i>a</i>=</p>
24786 !! wikitext
24787 <nowiki>=foo=</nowiki>
24788
24789 <nowiki> </nowiki>=foo=
24790 <!--cmt-->
24791 <nowiki>=foo=</nowiki>
24792
24793 =foo''a''<nowiki>=</nowiki>
24794 !!end
24795
24796 # New headings and existing headings are handled differently
24797 !! test
24798 Headings: 1. Nested inside html
24799 !! options
24800 parsoid=html2wt
24801 !! html/parsoid
24802 <h1>=foo=</h1>
24803 <h2>=foo=</h2>
24804 <h3>=foo=</h3>
24805
24806 <h1 data-parsoid=''>=foo=</h1>
24807 <h2 data-parsoid=''>=foo=</h2>
24808 <h3 data-parsoid=''>=foo=</h3>
24809 <h4 data-parsoid=''>=foo=</h4>
24810 <h5 data-parsoid=''>=foo=</h5>
24811 <h6 data-parsoid=''>=foo=</h6>
24812 !! wikitext
24813 = =foo= =
24814
24815 == =foo= ==
24816
24817 === =foo= ===
24818
24819 =<nowiki>=foo=</nowiki>=
24820 ==<nowiki>=foo=</nowiki>==
24821 ===<nowiki>=foo=</nowiki>===
24822 ====<nowiki>=foo=</nowiki>====
24823 =====<nowiki>=foo=</nowiki>=====
24824 ======<nowiki>=foo=</nowiki>======
24825
24826 !!end
24827
24828 !! test
24829 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24830 !! options
24831 parsoid=html2wt
24832 !! html/parsoid
24833 <h1>foo</h1>*bar
24834 <h1>foo</h1>=bar
24835 <h1>foo</h1>=bar=
24836 !! wikitext
24837 = foo =
24838 <nowiki>*</nowiki>bar
24839
24840 = foo =
24841 =bar
24842
24843 = foo =
24844 <nowiki>=bar=</nowiki>
24845 !!end
24846
24847 !! test
24848 Headings: 3. Nested inside html with wikitext split by html tags
24849 !! options
24850 parsoid=html2wt
24851 !! html/parsoid
24852 <h1>=<b>bold</b>foo=</h1>
24853 !! wikitext
24854 = ='''bold'''foo= =
24855 !!end
24856
24857 !! test
24858 Headings: 4a. No escaping needed (testing just h1 and h2)
24859 !! options
24860 parsoid=html2wt
24861 !! html/parsoid
24862 <h1>=foo</h1>
24863 <h1>foo=</h1>
24864 <h1> =foo= </h1>
24865 <h1>=foo= bar</h1>
24866 <h2>=foo</h2>
24867 <h2>foo=</h2>
24868 <h1>=</h1>
24869 <h1><i>=</i>foo=</h1>
24870 !! wikitext
24871 = =foo =
24872
24873 = foo= =
24874
24875 = =foo= =
24876
24877 = =foo= bar =
24878
24879 == =foo ==
24880
24881 == foo= ==
24882
24883 = = =
24884
24885 = ''=''foo= =
24886 !!end
24887
24888 !! test
24889 Headings: 4b. No escaping needed (inside p-tags)
24890 !! options
24891 parsoid=html2wt
24892 !! html/parsoid
24893 <p>=foo= x
24894 =foo= <s></s>
24895 </p>
24896 !! wikitext
24897 =foo= x
24898 =foo= <s></s>
24899 !! html/php
24900 <p>=foo= x
24901 =foo= <s></s>
24902 </p>
24903 !!end
24904
24905 !! test
24906 Headings: 4c. Short headings (1)
24907 !! options
24908 parsoid=html2wt
24909 !! html/parsoid
24910 <p>===
24911 </p>
24912 !! wikitext
24913 <nowiki>===</nowiki>
24914 !! html/php
24915 <p>===
24916 </p>
24917 !! end
24918
24919 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24920 !! test
24921 Headings: 4d. Short headings (2)
24922 !! options
24923 parsoid=wt2html,html2html
24924 !! wikitext
24925 =
24926 ==
24927 ===
24928 ====
24929 =====
24930 !! html/php
24931 <p>=
24932 ==
24933 </p>
24934 <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>
24935 <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>
24936 <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>
24937
24938 !! html/parsoid
24939 <p>=
24940 ==</p>
24941 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
24942 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
24943 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
24944 !! end
24945
24946 !! test
24947 Headings: 5. Empty headings
24948 !! options
24949 parsoid=html2wt
24950 !! html/parsoid
24951 <h1 data-parsoid='{}'></h1>
24952
24953 <h2 data-parsoid='{}'></h2>
24954
24955 <h3 data-parsoid='{}'></h3>
24956
24957 <h4 data-parsoid='{}'></h4>
24958
24959 <h5 data-parsoid='{}'></h5>
24960
24961 <h6 data-parsoid='{}'></h6>
24962 !! wikitext
24963 =<nowiki/>=
24964
24965 ==<nowiki/>==
24966
24967 ===<nowiki/>===
24968
24969 ====<nowiki/>====
24970
24971 =====<nowiki/>=====
24972
24973 ======<nowiki/>======
24974 !!end
24975
24976 !! test
24977 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24978 !! options
24979 parsoid=html2wt
24980 !! html/parsoid
24981 <p>=a=</p>
24982
24983 <p>=a=</p>
24984
24985 <p>=a=</p>
24986 !! wikitext
24987 <nowiki>=a=</nowiki>
24988
24989 <nowiki>=a=</nowiki>
24990
24991 <nowiki>=a=</nowiki>
24992 !!end
24993
24994 !! test
24995 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24996 !! options
24997 parsoid=html2wt
24998 !! html/parsoid
24999 <p>=a=
25000 b</p>
25001
25002 <p>=a=
25003 b</p>
25004
25005 <p>=a=
25006 b</p>
25007 !! wikitext
25008 <nowiki>=a=</nowiki>
25009 b
25010
25011 <nowiki>=a=</nowiki>
25012 b
25013
25014 <nowiki>=a=</nowiki>
25015 b
25016 !!end
25017
25018 !! test
25019 Headings: 6c. Heading chars in SOL context (leading newline break)
25020 !! options
25021 parsoid=html2wt
25022 !! html/parsoid
25023 <p>a
25024 =b=</p>
25025 !! wikitext
25026 a
25027 <nowiki>=b=</nowiki>
25028 !!end
25029
25030 !! test
25031 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25032 !! options
25033 parsoid=html2wt
25034 !! html/parsoid
25035 <!--c0--><p>=a=</p>
25036
25037 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25038 !! wikitext
25039 <!--c0--><nowiki>=a=</nowiki>
25040
25041 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25042 !!end
25043
25044 !! test
25045 Headings: 6d. Heading chars in SOL context (No escaping needed)
25046 !! options
25047 parsoid=html2wt
25048 !! html/parsoid
25049 =a=<div>b</div>
25050 !! wikitext
25051 =a=<div>b</div>
25052 !!end
25053
25054 !! test
25055 Headings: 7. Insert a newline between new content and headings
25056 !! options
25057 parsoid=html2wt
25058 !! html/parsoid
25059 <h2>NEW</h2>
25060 <p>new</p>
25061 <h2 data-parsoid='{}'>A</h2>
25062 <p data-parsoid='{}'>a</p>
25063 !! wikitext
25064 == NEW ==
25065 new
25066
25067 ==A==
25068 a
25069
25070 !! end
25071
25072 !! test
25073 Headings: Used as horizontal rule
25074 !! config
25075 wgFragmentMode=[ 'html5', 'legacy' ]
25076 !! options
25077 parsoid=wt2html
25078 !! wikitext
25079 ===============
25080 !! html/php
25081 <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>
25082
25083 !! html/parsoid
25084 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25085 !! end
25086
25087 #### --------------- Lists ---------------
25088 #### 0. Outside nests (*foo, etc.)
25089 #### 1. Nested inside html <ul><li>*foo</li></ul>
25090 #### 2. Inside definition lists
25091 #### 3. Only bullets at start should be escaped
25092 #### 4. No escapes needed
25093 #### 5. No unnecessary escapes
25094 #### 6. Escape bullets in SOL position
25095 #### 7. Escape bullets in a multi-line context
25096 #### ----------------------------------------
25097
25098 !! test
25099 Lists: 0. Outside nests
25100 !! options
25101 parsoid=html2wt
25102 !! html/parsoid
25103 <p>*foo</p>
25104
25105 <p>#foo</p>
25106
25107 <p>;Foo:bar</p>
25108 !! wikitext
25109 <nowiki>*</nowiki>foo
25110
25111 <nowiki>#</nowiki>foo
25112
25113 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25114 !!end
25115
25116 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25117 ## to test wikitext escaping, and insignificant whitespace diffs
25118 ## cause PHP parser tests to barf
25119 !! test
25120 Lists: 1. Nested inside html (No unnecessary escapes)
25121 !! options
25122 parsoid=html2wt
25123 !! html/parsoid
25124 <ul>
25125 <li>*foo</li>
25126 <li>#foo</li>
25127 <li>:foo</li>
25128 <li>;foo</li>
25129 <li data-parsoid='{}'>*foo</li>
25130 <li data-parsoid='{}'>#foo</li>
25131 <li data-parsoid='{}'>:foo</li>
25132 <li data-parsoid='{}'>;foo</li>
25133 </ul>
25134
25135 <ol>
25136 <li>*foo</li>
25137 <li>#foo</li>
25138 <li>:foo</li>
25139 <li>;foo</li>
25140 <li data-parsoid='{}'>*foo</li>
25141 <li data-parsoid='{}'>#foo</li>
25142 <li data-parsoid='{}'>:foo</li>
25143 <li data-parsoid='{}'>;foo</li>
25144 </ol>
25145 !! wikitext
25146 * *foo
25147 * #foo
25148 * :foo
25149 * ;foo
25150 *<nowiki>*foo</nowiki>
25151 *<nowiki>#foo</nowiki>
25152 *<nowiki>:foo</nowiki>
25153 *<nowiki>;foo</nowiki>
25154
25155 # *foo
25156 # #foo
25157 # :foo
25158 # ;foo
25159 #<nowiki>*foo</nowiki>
25160 #<nowiki>#foo</nowiki>
25161 #<nowiki>:foo</nowiki>
25162 #<nowiki>;foo</nowiki>
25163 !!end
25164
25165 !! test
25166 Lists: 2. Inside definition lists
25167 !! options
25168 parsoid=html2wt
25169 !! html/parsoid
25170 <dl><dt>;foo</dt></dl>
25171 <dl><dt>:foo</dt></dl>
25172 <dl><dt>:foo</dt>
25173 <dd>bar</dd></dl>
25174 <dl><dd>:foo</dd></dl>
25175 !! wikitext
25176 ; ;foo
25177
25178 ; <nowiki>:foo</nowiki>
25179
25180 ; <nowiki>:foo</nowiki>
25181 : bar
25182
25183 : :foo
25184 !!end
25185
25186 !! test
25187 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25188 !! options
25189 parsoid=html2wt
25190 !! html/parsoid
25191 <ul>
25192 <li>*foo*bar</li>
25193 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25194 </ul>
25195 !! wikitext
25196 * *foo*bar
25197 *<nowiki>*foo</nowiki>''it''*bar
25198 !!end
25199
25200 !! test
25201 Lists: 4. No escapes needed
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <ul>
25206 <li>foo*bar
25207 </li>
25208 </ul>
25209 <ul>
25210 <li><i>foo</i>*bar
25211 </li>
25212 </ul>
25213 <ul>
25214 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25215 </li>
25216 </ul>
25217 <ul>
25218 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25219 </li>
25220 </ul>
25221 !! wikitext
25222 *foo*bar
25223
25224 *''foo''*bar
25225
25226 *[[Foo]]: bar
25227
25228 *[[Foo]]*bar
25229 !!end
25230
25231 !! test
25232 Lists: 5. No unnecessary escapes
25233 !! options
25234 parsoid=html2wt
25235 !! html/parsoid
25236 <ul><li> bar <span>[[foo]]</span></li></ul>
25237 <ul><li> =bar <span>[[foo]]</span></li></ul>
25238 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25239 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25240 <ul><li> =bar <span>foo]]</span>=</li></ul>
25241 <ul><li> <s></s>: a</li></ul>
25242 <ul><li> <i>* foo</i></li></ul>
25243
25244 !! wikitext
25245 * bar <span><nowiki>[[foo]]</nowiki></span>
25246
25247 * =bar <span><nowiki>[[foo]]</nowiki></span>
25248
25249 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25250
25251 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25252
25253 * =bar <span>foo]]</span>=
25254
25255 * <s></s>: a
25256
25257 * ''* foo''
25258 !!end
25259
25260 !! test
25261 Lists: 6. Escape bullets in SOL position
25262 !! options
25263 parsoid=html2wt
25264 !! html/parsoid
25265 <p><!--cmt-->*foo</p>
25266 !! wikitext
25267 <!--cmt--><nowiki>*</nowiki>foo
25268 !!end
25269
25270 !! test
25271 Lists: 7. Escape bullets in a multi-line context
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <p>a
25276 *b
25277 </p>
25278 !! wikitext
25279 a
25280 <nowiki>*</nowiki>b
25281 !!end
25282
25283 !! test
25284 Lists: 8. Escape colons only if not present in tags
25285 !! options
25286 parsoid=html2wt
25287 !! html/parsoid
25288 <dl><dt>a:b<i>c:d</i></dt></dl>
25289 !! wikitext
25290 ; <nowiki>a:b</nowiki>''c:d''
25291 !! end
25292
25293 #### --------------- HRs ---------------
25294 #### 1. Single line
25295 #### -----------------------------------
25296
25297 !! test
25298 HRs: 1. Single line
25299 !! options
25300 parsoid=html2wt
25301 !! html/parsoid
25302 <hr />----
25303 <hr />=foo=
25304 <hr />*foo
25305 !! wikitext
25306 ----<nowiki>----</nowiki>
25307 ----=foo=
25308 ----*foo
25309 !! end
25310
25311 #### --------------- Tables ---------------
25312 #### 1a. Simple example
25313 #### 1b. No escaping needed (!foo)
25314 #### 1c. No escaping needed (|foo)
25315 #### 1d. No escaping needed (|}foo)
25316 ####
25317 #### 2a. Nested in td (<td>foo|bar</td>)
25318 #### 2b. Nested in td (<td>foo||bar</td>)
25319 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25320 ####
25321 #### 3a. Nested in th (<th>foo!bar</th>)
25322 #### 3b. Nested in th (<th>foo!!bar</th>)
25323 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25324 ####
25325 #### 4a. Escape -
25326 #### 4b. Escape +
25327 #### 4c. No escaping needed
25328 #### --------------------------------------
25329
25330 !! test
25331 Tables: 1a. Simple example
25332 !! options
25333 parsoid=html2wt
25334 !! html/parsoid
25335 <p>{|
25336 |}
25337 </p>
25338 !! wikitext
25339 <nowiki>{|</nowiki>
25340 |}
25341 !! end
25342
25343 !! test
25344 Tables: 1b. No escaping needed
25345 !! options
25346 parsoid=html2wt
25347 !! html/parsoid
25348 <p>!foo
25349 </p>
25350 !! wikitext
25351 !foo
25352 !! end
25353
25354 !! test
25355 Tables: 1c. No escaping needed
25356 !! options
25357 parsoid=html2wt
25358 !! html/parsoid
25359 <p>|foo
25360 </p>
25361 !! wikitext
25362 |foo
25363 !! end
25364
25365 !! test
25366 Tables: 1d. No escaping needed
25367 !! options
25368 parsoid=html2wt
25369 !! html/parsoid
25370 <p>|}foo
25371 </p>
25372 !! wikitext
25373 |}foo
25374 !! end
25375
25376 !! test
25377 Tables: 2a. Nested in td
25378 !! options
25379 parsoid=html2wt
25380 !! html/parsoid
25381 <table><tbody><tr>
25382 <td>foo|bar</td></tr>
25383 <tr><td>x<div>a|b</div></td>
25384 </tbody></table>
25385 !! wikitext
25386 {|
25387 |<nowiki>foo|bar</nowiki>
25388 |-
25389 |x<div><nowiki>a|b</nowiki></div>
25390 |}
25391 !! html/php+tidy
25392 <table>
25393 <tbody><tr>
25394 <td>foo|bar
25395 </td></tr>
25396 <tr>
25397 <td>x<div>a|b</div>
25398 </td></tr></tbody></table>
25399 !! end
25400
25401 !! test
25402 Tables: 2b. Nested in td
25403 !! options
25404 parsoid=html2wt
25405 !! html/parsoid
25406 <table><tbody><tr>
25407 <td>foo||bar</td>
25408 <td>a<i>b||c</i></td>
25409 <td>a<i><div>b||c</div></i></td>
25410 </tr></tbody></table>
25411 !! wikitext
25412 {|
25413 |<nowiki>foo||bar</nowiki>
25414 |a''<nowiki>b||c</nowiki>''
25415 |a''<div><nowiki>b||c</nowiki></div>''
25416 |}
25417 !! html/php
25418 <table>
25419 <tr>
25420 <td>foo||bar
25421 </td>
25422 <td>a<i>b||c</i>
25423 </td>
25424 <td>a<i><div>b||c</div></i>
25425 </td></tr></table>
25426
25427 !! end
25428
25429 !! test
25430 Tables: 2c. Nested in td -- no escaping needed
25431 !! options
25432 parsoid=html2wt
25433 !! html/*
25434 <table>
25435 <tr>
25436 <td>foo!!bar
25437 </td></tr></table>
25438
25439 !! wikitext
25440 {|
25441 |foo!!bar
25442 |}
25443 !! end
25444
25445 !! test
25446 Tables: 3a. Nested in th
25447 !! options
25448 parsoid=html2wt
25449 !! html/*
25450 <table>
25451 <tr>
25452 <th>foo!bar
25453 </th></tr></table>
25454
25455 !! wikitext
25456 {|
25457 !foo!bar
25458 |}
25459 !! end
25460
25461 !! test
25462 Tables: 3b. Nested in th
25463 !! options
25464 parsoid=html2wt
25465 !! html/parsoid
25466 <table><tbody>
25467 <tr><th>foo!!bar</th>
25468 <th><i>foo|bar</i></th>
25469 <th><i>foo!!bar</i></th>
25470 <th><i><span>foo!!bar</span></i></th>
25471 </tr></tbody></table>
25472 !! wikitext
25473 {|
25474 !<nowiki>foo!!bar</nowiki>
25475 !''<nowiki>foo|bar</nowiki>''
25476 !''<nowiki>foo!!bar</nowiki>''
25477 !''<span><nowiki>foo!!bar</nowiki></span>''
25478 |}
25479 !! html/php
25480 <table>
25481 <tr>
25482 <th>foo!!bar
25483 </th>
25484 <th><i>foo|bar</i>
25485 </th>
25486 <th><i>foo!!bar</i>
25487 </th>
25488 <th><i><span>foo!!bar</span></i>
25489 </th></tr></table>
25490
25491 !! end
25492
25493 !! test
25494 Tables: 3c. Nested in th
25495 !! options
25496 parsoid=html2wt
25497 !! html/parsoid
25498 <table><tbody>
25499 <tr><th>foo||bar</th>
25500 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25501 </tr></tbody></table>
25502 !! wikitext
25503 {|
25504 !<nowiki>foo||bar</nowiki>
25505 !<nowiki>foo||bar</nowiki>
25506 |}
25507 !! html/php
25508 <table>
25509 <tr>
25510 <th>foo||bar
25511 </th>
25512 <th>foo||bar
25513 </th></tr></table>
25514
25515 !! end
25516
25517 !! test
25518 Tables: 4a. Escape -
25519 !! options
25520 parsoid=html2wt
25521 !! html/*
25522 <table>
25523 <tr>
25524 <th>-bar
25525 </th></tr>
25526 <tr>
25527 <td>-bar
25528 </td></tr></table>
25529
25530 !! wikitext
25531 {|
25532 !-bar
25533 |-
25534 |<nowiki>-bar</nowiki>
25535 |}
25536 !! end
25537
25538 !! test
25539 Tables: 4b. Escape +
25540 !! options
25541 parsoid=html2wt
25542 !! html/*
25543 <table>
25544 <tr>
25545 <th>+bar
25546 </th></tr>
25547 <tr>
25548 <td>+bar
25549 </td></tr></table>
25550
25551 !! wikitext
25552 {|
25553 !+bar
25554 |-
25555 |<nowiki>+bar</nowiki>
25556 |}
25557 !! end
25558
25559 !! test
25560 Tables: 4c. No escaping needed
25561 !! options
25562 parsoid=html2wt
25563 !! html/parsoid
25564 <table><tbody>
25565 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25566 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25567 <tr><td>foo
25568 <p>bar|baz
25569 +bar
25570 -bar</p></td></tr>
25571 <tr><td>x
25572 <div>a|b</div></td>
25573 </tbody></table>
25574 !! wikitext
25575 {|
25576 |foo-bar
25577 |foo+bar
25578 |-
25579 |''foo''-bar
25580 |''foo''+bar
25581 |-
25582 |foo
25583 bar|baz
25584 +bar
25585 -bar
25586 |-
25587 |x
25588 <div>a|b</div>
25589 |}
25590 !! html/php
25591 <table>
25592 <tr>
25593 <td>foo-bar
25594 </td>
25595 <td>foo+bar
25596 </td></tr>
25597 <tr>
25598 <td><i>foo</i>-bar
25599 </td>
25600 <td><i>foo</i>+bar
25601 </td></tr>
25602 <tr>
25603 <td>foo
25604 <p>bar|baz
25605 +bar
25606 -bar
25607 </p>
25608 </td></tr>
25609 <tr>
25610 <td>x
25611 <div>a|b</div>
25612 </td></tr></table>
25613
25614 !! end
25615
25616 !! test
25617 Tables: 4d. No escaping needed
25618 !! options
25619 parsoid=html2wt
25620 !! html/parsoid
25621 <table>
25622 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25623 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25624 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25625 </tbody></table>
25626 !! wikitext
25627 {|
25628 |[[Foo]]-bar
25629 ||+1
25630 ||-2
25631 |}
25632 !! html/php
25633 <table>
25634 <tr>
25635 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25636 </td>
25637 <td>+1
25638 </td>
25639 <td>-2
25640 </td></tr></table>
25641
25642 !! end
25643
25644 !! test
25645 T97430: Don't emit empty nowiki pairs around marker meta tags
25646 !! options
25647 parsoid=html2wt
25648 !! html/parsoid
25649 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25650 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25651 !! wikitext
25652 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25653 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25654 !! end
25655
25656 !! test
25657 Unclosed xmlish element in table line shouldn't eat end delimiters
25658 !! options
25659 parsoid=html2wt
25660 !! html/parsoid
25661 <table>
25662 <tbody><tr><td> &lt;foo</td>
25663 <td> bar></td></tr>
25664 </tbody></table>
25665 !! wikitext
25666 {|
25667 | <foo
25668 | bar>
25669 |}
25670 !! html/php
25671 <table>
25672 <tr>
25673 <td> &lt;foo
25674 </td>
25675 <td> bar&gt;
25676 </td></tr></table>
25677
25678 !! end
25679
25680 #### --------------- Links ----------------
25681 #### 1. Quote marks in link text
25682 #### 2. Wikilinks: Escapes needed
25683 #### 3. Wikilinks: No escapes needed
25684 #### 4. Extlinks: Escapes needed
25685 #### 5. Extlinks: No escapes needed
25686 #### --------------------------------------
25687 !! test
25688 Links 1. WikiLinks: No escapes needed
25689 !! options
25690 parsoid=html2wt
25691 !! html/parsoid
25692 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25693 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25694 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25695 !! wikitext
25696 [[Foo|Foo''boo'']]
25697 [[Foo|[Foobar]]]
25698 [[Foo|x [Foobar] x]]
25699 !! html/php
25700 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25701 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25702 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25703 </p>
25704 !! end
25705
25706 !! test
25707 Links 2. WikiLinks: Escapes needed
25708 !! options
25709 parsoid=html2wt
25710 !! html/parsoid
25711 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25712 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25713 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25714 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25715 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25716 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25717 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25718 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25719 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25720 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25721 !! wikitext
25722 [[Foo|<nowiki>Foobar]</nowiki>]]
25723 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25724 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25725 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25726 [[Foo|<nowiki>|Bar</nowiki>]]
25727 [[Foo|<nowiki>]]bar</nowiki>]]
25728 [[Foo|<nowiki>[[bar</nowiki>]]
25729 [[Foo|<nowiki>x [[ y</nowiki>]]
25730 [[Foo|<nowiki>x ]] y</nowiki>]]
25731 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25732 !! html/php
25733 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25734 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25735 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25736 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25737 <a href="/wiki/Foo" title="Foo">|Bar</a>
25738 <a href="/wiki/Foo" title="Foo">]]bar</a>
25739 <a href="/wiki/Foo" title="Foo">[[bar</a>
25740 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25741 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25742 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25743 </p>
25744 !! end
25745
25746 !! test
25747 Links 3. WikiLinks: No escapes needed
25748 !! options
25749 parsoid=html2wt
25750 !! html/parsoid
25751 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25752 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25753 !! wikitext
25754 [[Foo|[Foobar]]
25755 [[Foo|foo|bar]]
25756 !! html/php
25757 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25758 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25759 </p>
25760 !! end
25761
25762 !! test
25763 Links 4. ExtLinks: Escapes needed
25764 !! options
25765 parsoid=html2wt
25766 !! html/parsoid
25767 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25768 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25769 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25770 <p>[http://google.com]</p>
25771 <p>[http://google.com google]</p>
25772 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25773 <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>
25774 !! wikitext
25775 [http://google.com <nowiki>[google]</nowiki>]
25776 [http://google.com <nowiki>google]</nowiki>]
25777 [http://google.com <nowiki>goog] le</nowiki>]
25778
25779 <nowiki>[http://google.com]</nowiki>
25780
25781 <nowiki>[http://google.com google]</nowiki>
25782
25783 [http://google.com<nowiki>]</nowiki>
25784
25785 [{{echo|http://google.com}}<nowiki>]</nowiki>
25786 !! html/php
25787 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25788 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25789 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25790 </p><p>[http://google.com]
25791 </p><p>[http://google.com google]
25792 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25793 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25794 </p>
25795 !! end
25796
25797 !! test
25798 Links 5. ExtLinks: No escapes needed
25799 !! options
25800 parsoid=html2wt
25801 !! html/parsoid
25802 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25803 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25804 !! wikitext
25805 [http://google.com [google]
25806
25807 [[http://google.com]]
25808 !! html/php
25809 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25810 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25811 </p>
25812 !! end
25813
25814 !! test
25815 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25816 !! options
25817 parsoid=html2wt
25818 !! html/parsoid
25819 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25820 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25821 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25822 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25826 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25827 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25828 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25830 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25831 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25832 </p>
25833 !! wikitext
25834 x<nowiki/>http://example.com<nowiki/>y
25835 http://example.com<nowiki/>?x
25836 http://example.com<nowiki/>&x
25837 http://example.com<nowiki/>'x
25838 http://example.com<nowiki/>,x
25839 http://example.com<nowiki/>.x
25840 http://example.com<nowiki/>;x
25841 http://example.com<nowiki/>:x
25842 http://example.com<nowiki/>;x
25843 http://example.com<nowiki/>!x
25844 http://example.com<nowiki/>=x
25845 http://example.com<nowiki/>(x)
25846 http://example.com(x<nowiki/>)
25847 !! end
25848
25849 !! test
25850 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25851 !! options
25852 parsoid=html2wt
25853 !! html/parsoid
25854 <p>x
25855 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25856 y
25857 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25858 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25859 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25860 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25861 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25862 </p>
25863 !! wikitext
25864 x
25865 http://example.com
25866 y
25867 "http://example.com"
25868 (http://example.com)
25869 (http://example.com) foo
25870 http://example.com,
25871 http://example.com, foo
25872 !! html/php
25873 <p>x
25874 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25875 y
25876 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25877 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25878 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25879 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25880 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25881 </p>
25882 !! end
25883
25884 !! test
25885 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25886 !! options
25887 parsoid=html2wt
25888 !! html/parsoid
25889 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25890 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25891 !! wikitext
25892 http://example.com.,;:!?\
25893 -http://example.com:
25894 !! html/php
25895 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25896 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25897 </p>
25898 !! end
25899
25900 !! test
25901 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25902 !! options
25903 parsoid=html2wt
25904 !! html/parsoid
25905 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25906 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25907 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25908 !! wikitext
25909 RFC 123<nowiki/>4
25910 RFC 123<nowiki/>y
25911 X<nowiki/>RFC 123<nowiki/>y
25912 !! end
25913
25914 !! test
25915 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25916 !! options
25917 parsoid=html2wt
25918 !! html/parsoid
25919 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25920 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25921 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25922 </p>
25923 !! wikitext
25924 RFC 123?foo
25925 RFC 123&foo
25926 -RFC 123-
25927 !! html/php
25928 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
25929 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25930 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
25931 </p>
25932 !! end
25933
25934 !! test
25935 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25936 !! options
25937 parsoid=html2wt
25938 !! html/parsoid
25939 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25940 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25941 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25942 !! wikitext
25943 PMID 123<nowiki/>4
25944 PMID 123<nowiki/>y
25945 X<nowiki/>PMID 123<nowiki/>y
25946 !! end
25947
25948 !! test
25949 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25950 !! options
25951 parsoid=html2wt
25952 !! html/parsoid
25953 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25954 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25955 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25956 </p>
25957 !! wikitext
25958 PMID 123?foo
25959 PMID 123&foo
25960 -PMID 123-
25961 !! html/php
25962 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25963 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25964 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25965 </p>
25966 !! end
25967
25968 !! test
25969 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25970 !! options
25971 parsoid=html2wt
25972 !! html/parsoid
25973 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25974 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25975 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25976 </p>
25977 !! wikitext
25978 ISBN 1234567890<nowiki/>1
25979 ISBN 1234567890<nowiki/>x
25980 a<nowiki/>ISBN 1234567890<nowiki/>b
25981 !! end
25982
25983 !! test
25984 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25985 !! options
25986 parsoid=html2wt
25987 !! html/parsoid
25988 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25989 !! wikitext
25990 -ISBN 1234567890's
25991 !! html/php
25992 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25993 </p>
25994 !! end
25995
25996 !! test
25997 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25998 !! options
25999 parsoid=html2wt
26000 !! html/*
26001 <p>this is not a link: http://example.com
26002 </p>
26003 !! wikitext
26004 this is not a link: <nowiki>http://example.com</nowiki>
26005 !! end
26006
26007 !! test
26008 Links 15. Link trails can't become link prefixes.
26009 !! options
26010 language=is
26011 parsoid=html2wt
26012 !! html/parsoid
26013 <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>
26014 !! wikitext
26015 [[Söfnuður]]-[[00]]
26016 !! html/php
26017 <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>
26018 </p>
26019 !! end
26020
26021 #### --------------- Quotes ---------------
26022 #### 1. Quotes inside <b> and <i>
26023 #### 2. Link fragments separated by <i> and <b> tags
26024 #### 3. Link fragments inside <i> and <b>
26025 #### 4. No escaping needed
26026 #### --------------------------------------
26027 !! test
26028 1a. Quotes inside <b> and <i>
26029 !! options
26030 parsoid=html2wt
26031 !! html/*
26032 <p><i>'foo'</i>
26033 <i>''foo''</i>
26034 <i>'''foo'''</i>
26035 <i>foo</i>'s
26036 <b>'foo'</b>
26037 <b>''foo''</b>
26038 <b>'''foo'''</b>
26039 <b>foo'<i>bar'</i>baz</b>
26040 <b>foo</b>'s
26041 '<i>foo</i>
26042 <i>foo</i>'
26043 <i>foo'</i>'
26044 '<i>foo</i>'
26045 '<b>foo</b>
26046 <b>foo</b>'
26047 '<b>foo</b>'
26048 <i>fools'<span> errand</span></i>
26049 <i><span>fool</span>'s errand</i>
26050 '<i>foo</i> bar '<i>baz</i>
26051 a|!*#-:;+-~[]{}b'<i>x</i>
26052 </p>
26053 !! wikitext
26054 ''<nowiki/>'foo'''
26055 ''<nowiki>''foo''</nowiki>''
26056 ''<nowiki>'''foo'''</nowiki>''
26057 ''foo''<nowiki/>'s
26058 '''<nowiki/>'foo''''
26059 '''<nowiki>''foo''</nowiki>'''
26060 '''<nowiki>'''foo'''</nowiki>'''
26061 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26062 '''foo'''<nowiki/>'s
26063 '''foo''
26064 ''foo''<nowiki/>'
26065 ''foo'''<nowiki/>'
26066 '''foo''<nowiki/>'
26067 ''''foo'''
26068 '''foo'''<nowiki/>'
26069 ''''foo'''<nowiki/>'
26070 ''fools'<span> errand</span>''
26071 ''<span>fool</span>'s errand''
26072 '<nowiki/>''foo'' bar '''baz''
26073 a|!*#-:;+-~[]{}b'''x''
26074 !! end
26075
26076 !! test
26077 1b. Quotes inside <b> and <i> with other tags on same line
26078 !! options
26079 parsoid=html2wt
26080 !! html/parsoid
26081 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26082 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26083 <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>
26084 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26085 '<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>
26086 '<i>foo</i> <div title="name">test</div>
26087 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26088 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26089 <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>
26090 </ol>
26091 !! wikitext
26092 '''a'' foo ''[[bar]]''
26093 ''a''' foo ''[[bar]]''
26094 ''a''' foo '''{{echo|[[bar]]}}'''
26095 [[foo]] x'''[[bar]]''
26096 '''foo'' <ref>test</ref>
26097 '''foo'' <div title="name">test</div>
26098 '''foo'' and <br> bar
26099 <references />
26100 !! end
26101
26102 !! test
26103 2. Link fragments separated by <i> and <b> tags
26104 !! options
26105 parsoid=html2wt
26106 !! html/parsoid
26107 <p>[[<i>foo</i>hello]]</p>
26108 <p>[[<b>foo</b>hello]]</p>
26109 !! wikitext
26110 [[''foo''<nowiki>hello]]</nowiki>
26111
26112 [['''foo'''<nowiki>hello]]</nowiki>
26113 !! end
26114
26115 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26116 # this is one of the shortcomings of this format
26117 !! test
26118 3. Link fragments inside <i> and <b>
26119 !! options
26120 parsoid=html2wt
26121 !! html/parsoid
26122 <p><i>[[foo</i>]]</p>
26123 <p><b>[[foo</b>]]</p>
26124 !! wikitext
26125 ''[[foo''<nowiki>]]</nowiki>
26126
26127 '''[[foo'''<nowiki>]]</nowiki>
26128 !! end
26129
26130 !! test
26131 4. No escaping needed
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <p>'<span><i>bar</i></span>'
26136 '<span><b>bar</b></span>'
26137 'a:b'foo
26138 </p>
26139 !! wikitext
26140 '<span>''bar''</span>'
26141 '<span>'''bar'''</span>'
26142 'a:b'foo
26143 !! end
26144
26145 #### ----------- Paragraphs ---------------
26146 #### 1. No unnecessary escapes
26147 #### --------------------------------------
26148
26149 !! test
26150 1. No unnecessary escapes
26151 !! options
26152 parsoid=html2wt
26153 !! html/parsoid
26154 <p>bar <span>[[foo]]</span>
26155 </p><p>=bar <span>[[foo]]</span>
26156 </p><p>[[bar <span>[[foo]]</span>
26157 </p><p>]]bar <span>[[foo]]</span>
26158 </p><p>=bar <span>foo]]</span>=
26159 </p>
26160 !! wikitext
26161 bar <span><nowiki>[[foo]]</nowiki></span>
26162
26163 =bar <span><nowiki>[[foo]]</nowiki></span>
26164
26165 [[bar <span><nowiki>[[foo]]</nowiki></span>
26166
26167 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26168
26169 =bar <span>foo]]</span><nowiki>=</nowiki>
26170 !!end
26171
26172 #### ----------------------- PRE --------------------------
26173 #### 1. Leading whitespace in SOL context should be escaped
26174 #### ------------------------------------------------------
26175 !! test
26176 1. Leading whitespace in SOL context should be escaped
26177 !! options
26178 parsoid=html2wt
26179 !! html/parsoid
26180 <p> a</p>
26181
26182 <p> a</p>
26183
26184 <p> a(tab)</p>
26185
26186 <p> a
26187 <!--cmt-->
26188 a</p>
26189
26190 <p>a
26191 b</p>
26192
26193 <p>a
26194 b</p>
26195
26196 <p>a
26197 b</p>
26198 !! wikitext
26199 <nowiki> </nowiki>a
26200
26201 <nowiki> </nowiki> a
26202
26203 a(tab)
26204
26205 <nowiki> </nowiki> a
26206 <!--cmt-->
26207 <nowiki> </nowiki>a
26208
26209 a
26210 <nowiki> </nowiki>b
26211
26212 a
26213 b
26214
26215 a
26216 b
26217 !! html/php
26218 <p> a
26219 </p><p> a
26220 </p><p> a(tab)
26221 </p><p> a
26222 a
26223 </p><p>a
26224 b
26225 </p><p>a
26226 b
26227 </p><p>a
26228 b
26229 </p>
26230 !! end
26231
26232 !! test
26233 2. Leading whitespace in non-indent-pre contexts should not be escaped
26234 !! options
26235 parsoid=html2wt
26236 !! html/parsoid
26237 <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>
26238 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26239 <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>
26240 b</span></li>
26241 </ol>
26242 !! wikitext
26243 foo <ref>''a''
26244 b</ref>
26245 <references />
26246 !! end
26247
26248 !! test
26249 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26250 !! options
26251 parsoid=html2wt
26252 !! html/parsoid
26253 <blockquote>
26254 <p>
26255 a
26256 <span>b</span>
26257 c</p>
26258 </blockquote>
26259 !! wikitext
26260 <blockquote>
26261 a
26262 <span>b</span>
26263 c
26264 </blockquote>
26265 !! end
26266
26267 !! test
26268 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26269 !! options
26270 parsoid=html2wt
26271 !! html/parsoid
26272 <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>
26273 !! wikitext
26274 [[File:Foobar.jpg|thumb|caption]]
26275 !! end
26276
26277 !! test
26278 5. Nowiki escaping should account for indent-pres
26279 !! options
26280 parsoid=html2wt
26281 !! html/parsoid
26282 <pre>==foo==</pre>
26283 !! wikitext
26284 ==foo==
26285 !! end
26286
26287 !!test
26288 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <pre>
26293 * foo
26294 * bar
26295 </pre>
26296 !! wikitext
26297 * foo
26298 * bar
26299 !! end
26300
26301 #### --------------- Behavior Switches --------------------
26302
26303 !! test
26304 1. Valid behavior switches should be escaped
26305 !! options
26306 parsoid=html2wt
26307 !! html/parsoid
26308 __TOC__
26309 <i>__TOC__</i>
26310 !! wikitext
26311 <nowiki>__TOC__</nowiki>
26312 ''<nowiki>__TOC__</nowiki>''
26313 !! end
26314
26315 !! test
26316 2. Invalid behavior switches should not be escaped
26317 !! options
26318 parsoid=html2wt
26319 !! html/parsoid
26320 __TOO__
26321 __|__
26322 !! wikitext
26323 __TOO__
26324 __|__
26325 !! end
26326
26327 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26328 !! test
26329 Behavior switches should be SOL-transparent
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <meta property="mw:PageProp/toc" />
26334
26335 <!-- this one's bogus -->
26336 <pre>__TOO__</pre>
26337
26338 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26339
26340 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26341 !! wikitext
26342 __TOC__
26343
26344 <!-- this one's bogus -->
26345 __TOO__
26346
26347 __TOC__ foo
26348
26349 __TOC__
26350 bar
26351 !! end
26352
26353 #### --------------- HTML tags ---------------
26354 #### 1. a tags
26355 #### 2. other tags
26356 #### 3. multi-line html tag
26357 #### 4. extension tags
26358 #### -----------------------------------------
26359 !! test
26360 1. a tags
26361 !! options
26362 parsoid=html2wt
26363 !! html/parsoid
26364 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26365 !! wikitext
26366 <a href="http://google.com">google</a>
26367 !! end
26368
26369 !! test
26370 2. other tags
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26375 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26376 <li> &lt;td&gt;</li></ul>
26377
26378 !! wikitext
26379 * <nowiki><div>foo</div></nowiki>
26380 * <nowiki><div style="color:red">foo</div></nowiki>
26381 * <nowiki><td></nowiki>
26382 !! end
26383
26384 !! test
26385 3. multi-line html tag
26386 !! options
26387 parsoid=html2wt
26388 !! html/parsoid
26389 <p>&lt;div
26390 &gt;foo&lt;/div
26391 &gt;
26392 </p>
26393 !! wikitext
26394 <nowiki><div
26395 >foo</div
26396 ></nowiki>
26397 !! end
26398
26399 !! test
26400 4. extension tags
26401 !! options
26402 parsoid=html2wt
26403 !! html/parsoid
26404 <p>&lt;ref&gt;foo&lt;/ref&gt;
26405 </p><p>&lt;ref&gt;bar
26406 </p><p>baz&lt;/ref&gt;
26407 </p>
26408 !! wikitext
26409 <nowiki><ref>foo</ref></nowiki>
26410
26411 <nowiki><ref>bar</nowiki>
26412
26413 baz<nowiki></ref></nowiki>
26414 !! end
26415
26416 #### --------------- Others ---------------
26417 !! test
26418 Escaping nowikis
26419 !! options
26420 parsoid=html2wt
26421 !! html/parsoid
26422 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26423 </p>
26424 !! wikitext
26425 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26426 !! end
26427
26428 ## The quote-char in the input is necessary for triggering the bug
26429 !! test
26430 (T54035) Nowiki-escaping should not get tripped by " :" in text
26431 !! options
26432 parsoid=html2wt
26433 !! html/parsoid
26434 <p>foo's bar :</p>
26435 !! wikitext
26436 foo's bar :
26437 !! end
26438
26439 #----------- End of wikitext escaping tests --------------
26440
26441 !! test
26442
26443 Tag-like HTML structures are passed through as text
26444 !! wikitext
26445 <x y>
26446
26447 <x.y>
26448
26449 <x-y>
26450
26451 1>2
26452
26453 x<y
26454
26455 a>b
26456
26457 1<d e>f
26458 !! html
26459 <p>&lt;x y&gt;
26460 </p><p>&lt;x.y&gt;
26461 </p><p>&lt;x-y&gt;
26462 </p><p>1&gt;2
26463 </p><p>x&lt;y
26464 </p><p>a&gt;b
26465 </p><p>1&lt;d e&gt;f
26466 </p>
26467 !! end
26468
26469 !! test
26470 HTML tag with necessary entities in attributes
26471 !! wikitext
26472 <span title="&amp;amp;">foo</span>
26473 !! html
26474 <p><span title="&amp;amp;">foo</span>
26475 </p>
26476 !! end
26477
26478 !! test
26479 HTML tag with 'unnecessary' entity encoding in attributes
26480 !! wikitext
26481 <span title="&amp;">foo</span>
26482 !! html
26483 <p><span title="&amp;">foo</span>
26484 </p>
26485 !! end
26486
26487 !! test
26488 HTML tag with broken attribute value quoting
26489 !! options
26490 parsoid=wt2html,html2html
26491 !! wikitext
26492 <span title="Hello world>Foo</span>
26493 !! html/php
26494 <p><span title="Hello world">Foo</span>
26495 </p>
26496 !! html/parsoid
26497 <p><span title="Hello world">Foo</span></p>
26498 !! end
26499
26500 !! test
26501 Self-closed tag with broken attribute value quoting
26502 !! options
26503 parsoid=wt2html,html2html
26504 !! wikitext
26505 <div title="Hello world />Foo
26506 !! html/php+tidy
26507 <div title="Hello world"></div><p>Foo
26508 </p>
26509 !! html/parsoid
26510 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26511 !! end
26512
26513 !! test
26514 Table with broken attribute value quoting
26515 !! options
26516 parsoid=wt2html,html2html
26517 !! wikitext
26518 {|
26519 | title="Hello world|Foo
26520 |}
26521 !! html/php
26522 <table>
26523 <tr>
26524 <td title="Hello world">Foo
26525 </td></tr></table>
26526
26527 !! html/parsoid
26528 <table>
26529 <tr>
26530 <td title="Hello world">Foo
26531 </td></tr></table>
26532
26533 !! end
26534
26535 !! test
26536 Table with broken attribute value quoting on consecutive lines
26537 !! options
26538 parsoid=wt2html,html2html
26539 !! wikitext
26540 {|
26541 | title="Hello world|Foo
26542 | style="color:red|Bar
26543 |}
26544 !! html/php
26545 <table>
26546 <tr>
26547 <td title="Hello world">Foo
26548 </td>
26549 <td style="color:red">Bar
26550 </td></tr></table>
26551
26552 !! html/parsoid
26553 <table><tbody>
26554 <tr>
26555 <td title="Hello world">Foo
26556 </td><td style="color: red">Bar
26557 </td></tr></tbody></table>
26558
26559 !! end
26560
26561 !!test
26562 Accept empty td cell attribute
26563 !! wikitext
26564 {|
26565 | align="center" | foo || |
26566 |}
26567 !! html
26568 <table>
26569 <tr>
26570 <td align="center"> foo </td>
26571 <td>
26572 </td></tr></table>
26573
26574 !!end
26575
26576 !!test
26577 Non-empty attributes in th-cells
26578 !! wikitext
26579 {|
26580 ! Foo !! style="color: red" | Bar
26581 |}
26582 !! html
26583 <table>
26584 <tr>
26585 <th> Foo </th>
26586 <th style="color: red"> Bar
26587 </th></tr></table>
26588
26589 !!end
26590
26591 !!test
26592 Accept empty attributes in th-cells
26593 !! wikitext
26594 {|
26595 !| foo !!| bar
26596 |}
26597 !! html
26598 <table>
26599 <tr>
26600 <th> foo </th>
26601 <th> bar
26602 </th></tr></table>
26603
26604 !!end
26605
26606 !!test
26607 Empty table rows go away
26608 !! wikitext
26609 {|
26610 | Hello
26611 | there
26612 |- class="foo"
26613 |-
26614 |}
26615 !! html
26616 <table>
26617 <tr>
26618 <td> Hello
26619 </td>
26620 <td> there
26621 </td></tr>
26622
26623 </table>
26624
26625 !! end
26626
26627 ###
26628 ### Parsoid-centric tests for testing RTing of inter-element separators
26629 ### Edge cases not tested by existing parser tests and specific to
26630 ### Parsoid-specific serialization strategies.
26631 ###
26632
26633 !!test
26634 RT-ed inter-element separators should be valid separators
26635 !! wikitext
26636 {|
26637 |- [[foo]]
26638 |}
26639 !! html/php
26640 <table>
26641
26642 </table>
26643
26644 !! html/parsoid
26645 <table>
26646 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26647 </tbody></table>
26648 !!end
26649
26650 # Parsoid-only test of a DOM pass
26651 !!test
26652 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26653 !! wikitext
26654 {|
26655 |<small>foo
26656 bar
26657 |}
26658
26659 {|
26660 |<small>foo<small>
26661 |}
26662 !! html/parsoid
26663 <table>
26664 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26665 <p>bar</p></small></td></tr>
26666 </tbody></table>
26667
26668 <table>
26669 <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>
26670 </tbody></table>
26671 !!end
26672
26673 # Note that the "style" attribute is really a template parameter here.
26674 # The = would have to be {{=}} if you wanted the literal.
26675 !!test
26676 Empty TD followed by TD with tpl-generated attribute
26677 !! wikitext
26678 {|
26679 |-
26680 |
26681 |{{echo|style='color:red'}}|foo
26682 |}
26683 !! html
26684 <table>
26685
26686 <tr>
26687 <td>
26688 </td>
26689 <td>foo
26690 </td></tr></table>
26691
26692 !!end
26693
26694 !!test
26695 Indented table with an empty td
26696 !! wikitext
26697 {|
26698 |-
26699 |
26700 |foo
26701 |}
26702 !! html
26703 <table>
26704
26705 <tr>
26706 <td>
26707 </td>
26708 <td>foo
26709 </td></tr></table>
26710
26711 !!end
26712
26713 ## We have some newline diffs RT-ing this edge case
26714 ## and it is not important enough -- we seem to be emitting
26715 ## at most 2 newlines after a </tr> and this is unrelated to
26716 ## the issue from T85627 that this is testing.
26717 !!test
26718 Indented table with blank lines in between (T85627)
26719 !! options
26720 parsoid=wt2html
26721 !! wikitext
26722 {|
26723 |foo
26724
26725
26726 |}
26727 !! html
26728 <table>
26729
26730 <tr>
26731 <td>foo
26732 </td></tr></table>
26733
26734 !!end
26735
26736 !!test
26737 Indented block & table
26738 !! wikitext
26739 <div>foo</div>
26740 {|
26741 |foo
26742 |}
26743 !! html/php
26744 <div>foo</div>
26745 <table>
26746 <tr>
26747 <td>foo
26748 </td></tr></table>
26749
26750 !! html/parsoid
26751 <div data-parsoid='{"stx":"html"}'>foo</div>
26752 <table><tbody>
26753 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26754 </tbody></table>
26755 !!end
26756
26757 !! test
26758 Indent and comment before table row
26759 !! wikitext
26760 {|
26761 <!--hi-->|-
26762 | there
26763 |}
26764 !! html/php
26765 <table>
26766
26767 <tr>
26768 <td> there
26769 </td></tr></table>
26770
26771 !! html/parsoid
26772 <table>
26773 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26774 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26775 </tbody></table>
26776 !! end
26777
26778 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26779 !!test
26780 Empty TR followed by a template-generated TR
26781 !!options
26782 parsoid
26783 !! wikitext
26784 {|
26785 |-
26786 {{echo|<tr><td>foo</td></tr>}}
26787 |}
26788 !! html
26789 <table>
26790 <tbody>
26791 <tr class='mw-empty-elt'></tr>
26792 <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}}]}'>
26793 <td>foo</td></tr>
26794 </tbody></table>
26795 !!end
26796
26797 ## PHP and parsoid output differ for this, and since this is primarily
26798 ## for testing Parsoid's serializer, marking this Parsoid only
26799 !!test
26800 Empty TR followed by mixed-ws-comment line should RT correctly
26801 !!options
26802 parsoid
26803 !! wikitext
26804 {|
26805 |-
26806 <!--c-->
26807 |-
26808 <!--c--> <!--d-->
26809 |}
26810 !! html
26811 <table>
26812 <tbody>
26813 <tr class='mw-empty-elt'></tr>
26814 <!--c-->
26815 <tr>
26816 <!--c--> </tr><!--d-->
26817 </tbody></table>
26818
26819 !!end
26820
26821 !!test
26822 Multi-line image caption generated by templates with/without trailing newlines
26823 !! wikitext
26824 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26825 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26826 !! html/parsoid
26827 <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>
26828 <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>
26829 !!end
26830
26831 !! test
26832 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26833 !! options
26834 parsoid=html2wt
26835 !! html/parsoid
26836 <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>
26837
26838 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26839 !! wikitext
26840 <includeonly>foo</includeonly>
26841 new para
26842
26843 [[Category:Foo]]
26844
26845 = new heading =
26846 !! end
26847
26848 ## PHP emits broken html for this, and since this is primarily
26849 ## a Parsoid serializer test, marking this Parsoid only
26850 !!test
26851 Improperly nested inline or quotes tags with whitespace in between
26852 !! wikitext
26853 <span> <s>x</span> </s>
26854 ''' ''x''' ''
26855 !! html/parsoid
26856 <p><span> <s>x</s></span><s> </s>
26857 <b> <i>x</i></b><i> </i>
26858 </p>
26859 !!end
26860
26861 !!test
26862 Encapsulate protected attributes from wt
26863 !! wikitext
26864 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26865
26866 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26867 | ok
26868 |}
26869 !! html/parsoid
26870 <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>
26871
26872 <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">
26873 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26874 </tbody></table>
26875 !!end
26876
26877 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26878 ## Having nested or stray pre tags results in the attempt to add duplicates,
26879 ## causing an assertion fail. This test tries to prevent that situation.
26880 !!test
26881 Ensure ParagraphWrapper can deal with stray closing pre tags
26882 !!options
26883 parsoid=wt2html
26884 !! wikitext
26885 plain text</pre>
26886 !! html/parsoid
26887 plain text
26888 !!end
26889
26890 !!test
26891 1. Ensure fostered text content is wrapped in element nodes
26892 !!options
26893 parsoid=wt2html
26894 !! wikitext
26895 <table>hi</table><table>ho</table>
26896 !! html/parsoid
26897 <p>hi</p>
26898 <table></table>
26899 <p>ho</p>
26900 <table></table>
26901 !!end
26902
26903 !!test
26904 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26905 !!options
26906 parsoid=wt2html,wt2wt
26907 !! wikitext
26908 <table>
26909 <tr> || ||
26910 <td> a
26911 </table>
26912 !! html/parsoid
26913 <p> || ||
26914 </p><table>
26915 <tbody><tr><td> a</td></tr>
26916 </tbody></table>
26917 !!end
26918
26919 !!test
26920 Encapsulation properly handles null DSR information from foster box
26921 !!options
26922 parsoid=wt2html,wt2wt
26923 !! wikitext
26924 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26925 !! html/parsoid
26926 <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>
26927 !!end
26928
26929 !!test
26930 1. Encapsulate foster-parented transclusion content
26931 !!options
26932 parsoid=wt2wt,wt2html
26933 !! wikitext
26934 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26935 !! html/parsoid
26936 <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>
26937 <tbody>
26938 <tr>
26939 <td>bar</td>
26940 </tr>
26941 </tbody>
26942 </table>
26943 !!end
26944
26945 !!test
26946 2. Encapsulate foster-parented transclusion content
26947 !!options
26948 parsoid=wt2wt,wt2html
26949 !! wikitext
26950 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26951 !! html/parsoid
26952 <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>
26953 <table>
26954 <tbody>
26955 <tr>
26956 <td>bar</td>
26957 </tr>
26958 </tbody>
26959 </table>
26960 !!end
26961
26962 !!test
26963 3. Encapsulate foster-parented transclusion content
26964 !!options
26965 parsoid=wt2wt,wt2html
26966 !! wikitext
26967 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26968 !! html/parsoid
26969 <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;]}">
26970 <p>foo</p>
26971 </div>
26972 <table>
26973 <tbody>
26974 <tr>
26975 <td>bar</td>
26976 </tr>
26977 </tbody>
26978 </table>
26979 !!end
26980
26981 !!test
26982 4. Encapsulate foster-parented transclusion content
26983 !!options
26984 parsoid=wt2wt,wt2html
26985 !! wikitext
26986 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26987 !! html/parsoid
26988 <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;]}">
26989 <p>foo</p>
26990 </div>
26991 <table>
26992 <tbody>
26993 <tr>
26994 <td>bar</td>
26995 </tr>
26996 </tbody>
26997 </table>
26998 !!end
26999
27000 !!test
27001 5. Encapsulate foster-parented transclusion content
27002 !!options
27003 parsoid=wt2wt,wt2html
27004 !! wikitext
27005 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27006 !! html/parsoid
27007 <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>
27008 <table>
27009 <tbody>
27010 <tr>
27011 <td>
27012 <div>
27013 <p>foo</p>
27014 </div>
27015 </td>
27016 </tr>
27017 </tbody>
27018 </table>
27019 !!end
27020
27021 !!test
27022 6. Encapsulate foster-parented transclusion content
27023 !!options
27024 parsoid=wt2wt,wt2html
27025 !! wikitext
27026 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27027 !! html/parsoid
27028 <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>
27029 <table>
27030 <tbody>
27031 <tr>
27032 <td>
27033 <div>
27034 <p>foo</p>
27035 </div>
27036 </td>
27037 </tr>
27038 </tbody>
27039 </table>
27040 <p>ok</p>
27041 !!end
27042
27043 !!test
27044 7. Encapsulate foster-parented transclusion content
27045 !!options
27046 parsoid=wt2wt,wt2html
27047 !! wikitext
27048 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27049 !! html/parsoid
27050 <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>
27051 <table>
27052 <tbody>
27053 <tr>
27054 <td>bar</td>
27055 </tr>
27056 </tbody>
27057 </table>
27058 !!end
27059
27060 # Note that the wt is broken on purpose: the = should be {{=}} if you
27061 # don't want it to be a template parameter key.
27062 !!test
27063 8. Encapsulate foster-parented transclusion content
27064 !!options
27065 parsoid=wt2wt,wt2html
27066 !! wikitext
27067 {{echo|a
27068 }}{|{{echo|style='color:red'}}
27069 |-
27070 |b
27071 |}
27072 !! html/parsoid
27073 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27074 <span> </span>
27075 <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>
27076 <table>
27077 <tbody>
27078 <tr>
27079 <td>b</td>
27080 </tr>
27081 </tbody>
27082 </table>
27083 !!end
27084
27085 !!test
27086 9. Encapsulate foster-parented transclusion content
27087 !!options
27088 parsoid=wt2wt,wt2html
27089 !! wikitext
27090 <table>{{echo|hi</table>hello}}
27091 !! html/parsoid
27092 <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>
27093 !!end
27094
27095 !!test
27096 Table in fosterable position
27097 !!options
27098 parsoid=wt2html
27099 !! wikitext
27100 {{OpenTable}}
27101 <div>
27102 {|
27103 |}
27104 </div>
27105 |}
27106 !! html/parsoid
27107 <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">
27108 </span>
27109 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27110
27111 <table>
27112 </table>
27113 !!end
27114
27115 # Parsoid only for T66747
27116 !! test
27117 Properly encapsulate empty-content transclusions in fosterable positions
27118 !! wikitext
27119 <table>
27120 {{#if:|
27121 <td>foo</td>
27122 }}
27123 </table>
27124 !! html/parsoid
27125 <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"}]]}'>
27126
27127 </table>
27128 !! end
27129
27130 !! test
27131 Always encapsulate foster box when template range is expanded to table
27132 !! options
27133 parsoid=wt2wt
27134 !! wikitext
27135 {|
27136 hello
27137 {{OpenTable}}
27138 |}
27139 !! html/parsoid
27140
27141 !! end
27142
27143 !! test
27144 T115289: Unclosed table
27145 !! wikitext
27146 {{echo|<table>}}<!--c-->[[Category:Two]]
27147 !! html/parsoid
27148 <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>
27149 !! end
27150
27151 !! test
27152 T115289: Don't migrate newlines out of tables with fostered content
27153 !! wikitext
27154 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27155 !! html/parsoid
27156 <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>
27157 !! end
27158
27159 !! test
27160 T73074: More fostering fun
27161 !! wikitext
27162 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27163 !! html/parsoid
27164 <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>
27165 !! end
27166
27167 !!test
27168 Support <object> element with .data attribute
27169 !!options
27170 parsoid=html2wt
27171 !! html/parsoid
27172 <object data="test.swf"></object>
27173 !! wikitext
27174 <object data="test.swf"></object>
27175 !!end
27176
27177 !! test
27178 Don't block XML namespace declaration
27179 !! wikitext
27180 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27181 !! html/php
27182 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27183 </p>
27184 !! html/parsoid
27185 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27186 !! end
27187
27188 # -----------------------------------------------------------------
27189 # The following section of tests are primarily to spec requirements
27190 # around Parsoid's serialization (old, new, edited content)
27191 #
27192 # All these tests are marked Parsoid html2wt and html2html only
27193 # ----------------------------------------------------------------
27194
27195 !! test
27196 Ignore rel attribute in a-tags during serialization to url-links
27197 !! options
27198 parsoid=html2wt
27199 !! html/parsoid
27200 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27201 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27202 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27203 !! wikitext
27204 http://en.wikipedia.org/wiki/Foobar
27205 http://en.wikipedia.org/wiki/Foobar
27206 http://en.wikipedia.org/wiki/Foobar
27207 !! end
27208
27209 # 'mi' is a localinterwiki prefix as well as a language
27210 !! test
27211 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27212 !! options
27213 parsoid=html2wt
27214 !! html/parsoid
27215 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27216 !! wikitext
27217 [[Foo]]
27218 !! end
27219
27220 !! test
27221 Parsoid should accept interwiki shortcuts
27222 !! options
27223 parsoid=html2wt
27224 !! html/parsoid
27225 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27226 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27227 <a href='./fr:Foo'>Foo</a></p>
27228 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27229 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27230 <a href='fr%3AFoo'>Foo</a></p>
27231 <p><a href='FR%3AFoo'>Foo</a>
27232 <a href='./FR:Foo'>Foo</a></p>
27233 !! wikitext
27234 [[:fr:Foo|Foo]]
27235 [[:fr:Foo|Foo]]
27236 [[:fr:Foo|Foo]]
27237
27238 [[:fr:Foo|Foo]]
27239 [[:fr:Foo|Foo]]
27240 [[:fr:Foo|Foo]]
27241
27242 [[:fr:Foo|Foo]]
27243 [[:fr:Foo|Foo]]
27244 !! end
27245
27246 !! test
27247 Parsoid should not accept invalid interwiki shortcuts
27248 !! options
27249 parsoid=html2wt
27250 !! html/parsoid
27251 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27252 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27253 <a href='news:Foo'>Foo</a></p>
27254 !! wikitext
27255 [news:Foo Foo]
27256 [news:Foo Foo]
27257 [news:Foo Foo]
27258 !! end
27259
27260 # See T93839
27261 !! test
27262 New wikilinks should be serialized properly
27263 !! options
27264 parsoid=html2wt
27265 !! html/parsoid
27266 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27267 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27268 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27269 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27270 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27271 !! wikitext
27272 [[Foo]]
27273 [[Foo]]
27274 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27275 http://en.wikipedia.org/wiki/Foo
27276 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27277 !! end
27278
27279 !! test
27280 New wiki links (href variations)
27281 !! options
27282 parsoid=html2wt
27283 !! html/parsoid
27284 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27285 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27286 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27287 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27288 !! wikitext
27289 [[Foo_bar]]
27290 [[Foo_bar]]
27291 [[Foo_bar]]
27292 [[Toxine bactérienne]]
27293 !! end
27294
27295 !! test
27296 New wiki links (content string variations)
27297 !! options
27298 parsoid=html2wt
27299 !! html/parsoid
27300 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27301 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27302 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27303 !! wikitext
27304 [[Foo_bar]]
27305 [[Foo bar]]
27306 [[Foo_bar|./Foo_bar]]
27307 !! end
27308
27309 !! test
27310 New category links (href variations)
27311 !! options
27312 parsoid=html2wt
27313 !! html/parsoid
27314 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27315 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27316 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27317 !! wikitext
27318 [[Category:Toxine bactérienne]]
27319 [[Category:Toxine bactérienne]]
27320 [[Category:Toxine bactérienne]]
27321 !! end
27322
27323 !! test
27324 New sol transparent links don't need indent-pre nowiki protection
27325 !! options
27326 parsoid=html2wt
27327 language=de
27328 !! html/parsoid
27329 <link rel="mw:PageProp/redirect" href="./Main_Page">
27330 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27331 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27332 !! wikitext
27333 #WEITERLEITUNG [[Main Page]]
27334 <!-- this is good --> [[Category:Good]]
27335 <!-- this is great --> [[Kategorie:Great]]
27336 !! end
27337
27338 !! test
27339 New interlanguage links (href variations)
27340 !! options
27341 parsoid=html2wt
27342 !! html/parsoid
27343 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27344 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27345 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27346 !! wikitext
27347 [[es:Toxine bactérienne]]
27348 [[es:Toxine_bactérienne]]
27349 [[es:Toxine_bactérienne]]
27350 !! end
27351
27352 !! test
27353 Image: Modifying size of an image (1)
27354 !! options
27355 parsoid={
27356 "modes": ["wt2wt"],
27357 "changes": [
27358 ["img[height]", "attr", "height", "22"],
27359 ["img[width]", "attr", "width", "200"]
27360 ]
27361 }
27362 !! wikitext
27363 [[Image:Foobar.jpg|230x230px]]
27364 !! wikitext/edited
27365 [[Image:Foobar.jpg|200x200px]]
27366 !!end
27367
27368 !! test
27369 Image: Modifying size of an image (2)
27370 !! options
27371 parsoid={
27372 "modes": ["wt2wt"],
27373 "changes": [
27374 ["img[height]", "attr", "height", "100"],
27375 ["img[width]", "attr", "width", "500"]
27376 ]
27377 }
27378 !! wikitext
27379 [[Image:Foobar.jpg|230x230px]]
27380 !! wikitext/edited
27381 [[Image:Foobar.jpg|500x500px]]
27382 !!end
27383
27384 # Change in size is ignored so long as class='mw-default-size'
27385 !! test
27386 Image: Modifying size of an image (3)
27387 !! options
27388 parsoid={
27389 "modes": ["wt2wt"],
27390 "changes": [
27391 ["figure[class]", "removeClass", "mw-default-size"],
27392 ["figure img", "attr", "height", "19"],
27393 ["figure img", "attr", "width", "170"]
27394 ]
27395 }
27396 !! wikitext
27397 [[Image:Foobar.jpg|thumb]]
27398 !! wikitext/edited
27399 [[Image:Foobar.jpg|thumb|170x170px]]
27400 !!end
27401
27402 !! test
27403 Image: Modifying alignment of an image (T50665)
27404 !! options
27405 parsoid={
27406 "modes": ["wt2wt"],
27407 "changes": [
27408 ["figure[class]", "removeClass", "mw-halign-right"],
27409 ["figure[class]", "addClass", "mw-halign-left"]
27410 ]
27411 }
27412 !! wikitext
27413 [[Image:Foobar.jpg|thumb|caption|right]]
27414 !! wikitext/edited
27415 [[Image:Foobar.jpg|thumb|caption|left]]
27416 !! end
27417
27418 !! test
27419 Image: Modifying mw-default-size of an frameless image (T64805)
27420 !! options
27421 parsoid={
27422 "modes": ["wt2wt"],
27423 "changes": [
27424 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27425 ]
27426 }
27427 !! wikitext
27428 [[Image:Foobar.jpg|frameless|right]]
27429 !! wikitext/edited
27430 [[Image:Foobar.jpg|frameless|right|220x220px]]
27431 !! end
27432
27433 !! test
27434 Image: Modifying valign of an image (T51221)
27435 !! options
27436 parsoid={
27437 "modes": ["wt2wt"],
27438 "changes": [
27439 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27440 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27441 ]
27442 }
27443 !! wikitext
27444 [[File:Foobar.jpg|20px|middle]]
27445 !! wikitext/edited
27446 [[File:Foobar.jpg|20px|text-top]]
27447 !! end
27448
27449 !! test
27450 Image: Modifying alt attribute of an image (T58400)
27451 !! options
27452 parsoid={
27453 "modes": ["wt2wt"],
27454 "changes": [
27455 ["img[alt]", "attr", "alt", "some alternate edited text"]
27456 ]
27457 }
27458 !! wikitext
27459 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27460 !! wikitext/edited
27461 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27462 !!end
27463
27464 !! test
27465 Image: Modifying caption of an image
27466 !! options
27467 parsoid={
27468 "modes": ["wt2wt"],
27469 "changes": [
27470 ["figcaption", "text", "new caption"]
27471 ]
27472 }
27473 !! wikitext
27474 [[Image:Foobar.jpg|thumb|original caption]]
27475 !! wikitext/edited
27476 [[Image:Foobar.jpg|thumb|new caption]]
27477 !!end
27478
27479 !! test
27480 Image: empty alt attribute (T50924)
27481 !! options
27482 parsoid
27483 !! wikitext
27484 [[File:Foobar.jpg|thumb|alt=|bar]]
27485 !! html
27486 <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>
27487 !! end
27488
27489 !! test
27490 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27491 !! options
27492 parsoid=html2wt
27493 language=ar
27494 disabled
27495 !! html/parsoid
27496 <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>
27497 !! wikitext
27498 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27499 !! end
27500
27501 !! test
27502 Image: Block level image should have \n before and after
27503 !! wikitext
27504 123
27505 [[File:Foobar.jpg|right|thumb|150x150px]]
27506 456
27507 !! html/parsoid
27508 <p>123</p>
27509 <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>
27510 <p>456</p>
27511 !! end
27512
27513 !! test
27514 Image: New block level image should have \n before and after (existing content)
27515 !! wikitext
27516 123
27517 [[File:Foobar.jpg|right|thumb|150x150px]]
27518 456
27519 !! html/parsoid
27520 <p>123</p>
27521 <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>
27522 <p>456</p>
27523 !! end
27524
27525 !! test
27526 Image: upright option (parsoid)
27527 !! wikitext
27528 [[File:Foobar.jpg|thumb|upright|caption]]
27529 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27530 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27531 !! html/parsoid
27532 <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>
27533 <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>
27534 <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>
27535 !! end
27536
27537 !! test
27538 Image: upright option is ignored on inline and frame images (parsoid)
27539 !! wikitext
27540 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27541 !! html/parsoid
27542 <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>
27543 !! end
27544
27545 !! test
27546 Image: in template parameter with empty parameter
27547 !! wikitext
27548 {{echo|[[File:Foobar.jpg|link=]]}}
27549 !! html/parsoid
27550 <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>
27551 !! end
27552
27553 !! test
27554 Image: from basic HTML (1)
27555 !! options
27556 parsoid=html2wt
27557 !! html/parsoid
27558 <span typeof="mw:Image">
27559 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27560 </span>
27561 !! wikitext
27562 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27563 !! end
27564
27565 !! test
27566 Image: from basic HTML (2)
27567 !! options
27568 parsoid=html2wt
27569 !! html/parsoid
27570 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27571 !! wikitext
27572 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27573 !! end
27574
27575 !! test
27576 Image: from basic HTML (3)
27577 !! options
27578 parsoid=html2wt
27579 !! html/parsoid
27580 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27581 !! wikitext
27582 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27583 !! end
27584
27585 !! test
27586 Image: from basic HTML (4)
27587 !! options
27588 parsoid=html2wt
27589 !! html/parsoid
27590 <img src="./File:Foobar.jpg">
27591 !! wikitext
27592 [[File:Foobar.jpg|link=]]
27593 !! end
27594
27595 !! test
27596 Image: Invalid title as link
27597 !! wikitext
27598 [[File:Foobar.jpg|link=<]]
27599 !! html/php
27600 <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>
27601 </p>
27602 !! html/parsoid
27603 <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>
27604 !! end
27605
27606 !! test
27607 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27608 !! options
27609 parsoid=html2wt
27610 !! html/parsoid
27611 <ul>
27612 <li><p>foo</p></li>
27613 </ul>
27614 !! wikitext
27615 * foo
27616 !! end
27617
27618 !! test
27619 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27620 !! options
27621 parsoid=html2wt
27622 !! html/parsoid
27623 <ul> <li>foo</li></ul>
27624 !! wikitext
27625 * foo
27626 !! end
27627
27628 !! test
27629 Don't strip leading whitespace when handling indent-pre suppressing tags
27630 !! options
27631 parsoid=html2wt
27632 !! html/parsoid
27633 <table>
27634 <tr><td> indented row</td></tr>
27635 </table>
27636 <blockquote><p>
27637 <b>This is very bold of you!</b>
27638 </p>
27639 <table><tr><td>
27640 indented cell (no pre-wrapping!)
27641 </td></tr></table>
27642 </blockquote>
27643 <p>foo</p>
27644 <div>bar</div>
27645 !! wikitext
27646 {|
27647 | indented row
27648 |}
27649 <blockquote>
27650 '''This is very bold of you!'''
27651
27652 {|
27653 |
27654 indented cell (no pre-wrapping!)
27655 |}
27656 </blockquote>
27657 foo
27658 <div>bar</div>
27659 !! end
27660
27661 !! test
27662 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27663 !! options
27664 parsoid=html2wt
27665 !! html/parsoid
27666 <p>foo</p>
27667 <span>bar</span>
27668
27669 <span>foo2
27670 </span>bar2
27671
27672 <div>foo</div>
27673 <span>bar</span>
27674
27675 <div>
27676 <span>foo</span>
27677 </div>
27678 !! wikitext
27679 foo
27680
27681 <span>bar</span>
27682
27683 <span>foo2
27684 <nowiki> </nowiki></span>bar2
27685
27686 <div>foo</div>
27687 <nowiki> </nowiki><span>bar</span>
27688
27689 <div>
27690 <nowiki> </nowiki><span>foo</span>
27691 </div>
27692 !! end
27693
27694 !! test
27695 Lists: Dont insert newlines in a serialized list item.
27696 !! options
27697 parsoid=html2wt
27698 !! html/parsoid
27699 <ul><li>a<br>b</li><li>c</li></ul>
27700 !! wikitext
27701 * a<br>b
27702 * c
27703 !! end
27704
27705 !! test
27706 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27707 !! options
27708 parsoid={
27709 "modes": ["html2wt"],
27710 "scrubWikitext": false
27711 }
27712 !! html/parsoid
27713 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27714 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27715
27716 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27717 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27718
27719 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27720
27721 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27722 !! wikitext
27723 == hello there [[Category:A1]] ==
27724
27725 == [[Category:A2]] hi pal ==
27726
27727 == <!--foo--> [[Category:A3]] how goes it ==
27728
27729 == it goes well [[Category:A4]] <!--bar--> ==
27730
27731 ==howdy [[Category:A5]]==
27732
27733 == __TOC__ ok ==
27734 !! end
27735
27736 !! test
27737 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27738 !! options
27739 parsoid={
27740 "modes": ["html2wt"],
27741 "scrubWikitext": true
27742 }
27743 !! html/parsoid
27744 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27745 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27746
27747 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27748 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27749
27750 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27751 !! wikitext
27752 == hello there ==
27753 [[Category:A1]]
27754 [[Category:A2]]
27755
27756 == hi pal ==
27757
27758 <!--foo--> [[Category:A3]]
27759
27760 == how goes it ==
27761
27762 == it goes well ==
27763 [[Category:A4]] <!--bar-->
27764
27765 __TOC__
27766
27767 == ok ==
27768 !! end
27769
27770 !! test
27771 Headings: Don't hoist metas that come from templates
27772 !! options
27773 parsoid={
27774 "modes": ["html2wt"],
27775 "scrubWikitext": true
27776 }
27777 !! html/parsoid
27778 <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>
27779 !! wikitext
27780 == {{echo|foo [[Category:Foo]]}} ==
27781 !! end
27782
27783 !! test
27784 Headings: Category in ref isn't hoisted
27785 !! options
27786 parsoid={
27787 "modes": ["html2wt"],
27788 "scrubWikitext": true
27789 }
27790 !! html/parsoid
27791 <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>
27792
27793 <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>
27794 !! wikitext
27795 == foo <ref>bar
27796 [[Category:Baz]] </ref> ==
27797
27798 <references />
27799 !! end
27800
27801 !! test
27802 Parsoid: Serialize positional parameters with = in them as named parameter
27803 !! options
27804 parsoid=html2wt
27805 !! html/parsoid
27806 <p about="#mwt1" typeof="mw:Transclusion"
27807 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27808
27809 <p about="#mwt1" typeof="mw:Transclusion"
27810 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27811
27812 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27813 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27814 <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>
27815 !! wikitext
27816 {{echo|1=f=oo}}
27817
27818 {{echo|1=f=oo|2=bar}}
27819
27820 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27821 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27822 {{echo|<nowiki>f=oo</nowiki>|bar}}
27823 !! end
27824
27825 !! test
27826 Parsoid: Serialize positional parameters with = in extlink as named parameter
27827 !! options
27828 parsoid=html2wt
27829 !! html/parsoid
27830 <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>
27831 !! wikitext
27832 {{echo|1=http://stuff?is=ok}}
27833 !! end
27834
27835 !! test
27836 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27837 !! options
27838 parsoid=html2wt
27839 !! html/parsoid
27840 <div>a<p>b</p></div>
27841 <div>a
27842 <p>b</p></div>
27843 <div>
27844 a
27845 <p>b</p></div>
27846 !! wikitext
27847 <div>a
27848 b
27849 </div>
27850 <div>a
27851 b
27852 </div>
27853 <div>
27854 a
27855
27856 b
27857 </div>
27858 !! end
27859
27860 !! test
27861 Substrings resembling wikitext in hrefs should not get nowiki escapes
27862 !! options
27863 parsoid=html2wt
27864 !! html/parsoid
27865 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27866 !! wikitext
27867 [[Foo''bar''baz]]
27868 !! end
27869
27870 !! test
27871 Enforce single-line context in the serializer
27872 !! options
27873 parsoid=html2wt
27874 !! html/parsoid
27875 <h2>testing
27876 123</h2>
27877
27878 <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">
27879 </span><span about="#mwt1">you</span> </h2>
27880
27881 <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>
27882
27883 <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
27884 there</span></li></ol>
27885
27886 <ul><li>asd
27887 sdf</li></ul>
27888
27889 <ul><li>foo
27890 bar
27891 baz</li>
27892 <li>foo <b>bar</b>
27893 baz</li></ul>
27894
27895 <dl><dt>hi
27896 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27897 ho</dd></dl>
27898
27899 <dl><dd> <table>
27900 <tbody><tr><td> ha
27901 ha
27902 ha</td></tr>
27903 </tbody></table></dd></dl>
27904 !! wikitext
27905 == testing 123 ==
27906
27907 == hi {{bogus|there
27908 you}} ==
27909
27910 == foo <ref>hello
27911 there</ref> ==
27912
27913 <references />
27914
27915 * asd sdf
27916
27917 * foo bar baz
27918 * foo '''bar''' baz
27919
27920 ; hi ho : hi ho
27921
27922 : {|
27923 | ha
27924 ha
27925 ha
27926 |}
27927 !! end
27928
27929 !! test
27930 Serialize new placeholder space without spans
27931 !! options
27932 parsoid=html2wt
27933 !! html/parsoid
27934 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27935
27936 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27937
27938 <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>
27939 !! wikitext
27940 foo : bar
27941
27942 foo : bar
27943
27944 <ref>foo : bar</ref>ok
27945 !! end
27946
27947
27948 #-----------------------
27949 # Tag minimization tests
27950 #-----------------------
27951
27952 !! test
27953 1. I/B quote minimization: wikitext-only tags should be combined
27954 !! options
27955 parsoid=html2wt
27956 !! html/parsoid
27957 <p><i>A</i><i>B</i></p>
27958 <p><b>A</b><b>B</b></p>
27959 <p><i>A</i><b><i>B</i></b></p>
27960 <p><b>A</b><i><b>B</b></i></p>
27961 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27962 <p><i><b>A</b></i><i><b>B</b></i></p>
27963 <p><i><b>A</b></i><b><i>B</i></b></p>
27964 <p><b><i>A</i></b><i><b>B</b></i></p>
27965 !! wikitext
27966 ''AB''
27967
27968 '''AB'''
27969
27970 ''A'''B'''''
27971
27972 '''A''B'''''
27973
27974 '''A''BC''D'''
27975
27976 '''''AB'''''
27977
27978 '''''AB'''''
27979
27980 '''''AB'''''
27981 !! end
27982
27983 !! test
27984 2. I/B quote minimization: wikitext and html tags should not be combined
27985 !! options
27986 parsoid=html2wt
27987 !! html/parsoid
27988 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27989 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27990 !! wikitext
27991 ''A''<i>B</i>
27992
27993 ''A''<nowiki/>'''<i>B</i>'''
27994 !! end
27995
27996 !! test
27997 3. I/B quote minimization: templated content stops minimization
27998 !! options
27999 parsoid=html2wt
28000 !! html/parsoid
28001 <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>
28002 <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>
28003 !! wikitext
28004 ''A''{{echo|''B''}}
28005
28006 ''A''{{echo|'''''B'''''}}
28007 !! end
28008
28009 !! test
28010 4. I/B quote minimization: new content should be mimimized with adjacent old content
28011 !! options
28012 parsoid=html2wt
28013 !! html/parsoid
28014 <p><i>A</i><i>B</i></p>
28015 <p><b>A</b><b>B</b></p>
28016 <p><i>A</i><b><i>B</i></b></p>
28017 !! wikitext
28018 ''AB''
28019
28020 '''AB'''
28021
28022 ''A'''B'''''
28023 !! end
28024
28025 !! test
28026 5a. Merge adjacent quote nodes if they've been edited
28027 !! options
28028 parsoid={
28029 "modes": ["wt2wt", "selser"],
28030 "changes": [
28031 ["p", "contents", "remove", ":contains('b')"]
28032 ]
28033 }
28034 !! wikitext
28035 ''a''b''c''
28036 !! wikitext/edited
28037 ''ac''
28038 !! end
28039
28040 !! test
28041 5b. Merge adjacent quote nodes if they've been edited
28042 !! options
28043 parsoid={
28044 "modes": ["wt2wt", "selser"],
28045 "changes": [
28046 ["#x", "remove"]
28047 ]
28048 }
28049 !! wikitext
28050 ''a''<span id="x">b</span>''c''
28051 !! wikitext/edited
28052 ''ac''
28053 !! end
28054
28055 !! test
28056 1. Merge adjacent link nodes as long as at least one element is new
28057 !! options
28058 parsoid={
28059 "modes": ["html2wt"],
28060 "scrubWikitext": true
28061 }
28062 !! html/parsoid
28063 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28064 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28065 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28066 !! wikitext
28067 [[Football]]
28068 [[Football]]
28069 [[Football|Foot]][[Football|ball]]
28070 !! end
28071
28072 !! test
28073 2. Merge adjacent link nodes and enable additional normalizations
28074 !! options
28075 parsoid={
28076 "modes": ["html2wt"],
28077 "scrubWikitext": true
28078 }
28079 !! html/parsoid
28080 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28081 !! wikitext
28082 [[Football|''Football'']]
28083 !! end
28084
28085 !! test
28086 3. Don't merge adjacent link nodes if scrubWikitext is false
28087 !! options
28088 parsoid={
28089 "modes": ["html2wt"],
28090 "scrubWikitext": false
28091 }
28092 !! html/parsoid
28093 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28094 !! wikitext
28095 [[Football|Foot]][[Football|ball]]
28096 !! end
28097
28098 #------------------------------
28099 # End of tag minimization tests
28100 #------------------------------
28101
28102 !!test
28103 T56262: New entities
28104 !! options
28105 parsoid=html2wt
28106 !! html/parsoid
28107 <span typeof="mw:Entity">&nbsp;</span>
28108 !! wikitext
28109 &nbsp;
28110 !! end
28111
28112 ## Note that there is no wikitext output for 'unknownproperty' ##
28113 ## Unknown magic words are silently dropped ##
28114
28115 !! test
28116 Magic words
28117 !! options
28118 parsoid=html2wt
28119 !! html/parsoid
28120 <meta property='mw:PageProp/toc' />
28121 <meta property='mw:PageProp/notoc' />
28122 <meta property='mw:PageProp/forcetoc' />
28123 <meta property='mw:PageProp/index' />
28124 <meta property='mw:PageProp/noindex' />
28125 <meta property='mw:PageProp/nogallery' />
28126 <meta property='mw:PageProp/noeditsection' />
28127 <meta property='mw:PageProp/notitleconvert' />
28128 <meta property='mw:PageProp/nocontentconvert' />
28129 <meta property='mw:PageProp/unknownproperty' />
28130 !! wikitext
28131 __TOC__
28132 __NOTOC__
28133 __FORCETOC__
28134 __INDEX__
28135 __NOINDEX__
28136 __NOGALLERY__
28137 __NOEDITSECTION__
28138 __NOTITLECONVERT__
28139 __NOCONTENTCONVERT__
28140 !! end
28141
28142 !! test
28143 Consecutive <pre>s should not get merged
28144 !! options
28145 parsoid=html2wt,html2html
28146 !! html/parsoid
28147 <pre>a</pre><pre>b</pre>
28148
28149 <pre>c
28150 </pre><pre>
28151 d</pre>
28152
28153 <pre>e
28154
28155 </pre><pre>
28156
28157 f</pre>
28158 !! wikitext
28159 a
28160
28161 b
28162
28163 c
28164
28165 d
28166
28167 e
28168
28169
28170
28171 f
28172 !! end
28173
28174 !! test
28175 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28176 !! options
28177 parsoid=html2wt
28178 !! html/parsoid
28179 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28180 !! wikitext
28181 [[Special:BookSources/1234567890|ISBN 1234567895]]
28182 !! end
28183
28184 !! test
28185 Edited RFC links not serializable as RFC links should serialize as extlinks
28186 !! options
28187 parsoid=html2wt
28188 !! html/parsoid
28189 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28190 !! wikitext
28191 [https://tools.ietf.org/html/rfc123 New RFC]
28192 !! end
28193
28194 !! test
28195 Edited PMID links not serializable as PMID links should serialize as extlinks
28196 !! options
28197 parsoid=html2wt
28198 !! html/parsoid
28199 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28200 !! wikitext
28201 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28202 !! end
28203
28204 !! test
28205 WTS of autolinks with trailing/surrounding context
28206 !! options
28207 parsoid=html2wt
28208 !! html/parsoid
28209 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28210 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28211 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28212 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28213 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28214 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28215 !! wikitext
28216 http://cscott.net'''foo'''
28217
28218 http://cscott.net<b>foo</b>
28219
28220 '''http://cscott.net'''
28221
28222 '''http://cscott.net '''
28223
28224 '''http://cscott.net<nowiki/>x'''
28225
28226 http://cscott.net<nowiki/>x
28227 !! end
28228
28229 !! test
28230 WTS of autolinks with nowikis (round-trip)
28231 !! wikitext
28232 x<nowiki/>http://cscott.net<nowiki/>x
28233 !! html/parsoid
28234 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28235 !! end
28236
28237 # this is the "easy" test because it leaves in place all the
28238 # data-parsoid information indicating this is an autolink
28239 !! test
28240 WTS of autolinks with escapes (editing)
28241 !! options
28242 parsoid={
28243 "modes": ["wt2wt"],
28244 "changes": [
28245 [ "span", "remove" ]
28246 ]
28247 }
28248 !! wikitext
28249 x<nowiki/>http://cscott.net<nowiki/>x
28250 !! wikitext/edited
28251 x<nowiki/>http://cscott.net<nowiki/>x
28252 !! end
28253
28254 !! test
28255 WTS of edited autolink-like text (T103364)
28256 !! options
28257 parsoid={
28258 "modes": ["wt2wt"],
28259 "changes": [
28260 [ "span[typeof]", "removeAttr", "typeof" ]
28261 ]
28262 }
28263 !! wikitext
28264 Not a link: <nowiki>http://example.com</nowiki>.
28265 !! wikitext/edited
28266 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28267 !! end
28268
28269 !! test
28270 WTS of newly-authored autolink-like text (T103364)
28271 !! options
28272 parsoid=html2wt
28273 !! html/parsoid
28274 <p>http://example.com is not a link.</p>
28275 !! wikitext
28276 <nowiki>http://example.com</nowiki> is not a link.
28277 !! end
28278
28279 !! test
28280 WTS of autolink-like text after an autolink (T108563)
28281 !! options
28282 parsoid=html2wt
28283 !! html/parsoid
28284 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28285 !! wikitext
28286 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28287 !! end
28288
28289 !! test
28290 Magic links inside links (not autolinked)
28291 !! wikitext
28292 [[Foo|http://example.com]]
28293 [[Foo|RFC 1234]]
28294 [[Foo|PMID 1234]]
28295 [[Foo|ISBN 123456789x]]
28296
28297 [http://foo.com http://example.com]
28298 [http://foo.com RFC 1234]
28299 [http://foo.com PMID 1234]
28300 [http://foo.com ISBN 123456789x]
28301 !! html+tidy
28302 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28303 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28304 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28305 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28306 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28307 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28308 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28309 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28310 </p>
28311 !! html/parsoid
28312 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28313 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28314 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28315 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28316
28317 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28318 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28319 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28320 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28321 !! end
28322
28323 !! test
28324 Magic links inside image captions (autolinked)
28325 !! wikitext
28326 [[File:Foobar.jpg|thumb|http://example.com]]
28327 [[File:Foobar.jpg|thumb|RFC 1234]]
28328 [[File:Foobar.jpg|thumb|PMID 1234]]
28329 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28330 !! html+tidy
28331 <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>
28332 <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>
28333 <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>
28334 <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>
28335 !! html/parsoid
28336 <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>
28337 <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>
28338 <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>
28339 <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>
28340 !! end
28341
28342 !! test
28343 WTS of magic word text (T109371)
28344 !! options
28345 parsoid=html2wt
28346 !! html/parsoid
28347 <p>RFC 1234</p>
28348 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28349 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28350 !! wikitext
28351 <nowiki>RFC 1234</nowiki>
28352
28353 [http://foo.com RFC 1234]
28354
28355 [[Foo|RFC 1234]]
28356 !! end
28357
28358 !! test
28359 Edited Redirect link should emit a non-piped wikitext link
28360 !! options
28361 parsoid=html2wt
28362 !! html/parsoid
28363 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28364 !! wikitext
28365 #REDIRECT [[Bar]]
28366 !! end
28367
28368 !! test
28369 T75121: Infer extension name from typeOf if data-mw is not present
28370 !! options
28371 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28372 !! html/parsoid
28373 <div typeOf="mw:Extension/foo"></div>
28374 !! wikitext
28375 <foo />
28376 !! end
28377
28378 # Note that the <p> wrapping isn't present in PHP parser output
28379 # The important thing for this test is that P-wrapping doesn't
28380 # interfere with the <nowiki> protection for leading - in <td>
28381 # (which isn't necessary for <th>).
28382 !! test
28383 T88318: p-wrapped dash in table.
28384 !! options
28385 parsoid=html2wt,wt2wt
28386 !! html/parsoid
28387 <table><tbody>
28388 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28389 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28390 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28391 </tbody></table>
28392 !! wikitext
28393 {|
28394 !-
28395 !-
28396 |-
28397 |<nowiki>-</nowiki>
28398 |<nowiki>- </nowiki>
28399 |-
28400 |<small>-</small>
28401 |<br>
28402 -
28403 |<br>
28404 -
28405 |}
28406 !! html/php+tidy
28407 <table>
28408 <tbody><tr>
28409 <th>-
28410 </th>
28411 <th>-
28412 </th></tr>
28413 <tr>
28414 <td>-
28415 </td>
28416 <td>-
28417 </td></tr>
28418 <tr>
28419 <td><small>-</small>
28420 </td>
28421 <td><br />
28422 <p>-
28423 </p>
28424 </td>
28425 <td><br />
28426 <p>-
28427 </p>
28428 </td></tr></tbody></table>
28429 !! end
28430
28431 !! test
28432 T149209: WTS: Handle newlines in table cells properly
28433 !! options
28434 parsoid=html2wt
28435 !! html/parsoid
28436 <table>
28437 <tbody>
28438 <tr><td>a
28439 b
28440 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28441 <tr><td><p>x</p>
28442 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28443 </tbody></table>
28444 <table>
28445 <tbody>
28446 <tr><th>a
28447 b
28448 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28449 <tr><th><p>x</h>
28450 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28451 </tbody></table>
28452 !! wikitext
28453 {|
28454 |a
28455 b
28456 |c
28457 |-
28458 |x
28459 {{!}}y
28460 |}
28461 {|
28462 !a
28463 b
28464 !c
28465 |-
28466 !x
28467 !y
28468 |}
28469 !! end
28470
28471 !! test
28472 T149209: Selser: Handle newlines in table cells properly
28473 !! options
28474 parsoid={
28475 "modes": ["selser"],
28476 "changes": [
28477 [ "#h1", "html", "a\nb\n" ],
28478 [ "#h2", "html", "a\nb\n" ],
28479 [ "#c1", "html", "a\nb\n" ],
28480 [ "#c2", "html", "<p>a</p>" ],
28481 [ "#c3", "html", "<p>a</p>" ],
28482 [ "#c4", "html", "edit-me<p>a</p>" ]
28483 ]
28484 }
28485 !! wikitext
28486 {|
28487 ! id="h1" |edit-me!!1
28488 |-
28489 ! id="h2" |edit-me||2
28490 |-
28491 | id="c1" |edit-me||3
28492 |-
28493 | id="c2" |edit-me||4
28494 |-
28495 | id="c3" |edit-me||p||q||r
28496 |-
28497 | id="c4" |edit-me||p||q||r
28498 |}
28499 !! wikitext/edited
28500 {|
28501 ! id="h1" |a
28502 b
28503 !1
28504 |-
28505 ! id="h2" |a
28506 b
28507 !2
28508 |-
28509 | id="c1" |a
28510 b
28511 |3
28512 |-
28513 | id="c2" |a
28514 |4
28515 |-
28516 | id="c3" |a
28517 |p||q||r
28518 |-
28519 | id="c4" |edit-me
28520 a
28521 |p||q||r
28522 |}
28523 !! end
28524
28525 !! test
28526 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28527 !! options
28528 parsoid=html2wt
28529 !! html/parsoid
28530 <table id='mwAb'>
28531 <td id='mwAc'>foo</td>
28532 <td id='serialize-this'>bar</td>
28533 </table>
28534 !! wikitext
28535 {|
28536 |foo
28537 | id="serialize-this" |bar
28538 |}
28539 !! end
28540
28541 !! test
28542 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28543 !! options
28544 parsoid=html2wt
28545 !! html/parsoid
28546 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28547 !! wikitext
28548 <div id="hello">ok</div>
28549 !! end
28550
28551 !! test
28552 WTS change modes
28553 !! options
28554 parsoid={
28555 "modes": ["wt2wt"],
28556 "changes": [
28557 [ "#xyz", "before", "<b>before</b> stuff " ],
28558 [ "#xyz", "after", " stuff <i>after</i>" ],
28559 [ "#xyz", "html", "x <b>y</b> z" ]
28560 ]
28561 }
28562 !! wikitext
28563 <span id="xyz">hello</span>
28564 !! wikitext/edited
28565 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28566 !! end
28567
28568 !! test
28569 Never serialize a-tag as html, regardless of what data-parsoid has to say
28570 !! options
28571 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28572 !! html/parsoid
28573 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28574 !! wikitext
28575 [[Foo]]
28576 !! end
28577
28578 ## SSS FIXME: This is broken output nevertheless.
28579 ## What might be a reasonable non-broken output for this?
28580 ## This is an edge case unlikely to be seen in production
28581 ## that I am not wasting more time on this right now.
28582 !! test
28583 Never serialize a-tag as html, no matter what attributes it has
28584 !! options
28585 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28586 !! html/parsoid
28587 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28588 !! wikitext
28589 [http://boo.org http://boohoo.org]
28590 !! end
28591
28592 # Misnested is an indication that selser can reuse the source but these have
28593 # shown to sneak through on occasion. See T101768.
28594 # The original wikitext here is: [http://test.com [[one]] two three]
28595 !! test
28596 Strip span tags added to mark misnested links
28597 !! options
28598 parsoid=html2wt
28599 !! html/parsoid
28600 <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>
28601 !! wikitext
28602 [http://test.com][[one]] two three
28603 !! end
28604
28605 !! test
28606 Catch regression when unpacking misnested links
28607 !! options
28608 parsoid=wt2html
28609 !! wikitext
28610 {{echo|hi}}[http://example.com [[ho]]]
28611 !! html/parsoid
28612 <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>
28613 !! end
28614
28615 !! test
28616 Catch regression when unpacking with trailing content
28617 !! wikitext
28618 {{echo|Foo <references/> bar}}
28619 !! html/parsoid
28620 <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>
28621 !! end
28622
28623 !! test
28624 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28625 !! options
28626 parsoid=html2wt
28627 !! html/parsoid
28628 <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|}"]}'>
28629 <tbody><tr><td>d
28630 </td></tr>
28631 </tbody></table>
28632 !! wikitext
28633 {{echo|a}}
28634 {|{{echo|c
28635 {{!}}d
28636 }}
28637 |}
28638 !! end
28639
28640 ## This test verifies the presence and computation of this attribute indirectly
28641 ## by making an edit and ensuring that the serialization is correct (which it would be
28642 ## only if firstWikitextNode is properly set).
28643 !! test
28644 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28645 !! options
28646 parsoid= {
28647 "modes": ["wt2wt"],
28648 "changes": [
28649 [ "div#x", "remove" ],
28650 [ "div", "before", "<div>new</div>" ]
28651 ]
28652 }
28653 !! wikitext
28654 <div id="x">foo</div>
28655 {|
28656 {{echo|<div>boo</div>
28657 {{!}}b}}
28658 |c
28659 |}
28660 !! wikitext/edited
28661
28662 <div>new</div>
28663 {|
28664 {{echo|<div>boo</div>
28665 {{!}}b}}
28666 |c
28667 |}
28668 !! end
28669
28670 # --------------------------------------------
28671 # Tests spec'ing wikitext serialization norms |
28672 # --------------------------------------------
28673
28674 !! test
28675 Serialize multi-line indent-pre starting with wikitext syntax
28676 !! options
28677 parsoid=html2wt
28678 !! html/parsoid
28679 <pre>* 1
28680 ** 2
28681 * 3</pre>
28682 !! wikitext
28683 * 1
28684 ** 2
28685 * 3
28686 !! end
28687
28688 !! test
28689 1. Categories should always be serialized on their own line
28690 !! options
28691 parsoid=html2wt
28692 !! html/parsoid
28693 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28694 !! wikitext
28695 foo
28696 [[Category:Foo]]
28697 bar
28698 !! end
28699
28700 !! test
28701 2. Categories that are part of templates should not introduce a line break
28702 !! wikitext
28703 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28704 !! html/parsoid
28705 <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>
28706 !! end
28707
28708 # Careful while editing these next 2 tests. There are \u200f characters
28709 # before and after the <link> tags in the HTML and following some
28710 # of the categories in wikitext
28711 # Do not remove these characters in edits.
28712 #
28713 # As part of the serialization, these bidi characters will get stripped.
28714 !! test
28715 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28716 !! options
28717 parsoid={
28718 "modes": ["html2wt"],
28719 "scrubWikitext": true
28720 }
28721 !! html/parsoid
28722 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28723 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28724 !! wikitext
28725 [[קטגוריה:טקסים]]
28726 [[קטגוריה: שיטות משפט]]
28727 !! end
28728
28729 !! test
28730 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28731 !! options
28732 parsoid={
28733 "modes": ["html2wt"],
28734 "scrubWikitext": true
28735 }
28736 !! html/parsoid
28737 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28738 !! wikitext
28739 [[קטגוריה:טקסים]]
28740 ‏y
28741 !! end
28742
28743 !! test
28744 Lists: Add space after bullets
28745 !! options
28746 parsoid=html2wt
28747 !! html/parsoid
28748 <ul>
28749 <li>foo</li>
28750 <li> bar</li>
28751 <li><span> baz</span></li>
28752 </ul>
28753 !! wikitext
28754 * foo
28755 * bar
28756 * <span> baz</span>
28757 !! end
28758
28759 !! test
28760 1. Headings: Add space before/after == (T53744)
28761 !! options
28762 parsoid=html2wt
28763 !! html/parsoid
28764 <h2>foo</h2>
28765 <h2> bar</h2>
28766 <h2>baz </h2>
28767 <h2><span> baz</span></h2>
28768 !! wikitext
28769 == foo ==
28770
28771 == bar ==
28772
28773 == baz ==
28774
28775 == <span> baz</span> ==
28776 !! end
28777
28778 !! test
28779 2. Headings: Add space before/after == even after hoisted content
28780 !! options
28781 parsoid={
28782 "modes": ["html2wt"],
28783 "scrubWikitext": true
28784 }
28785 !! html/parsoid
28786 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28787 !! wikitext
28788 [[Category:A2]]
28789
28790 == ok ==
28791 !! end
28792
28793 !! test
28794 1. Headings: suppress newly created empty headings
28795 !! options
28796 parsoid={
28797 "modes": ["html2wt"],
28798 "scrubWikitext": true
28799 }
28800 !! html/parsoid
28801 <h2></h2>
28802 !! wikitext
28803 !! end
28804
28805 !! test
28806 2. Headings: don't suppress empty headings if scrubWikitext is false
28807 !! options
28808 parsoid=html2wt
28809 !! html/parsoid
28810 <h2></h2>
28811 !! wikitext
28812 ==<nowiki/>==
28813 !! end
28814
28815 !! test
28816 3. Headings: suppress empty headings on edits
28817 !! options
28818 parsoid={
28819 "modes": ["selser"],
28820 "scrubWikitext": true,
28821 "changes": [
28822 [ "#x", "remove"]
28823 ]
28824 }
28825 !! wikitext
28826 ==<span id="x">foo</span>==
28827 !! wikitext/edited
28828 !! end
28829
28830 !! test
28831 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28832 !! options
28833 parsoid={
28834 "modes": ["html2wt"],
28835 "scrubWikitext": true
28836 }
28837 !! html/parsoid
28838 <h2>foo<br/>bar</h2>
28839 <h2>foo <span><br/>bar</span> baz</h2>
28840 !! wikitext
28841 == foo bar ==
28842
28843 == foo <span> bar</span> baz ==
28844 !! end
28845
28846 !! test
28847 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28848 !! options
28849 parsoid={
28850 "modes": ["html2wt"],
28851 "scrubWikitext": false
28852 }
28853 !! html/parsoid
28854 <h2>foo<br/>bar</h2>
28855 !! wikitext
28856 == foo<br> bar ==
28857 !! end
28858
28859 !! test
28860 1. WT Quote Tags: suppress newly created empty style tags
28861 !! options
28862 parsoid={
28863 "modes": ["html2wt"],
28864 "scrubWikitext": true
28865 }
28866 !! html/parsoid
28867 <i></i><b></b>
28868 !! wikitext
28869 !! end
28870
28871 !! test
28872 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28873 !! options
28874 parsoid=html2wt
28875 !! html/parsoid
28876 <i></i><b></b>
28877 !! wikitext
28878 ''<nowiki/>'''''<nowiki/>'''
28879 !! end
28880
28881 !! test
28882 3. WT Quote Tags: suppress empty style tags on edits
28883 !! options
28884 parsoid={
28885 "modes": ["selser"],
28886 "scrubWikitext": true,
28887 "changes": [
28888 [ "#x", "remove"]
28889 ]
28890 }
28891 !! wikitext
28892 '''<span id="x">foo</span>'''
28893 !! wikitext/edited
28894 !! end
28895
28896 !! test
28897 1. Anchors: suppress newly created empty anchors
28898 !! options
28899 parsoid={
28900 "modes": ["html2wt"],
28901 "scrubWikitext": true
28902 }
28903 !! html/parsoid
28904 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28905 !! wikitext
28906 !! end
28907
28908 !! test
28909 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28910 !! options
28911 parsoid={
28912 "modes": ["html2wt"],
28913 "scrubWikitext": false
28914 }
28915 !! html/parsoid
28916 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28917 !! wikitext
28918 [[Test|<nowiki/>]]
28919 !! end
28920
28921 !! test
28922 3. Anchors: suppress empty anchors on edits
28923 !! options
28924 parsoid={
28925 "modes": ["selser"],
28926 "scrubWikitext": true,
28927 "changes": [
28928 [ "#x", "remove"]
28929 ]
28930 }
28931 !! wikitext
28932 [[Test|<span id="x">foo</span>]]
28933 !! wikitext/edited
28934 !! end
28935
28936 !! test
28937 3a. Anchors: do not suppress numbered extlinks
28938 !! options
28939 parsoid={
28940 "modes": ["wt2wt"],
28941 "scrubWikitext": true
28942 }
28943 !! wikitext
28944 [http://foo.com]
28945 !! html/parsoid
28946 <a rel="mw:ExtLink" href="http://foo.com"></a>
28947 !! end
28948
28949 !! test
28950 3b. Anchors: do not suppress numbered extlinks
28951 !! options
28952 parsoid={
28953 "modes": ["wt2wt"],
28954 "scrubWikitext": true,
28955 "changes": [
28956 [ "#x", "remove"]
28957 ]
28958 }
28959 !! wikitext
28960 [http://foo.com <span id="x">foo</span>]
28961 !! wikitext/edited
28962 [http://foo.com]
28963 !! end
28964
28965 !!test
28966 Normalizations should be restricted to edited content
28967 !!options
28968 parsoid={
28969 "modes": ["selser"],
28970 "scrubWikitext": true,
28971 "changes": [
28972 [ "h1", "before", "<i></i>"]
28973 ]
28974 }
28975 !!wikitext
28976 a
28977 = =
28978 b
28979 !!wikitext/edited
28980 a
28981 = =
28982 b
28983 !!end
28984
28985 !! test
28986 1. Multiple normalizations (html2wt)
28987 !! options
28988 parsoid={
28989 "modes": ["html2wt"],
28990 "scrubWikitext": true
28991 }
28992 !! html
28993 <h2><i></i></h2>
28994 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28995 </a><b><i></i></b>x</p>
28996 !! wikitext
28997
28998 [[foo]]
28999 x
29000
29001 !! end
29002
29003 !! test
29004 2. Multiple normalizations (selser)
29005 !! options
29006 parsoid={
29007 "modes": ["selser"],
29008 "scrubWikitext": true,
29009 "changes": [
29010 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29011 ]
29012 }
29013 !! wikitext
29014 <span id="x">foo</span>
29015 !! wikitext/edited
29016 <span id="x">foo</span>
29017
29018 x
29019 !! end
29020
29021 !! test
29022 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29023 !! options
29024 parsoid={
29025 "modes": ["html2wt"],
29026 "scrubWikitext": true
29027 }
29028 !! html/parsoid
29029 <p> hi</p>
29030 <p> hello</p>
29031 !! wikitext
29032 hi
29033
29034 hello
29035 !! end
29036
29037 !! test
29038 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29039 !! options
29040 parsoid=html2wt
29041 !! html/parsoid
29042 <p> hi</p>
29043 <p> hello</p>
29044 !! wikitext
29045 <nowiki> </nowiki>hi
29046
29047 <nowiki> </nowiki> hello
29048 !! end
29049
29050 !! test
29051 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29052 !! options
29053 parsoid={
29054 "modes": ["html2wt"],
29055 "scrubWikitext": true
29056 }
29057 !! html/parsoid
29058 <p>Foo
29059 bar
29060 baz</p>
29061
29062 <table><tr><td>Foo
29063 bar
29064 baz bang</td></tr></table>
29065
29066 <p><!--boo--> foo
29067 bar</p>
29068
29069 <p> foo
29070 bar<span>boo</span></p>
29071 !! wikitext
29072 Foo
29073 bar
29074 baz
29075
29076 {|
29077 |Foo
29078 bar
29079 baz bang
29080 |}
29081
29082 <!--boo-->foo
29083 bar
29084
29085 foo
29086 bar<span>boo</span>
29087 !! end
29088
29089 !! test
29090 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29091 !! options
29092 parsoid={
29093 "modes": ["selser"],
29094 "scrubWikitext": true,
29095 "changes": [
29096 [ "p", "html", " a\n b" ]
29097 ]
29098 }
29099 !! wikitext
29100 xyz
29101 !! wikitext/edited
29102 a
29103 b
29104 !! end
29105
29106 !! test
29107 1. New links that end in spaces
29108 !! options
29109 parsoid={
29110 "modes": ["html2wt"],
29111 "scrubWikitext": false
29112 }
29113 !! html/parsoid
29114 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29115 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29116 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29117 !! wikitext
29118 [[Berlin ]]<nowiki/>is the capital of Germany.
29119
29120 [[Foo ]]'''bar'''
29121
29122 [[Boston ]] is a city.
29123 !! end
29124
29125 !! test
29126 2. New links that end in spaces
29127 !! options
29128 parsoid={
29129 "modes": ["html2wt"],
29130 "scrubWikitext": true
29131 }
29132 !! html/parsoid
29133 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29134 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29135 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29136 !! wikitext
29137 [[Berlin]] is the capital of Germany.
29138
29139 [[Foo]] '''bar'''
29140
29141 [[Boston]] is a city.
29142 !! end
29143
29144 !! test
29145 1. Table cells with escapable prefixes
29146 !! options
29147 parsoid={
29148 "modes": ["html2wt"],
29149 "scrubWikitext": false
29150 }
29151 !! html
29152 <table>
29153 <tr><td>a</td></tr>
29154 <tr><td>-</td></tr>
29155 <tr><td>+</td></tr>
29156 </table>
29157 !! wikitext
29158 {|
29159 |a
29160 |-
29161 |<nowiki>-</nowiki>
29162 |-
29163 |<nowiki>+</nowiki>
29164 |}
29165 !! end
29166
29167 !! test
29168 2. Table cells with escapable prefixes
29169 !! options
29170 parsoid={
29171 "modes": ["html2wt"],
29172 "scrubWikitext": true
29173 }
29174 !! html
29175 <table>
29176 <tr><td>a</td></tr>
29177 <tr><td>-</td></tr>
29178 <tr><td>+</td></tr>
29179 </table>
29180 !! wikitext
29181 {|
29182 |a
29183 |-
29184 | -
29185 |-
29186 | +
29187 |}
29188 !! end
29189
29190 !! test
29191 3a. Table cells with escapable prefixes after edits
29192 !! options
29193 parsoid={
29194 "modes": ["selser"],
29195 "scrubWikitext": true,
29196 "changes": [
29197 [ "table tbody tr:first-child td:first-child", "remove"]
29198 ]
29199 }
29200 !! wikitext
29201 {|
29202 |a||-
29203 |}
29204 !! wikitext/edited
29205 {|
29206 | -
29207 |}
29208 !! end
29209
29210 !! test
29211 3b. Table cells with escapable prefixes after edits
29212 !! options
29213 parsoid={
29214 "modes": ["selser"],
29215 "scrubWikitext": true,
29216 "changes": [
29217 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29218 [ "#x", "remove" ]
29219 ]
29220 }
29221 !! wikitext
29222 {|
29223 |pqr
29224 |<span id="x">foo</span>+
29225 |}
29226 !! wikitext/edited
29227 {|
29228 | -
29229 | +
29230 |}
29231 !! end
29232
29233 # FIXME: This test will fail because
29234 # normalization doesn't realize that the id attribute
29235 # will eliminate the escapable scenario
29236 !! test
29237 4a. Table cells without escapable prefixes after edits
29238 !! options
29239 parsoid={
29240 "modes": ["selser"],
29241 "scrubWikitext": true,
29242 "changes": [
29243 [ "#x", "html", "-" ]
29244 ]
29245 }
29246 !! wikitext
29247 {|
29248 | id="x" |abcd
29249 |}
29250 !! wikitext/edited
29251 {|
29252 | id="x" |-
29253 |}
29254 !! end
29255
29256 ## This tests normalizer's ability to discriminate between
29257 ## cells having identical content.
29258 !! test
29259 4b. Table cells without escapable prefixes after edits
29260 !! options
29261 parsoid={
29262 "modes": ["selser"],
29263 "scrubWikitext": true,
29264 "changes": [
29265 [ "td", "html", "-" ]
29266 ]
29267 }
29268 !! wikitext
29269 {|
29270 |a||b
29271 |}
29272 !! wikitext/edited
29273 {|
29274 | -||-
29275 |}
29276 !! end
29277
29278 ## This tests normalizer's ability to not be tripped by
29279 ## comments (and whitespace)
29280 !! test
29281 4c. Table cells without escapable prefixes after edits
29282 !! options
29283 parsoid={
29284 "modes": ["selser"],
29285 "scrubWikitext": true,
29286 "changes": [
29287 [ "table tbody tr td:first-child", "remove" ]
29288 ]
29289 }
29290 !! wikitext
29291 {|
29292 |-
29293 <!--foo--> |a||-
29294 |}
29295 !! wikitext/edited
29296 {|
29297 |-
29298 <!--foo--> | -
29299 |}
29300 !! end
29301
29302 ## This tests normalizer's ability to handle HTML cells
29303 !! test
29304 4d. Table cells without escapable prefixes after edits
29305 !! options
29306 parsoid={
29307 "modes": ["selser"],
29308 "scrubWikitext": true,
29309 "changes": [
29310 [ "td", "html", "-" ]
29311 ]
29312 }
29313 !! wikitext
29314 <table>
29315 <tr><td>a</td></tr>
29316 </table>
29317 !! wikitext/edited
29318 <table>
29319 <tr><td>-</td></tr>
29320 </table>
29321 !! end
29322
29323 ## T111151 Remove font elements without attributes
29324 !! test
29325 5a. font tags without attributes should be dropped in scrubWikitext mode
29326 !! options
29327 parsoid={
29328 "modes": ["html2wt"],
29329 "scrubWikitext": true
29330 }
29331 !! html
29332 <font>foo</font>
29333 <font><font>bar</font></font>
29334 <font class="x">boo</font>
29335 !! wikitext
29336 foo
29337 bar
29338 <font class="x">boo</font>
29339 !! end
29340
29341 !! test
29342 5b. font tags should not be dropped without scrubWikitext being enabled
29343 !! options
29344 parsoid={
29345 "modes": ["html2wt"],
29346 "scrubWikitext": false
29347 }
29348 !! html
29349 <font>foo</font>
29350 !! wikitext
29351 <font>foo</font>
29352 !! end
29353
29354 !! test
29355 Escape nowiki DOM elements
29356 !! options
29357 parsoid=html2wt
29358 !! html/parsoid
29359 <nowiki><i>foo</i></nowiki>
29360 !! wikitext
29361 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29362 !! end
29363
29364 # This is meant to be an interim fix while we go about figuring out
29365 # how to not introduce these trailing <nowiki/>s in the first place.
29366 !! test
29367 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29368 !! options
29369 parsoid=html2wt
29370 !! html/parsoid
29371 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29372 y</p>
29373 <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>
29374 <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>
29375 !! wikitext
29376 x
29377 y
29378
29379 {{echo|
29380 1 = <nowiki/>}}
29381
29382 {{echo|
29383 1 = <nowiki/>
29384 }}
29385 !! end
29386
29387 # ---------------------------------------------------
29388 # End of tests spec'ing wikitext serialization norms |
29389 # ---------------------------------------------------
29390
29391 # T104032
29392 !! test
29393 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29394 !! options
29395 parsoid=html2wt
29396 !! html/parsoid
29397 a<p>b</p>
29398 <b>c</b><p>d</p>
29399 <table><tr>
29400 <td>a<p>b</p></td>
29401 <td><b>c</b><p>d</p></td>
29402 </tr></table>
29403 !! wikitext
29404 a
29405
29406 b
29407
29408 '''c'''
29409
29410 d
29411 {|
29412 |a
29413 b
29414 |'''c'''
29415 d
29416 |}
29417 !! end
29418
29419 !! test
29420 Anchor without href scenarios
29421 !! options
29422 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29423 !! html/parsoid
29424 <a class="bc"></a>
29425 <a class="no">dice</a>
29426 <a name="foo"></a>
29427 !! wikitext
29428
29429 dice
29430 <span name="foo"></span>
29431 !! end
29432
29433 !! test
29434 New transclusion added after a list should be serialized after the list
29435 !! options
29436 parsoid=html2wt
29437 !! html/parsoid
29438 <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>
29439 !! wikitext
29440 * a
29441 {{echo|foo}}
29442 !! end
29443
29444 # -----------------------------------------------------------------
29445 # End of section for Parsoid-only html2wt tests for serialization
29446 # of new content
29447 # -----------------------------------------------------------------
29448
29449 # -----------------------------------------------------------------
29450 # The following section of tests are primarily to spec behavior of
29451 # the selective serializer. All these tests have manual selser
29452 # changes. The automated selser changes for all tests handle the
29453 # wide variation of changes, but these tests here capture specs
29454 # deterministically.
29455 # ----------------------------------------------------------------
29456
29457 ## T90517
29458 !! test
29459 Selser: New comments should not be lost
29460 !! options
29461 parsoid={
29462 "modes": ["selser"],
29463 "changes": [
29464 [ "#a", "after", "<!--c1-->" ],
29465 [ "#b", "before", "<!--c2-->" ]
29466 ]
29467 }
29468 !! wikitext
29469 <span id="a">a</span>
29470
29471 <span id="b">b</span>
29472 !! wikitext/edited
29473 <span id="a">a</span><!--c1-->
29474
29475 <!--c2--><span id="b">b</span>
29476 !! end
29477
29478 ## T89383
29479 !! test
29480 Selser: Check for validity of DSR before using it
29481 !! options
29482 parsoid={
29483 "modes": ["selser"],
29484 "changes": [
29485 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29486 ]
29487 }
29488 !! wikitext
29489 <span id="a">a</span>
29490 !! wikitext/edited
29491 {{DISPLAYTITLE:foo}}
29492 <span id="a">a</span>
29493 !! end
29494
29495 !! test
29496 1. DOMDiff: Changes to <ref> content should be looked up using id
29497 !! options
29498 parsoid={
29499 "modes": ["selser"],
29500 "changes": [
29501 ["#X", "after", "bar"],
29502 ["#Y", "after", "baz"]
29503 ]
29504 }
29505 !! wikitext
29506 X <ref><span id="X">foo</span></ref>
29507 Y <ref name="a" />
29508 <references>
29509 <ref name="a"><span id="Y">foo</span></ref>
29510 </references>
29511 !! wikitext/edited
29512 X <ref><span id="X">foo</span>bar</ref>
29513 Y <ref name="a" />
29514 <references>
29515 <ref name="a"><span id="Y">foo</span>baz</ref>
29516 </references>
29517 !! end
29518
29519 !! test
29520 2. DOMDiff: Changes to <ref> content should be looked up using id
29521 !! options
29522 parsoid={
29523 "modes": ["selser"],
29524 "changes": [
29525 ["#Z", "after", "bar"]
29526 ]
29527 }
29528 !! wikitext
29529 A <ref>foo bar for a</ref>
29530 B <ref group="X" name="b" />
29531
29532 <references />
29533
29534 <references group="X">
29535 <ref name="b"><span id="Z">foo</span></ref>
29536 </references>
29537 !! wikitext/edited
29538 A <ref>foo bar for a</ref>
29539 B <ref group="X" name="b" />
29540
29541 <references />
29542
29543 <references group="X">
29544 <ref name="b"><span id="Z">foo</span>bar</ref>
29545 </references>
29546 !! end
29547
29548 !! test
29549 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29550 !! options
29551 parsoid={
29552 "modes": ["selser"],
29553 "changes": [
29554 [ "div:first-child", "text", "bar" ]
29555 ]
29556 }
29557 !! wikitext
29558 <div style="{{1x|color:red;}}%">foo</div>
29559 !! wikitext/edited
29560 <div style="{{1x|color:red;}}%">bar</div>
29561 !! end
29562
29563 !! test
29564 Empty LI (T49673)
29565 !! wikitext
29566 * a
29567 *
29568 *
29569 * b
29570 !! html+tidy
29571 <ul><li> a</li>
29572 <li class="mw-empty-elt"> </li>
29573 <li class="mw-empty-elt"></li>
29574 <li> b</li></ul>
29575 !! end
29576
29577 !! test
29578 Thumbnail output
29579 !! wikitext
29580 [[File:Thumb.png|thumb]]
29581 !! html/php+tidy
29582 <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>
29583 !! html/parsoid
29584 <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>
29585 !! end
29586
29587 !! test
29588 unclosed internal link XSS (T137264)
29589 !! wikitext
29590 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29591 !! html/php
29592 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29593 </p>
29594 !! html/parsoid
29595 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29596 !! end
29597
29598 !! test
29599 Validating that <style> isn't eaten by tidy (T167349)
29600 !! options
29601 styletag=1
29602 !! wikitext
29603 <div class="foo">
29604 <style>.foo::before { content: "<foo>"; }</style>
29605 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29606 </div>
29607 !! html/php+tidy
29608 <div class="foo">
29609 <style>.foo::before { content: "<foo>"; }</style>
29610 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29611 </div>
29612 !! end
29613
29614 !! test
29615 Validating that <style> isn't wrapped in a paragraph (T186965)
29616 !! options
29617 styletag=1
29618 !! wikitext
29619 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29620
29621 <style>.foo::before { content: "<foo>"; }</style>
29622
29623 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29624
29625 But if it's on a line with other content, let it be wrapped.
29626
29627 <style>.foo::before { content: "<foo>"; }</style> bar
29628
29629 foo <style>.foo::before { content: "<foo>"; }</style>
29630
29631 foo <style>.foo::before { content: "<foo>"; }</style> bar
29632
29633 And the same if we have non-paragraph-breaking whitespace
29634
29635 foo
29636 <style>.foo::before { content: "<foo>"; }</style>
29637 bar
29638 !! html/php
29639 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29640 </p>
29641 <style>.foo::before { content: "<foo>"; }</style>
29642 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29643 <p>But if it's on a line with other content, let it be wrapped.
29644 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29645 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29646 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29647 </p><p>And the same if we have non-paragraph-breaking whitespace
29648 </p><p>foo
29649 <style>.foo::before { content: "<foo>"; }</style>
29650 bar
29651 </p>
29652 !! end
29653
29654 !! test
29655 Validating that <link> isn't wrapped in a paragraph (T186965)
29656 !! options
29657 styletag=1
29658 !! wikitext
29659 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29660
29661 <link rel="foo" href="bar"/>
29662
29663 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29664
29665 But if it's on a line with other content, let it be wrapped.
29666
29667 <link rel="foo" href="bar"/> bar
29668
29669 foo <link rel="foo" href="bar"/>
29670
29671 foo <link rel="foo" href="bar"/> bar
29672
29673 And the same if we have non-paragraph-breaking whitespace
29674
29675 foo
29676 <link rel="foo" href="bar"/>
29677 bar
29678 !! html/php
29679 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29680 </p>
29681 <link rel="foo" href="bar"/>
29682 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29683 <p>But if it's on a line with other content, let it be wrapped.
29684 </p><p><link rel="foo" href="bar"/> bar
29685 </p><p>foo <link rel="foo" href="bar"/>
29686 </p><p>foo <link rel="foo" href="bar"/> bar
29687 </p><p>And the same if we have non-paragraph-breaking whitespace
29688 </p><p>foo
29689 <link rel="foo" href="bar"/>
29690 bar
29691 </p>
29692 !! end
29693
29694 !! test
29695 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29696 !! config
29697 wgFragmentMode=[ 'html5', 'legacy' ]
29698 !! wikitext
29699 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29700 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29701 !! html/php
29702 <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>
29703 <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>
29704 </p>
29705 !! html/parsoid
29706 <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>
29707 <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>
29708 !! end
29709
29710 !! test
29711 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29712 !! config
29713 wgFragmentMode=[ 'legacy' ]
29714 !! wikitext
29715 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29716 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29717 !! html/php
29718 <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>
29719 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29720 </p>
29721 !! end
29722
29723 !! test
29724 Decoding of HTML entities in embedded HTML tags
29725 !! wikitext
29726 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29727 !! html/php
29728 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29729
29730 !! html/parsoid
29731 <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>
29732 !! end
29733
29734 !! test
29735 Decoding of HTML entities in indicator names for IDs (T104196)
29736 !! options
29737 parsoid=wt2html,html2html
29738 showindicators
29739 !! wikitext
29740 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29741 !! html/php
29742 1&2&3&amp;4&amp;amp;5=Indicator
29743
29744 !! html/parsoid
29745 <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>
29746 !! end
29747
29748 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29749 !! test
29750 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29751 !! options
29752 showindicators
29753 !! wikitext
29754 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29755 !! html/php
29756 1&2&3&amp;4&amp;amp;5=Indicator
29757
29758 !! html/parsoid
29759 <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
29760 !! end
29761
29762 # This fragment mode is what Parsoid supports.
29763 !! test
29764 HTML5 ids: fallback to legacy
29765 !! config
29766 wgFragmentMode=[ 'html5', 'legacy' ]
29767 !! wikitext
29768 == Foo bar ==
29769
29770 == foo Bar ==
29771
29772 == Тест ==
29773
29774 == Тест ==
29775
29776 == тест ==
29777
29778 == Hey < # " > % : ' ==
29779 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29780
29781 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29782
29783 <!-- These two links should produce identical HTML -->
29784 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29785
29786 !! html/php
29787 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29788 <ul>
29789 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29790 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29791 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29792 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29793 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29794 <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>
29795 </ul>
29796 </div>
29797
29798 <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>
29799 <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>
29800 <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>
29801 <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>
29802 <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>
29803 <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>
29804 <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>
29805 </p><p>💩 <span id="💩"></span>
29806 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29807 </p>
29808 !! html/parsoid
29809 <h2 id="Foo_bar"> Foo bar </h2>
29810
29811 <h2 id="foo_Bar_2"> foo Bar </h2>
29812
29813 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span> Тест </h2>
29814
29815 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span> Тест </h2>
29816
29817 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span> тест </h2>
29818
29819 <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>
29820 <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>
29821
29822 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[190,209,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
29823
29824 <!-- These two links should produce identical HTML -->
29825 <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>
29826 !! end
29827
29828 # Parsoid doesn't support this mode
29829 !! test
29830 HTML5 ids: legacy with a fallback to modern
29831 !! config
29832 wgFragmentMode=[ 'legacy', 'html5' ]
29833 !! wikitext
29834 == Foo bar ==
29835
29836 == foo Bar ==
29837
29838 == Тест ==
29839
29840 == Тест ==
29841
29842 == тест ==
29843
29844 == Hey < # " > % : ' ==
29845 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29846
29847 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29848
29849 <!-- These two links should produce identical HTML -->
29850 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29851
29852 !! html/php
29853 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29854 <ul>
29855 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29856 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29857 <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>
29858 <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>
29859 <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>
29860 <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>
29861 </ul>
29862 </div>
29863
29864 <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>
29865 <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>
29866 <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>
29867 <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>
29868 <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>
29869 <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>
29870 <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>
29871 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29872 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29873 </p>
29874 !! end
29875
29876 # Parsoid doesn't support this mode.
29877 !! test
29878 HTML5 ids: no legacy
29879 !! config
29880 wgFragmentMode=[ 'html5' ]
29881 !! wikitext
29882 == Foo bar ==
29883
29884 == foo Bar ==
29885
29886 == Тест ==
29887
29888 == Тест ==
29889
29890 == тест ==
29891
29892 == Hey < # " > % : ' ==
29893 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29894
29895 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29896
29897 <!-- These two links should produce identical HTML -->
29898 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29899
29900 !! html/php
29901 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29902 <ul>
29903 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29904 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29905 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29906 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29907 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29908 <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>
29909 </ul>
29910 </div>
29911
29912 <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>
29913 <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>
29914 <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>
29915 <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>
29916 <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>
29917 <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>
29918 <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>
29919 </p><p>💩 <span id="💩"></span>
29920 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29921 </p>
29922 !! end
29923
29924 !! test
29925 T90902: Normalize weird characters in section IDs
29926 !! config
29927 wgFragmentMode=[ 'html5', 'legacy' ]
29928 !! wikitext
29929 == Foo&nbsp;bar ==
29930 [[#Foo&nbsp;bar]]
29931
29932 !! html/php
29933 <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>
29934 <p><a href="#Foo_bar">#Foo&#160;bar</a>
29935 </p>
29936 !! end
29937
29938 !! test
29939 T51672: Test for brackets in attributes of elements in external link texts
29940 !! wikitext
29941 [http://example.com/ link <span title="title with [brackets]">span</span>]
29942 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
29943
29944 !! html/php
29945 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29946 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
29947 </p>
29948 !! html/parsoid
29949 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
29950 <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>
29951 !! end
29952
29953 !! test
29954 T72875: Test for brackets in attributes of elements in internal link texts
29955 !! wikitext
29956 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
29957 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
29958
29959 !! html/php
29960 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29961 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
29962 </p>
29963 !! html/parsoid
29964 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
29965 <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>
29966 !! end
29967
29968 !! test
29969 T179544: {{anchorencode:}} output should be always usable in links
29970 !! config
29971 wgFragmentMode=[ 'html5' ]
29972 !! wikitext
29973 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
29974 !! html/php
29975 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
29976 </p>
29977 !! html/parsoid
29978 <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>
29979 !! end
29980
29981 ## ------------------------------
29982 ## Parsoid section-wrapping tests
29983 ## ------------------------------
29984 !! test
29985 Section wrapping for well-nested sections (no leading content)
29986 !! options
29987 parsoid={
29988 "wrapSections": true
29989 }
29990 !! wikitext
29991 = 1 =
29992 a
29993
29994 = 2 =
29995 b
29996
29997 == 2.1 ==
29998 c
29999
30000 == 2.2 ==
30001 d
30002
30003 === 2.2.1 ===
30004 e
30005
30006 = 3 =
30007 f
30008 !! html/parsoid
30009 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30010 <p>a</p>
30011
30012 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30013 <p>b</p>
30014
30015 <section data-mw-section-id="3"><h2 id="2.1"> 2.1 </h2>
30016 <p>c</p>
30017
30018 </section><section data-mw-section-id="4"><h2 id="2.2"> 2.2 </h2>
30019 <p>d</p>
30020
30021 <section data-mw-section-id="5"><h3 id="2.2.1"> 2.2.1 </h3>
30022 <p>e</p>
30023
30024 </section></section></section><section data-mw-section-id="6"><h1 id="3"> 3 </h1>
30025 <p>f</p>
30026
30027 </section>
30028 !! end
30029
30030 !! test
30031 Section wrapping for well-nested sections (with leading content)
30032 !! options
30033 parsoid={
30034 "wrapSections": true
30035 }
30036 !! wikitext
30037 Para 1.
30038
30039 Para 2 with a <div>nested in it</div>
30040
30041 Para 3.
30042
30043 = 1 =
30044 a
30045
30046 = 2 =
30047 b
30048
30049 == 2.1 ==
30050 c
30051 !! html/parsoid
30052 <section data-mw-section-id="0"><p>Para 1.</p>
30053
30054 <p>Para 2 with a </p><div>nested in it</div>
30055
30056 <p>Para 3.</p>
30057
30058 </section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30059 <p>a</p>
30060
30061 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30062 <p>b</p>
30063
30064 <section data-mw-section-id="3"><h2 id="2.1"> 2.1 </h2>
30065 <p>c</p>
30066
30067 </section></section>
30068 !! end
30069
30070 !! test
30071 Section wrapping with template-generated sections (good nesting 1)
30072 !! options
30073 parsoid={
30074 "wrapSections": true
30075 }
30076 !! wikitext
30077 = 1 =
30078 a
30079
30080 {{echo|1=
30081 == 1.1 ==
30082 b
30083 }}
30084
30085 == 1.2 ==
30086 c
30087
30088 = 2 =
30089 d
30090 !! html/parsoid
30091 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30092 <p>a</p>
30093
30094 <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">
30095 </span><p about="#mwt1">b</p>
30096 </section><section data-mw-section-id="3"><h2 id="1.2"> 1.2 </h2>
30097 <p>c</p>
30098
30099 </section></section><section data-mw-section-id="4"><h1 id="2"> 2 </h1>
30100 <p>d</p></section>
30101 !! end
30102
30103 # In this example, the template scope is mildly expanded to incorporate the
30104 # trailing newline after the transclusion since that is part of section 1.1.1
30105 !! test
30106 Section wrapping with template-generated sections (good nesting 2)
30107 !! options
30108 parsoid={
30109 "wrapSections": true,
30110 "modes": ["wt2html", "wt2wt"]
30111 }
30112 !! wikitext
30113 = 1 =
30114 a
30115
30116 {{echo|1=
30117 == 1.1 ==
30118 b
30119 === 1.1.1 ===
30120 d
30121 }}
30122 = 2 =
30123 e
30124 !! html/parsoid
30125 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30126 <p>a</p>
30127
30128 <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">
30129 </span><p about="#mwt1">b</p><span about="#mwt1">
30130 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1"> 1.1.1 </h3><span about="#mwt1">
30131 </span><p about="#mwt1">d</p><span about="#mwt1">
30132 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2"> 2 </h1>
30133 <p>e</p></section>
30134 !! end
30135
30136 # In this example, the template scope is mildly expanded to incorporate the
30137 # trailing newline after the transclusion since that is part of section 1.2.1
30138 !! test
30139 Section wrapping with template-generated sections (good nesting 3)
30140 !! options
30141 parsoid={
30142 "wrapSections": true,
30143 "modes": ["wt2html", "wt2wt"]
30144 }
30145 !! wikitext
30146 = 1 =
30147 a
30148
30149 {{echo|1=
30150 x
30151 == 1.1 ==
30152 b
30153 ==1.2==
30154 c
30155 ===1.2.1===
30156 d
30157 }}
30158 = 2 =
30159 e
30160 !! html/parsoid
30161 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30162 <p>a</p>
30163
30164 <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">
30165 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1"> 1.1 </h2><span about="#mwt1">
30166 </span><p about="#mwt1">b</p><span about="#mwt1">
30167 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30168 </span><p about="#mwt1">c</p><span about="#mwt1">
30169 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30170 </span><p about="#mwt1">d</p><span about="#mwt1">
30171 </span></section></section></section><section data-mw-section-id="5"><h1 id="2"> 2 </h1>
30172 <p>e</p></section>
30173 !! end
30174
30175 # Because of section-wrapping and template-wrapping interactions,
30176 # the scope of the template is expanded so that the template markup
30177 # is valid in the presence of <section> tags.
30178 # This exercises the s1 is null scenario in the wrapSections code
30179 !! test
30180 Section wrapping with template-generated sections (bad nesting 1)
30181 !! options
30182 parsoid={
30183 "wrapSections": true
30184 }
30185 !! wikitext
30186 <div>
30187 a
30188
30189 {{echo|
30190 = 1 =
30191 b
30192 }}
30193
30194 c
30195 </div>
30196 !! html/parsoid
30197 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30198 <p>a</p>
30199
30200 <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"]}'>
30201 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1"> 1 </h1><span about="#mwt1">
30202 </span><p about="#mwt1">b
30203 </p><span about="#mwt1">
30204
30205 </span><p about="#mwt1">c</p><span about="#mwt1">
30206 </span></section></div></section>
30207 !! end
30208
30209 # Because of section-wrapping and template-wrapping interactions,
30210 # the scope of the template is expanded so that the template markup
30211 # is valid in the presence of <section> tags.
30212 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30213 !! test
30214 Section wrapping with template-generated sections (bad nesting 2)
30215 !! options
30216 parsoid={
30217 "wrapSections": true
30218 }
30219 !! wikitext
30220 = 1 =
30221 a
30222
30223 {{echo|1=
30224 = 2 =
30225 b
30226 == 2.1 ==
30227 c
30228 }}
30229
30230 d
30231
30232 = 3 =
30233 e
30234 !! html/parsoid
30235 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30236 <p>a</p>
30237
30238 </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">
30239 </span><p about="#mwt1">b</p><span about="#mwt1">
30240 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1"> 2.1 </h2><span about="#mwt1">
30241 </span><p about="#mwt1">c</p><span about="#mwt1">
30242
30243 </span><p about="#mwt1">d</p><span about="#mwt1">
30244
30245 </span></section></section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30246 <p>e</p></section>
30247 !! end
30248
30249 # Because of section-wrapping and template-wrapping interactions,
30250 # additional template wrappers are added to <section> tags
30251 # so that template wrapping semantics are valid whether section
30252 # tags are retained or stripped. But, the template scope can expand
30253 # greatly when accounting for section tags.
30254 # This exercises the s1 and s2 are in different subtrees scenario
30255 !! test
30256 Section wrapping with template-generated sections (bad nesting 3)
30257 !! options
30258 parsoid={
30259 "wrapSections": true,
30260 "modes": ["wt2html", "wt2wt"]
30261 }
30262 !! wikitext
30263 = 1 =
30264 a
30265
30266 {{echo|1=
30267 == 1.2 ==
30268 b
30269 = 2 =
30270 c
30271 }}
30272
30273 d
30274
30275 = 3 =
30276 e
30277 !! html/parsoid
30278 <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>
30279 <p>a</p>
30280
30281 <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">
30282 </span><p about="#mwt1">b</p><span about="#mwt1">
30283 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2"> 2 </h1><span about="#mwt1">
30284 </span><p about="#mwt1">c</p>
30285
30286 <p>d</p>
30287 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3"> 3 </h1>
30288 <p>e</p></section>
30289 !! end
30290
30291 !! test
30292 Section wrapping with uneditable lead section + div wrapping multiple sections
30293 !! options
30294 parsoid={
30295 "wrapSections": true
30296 }
30297 !! wikitext
30298 foo
30299
30300 <div style="border:1px solid red;">
30301 = 1 =
30302 a
30303
30304 == 1.1 ==
30305 b
30306
30307 = 2 =
30308 c
30309 </div>
30310
30311 = 3 =
30312 d
30313
30314 == 3.1 ==
30315 e
30316 !! html/parsoid
30317 <section data-mw-section-id="-1"><p>foo</p>
30318
30319 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30320 <section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30321 <p>a</p>
30322
30323 <section data-mw-section-id="2"><h2 id="1.1"> 1.1 </h2>
30324 <p>b</p>
30325
30326 </section></section><section data-mw-section-id="-1"><h1 id="2"> 2 </h1>
30327 <p>c</p>
30328 </section></div>
30329
30330 </section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30331 <p>d</p>
30332
30333 <section data-mw-section-id="5"><h2 id="3.1"> 3.1 </h2>
30334 <p>e</p>
30335 </section></section>
30336 !! end
30337
30338 !! test
30339 Section wrapping with editable lead section + div overlapping multiple sections
30340 !! options
30341 parsoid={
30342 "wrapSections": true
30343 }
30344 !! wikitext
30345 foo
30346
30347 = 1 =
30348 a
30349 <div style="border:1px solid red;">
30350 b
30351
30352 == 1.1 ==
30353 c
30354
30355 = 2 =
30356 d
30357 </div>
30358 e
30359
30360 = 3 =
30361 f
30362
30363 == 3.1 ==
30364 g
30365 !! html/parsoid
30366 <section data-mw-section-id="0"><p>foo</p>
30367
30368 </section><section data-mw-section-id="-1"><h1 id="1"> 1 </h1>
30369 <p>a</p>
30370 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30371 <p>b</p>
30372
30373 <section data-mw-section-id="2"><h2 id="1.1"> 1.1 </h2>
30374 <p>c</p>
30375
30376 </section><section data-mw-section-id="-1"><h1 id="2"> 2 </h1>
30377 <p>d</p>
30378 </section></div>
30379 <p>e</p>
30380
30381 </section><section data-mw-section-id="4"><h1 id="3"> 3 </h1>
30382 <p>f</p>
30383
30384 <section data-mw-section-id="5"><h2 id="3.1"> 3.1 </h2>
30385 <p>g</p>
30386 </section></section>
30387 !! end
30388
30389 !! test
30390 HTML header tags should not be wrapped in section tags
30391 !! options
30392 parsoid={
30393 "wrapSections": true
30394 }
30395 !! wikitext
30396 foo
30397
30398 <h1>a</h1>
30399
30400 = b =
30401
30402 <h1>c</h1>
30403
30404 = d =
30405 !! html/parsoid
30406 <section data-mw-section-id="0"><p>foo</p>
30407
30408 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30409
30410 </section><section data-mw-section-id="1"><h1 id="b"> b </h1>
30411
30412 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30413
30414 </section><section data-mw-section-id="2"><h1 id="d"> d </h1></section>
30415 !! end
30416
30417 !! test
30418 Lead section containing only whitespace and comments.
30419 !! options
30420 parsoid={
30421 "wrapSections": true
30422 }
30423 !! wikitext
30424
30425 <!-- this is a comment, presumably significant to editors -->
30426 = 1 =
30427 a
30428
30429 = 2 =
30430 b
30431 !! html/parsoid
30432 <section data-mw-section-id="0" data-parsoid="{}">
30433 <!-- this is a comment, presumably significant to editors -->
30434 </section><section data-mw-section-id="1"><h1 id="1"> 1 </h1>
30435 <p>a</p>
30436
30437 </section><section data-mw-section-id="2"><h1 id="2"> 2 </h1>
30438 <p>b</p></section>
30439 !! end
30440
30441 !! test
30442 Pseudo-sections emitted by templates should have id -2
30443 !! options
30444 parsoid={
30445 "wrapSections": true
30446 }
30447 !! wikitext
30448 foo
30449 {{echo|<div>
30450 == a ==
30451 == b ==
30452 </div>
30453 }}
30454 !! html/parsoid
30455 <section data-mw-section-id="-1"><p>foo</p>
30456 </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}}]}'>
30457 <section data-mw-section-id="-1"><h2 id="a"> a </h2>
30458 </section><section data-mw-section-id="-1"><h2 id="b"> b </h2>
30459 </section></div><span about="#mwt1">
30460 </span></section>
30461 !! end