Fix bug in dl-dt list output generation
[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:CircularRef
284 !! text
285 <ref>{{CircularRef}}</ref>
286 !! endarticle
287
288 !! article
289 Template:With: Colon
290 !! text
291 Template with colon
292 !! endarticle
293
294 ###
295 ### Basic tests
296 ###
297 !! test
298 Blank input
299 !! wikitext
300 !! html
301 !! end
302
303 !! test
304 CircularRef
305 !! wikitext
306 {{CircularRef}}
307 <references />
308 !! html/parsoid
309 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
310 <ol class="mw-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="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
311 !! end
312
313 !! test
314 Simple paragraph
315 !! wikitext
316 This is a simple paragraph.
317 !! html
318 <p>This is a simple paragraph.
319 </p>
320 !! end
321
322 !! test
323 Paragraphs with extra newline spacing
324 !! wikitext
325 foo
326
327 bar
328
329
330 baz
331
332
333
334 booz
335 !! html
336 <p>foo
337 </p><p>bar
338 </p><p><br />
339 baz
340 </p><p><br />
341 </p><p>booz
342 </p>
343 !! end
344
345 !! test
346 Paragraphs with newline spacing with comment lines in between
347 !! wikitext
348 ----
349 a
350 <!--foo-->
351 b
352 ----
353 a
354 <!--foo--><!--More than 1 comment, still stripped-->
355 b
356 ----
357 a
358 <!--foo--> <!----> <!-- bar -->
359 b
360 ----
361 a
362 <!--foo-->
363
364 b
365 ----
366 a
367
368 <!--foo-->
369 b
370 ----
371 a
372 <!--foo-->
373
374
375 b
376 ----
377 a
378
379
380 <!--foo-->
381 b
382 ----
383 !! html
384 <hr />
385 <p>a
386 b
387 </p>
388 <hr />
389 <p>a
390 b
391 </p>
392 <hr />
393 <p>a
394 b
395 </p>
396 <hr />
397 <p>a
398 </p><p>b
399 </p>
400 <hr />
401 <p>a
402 </p><p>b
403 </p>
404 <hr />
405 <p>a
406 </p><p><br />
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p><br />
412 b
413 </p>
414 <hr />
415
416 !! end
417
418 !! test
419 Paragraphs with newline spacing with non-empty white-space lines in between
420 !! wikitext
421 ----
422 a
423
424 b
425 ----
426 a
427
428
429 b
430 ----
431 !! html
432 <hr />
433 <p>a
434 </p><p>b
435 </p>
436 <hr />
437 <p>a
438 </p><p><br />
439 b
440 </p>
441 <hr />
442
443 !! end
444
445 !! test
446 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
447 !! wikitext
448 ----
449 a
450 <!--foo-->
451 b
452 ----
453 a
454 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
455 b
456 ----
457 a
458
459 <!--foo-->
460 <!--bar-->
461 b
462 ----
463 a
464
465 <!--foo-->
466 <!--bar-->
467
468 b
469 ----
470 !! html
471 <hr />
472 <p>a
473 b
474 </p>
475 <hr />
476 <p>a
477 b
478 </p>
479 <hr />
480 <p>a
481 </p><p>b
482 </p>
483 <hr />
484 <p>a
485 </p><p><br />
486 b
487 </p>
488 <hr />
489
490 !! end
491
492 !! test
493 Extra newlines: More paragraphs with indented comment
494 !! wikitext
495 a
496
497 <!--boo-->
498
499 b
500 !! html
501 <p>a
502 </p><p><br />
503 b
504 </p>
505 !!end
506
507 !! test
508 Extra newlines followed by heading
509 !! wikitext
510 a
511
512
513
514 =b=
515 [[a]]
516
517
518 =b=
519 !! html
520 <p>a
521 </p><p><br />
522 </p>
523 <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>
524 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
525 </p><p><br />
526 </p>
527 <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>
528
529 !! end
530
531 !! test
532 Extra newlines between heading and content are swallowed
533 !! wikitext
534 =b=
535
536
537
538 [[a]]
539 !! html
540 <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>
541 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
542 </p>
543 !! end
544
545 !! test
546 Heading with line break in nowiki
547 !! options
548 parsoid=wt2html
549 !! wikitext
550 == A <nowiki>B
551 C</nowiki> ==
552 !! html
553 <h2><span class="mw-headline" id="A_B.0AC">A B
554 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>
555
556 !! html/parsoid
557 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
558 C</span> </h2>
559 !! end
560
561 !! test
562 Parsing an URL
563 !! wikitext
564 http://fr.wikipedia.org/wiki/🍺
565 <!-- EasterEgg we love beer, better be able be able to link to it -->
566 !! html
567 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
568 </p>
569 !! end
570
571 # Note that the html+tidy output removes the spaces after the <li>,
572 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
573 # This is an issue for all tests with lists. We intentionally do
574 # *not* add html+tidy clauses for these, as we don't want to
575 # document/test the broken behavior. (Parsoid matches the non-tidy
576 # output in these cases.)
577
578 !! test
579 Simple list
580 !! wikitext
581 * Item 1
582 * Item 2
583 !! html
584 <ul><li> Item 1</li>
585 <li> Item 2</li></ul>
586
587 !! end
588
589 !! test
590 Italics and bold
591 !! wikitext
592 * plain
593 * plain''italic''plain
594 * plain''italic''plain''italic''plain
595 * plain'''bold'''plain
596 * plain'''bold'''plain'''bold'''plain
597 * plain''italic''plain'''bold'''plain
598 * plain'''bold'''plain''italic''plain
599 * plain''italic'''bold-italic'''italic''plain
600 * plain'''bold''bold-italic''bold'''plain
601 * plain'''''bold-italic'''italic''plain
602 * plain'''''bold-italic''bold'''plain
603 * plain''italic'''bold-italic'''''plain
604 * plain'''bold''bold-italic'''''plain
605 * plain l'''italic''plain
606 * plain l''''bold''' plain
607 !! html
608 <ul><li> plain</li>
609 <li> plain<i>italic</i>plain</li>
610 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
611 <li> plain<b>bold</b>plain</li>
612 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
613 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
614 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
615 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
616 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
617 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
618 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
619 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
620 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
621 <li> plain l'<i>italic</i>plain</li>
622 <li> plain l'<b>bold</b> plain</li></ul>
623
624 !! end
625
626 # this example taken from the [[simple:Moon]] article (T49326)
627 !! test
628 Italics and possessives (1)
629 !! wikitext
630 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
631 !! html
632 <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
633 </p>
634 !! end
635
636 # this example taken from [[en:Flaming Pie]] (T51926)
637 !! test
638 Italics and possessives (2)
639 !! wikitext
640 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
641 !! html
642 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
643 </p>
644 !! end
645
646 # this example taken from [[en:Dictionary]] (T51926)
647 !! test
648 Italics and possessives (3)
649 !! wikitext
650 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''.
651 !! html
652 <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>.
653 </p>
654 !! end
655
656
657 ###
658 ### 2-quote opening sequence tests
659 ###
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,2)
662 !! wikitext
663 ''foo''
664 !! html
665 <p><i>foo</i>
666 </p>
667 !!end
668
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,3)
671 !! wikitext
672 ''foo'''
673 !! html/*
674 <p><i>foo'</i>
675 </p>
676 !!end
677
678 !! test
679 Italics and bold: 2-quote opening sequence: (2,4)
680 !! options
681 parsoid=wt2html
682 !! wikitext
683 ''foo''''
684 !! html/*
685 <p><i>foo''</i>
686 </p>
687 !!end
688
689 # same html as previous, but wikitext adjusted to match parsoid html2wt
690 !! test
691 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
692 !! wikitext
693 ''foo<nowiki>''</nowiki>''
694 !! html
695 <p><i>foo''</i>
696 </p>
697 !! end
698
699 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
700 !! test
701 Italics and bold: 2-quote opening sequence: (2,5)
702 !! options
703 parsoid=wt2html
704 !! wikitext
705 ''foo'''''
706 !! html/php
707 <p><i>foo</i>
708 </p>
709 !! html/parsoid
710 <p><i>foo</i><b></b>
711 </p>
712 !!end
713
714 # same html as previous, but wikitext adjusted to match parsoid html2wt
715 !! test
716 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
717 !! wikitext
718 ''foo'''''<nowiki/>'''
719 !! html/php
720 <p><i>foo</i>
721 </p>
722 !! html/parsoid
723 <p><i>foo</i><b></b>
724 </p>
725 !! end
726
727
728 ###
729 ### 3-quote opening sequence tests
730 ###
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,2)
734 !! wikitext
735 '''foo''
736 !! html/*
737 <p>'<i>foo</i>
738 </p>
739 !!end
740
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,3)
743 !! wikitext
744 '''foo'''
745 !! html
746 <p><b>foo</b>
747 </p>
748 !!end
749
750 !! test
751 Italics and bold: 3-quote opening sequence: (3,4)
752 !! wikitext
753 '''foo''''
754 !! html/*
755 <p><b>foo'</b>
756 </p>
757 !!end
758
759 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
760 !! test
761 Italics and bold: 3-quote opening sequence: (3,5)
762 !! options
763 parsoid=wt2html
764 !! wikitext
765 '''foo'''''
766 !! html/php
767 <p><b>foo</b>
768 </p>
769 !! html/parsoid
770 <p><b>foo</b><i></i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
777 !! wikitext
778 '''foo'''''<nowiki/>''
779 !! html/php
780 <p><b>foo</b>
781 </p>
782 !! html/parsoid
783 <p><b>foo</b><i></i>
784 </p>
785 !! end
786
787
788 ###
789 ### 4-quote opening sequence tests
790 ###
791
792 !! test
793 Italics and bold: 4-quote opening sequence: (4,2)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 ''''foo''
798 !! html/*
799 <p>''<i>foo</i>
800 </p>
801 !!end
802
803 # same html as previous, but wikitext adjusted to match parsoid html2wt
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
806 !! wikitext
807 <nowiki>''</nowiki>''foo''
808 !! html
809 <p>''<i>foo</i>
810 </p>
811 !! end
812
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,3)
815 !! wikitext
816 ''''foo'''
817 !! html/*
818 <p>'<b>foo</b>
819 </p>
820 !!end
821
822 !! test
823 Italics and bold: 4-quote opening sequence: (4,4)
824 !! options
825 parsoid=wt2html
826 !! wikitext
827 ''''foo''''
828 !! html/*
829 <p>'<b>foo'</b>
830 </p>
831 !!end
832
833 # same html as previous, but wikitext adjusted to match parsoid html2wt
834 !! test
835 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
836 !! wikitext
837 '<nowiki/>'''foo''''
838 !! html
839 <p>'<b>foo'</b>
840 </p>
841 !! end
842
843 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
844 !! test
845 Italics and bold: 4-quote opening sequence: (4,5)
846 !! options
847 parsoid=wt2html
848 !! wikitext
849 ''''foo'''''
850 !! html/php
851 <p>'<b>foo</b>
852 </p>
853 !! html/parsoid
854 <p>'<b>foo</b><i></i>
855 </p>
856 !!end
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
861 !! wikitext
862 '<nowiki/>'''foo'''''<nowiki/>''
863 !! html/php
864 <p>'<b>foo</b>
865 </p>
866 !! html/parsoid
867 <p>'<b>foo</b><i></i>
868 </p>
869 !! end
870
871
872 ###
873 ### 5-quote opening sequence tests
874 ###
875
876 !! test
877 Italics and bold: 5-quote opening sequence: (5,2)
878 !! options
879 parsoid=wt2html
880 !! wikitext
881 '''''foo''
882 !! html/*
883 <p><b><i>foo</i></b>
884 </p>
885 !!end
886
887 # same html as previous, but wikitext adjusted to match parsoid html2wt
888 !! test
889 Italics and bold: 5-quote opening sequence: (5,2+3)
890 !! wikitext
891 '''''foo'''''
892 !! html/*
893 <p><i><b>foo</b></i>
894 </p>
895 !! end
896
897 !! test
898 Italics and bold: 5-quote opening sequence: (5,3)
899 !! options
900 parsoid=wt2html
901 !! wikitext
902 '''''foo'''
903 !! html/*
904 <p><i><b>foo</b></i>
905 </p>
906 !!end
907
908 # same html as previous, but wikitext adjusted to match parsoid html2wt
909 !! test
910 Italics and bold: 5-quote opening sequence: (5,3+2)
911 !! wikitext
912 '''''foo'''''
913 !! html
914 <p><i><b>foo</b></i>
915 </p>
916 !! end
917
918 !! test
919 Italics and bold: 5-quote opening sequence: (5,4)
920 !! options
921 parsoid=wt2html
922 !! wikitext
923 '''''foo''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !!end
928
929 !! test
930 Italics and bold: 5-quote opening sequence: (5,5)
931 !! wikitext
932 '''''foo'''''
933 !! html
934 <p><i><b>foo</b></i>
935 </p>
936 !!end
937
938 !! test
939 Italics and bold: 5-quote opening sequence: (5,6)
940 !! wikitext
941 '''''foo''''''
942 !! html/*
943 <p><i><b>foo'</b></i>
944 </p>
945 !! end
946
947 ###
948 ### multiple quote sequences in a line
949 ###
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,2)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''
957 !! html/*
958 <p><i>foo'<b>bar</b></i>
959 </p>
960 !! end
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'''''
967 !! html
968 <p><i>foo'<b>bar</b></i>
969 </p>
970 !! end
971
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3)
974 !! options
975 parsoid=wt2html
976 !! wikitext
977 ''foo''''bar'''
978 !! html/*
979 <p><i>foo'<b>bar</b></i>
980 </p>
981 !! end
982
983 # same html as previous, but wikitext adjusted to match parsoid html2wt
984 !! test
985 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
986 !! wikitext
987 ''foo'<nowiki/>'''bar'''''
988 !! html
989 <p><i>foo'<b>bar</b></i>
990 </p>
991 !! end
992
993 !! test
994 Italics and bold: multiple quote sequences: (2,4,4)
995 !! options
996 parsoid=wt2html
997 !! wikitext
998 ''foo''''bar''''
999 !! html/*
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1003
1004 # same html as previous, but wikitext adjusted to match parsoid html2wt
1005 !! test
1006 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1007 !! wikitext
1008 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1009 !! html
1010 <p><i>foo'<b>bar'</b></i>
1011 </p>
1012 !! end
1013
1014 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1015 !! test
1016 Italics and bold: multiple quote sequences: (3,4,2)
1017 !! options
1018 parsoid=wt2html
1019 !! wikitext
1020 '''foo''''bar''
1021 !! html/php
1022 <p><b>foo'</b>bar
1023 </p>
1024 !! html/parsoid
1025 <p><b>foo'</b>bar<i></i>
1026 </p>
1027 !! end
1028
1029 # same html as previous, but wikitext adjusted to match parsoid html2wt
1030 !! test
1031 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1032 !! wikitext
1033 '''foo''''bar''<nowiki/>''
1034 !! html/php
1035 <p><b>foo'</b>bar
1036 </p>
1037 !! html/parsoid
1038 <p><b>foo'</b>bar<i></i>
1039 </p>
1040 !! end
1041
1042 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1043 !! test
1044 Italics and bold: multiple quote sequences: (3,4,3)
1045 !! options
1046 parsoid=wt2html
1047 !! wikitext
1048 '''foo''''bar'''
1049 !! html/php
1050 <p><b>foo'</b>bar
1051 </p>
1052 !! html/parsoid
1053 <p><b>foo'</b>bar<b></b>
1054 </p>
1055 !! end
1056
1057 # same html as previous, but wikitext adjusted to match parsoid html2wt
1058 !! test
1059 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1060 !! wikitext
1061 '''foo''''bar'''<nowiki/>'''
1062 !! html/php
1063 <p><b>foo'</b>bar
1064 </p>
1065 !! html/parsoid
1066 <p><b>foo'</b>bar<b></b>
1067 </p>
1068 !! end
1069
1070 ###
1071 ### other quote tests
1072 ###
1073 !! test
1074 Italics and bold: other quote tests: (2,3,5)
1075 !! wikitext
1076 ''this is about '''foo's family'''''
1077 !! html
1078 <p><i>this is about <b>foo's family</b></i>
1079 </p>
1080 !!end
1081
1082
1083 !! test
1084 Italics and bold: other quote tests: (2,(3,3),2)
1085 !! wikitext
1086 ''this is about '''foo's''' family''
1087 !! html
1088 <p><i>this is about <b>foo's</b> family</i>
1089 </p>
1090 !!end
1091
1092
1093 !! test
1094 Italics and bold: other quote tests: (3,2,3,2)
1095 !! options
1096 parsoid=wt2html
1097 !! wikitext
1098 '''this is about ''foo'''s family''
1099 !! html/*
1100 <p><b>this is about <i>foo</i></b><i>s family</i>
1101 </p>
1102 !!end
1103
1104
1105 # same html as previous, but wikitext adjusted to match parsoid html2wt
1106 !! test
1107 Italics and bold: other quote tests: (3,2,3+2+2,2)
1108 !! wikitext
1109 '''this is about ''foo'''''<nowiki/>''s family''
1110 !! html
1111 <p><b>this is about <i>foo</i></b><i>s family</i>
1112 </p>
1113 !! end
1114
1115
1116 !! test
1117 Italics and bold: other quote tests: (3,2,3,3)
1118 !! wikitext
1119 '''this is about ''foo'''s family'''
1120 !! html/*
1121 <p>'<i>this is about </i>foo<b>s family</b>
1122 </p>
1123 !!end
1124
1125
1126 !! test
1127 Italics and bold: other quote tests: (3,(2,2),3)
1128 !! wikitext
1129 '''this is about ''foo's'' family'''
1130 !! html
1131 <p><b>this is about <i>foo's</i> family</b>
1132 </p>
1133 !!end
1134
1135
1136 !! test
1137 Italicized possessive
1138 !! wikitext
1139 The ''[[Main Page]]'''s talk page.
1140 !! html/php
1141 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1142 </p>
1143 !! html/parsoid
1144 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1145 !! end
1146
1147 !! test
1148 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1149 (Requires tidy for PHP parser output to be fixed up)
1150 !! options
1151 parsoid=wt2html,wt2wt
1152 !! wikitext
1153 {|
1154 !''a!!''b
1155 |''a||''b
1156 |}
1157 !! html/php+tidy
1158 <table>
1159 <tr>
1160 <th><i>a</i></th>
1161 <th><i>b</i></th>
1162 <td><i>a</i></td>
1163 <td><i>b</i></td>
1164 </tr>
1165 </table>
1166 !! html/parsoid
1167 <table>
1168 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1169 <td><i>a</i></td><td><i>b</i></td></tr>
1170 </tbody></table>
1171 !! end
1172
1173 ###
1174 ### Non-html5 tags
1175 ###
1176
1177 !! test
1178 Non-html5 tags should be accepted
1179 !! wikitext
1180 <center>''foo''</center>
1181 <big>''foo''</big>
1182 <font>''foo''</font>
1183 <strike>''foo''</strike>
1184 <tt>''foo''</tt>
1185 !! html
1186 <center><i>foo</i></center>
1187 <p><big><i>foo</i></big>
1188 <font><i>foo</i></font>
1189 <strike><i>foo</i></strike>
1190 <tt><i>foo</i></tt>
1191 </p>
1192 !! end
1193
1194 !! test
1195 <wbr> is valid wikitext (T54468)
1196 !! wikitext
1197 <wbr>
1198 !! html
1199 <p><wbr />
1200 </p>
1201 !! end
1202
1203 # <strike> is HTML4, <s> is HTML4/5.
1204 !! test
1205 <s> or <strike> for strikethrough
1206 !! wikitext
1207 <strike>strike</strike>
1208
1209 <s>s</s>
1210 !! html
1211 <p><strike>strike</strike>
1212 </p><p><s>s</s>
1213 </p>
1214 !! end
1215
1216 ## a not permitted
1217 ## i,b,br omitted
1218 !! test
1219 Text-level semantic html elements in wikitext
1220 !! wikitext
1221 <em>text</em>
1222 <strong>text</strong>
1223 <small>text</small>
1224 <s>text</s>
1225 <cite>text</cite>
1226 <q>text</q>
1227 <dfn>text</dfn>
1228 <abbr>text</abbr>
1229 <data>text</data>
1230 <time>text</time>
1231 <code>text</code>
1232 <var>text</var>
1233 <samp>text</samp>
1234 <kbd>text</kbd>
1235 <sub>text</sub>
1236 <u>text</u>
1237 <mark>text</mark>
1238 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1239 <bdi>text</bdi>
1240 <bdo>text</bdo>
1241 <span>text</span>
1242 <wbr />
1243 !! html
1244 <p><em>text</em>
1245 <strong>text</strong>
1246 <small>text</small>
1247 <s>text</s>
1248 <cite>text</cite>
1249 <q>text</q>
1250 <dfn>text</dfn>
1251 <abbr>text</abbr>
1252 <data>text</data>
1253 <time>text</time>
1254 <code>text</code>
1255 <var>text</var>
1256 <samp>text</samp>
1257 <kbd>text</kbd>
1258 <sub>text</sub>
1259 <u>text</u>
1260 <mark>text</mark>
1261 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1262 <bdi>text</bdi>
1263 <bdo>text</bdo>
1264 <span>text</span>
1265 <wbr />
1266 </p>
1267 !! end
1268
1269 # test cases taken from
1270 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1271 !! test
1272 Ruby markup (W3C-style)
1273 !! wikitext
1274 ; Mono-ruby for individual base characters
1275 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1276 ; Group ruby
1277 : <ruby>今日<rt>きょう</rt></ruby>
1278 ; Jukugo ruby
1279 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1280 ; Inline ruby
1281 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1282 ; Double-sided ruby
1283 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1284 <ruby>
1285 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1286 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1287 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1288 </ruby>
1289 !! html
1290 <dl><dt> Mono-ruby for individual base characters</dt>
1291 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1292 <dt> Group ruby</dt>
1293 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1294 <dt> Jukugo ruby</dt>
1295 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1296 <dt> Inline ruby</dt>
1297 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1298 <dt> Double-sided ruby</dt>
1299 <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>
1300 <p><ruby>
1301 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1302 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1303 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1304 </ruby>
1305 </p>
1306 !! end
1307
1308 # The next two test different paths in the sanitizer.
1309 !! test
1310 Non-word characters don't terminate tag names (T19663, T42670, T54022)
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
1324 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
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 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1334 # If the non-word-character tag made it through the sanitizer, tidy
1335 # would munge it up.
1336 !! test
1337 Non-word characters don't terminate tag names + tidy
1338 !! wikitext
1339 <blockquote|>a</blockquote>
1340
1341 <b→> doesn't terminate </b→>
1342
1343 <bä> doesn't terminate </bä>
1344
1345 <boo> doesn't terminate </boo>
1346
1347 <s.foo> doesn't terminate </s.foo>
1348
1349 <sub-ID#1>
1350 !! html+tidy
1351 <p>&lt;blockquote|&gt;a</p>
1352 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1353 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1354 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1355 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1356 <p>&lt;sub-ID#1&gt;</p>
1357 !! end
1358
1359 ###
1360 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1361 ### This checks that HTML5 tags (with non-word characters in the tag
1362 ### name) make it safely through the parser -- the Sanitizer will
1363 ### munge them later, as it should.
1364 ###
1365 !! test
1366 Non-word characters are valid in extension tags (T19663)
1367 !! wikitext
1368 <tåg>tåg</tåg>
1369 !! html/php
1370 <pre>
1371 'tåg'
1372 array (
1373 )
1374 </pre>
1375
1376 !! html/parsoid
1377 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1378 !! end
1379
1380 !! test
1381 Isolated close tags should be treated as literal text (T54760)
1382 !! options
1383 parsoid=wt2html
1384 !! wikitext
1385 </b>
1386
1387 <s.foo>s</s>
1388 !! html/php+tidy
1389 <p>&lt;s.foo&gt;s</p>
1390 !! html/parsoid
1391 <p>&lt;s.foo&gt;s</p>
1392 !! end
1393
1394 ###
1395 ### Special characters
1396 ###
1397
1398 !! test
1399 Bare pipe character (T54363)
1400 !! wikitext
1401 |
1402 !! html
1403 <p>|
1404 </p>
1405 !! end
1406
1407 !! test
1408 Bare pipe character from a template (T54363)
1409 !! wikitext
1410 {{pipe}}
1411 !! html
1412 <p>|
1413 </p>
1414 !! end
1415
1416 ###
1417 ### <nowiki> test cases
1418 ###
1419
1420 !! test
1421 <nowiki> unordered list
1422 !! wikitext
1423 <nowiki>* This is not an unordered list item.</nowiki>
1424 !! html/php
1425 <p>* This is not an unordered list item.
1426 </p>
1427 !! html/parsoid
1428 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1429 !! end
1430
1431 !! test
1432 <nowiki> spacing
1433 !! wikitext
1434 <nowiki>Lorem ipsum dolor
1435
1436 sed abit.
1437 sed nullum.
1438
1439 :and a colon
1440 </nowiki>
1441 !! html/php
1442 <p>Lorem ipsum dolor
1443
1444 sed abit.
1445 sed nullum.
1446
1447 :and a colon
1448
1449 </p>
1450 !! html/parsoid
1451 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1452
1453 sed abit.
1454 sed nullum.
1455
1456 :and a colon
1457 </span></p>
1458 !! end
1459
1460 !! test
1461 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1462 !! wikitext
1463 <nowiki><span class="error"></nowiki>
1464 !! html/php
1465 <p>&lt;span class="error"&gt;
1466 </p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1469 !! end
1470
1471 !! test
1472 nowiki 3
1473 !! wikitext
1474 :There is not nowiki.
1475 :There is <nowiki>nowiki</nowiki>.
1476
1477 #There is not nowiki.
1478 #There is <nowiki>nowiki</nowiki>.
1479
1480 *There is not nowiki.
1481 *There is <nowiki>nowiki</nowiki>.
1482 !! html/php
1483 <dl><dd>There is not nowiki.</dd>
1484 <dd>There is nowiki.</dd></dl>
1485 <ol><li>There is not nowiki.</li>
1486 <li>There is nowiki.</li></ol>
1487 <ul><li>There is not nowiki.</li>
1488 <li>There is nowiki.</li></ul>
1489
1490 !! html/parsoid
1491 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1492 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1493
1494 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1495 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1496
1497 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1498 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1499 !! end
1500
1501 !! test
1502 Entities inside <nowiki>
1503 !! wikitext
1504 <nowiki>&lt;</nowiki>
1505 !! html/php
1506 <p>&lt;
1507 </p>
1508 !! html/parsoid
1509 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1510 !! end
1511
1512 !! test
1513 Entities inside template parameters
1514 !! wikitext
1515 {{echo|&ndash;}}
1516 !! html/php+tidy
1517 <p>–</p>
1518 !! html/parsoid
1519 <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>
1520 !! end
1521
1522 !! test
1523 Properly escape nowiki when combined with other wiki markup
1524 !! options
1525 parsoid=html2wt
1526 !! html/parsoid
1527 <p>* &lt;/nowiki&gt; tag</p>
1528 !! wikitext
1529 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1530 !! end
1531
1532 !! test
1533 T93824: Put escaped HTML tags inside nowiki
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1538 !! wikitext
1539 <nowiki><h2>foo</h2></nowiki>
1540 !! end
1541
1542 !! test
1543 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1544 !! options
1545 parsoid=html2wt
1546 !! html/parsoid
1547 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1548 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1549 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1550 !! wikitext
1551 This text: L'[[Foo]]
1552 This text: L<nowiki>''</nowiki>[[Foo]]
1553 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1554 !! end
1555
1556 # This test fails because wikitext whitespace is not normalized before comparing.
1557 !! test
1558 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1559 !! options
1560 parsoid=html2wt
1561 !! html/parsoid
1562 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1563 </p>
1564 !! wikitext
1565 This text : L<nowiki>''</nowiki>[[Foo]]
1566 !! end
1567
1568 # This test and the next one are html2wt only as they test that incorrect wikitext
1569 # passed in template arguments gets escaped or wrapped in nowikis where required.
1570 !! test
1571 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1572 !! options
1573 parsoid=html2wt
1574 !! html/parsoid
1575 <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>
1576 <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>
1577 !! wikitext
1578 {{echo|foo{{!}}bar}}
1579 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1580 !! end
1581
1582 !! test
1583 T53961: Output correct nowikis in template arguments
1584 !! options
1585 parsoid=html2wt
1586 !! html/parsoid
1587 <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>
1588 <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>
1589 <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>
1590 <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>
1591 <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>
1592 !! wikitext
1593 {{echo|a [ b}}
1594 {{echo|<nowiki>a }} b</nowiki>}}
1595 {{echo|<nowiki>a [[ b</nowiki>}}
1596 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1597 {{echo|a <nowiki>}</nowiki>}}
1598 !! end
1599
1600 !! test
1601 Cases where "!!" needs nowiki protection
1602 !! options
1603 parsoid=html2wt
1604 !! html/parsoid
1605 <table>
1606 <tr><th>this needs protection !! here</th></tr>
1607 </table>
1608
1609 <table>
1610 <tr><th>this does not need
1611 protection !! here</th></tr>
1612 </table>
1613 !! wikitext
1614 {|
1615 !<nowiki>this needs protection !! here</nowiki>
1616 |}
1617
1618 {|
1619 !this does not need
1620 protection !! here
1621 |}
1622 !! end
1623
1624 ###
1625 ### Comments
1626 ###
1627 !! test
1628 Comments and Indent-Pre
1629 !! wikitext
1630 <!-- comment 1 --> asdf
1631
1632 <!-- comment 1 --> asdf
1633 <!-- comment 2 -->
1634
1635 <!-- comment 1 --> asdf
1636 <!-- comment 2 -->xyz
1637
1638 <!-- comment 1 --> asdf
1639 <!-- comment 2 --> xyz
1640 !! html
1641 <pre>asdf
1642 </pre>
1643 <pre>asdf
1644 </pre>
1645 <pre>asdf
1646 </pre>
1647 <p>xyz
1648 </p>
1649 <pre>asdf
1650 xyz
1651 </pre>
1652 !! end
1653
1654 !! test
1655 Comment test 2a
1656 !! wikitext
1657 asdf
1658 <!-- comment 1 -->
1659 jkl
1660 !! html
1661 <p>asdf
1662 jkl
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment test 2b
1668 !! wikitext
1669 asdf
1670 <!-- comment 1 -->
1671
1672 jkl
1673 !! html
1674 <p>asdf
1675 </p><p>jkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment test 3
1681 !! wikitext
1682 asdf
1683 <!-- comment 1 -->
1684 <!-- comment 2 -->
1685 jkl
1686 !! html
1687 <p>asdf
1688 jkl
1689 </p>
1690 !! end
1691
1692 !! test
1693 Comment test 4
1694 !! wikitext
1695 asdf<!-- comment 1 -->jkl
1696 !! html
1697 <p>asdfjkl
1698 </p>
1699 !! end
1700
1701 !! test
1702 Comment spacing
1703 !! wikitext
1704 a
1705 <!-- foo --> b <!-- bar -->
1706 c
1707 !! html
1708 <p>a
1709 </p>
1710 <pre> b
1711 </pre>
1712 <p>c
1713 </p>
1714 !! end
1715
1716 !! test
1717 Comment whitespace
1718 !! wikitext
1719 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1720 !! html
1721
1722 !! end
1723
1724 !! test
1725 Comment semantics and delimiters
1726 !! wikitext
1727 <!-- --><!----><!-----><!------>
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1732 !! end
1733
1734 !! test
1735 Comment semantics and delimiters, redux
1736 !! wikitext
1737 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1738 -- foo -- funky huh? ... -->
1739 !! html/php
1740
1741 !! html/parsoid
1742 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1743 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1744 !! end
1745
1746 !! test
1747 Comment semantics and delimiters: directors cut
1748 !! wikitext
1749 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1750 everything starting with < followed by !-- until the first -- and > we see,
1751 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1752 -->-->
1753 !! html/php
1754 <p>--&gt;
1755 </p>
1756 !! html/parsoid
1757 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1758 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1759 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1760 --><p>--></p>
1761 !! end
1762
1763 !! test
1764 Comment semantics: nesting
1765 !! wikitext
1766 <!--<!-- no, we're not going to do anything fancy here -->-->
1767 !! html/php
1768 <p>--&gt;
1769 </p>
1770 !! html/parsoid
1771 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1772 !! end
1773
1774 # Parsoid closes the unclosed comment, even if it means a slight
1775 # round-trip diff.
1776 !! test
1777 Comment semantics: unclosed comment at end
1778 !! options
1779 parsoid=wt2html,html2html
1780 !! wikitext
1781 <!--This comment will run out to the end of the document
1782 !! html/php
1783
1784 !! html/parsoid
1785 <!--This comment will run out to the end of the document-->
1786 !! end
1787
1788 !! test
1789 Comment semantics: normalize comments to play nice with XML and browsers
1790 !! wikitext
1791 <!-- Browsers --!> think this is closed -->
1792 <!--> This would normally be text -->
1793 <!---> As would this -->
1794 <!-- XML doesn't like trailing dashes -------->
1795 <!-- Nor doubled hyphens -- anywhere in the data -->
1796 But this is not a comment.
1797 !! html/php
1798 <p>But this is not a comment.
1799 </p>
1800 !! html/parsoid
1801 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1802 <!--&#x3E; This would normally be text -->
1803 <!--&#x2D;&#x3E; As would this -->
1804 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1805 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1806 <p>But this is not a comment.</p>
1807 !! end
1808
1809 !! test
1810 Comment semantics: round-trip even text which contains encoded -->
1811 !! wikitext
1812 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1813 !! html/parsoid
1814 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1815 !! end
1816
1817 !! test
1818 Comment in template title
1819 !! wikitext
1820 {{f<!---->oo}}
1821 !! html
1822 <p>FOO
1823 </p>
1824 !! end
1825
1826 !! test
1827 Comment on its own line post-expand
1828 !! wikitext
1829 a
1830 {{blank}}<!---->
1831 b
1832 !! html
1833 <p>a
1834 </p><p>b
1835 </p>
1836 !! end
1837
1838 !! test
1839 Comment on its own line post-expand with non-significant whitespace
1840 !! wikitext
1841 a
1842 {{blank}} <!---->
1843 b
1844 !! html
1845 <p>a
1846 </p><p>b
1847 </p>
1848 !! end
1849
1850 !! test
1851 Multiple comments should still parse as SOL-transparent
1852 !! options
1853 parsoid=wt2html,wt2wt
1854 !! wikitext
1855 <!--c1-->*a
1856 <!--c2--><!--c3--><!--c4-->*b
1857 !! html/php
1858 <ul><li>a</li>
1859 <li>b</li></ul>
1860
1861 !! html/parsoid
1862 <!--c1--><ul>
1863 <li>a
1864 </li>
1865 <!--c2--><!--c3--><!--c4-->
1866 <li>b
1867 </li>
1868 </ul>
1869 !! end
1870
1871 ## Make sure ">" gets escaped in comments to avoid XSS
1872 !! test
1873 IE conditional comments
1874 !! wikitext
1875 <!--[if lt IE 9]>
1876 <script>alert('hi');</script>
1877 <![endif]-->
1878 !! html/parsoid
1879 <!--[if lt IE 9]&#x3E;
1880 <script&#x3E;alert('hi');</script&#x3E;
1881 <![endif]-->
1882 !! end
1883
1884 ###
1885 ### paragraph wrapping tests
1886 ###
1887 !! test
1888 No block tags
1889 !! wikitext
1890 a
1891
1892 b
1893 !! html
1894 <p>a
1895 </p><p>b
1896 </p>
1897 !! end
1898
1899 !! test
1900 Block tag on one line (<div>)
1901 !! wikitext
1902 a <div>foo</div>
1903
1904 b
1905 !! html
1906 a <div>foo</div>
1907 <p>b
1908 </p>
1909 !! html+tidy
1910 <p>a</p>
1911 <div>foo</div>
1912 <p>b</p>
1913 !! end
1914
1915 !! test
1916 Block tag on one line (<blockquote>)
1917 !! wikitext
1918 a <blockquote>foo</blockquote>
1919
1920 b
1921 !! html
1922 a <blockquote>foo</blockquote>
1923 <p>b
1924 </p>
1925 !! html+tidy
1926 <p>a</p>
1927 <blockquote>
1928 <p>foo</p>
1929 </blockquote>
1930 <p>b</p>
1931 !! end
1932
1933 !! test
1934 Block tag on both lines (<div>)
1935 !! wikitext
1936 a <div>foo</div>
1937
1938 b <div>foo</div>
1939 !! html
1940 a <div>foo</div>
1941 b <div>foo</div>
1942
1943 !! html+tidy
1944 <p>a</p>
1945 <div>foo</div>
1946 <p>b</p>
1947 <div>foo</div>
1948 !! end
1949
1950 !! test
1951 Block tag on both lines (<blockquote>)
1952 !! wikitext
1953 a <blockquote>foo</blockquote>
1954
1955 b <blockquote>foo</blockquote>
1956 !! html
1957 a <blockquote>foo</blockquote>
1958 b <blockquote>foo</blockquote>
1959
1960 !! html+tidy
1961 <p>a</p>
1962 <blockquote>
1963 <p>foo</p>
1964 </blockquote>
1965 <p>b</p>
1966 <blockquote>
1967 <p>foo</p>
1968 </blockquote>
1969 !! end
1970
1971 !! test
1972 Multiple lines without block tags
1973 !! wikitext
1974 <div>foo</div> a
1975 b
1976 c
1977 d<!--foo--> e
1978 x <div>foo</div> z
1979 !! html
1980 <div>foo</div> a
1981 <p>b
1982 c
1983 d e
1984 </p>
1985 x <div>foo</div> z
1986
1987 !! html+tidy
1988 <div>foo</div>
1989 <p>a</p>
1990 <p>b c d e</p>
1991 <p>x</p>
1992 <div>foo</div>
1993 <p>z</p>
1994 !! end
1995
1996 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1997 # So, we have a separate section for Parsoid. We don't want
1998 # to mimic this stripping behavior in Parsoid. It affects
1999 # editing experience and also requires us to maintain additional
2000 # info for RT-ing.
2001 !! test
2002 Empty lines between lines with block tags
2003 !! wikitext
2004 <div></div>
2005
2006
2007 <div></div>a
2008
2009 b
2010 <div>a</div>b
2011
2012 <div>b</div>d
2013
2014
2015 <div>e</div>
2016 !! html
2017 <div></div>
2018 <p><br />
2019 </p>
2020 <div></div>a
2021 <p>b
2022 </p>
2023 <div>a</div>b
2024 <div>b</div>d
2025 <p><br />
2026 </p>
2027 <div>e</div>
2028
2029 !! html+tidy
2030 <p><br /></p>
2031 <p>a</p>
2032 <p>b</p>
2033 <div>a</div>
2034 <p>b</p>
2035 <div>b</div>
2036 <p>d</p>
2037 <p><br /></p>
2038 <div>e</div>
2039 !! html/parsoid
2040 <div data-parsoid='{"stx":"html"}'></div>
2041
2042 <p><br /></p>
2043 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2044
2045 <p>b</p>
2046 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2047
2048 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2049
2050 <p><br /></p>
2051 <div data-parsoid='{"stx":"html"}'>e</div>
2052 !! end
2053
2054 ## PHP parser emits output which is broken
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>
2064 <p>foo</p>
2065 </div>
2066 <p>a</p>
2067 <p>b</p>
2068 !! html/parsoid
2069 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2070 <p>a</p>
2071 <p>b</p>
2072 !! end
2073
2074 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2075 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2076 ## them for now.
2077 !! test
2078 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2079 !! options
2080 parsoid=wt2html
2081 !! wikitext
2082 a [[Category:A1]] [[Category:A2]]
2083 [[Category:A3]]
2084 [[Category:A4]]
2085 !! html/parsoid
2086 <p>a</p>
2087 <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"/>
2088 !! end
2089
2090 !! test
2091 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2092 !! options
2093 parsoid=wt2html
2094 !! wikitext
2095 [[Category:A1]]a
2096 !! html/parsoid
2097 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2098 !! end
2099
2100 ###
2101 ### Preformatted text
2102 ###
2103 !! test
2104 Preformatted text
2105 !! wikitext
2106 This is some
2107 Preformatted text
2108 With ''italic''
2109 And '''bold'''
2110 And a [[Main Page|link]]
2111 !! html
2112 <pre>This is some
2113 Preformatted text
2114 With <i>italic</i>
2115 And <b>bold</b>
2116 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2117 </pre>
2118 !! end
2119
2120 !! test
2121 Tabs don't trigger preformatted text
2122 !! wikitext
2123 This is not
2124 preformatted text.
2125 This is preformatted text.
2126 So is this.
2127 !! html/php
2128 <p> This is not
2129 preformatted text.
2130 </p>
2131 <pre>This is preformatted text.
2132 So is this.
2133 </pre>
2134 !! html/parsoid
2135 <p> This is not
2136 preformatted text.</p>
2137 <pre>This is preformatted text.
2138 So is this.</pre>
2139 !! end
2140
2141 !! test
2142 Space before tab needs nowiki pre protection
2143 !! options
2144 parsoid=html2wt
2145 !! html/parsoid
2146 <p> a</p>
2147 !! wikitext
2148 <nowiki> </nowiki> a
2149 !! end
2150
2151 !! test
2152 Ident preformatting with inline content
2153 !! wikitext
2154 a
2155 ''b''
2156 !! html
2157 <pre>a
2158 <i>b</i>
2159 </pre>
2160 !! end
2161
2162 !! test
2163 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2164 !! wikitext
2165 <pre><nowiki>
2166 <b>
2167 <cite>
2168 <em>
2169 </nowiki></pre>
2170 !! html
2171 <pre>
2172 &lt;b&gt;
2173 &lt;cite&gt;
2174 &lt;em&gt;
2175 </pre>
2176
2177 !! end
2178
2179 !! test
2180 Regression with preformatted in <center>
2181 !! wikitext
2182 <center>
2183 Blah
2184 </center>
2185 !! html
2186 <center>
2187 <pre>Blah
2188 </pre>
2189 </center>
2190
2191 !! end
2192
2193 !! test
2194 T54763: Preformatted in <blockquote>
2195 !! wikitext
2196 <blockquote>
2197 Blah
2198 {|
2199 |
2200 indented cell (no pre-wrapping!)
2201 |}
2202 </blockquote>
2203 !! html
2204 <blockquote>
2205 <p> Blah
2206 </p>
2207 <table>
2208 <tr>
2209 <td>
2210 <p> indented cell (no pre-wrapping!)
2211 </p>
2212 </td></tr></table>
2213 </blockquote>
2214
2215 !! end
2216
2217 !! test
2218 T53086: Double newlines in blockquotes should be turned into paragraphs
2219 !! wikitext
2220 <blockquote>
2221 Foo
2222
2223 Bar
2224 </blockquote>
2225 !! html
2226 <blockquote>
2227 <p>Foo
2228 </p><p>Bar
2229 </p>
2230 </blockquote>
2231
2232 !! end
2233
2234 !! test
2235 T17491: <ins>/<del> in blockquote
2236 !! wikitext
2237 <blockquote>
2238 Foo <del>bar</del> <ins>baz</ins> quux
2239 </blockquote>
2240 !! html
2241 <blockquote>
2242 <p>Foo <del>bar</del> <ins>baz</ins> quux
2243 </p>
2244 </blockquote>
2245
2246 !! end
2247
2248 # Note that the p-wrapping is newline sensitive, which could be
2249 # considered a bug: tidy will wrap only the 'Foo' in the example
2250 # below in a <p> tag. (see comment 23-25 of T8200)
2251 !! test
2252 T17491: <ins>/<del> in blockquote (2)
2253 !! wikitext
2254 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2255 </blockquote>
2256 !! html
2257 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2258 </blockquote>
2259
2260 !! html+tidy
2261 <blockquote>
2262 <p>Foo</p>
2263 <del>bar</del> <ins>baz</ins> quux</blockquote>
2264 !! end
2265
2266 !! test
2267 <pre> with attributes (T5202)
2268 !! wikitext
2269 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2270 !! html
2271 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2272
2273 !! end
2274
2275 !! test
2276 <pre> with width attribute (T5202)
2277 !! wikitext
2278 <pre width="8">Narrow screen goodies</pre>
2279 !! html
2280 <pre width="8">Narrow screen goodies</pre>
2281
2282 !! end
2283
2284 !! test
2285 <pre> with forbidden attribute (T5202)
2286 !! wikitext
2287 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2288 !! html
2289 <pre width="8">Narrow screen goodies</pre>
2290
2291 !! end
2292
2293 !! test
2294 Entities inside <pre>
2295 !! wikitext
2296 <pre>&lt;</pre>
2297 !! html
2298 <pre>&lt;</pre>
2299
2300 !! end
2301
2302 !! test
2303 <pre> with forbidden attribute values (T5202)
2304 !! wikitext
2305 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2306 !! html
2307 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2308
2309 !! end
2310
2311 !! test
2312 <nowiki> inside <pre> (T15238)
2313 !! wikitext
2314 <pre>
2315 <nowiki>
2316 </pre>
2317 <pre>
2318 <nowiki></nowiki>
2319 </pre>
2320 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2321 !! html
2322 <pre>
2323 &lt;nowiki&gt;
2324 </pre>
2325 <pre>
2326
2327 </pre>
2328 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2329
2330 !! end
2331
2332 !! test
2333 <nowiki> inside of #tag:pre
2334 !! wikitext
2335 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2336 !! html/php
2337 <pre>Foo &#8594;bar</pre>
2338
2339 !! html/parsoid
2340 <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>
2341 !! end
2342
2343 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2344 ## aren't enclosed in nowikis.
2345 !! test
2346 <nowiki> and <pre> preference (first one wins)
2347 !! options
2348 parsoid=wt2html
2349 !! wikitext
2350 <pre>
2351 <nowiki>
2352 </pre>
2353 </nowiki>
2354 </pre>
2355
2356 <nowiki>
2357 <pre>
2358 <nowiki>
2359 </pre>
2360 </nowiki>
2361 </pre>
2362
2363 !! html/php
2364 <pre>
2365 &lt;nowiki&gt;
2366 </pre>
2367 <p>&lt;/nowiki&gt;
2368 &lt;/pre&gt;
2369 </p><p>
2370 &lt;pre&gt;
2371 &lt;nowiki&gt;
2372 &lt;/pre&gt;
2373
2374 &lt;/pre&gt;
2375 </p>
2376 !! html/parsoid
2377 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2378 </pre>
2379 <p>&lt;/nowiki></p>
2380
2381
2382 <p><span typeof="mw:Nowiki">
2383 &lt;pre>
2384 &lt;nowiki>
2385 &lt;/pre>
2386 </span></p>
2387 !! end
2388
2389 !! test
2390 </pre> inside nowiki
2391 !! wikitext
2392 <nowiki></pre></nowiki>
2393 !! html
2394 <p>&lt;/pre&gt;
2395 </p>
2396 !! end
2397
2398 # Parsoid doesn't strip empty tags, like Tidy does.
2399 !! test
2400 Empty pre; pre inside other HTML tags (T56946)
2401 !! wikitext
2402 a
2403
2404 <div><pre>
2405 foo
2406 </pre></div>
2407 <pre></pre>
2408 !! html/php
2409 <p>a
2410 </p>
2411 <div><pre>
2412 foo
2413 </pre></div>
2414 <pre></pre>
2415
2416 !! html/php+tidy
2417 <p>a</p>
2418 <div>
2419 <pre>
2420 foo
2421 </pre></div>
2422 !! html/parsoid
2423 <p>a</p>
2424
2425 <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
2426 </pre></div>
2427 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2428 !! end
2429
2430 !! test
2431 HTML pre followed by indent-pre
2432 !! wikitext
2433 <pre>foo</pre>
2434 bar
2435 !! html
2436 <pre>foo</pre>
2437 <pre>bar
2438 </pre>
2439 !! end
2440
2441 # Note that tidy removes the empty <p> tags from the start and end.
2442 # Parsoid does not, by design.
2443 !! test
2444 Block tag pre
2445 !! wikitext
2446 <p><pre>foo</pre></p>
2447 !! html/php+tidy
2448 <pre>
2449 foo
2450 </pre>
2451 !! html/parsoid
2452 <p 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 data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2453 !! end
2454
2455 !!test
2456 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2457 !! wikitext
2458 {{echo|}}
2459 !! html
2460
2461 !!end
2462
2463 !!test
2464 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2465 !! wikitext
2466 {{echo|
2467 foo}}
2468 !! html
2469 <p>foo
2470 </p>
2471 !!end
2472
2473 !! test
2474 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2475 !! wikitext
2476 {{echo|a
2477 b}}
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p>b
2482 </p>
2483 !!end
2484
2485 !! test
2486 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2487 !! wikitext
2488 {{echo|a
2489 b
2490 c
2491 d
2492 e
2493 }}
2494 !! html
2495 <pre>a
2496 </pre>
2497 <p>b
2498 c
2499 </p>
2500 <pre>d
2501 </pre>
2502 <p>e
2503 </p>
2504 !!end
2505
2506 !!test
2507 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2508 !! wikitext
2509 {{echo| foo}}
2510
2511 {{echo| foo}}{{echo| bar}}
2512
2513 {{echo| foo}}
2514 {{echo| bar}}
2515
2516 {{echo|<!--cmt--> foo}}
2517
2518 <!--cmt-->{{echo| foo}}
2519
2520 {{echo|{{echo| }}bar}}
2521 !! html
2522 <pre>foo
2523 </pre>
2524 <pre>foo bar
2525 </pre>
2526 <pre>foo
2527 bar
2528 </pre>
2529 <pre>foo
2530 </pre>
2531 <pre>foo
2532 </pre>
2533 <pre>bar
2534 </pre>
2535 !!end
2536
2537 !! test
2538 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2539 !! wikitext
2540 {{echo| }}a
2541
2542 {{echo|
2543 }}a
2544
2545 {{echo|
2546 b}}
2547
2548 {{echo|a
2549 }}b
2550
2551 {{echo|a
2552 }} b
2553 !! html
2554 <pre>a
2555 </pre>
2556 <p><br />
2557 </p>
2558 <pre>a
2559 </pre>
2560 <p><br />
2561 </p>
2562 <pre>b
2563 </pre>
2564 <p>a
2565 </p>
2566 <pre>b
2567 </pre>
2568 <p>a
2569 </p>
2570 <pre>b
2571 </pre>
2572 !!end
2573
2574 ## Hmm, should Parsoid rt this?
2575 !! test
2576 Pres with newline attributes
2577 !! options
2578 parsoid=wt2html,html2html
2579 !! wikitext
2580 <pre class="one
2581 two">hi</pre>
2582 !! html/php
2583 <pre class="one two">hi</pre>
2584
2585 !! html/parsoid
2586 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2587 !! end
2588
2589 !! test
2590 Things that look like <pre> tags aren't treated as such
2591 !! wikitext
2592 Barack Obama <President> of the United States
2593 <President></President>
2594 !! html
2595 <p>Barack Obama &lt;President&gt; of the United States
2596 &lt;President&gt;&lt;/President&gt;
2597 </p>
2598 !! end
2599
2600 !! test
2601 Handle broken pre-like tags (T66025)
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 {{echo|<pre <pre>x</pre>}}
2606
2607 <table><pre </table>
2608 !! html/php
2609 <pre>x</pre>
2610 <table>&lt;pre </table>
2611
2612 !! html/php+tidy
2613 <pre>
2614 x
2615 </pre>
2616 <p>&lt;pre</p>
2617 !! html/parsoid
2618 <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>
2619
2620
2621 <p>&lt;pre </p>
2622
2623 <table></table>
2624 !! end
2625
2626 !! test
2627 Parsoid: handle pre with space after attribute
2628 !! options
2629 parsoid=wt2html
2630 !! wikitext
2631 <pre style="width:50%;" >{{echo|foo}}</pre>
2632 !! html/php
2633 <pre style="width:50%;">{{echo|foo}}</pre>
2634
2635 !! html/parsoid
2636 <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>
2637 !! end
2638
2639 # TODO / maybe: fix wt2wt for this
2640 !! test
2641 Parsoid: Don't paragraph-wrap fosterable content
2642 !! options
2643 parsoid=wt2html
2644 !! wikitext
2645 {|
2646 <td></td>
2647 <td></td>
2648
2649
2650
2651 |}
2652 !! html
2653 <table>
2654
2655 <tbody>
2656 <tr>
2657 <td></td>
2658
2659 <td></td></tr>
2660
2661
2662
2663 </tbody></table>
2664 !! end
2665
2666 !! test
2667 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2668 !! options
2669 parsoid=wt2html
2670 !! wikitext
2671 {|
2672 <td>
2673 <td>
2674 </td>
2675
2676
2677
2678 |}
2679 !! html
2680 <table>
2681
2682 <tbody>
2683 <tr>
2684 <td></td>
2685
2686 <td>
2687 </td></tr>
2688
2689
2690
2691 </tbody></table>
2692 !! end
2693
2694
2695 #--------------------------------------------------------------------
2696 # Transclusion parameter whitespace stripping tests
2697 # Behavior is different for positional and named parameters
2698 #--------------------------------------------------------------------
2699 !! test
2700 Templates: Strip leading and trailing whitespace from named-param values
2701 !! wikitext
2702 {{echo|1= a }}
2703
2704 {{echo|1= {{echo|b}} }}
2705
2706 {{echo| 1 =
2707 c }}
2708
2709 {{echo| 1 =
2710 * d
2711 }}
2712 !! html
2713 <p>a
2714 </p><p>b
2715 </p><p>c
2716 </p>
2717 <ul><li> d</li></ul>
2718
2719 !! end
2720
2721 !! test
2722 Templates: Don't strip whitespace from positional-param values
2723 !! wikitext
2724 {{echo|a }}
2725
2726 {{echo|{{echo|b}} }}
2727
2728 {{echo| c
2729 }}
2730
2731 {{echo| {{echo|d}}
2732 }}
2733
2734 {{echo|
2735 e}}
2736
2737 {{echo|
2738 * f}}
2739
2740 {{echo|
2741 }}g
2742 !! html
2743 <p>a
2744 </p><p>b
2745 </p>
2746 <pre>c
2747 </pre>
2748 <p><br />
2749 </p>
2750 <pre>d
2751 </pre>
2752 <p><br />
2753 </p>
2754 <pre>e
2755 </pre>
2756 <p><br />
2757 </p>
2758 <ul><li> f</li></ul>
2759 <p><br />
2760 </p>
2761 <pre>g
2762 </pre>
2763 !! end
2764
2765 !! test
2766 Templates: Don't recognize targets split by newlines
2767 !! options
2768 parsoid=wt2html
2769 !! wikitext
2770 {{ech
2771 o|foo}}
2772 !! html/php
2773 <p>{{ech
2774 o|foo}}
2775 </p>
2776 !! html/parsoid
2777 <p>{{ech
2778 o|foo}}</p>
2779 !! end
2780
2781 !! test
2782 Templates: Recognize targets when newlines and comments don't split the target
2783 !! options
2784 parsoid=wt2html
2785 !! wikitext
2786 {{
2787 <!--X--> ech<!--X-->o<!--X-->
2788 <!--X--> <!--X-->
2789
2790 |foo}}
2791 !! html/php
2792 <p>foo
2793 </p>
2794 !! html/parsoid
2795 <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>
2796 !! end
2797
2798 !! test
2799 Templates: Handle empty comment-and-ws-only lines correctly
2800 !! wikitext
2801 {{echo|foo
2802 <!--should be ignored-->
2803 <!--should be ignored as well-->
2804 bar}}
2805 !! html/php
2806 <p>foo
2807 bar
2808 </p>
2809 !! html/parsoid
2810 <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>
2811 !! end
2812
2813 !! test
2814 Templates: Handle comments in the target
2815 !! wikitext
2816 {{echo
2817 <!-- should be ignored -->
2818 |foo}}
2819
2820 {{echo
2821 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2822 |foo}}
2823
2824 {{echo<!-- should be ignored -->
2825 |foo}}
2826
2827 {{echo<!-- should be ignored -->|foo}}
2828
2829 {{<!-- should be ignored -->echo|foo}}
2830 !! html/php
2831 <p>foo
2832 </p><p>foo
2833 </p><p>foo
2834 </p><p>foo
2835 </p><p>foo
2836 </p>
2837 !! html/parsoid
2838 <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>
2839
2840 <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>
2841
2842 <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>
2843
2844 <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>
2845
2846 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2847 !! end
2848
2849 !! test
2850 Templates: Handle comments in parameter names (T69657)
2851 !! wikitext
2852 {{echo|1
2853 <!-- should be ignored -->
2854 =foo}}
2855
2856 {{echo|
2857 <!-- should be ignored -->
2858 1 = foo}}
2859
2860 {{echo|1<!-- should be ignored -->=foo}}
2861
2862 {{echo|<!-- should be ignored -->1=foo}}
2863 !! html/php
2864 <p>foo
2865 </p><p>foo
2866 </p><p>foo
2867 </p><p>foo
2868 </p>
2869 !! html/parsoid
2870 <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>
2871
2872 <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>
2873
2874 <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>
2875
2876 <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>
2877 !! end
2878
2879 !! test
2880 Templates: Other wikitext in parameter names (T69657)
2881 !! wikitext
2882 {{echo|''1''=foo}}
2883 !! html/php
2884 <p>{{{1}}}
2885 </p>
2886 !! html/parsoid
2887 <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>
2888 !! end
2889
2890 !! test
2891 Templates: With colons
2892 !! wikitext
2893 {{With: Colon}}
2894 !! html/php
2895 <p>Template with colon
2896 </p>
2897 !! html/parsoid
2898 <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>
2899 !! end
2900
2901 #--------------------------------------------------------------------
2902 # Transclusion parameter escaping tests
2903 #--------------------------------------------------------------------
2904
2905 !! test
2906 Templates: Parsoid parameter escaping test 1
2907 !! wikitext
2908 {{echo|[foo]|{{echo|[bar]}}}}
2909 !! html/php+tidy
2910 <p>[foo]</p>
2911 !! html/parsoid
2912 <p about="#mwt1" typeof="mw:Transclusion"
2913 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2914 !! end
2915
2916 !! test
2917 Parsoid: Pipes in external links in template parameter
2918 !! wikitext
2919 {{echo|[{{echo|http://example.com}} link]}}
2920 !! html/php+tidy
2921 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2922 !! html/parsoid
2923 <p><a rel="mw:ExtLink" 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>
2924 !! end
2925
2926 !! test
2927 Parsoid: pipe in transclusion parameter
2928 !! wikitext
2929 {{echo|http://foo.com/a&#124;b}}
2930 !! html/php+tidy
2931 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2932 !! html/parsoid
2933 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1"
2934 typeof="mw:Transclusion"
2935 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>
2936 !! end
2937
2938 !! test
2939 Parsoid: Pipe in external link target and content in template parameter
2940 !! options
2941 parsoid=html2wt,wt2wt
2942 !! wikitext
2943 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2944 !! html/php+tidy
2945 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2946 !! html/parsoid
2947 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2948 typeof="mw:Transclusion"
2949 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2950 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2951 !! end
2952
2953 !! test
2954 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2955 !! options
2956 parsoid
2957 !! wikitext
2958 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2959 !! html
2960 <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>
2961 !! end
2962
2963 !! test
2964 Templates: Don't escape already nowiki-escaped text in template parameters
2965 !! options
2966 parsoid=html2wt,wt2wt
2967 !! wikitext
2968 {{echo|foo<nowiki>|</nowiki>bar}}
2969 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2970 {{echo|<nowiki></nowiki>}}
2971 !! html/php+tidy
2972 <p>foo|bar &lt;div&gt;</p>
2973 !! html/parsoid
2974 <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>
2975 <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>
2976 <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>
2977 </p>
2978 !! end
2979
2980 ## T54824
2981 !! test
2982 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2983 !! options
2984 parsoid=html2wt,wt2wt
2985 !! wikitext
2986 {{echo|{{echo|1=bar}}}}
2987 !! html/php+tidy
2988 <p>bar</p>
2989 !! html/parsoid
2990 <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>
2991 !! end
2992
2993 ## T58733
2994 !! test
2995 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2996 !! wikitext
2997 {{echo|a : b}}
2998 !! html/php+tidy
2999 <p>a&#160;: b</p>
3000 !! html/parsoid
3001 <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>
3002 !! end
3003
3004 ## T73412
3005 !! test
3006 Templates: Preserve blank parameter names
3007 !! wikitext
3008 {{echo|=foo}}
3009 !! html/php+tidy
3010 <p>{{{1}}}</p>
3011 !! html/parsoid
3012 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3013 !! end
3014
3015 !! test
3016 Templates: Preserve blank parameter names in other positions
3017 !! wikitext
3018 {{blank_param|bar|=foo}}
3019 !! html/php+tidy
3020 <p>bar foo</p>
3021 !! html/parsoid
3022 <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
3023 foo</p>
3024 !! end
3025
3026 ###
3027 ### Parsoid-centric tests for testing RT edge cases for pre
3028 ###
3029
3030 !!test
3031 1a. Indent-Pre and Comments
3032 !! wikitext
3033 a
3034 <!--a-->
3035 c
3036 !! html
3037 <pre>a
3038 </pre>
3039 <p>c
3040 </p>
3041 !!end
3042
3043 !!test
3044 1b. Indent-Pre and Comments
3045 !! wikitext
3046 a
3047 <!--a-->
3048 c
3049 !! html
3050 <pre>a
3051 </pre>
3052 <p>c
3053 </p>
3054 !!end
3055
3056 !!test
3057 1c. Indent-Pre and Comments
3058 !! wikitext
3059 <!--a--> a
3060
3061 <!--a--> a
3062 !! html
3063 <pre> a
3064 </pre>
3065 <pre> a
3066 </pre>
3067 !!end
3068
3069 !!test
3070 1d. Indent-Pre and Comments
3071 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3072 !! wikitext
3073 <!--a--> a
3074
3075 <!--b-->b
3076 !! html
3077 <pre>a
3078 </pre>
3079 <pre>b
3080 </pre>
3081 !!end
3082
3083 !!test
3084 2a. Indent-Pre and tables
3085 !! wikitext
3086 {|
3087 |-
3088 !h1!!h2
3089 |foo||bar
3090 |}
3091 !! html
3092 <table>
3093
3094 <tr>
3095 <th>h1</th>
3096 <th>h2
3097 </th>
3098 <td>foo</td>
3099 <td>bar
3100 </td></tr></table>
3101
3102 !!end
3103
3104 !!test
3105 2b. Indent-Pre and tables
3106 !! wikitext
3107 {|
3108 |-
3109 |foo
3110 |}
3111 !! html
3112 <table>
3113
3114 <tr>
3115 <td>foo
3116 </td></tr></table>
3117
3118 !!end
3119
3120 !!test
3121 2c. Indent-Pre and tables (T44252)
3122 !! wikitext
3123 {|
3124 |+ foo
3125 ! | bar
3126 |}
3127 !! html
3128 <table>
3129 <caption> foo
3130 </caption>
3131 <tr>
3132 <th> bar
3133 </th></tr></table>
3134
3135 !!end
3136
3137 !!test
3138 2d. Indent-Pre and tables
3139 !! wikitext
3140 a
3141 {|
3142 | b
3143 |}
3144 !! html/php
3145 <pre>a
3146 </pre>
3147 <table>
3148 <tr>
3149 <td> b
3150 </td></tr></table>
3151
3152 !! html/parsoid
3153 <pre>a</pre>
3154 <table>
3155 <tbody><tr><td> b</td></tr>
3156 </tbody></table>
3157 !!end
3158
3159 !!test
3160 2e. Indent-Pre and table-line syntax
3161 !! wikitext
3162 a
3163 | b
3164 | c
3165 !! html/php
3166 <pre>a
3167 | b
3168 | c
3169 </pre>
3170 !!end
3171
3172 !!test
3173 2f. Indent-pre started by table-line syntax
3174 !! wikitext
3175 a
3176 | b
3177 | c
3178 !! html/php
3179 <p>a
3180 </p>
3181 <pre>| b
3182 | c
3183 </pre>
3184 !! html/parsoid
3185 <p>a</p>
3186 <pre>
3187 | b
3188 | c</pre>
3189 !!end
3190
3191 !! test
3192 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3193 !! wikitext
3194 <table>
3195 <tr>
3196 <td>
3197 Text that should be rendered preformatted
3198 </td>
3199 </tr>
3200 </table>
3201 !! html
3202 <table>
3203 <tr>
3204 <td>
3205 <pre>Text that should be rendered preformatted
3206 </pre>
3207 </td>
3208 </tr>
3209 </table>
3210
3211 !! end
3212
3213 !!test
3214 3a. Indent-Pre and block tags (single-line html)
3215 !! wikitext
3216 a <p> foo </p>
3217 b <div> foo </div>
3218 c <blockquote> foo </blockquote>
3219 <span> foo </span>
3220 !! html
3221 a <p> foo </p>
3222 b <div> foo </div>
3223 c <blockquote> foo </blockquote>
3224 <pre><span> foo </span>
3225 </pre>
3226 !! html/parsoid
3227 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3228 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3229 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3230 <pre><span> foo </span>
3231 </pre>
3232 !! html+tidy
3233 <p>a</p>
3234 <p>foo</p>
3235 <p>b</p>
3236 <div>foo</div>
3237 <p>c</p>
3238 <blockquote>
3239 <p>foo</p>
3240 </blockquote>
3241 <pre>
3242 <span> foo </span>
3243 </pre>
3244 !! end
3245
3246 !!test
3247 3b. Indent-Pre and block tags (multi-line html)
3248 !! wikitext
3249 a <span>foo</span>
3250 b <div> foo </div>
3251 !! html
3252 <pre>a <span>foo</span>
3253 </pre>
3254 b <div> foo </div>
3255
3256 !! html/parsoid
3257 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3258 b <div data-parsoid='{"stx":"html"}'> foo </div>
3259 !! html+tidy
3260 <pre>
3261 a <span>foo</span>
3262 </pre>
3263 <p>b</p>
3264 <div>foo</div>
3265 !!end
3266
3267 !!test
3268 3c. Indent-Pre and block tags (pre-content on separate line)
3269 !! wikitext
3270 <p>
3271 foo
3272 </p>
3273
3274 <div>
3275 foo
3276 </div>
3277
3278 <center>
3279 foo
3280 </center>
3281
3282 <blockquote>
3283 foo
3284 </blockquote>
3285
3286 <blockquote>
3287 <pre>
3288 foo
3289 </pre>
3290 </blockquote>
3291
3292 <table><tr><td>
3293 foo
3294 </td></tr></table>
3295
3296 <ul><li>
3297 foo
3298 </li></ul>
3299
3300 !! html
3301 <p>
3302 foo
3303 </p>
3304 <div>
3305 <pre>foo
3306 </pre>
3307 </div>
3308 <center>
3309 <pre>foo
3310 </pre>
3311 </center>
3312 <blockquote>
3313 <p> foo
3314 </p>
3315 </blockquote>
3316 <blockquote>
3317 <pre>
3318 foo
3319 </pre>
3320 </blockquote>
3321 <table><tr><td>
3322 <pre>foo
3323 </pre>
3324 </td></tr></table>
3325 <ul><li>
3326 foo
3327 </li></ul>
3328
3329 !!end
3330
3331 !! test
3332 4. Indent-Pre and extension tags
3333 !! wikitext
3334 a <tag />
3335 !! html/php
3336 a <pre>
3337 NULL
3338 array (
3339 )
3340 </pre>
3341
3342 !! html/parsoid
3343 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3344 !! end
3345
3346 !! test
3347 5. Indent-Pre and html pre
3348 !! wikitext
3349 <pre class="123">hi</pre>
3350 !! html/php
3351 <pre class="123">hi</pre>
3352
3353 !! html/parsoid
3354 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3355 !! end
3356
3357 !!test
3358 Render paragraphs when indent-pre is suppressed in blocklevels
3359 !! wikitext
3360 <blockquote>
3361 foo
3362
3363 bar
3364 </blockquote>
3365 !! html
3366 <blockquote>
3367 <p> foo
3368 </p><p> bar
3369 </p>
3370 </blockquote>
3371
3372 !!end
3373
3374 !!test
3375 4. Multiple spaces at start-of-line
3376 !! wikitext
3377 <p> foo </p>
3378 foo
3379 {|
3380 |foo
3381 |}
3382 !! html
3383 <p> foo </p>
3384 <pre> foo
3385 </pre>
3386 <table>
3387 <tr>
3388 <td>foo
3389 </td></tr></table>
3390
3391 !!end
3392
3393 ## NOTE: the leading white-space chars on empty line are significant
3394 !! test
3395 5a. White-space in indent-pre
3396 !! wikitext
3397 a<br />
3398
3399 b
3400 !! html
3401 <pre>a<br />
3402
3403 b
3404 </pre>
3405 !! end
3406
3407 ## NOTE: the leading white-space chars on empty line are significant
3408 !! test
3409 5b. White-space in indent-pre
3410 !! wikitext
3411 a
3412
3413 b
3414
3415
3416 c
3417 !! html
3418 <pre>a
3419
3420 b
3421
3422
3423 c
3424 </pre>
3425 !! end
3426
3427 !! test
3428 5c. White-space in indent-pre
3429 !! wikitext
3430 ''a''
3431 ''b''
3432 ''c''
3433 !! html
3434 <pre><i>a</i>
3435 <i>b</i>
3436 <i>c</i>
3437 </pre>
3438 !! end
3439
3440 !! test
3441 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3442 !! wikitext
3443 a
3444
3445 <!-- continue -->
3446 b
3447
3448 c
3449
3450 d
3451 !! html
3452 <pre>a
3453
3454 b
3455 </pre>
3456 <pre>c
3457
3458 </pre>
3459 <p>d
3460 </p>
3461 !! end
3462
3463 !! test
3464 7a. Indent-pre and category links
3465 !! options
3466 parsoid=wt2html,wt2wt
3467 !! wikitext
3468 [[Category:foo]] <!-- No pre-wrapping -->
3469 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3470 !! html/php+tidy
3471 !! html/parsoid
3472 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3473 <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 -->
3474 !! end
3475
3476 ## We used to, but no longer wt2wt this test since the default serializer
3477 ## will normalize all categories to serialize on their own line.
3478 ## This wikitext usage is going to be fairly uncommon in production and
3479 ## selser will take care of preserving formatting in those scenarios.
3480 !! test
3481 7b. Indent-pre and category links
3482 !! options
3483 parsoid=wt2html
3484 !! wikitext
3485 [[Category:foo]] a
3486 [[Category:foo]] {{echo|b}}
3487 !! html/parsoid
3488 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3489 <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>
3490 !! end
3491
3492 !! test
3493 Indent-Pre: Newlines in comments shouldn't affect sol state
3494 !! wikitext
3495 a <!--
3496 foo
3497 --> b
3498 !! html/php+tidy
3499 <p>a b</p>
3500 !! html/parsoid
3501 <p>a <!--
3502 foo
3503 --> b</p>
3504 !! end
3505
3506 ###
3507 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3508 ###
3509
3510 !!test
3511 HTML-pre: 1. embedded newlines
3512 !! wikitext
3513 <pre>foo</pre>
3514
3515 <pre>
3516 foo
3517 </pre>
3518
3519 <pre>
3520
3521 foo
3522 </pre>
3523
3524 <pre>
3525
3526
3527 foo
3528 </pre>
3529 !! html/php+tidy
3530 <pre>
3531 foo
3532 </pre>
3533 <pre>
3534 foo
3535 </pre>
3536 <pre>
3537
3538 foo
3539 </pre>
3540 <pre>
3541
3542
3543 foo
3544 </pre>
3545 !! html/parsoid
3546 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3547
3548 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3549 </pre>
3550
3551 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3552
3553 foo
3554 </pre>
3555
3556 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3557
3558
3559 foo
3560 </pre>
3561 !!end
3562
3563 !! test
3564 HTML-pre: big spaces
3565 !! wikitext
3566 <pre>
3567
3568
3569
3570
3571 haha
3572
3573
3574
3575
3576 haha
3577
3578
3579
3580
3581 </pre>
3582 !! html/php+tidy
3583 <pre>
3584
3585
3586
3587
3588 haha
3589
3590
3591
3592
3593 haha
3594
3595
3596
3597
3598 </pre>
3599 !! html/parsoid
3600 <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"}}'>
3601
3602
3603
3604
3605 haha
3606
3607
3608
3609
3610 haha
3611
3612
3613
3614
3615 </pre>
3616 !! end
3617
3618 !!test
3619 HTML-pre: 2: indented text
3620 !! wikitext
3621 <pre>
3622 foo
3623 </pre>
3624 !! html
3625 <pre>
3626 foo
3627 </pre>
3628
3629 !!end
3630
3631 !!test
3632 HTML-pre: 3: other wikitext
3633 !! wikitext
3634 <pre>
3635 * foo
3636 # bar
3637 = no-h =
3638 '' no-italic ''
3639 [[ NoLink ]]
3640 </pre>
3641 !! html/php
3642 <pre>
3643 * foo
3644 # bar
3645 = no-h =
3646 '' no-italic ''
3647 [[ NoLink ]]
3648 </pre>
3649
3650 !! html/parsoid
3651 <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
3652 # bar
3653 = no-h =
3654 '' no-italic ''
3655 [[ NoLink ]]
3656 </pre>
3657 !!end
3658
3659 ###
3660 ### Definition lists
3661 ###
3662 !! test
3663 Simple definition
3664 !! wikitext
3665 ; name : Definition
3666 !! html
3667 <dl><dt> name&#160;</dt>
3668 <dd> Definition</dd></dl>
3669
3670 !! end
3671
3672 !! test
3673 Definition list for indentation only
3674 !! wikitext
3675 : Indented text
3676 !! html
3677 <dl><dd> Indented text</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition list with no space
3683 !! wikitext
3684 ;name:Definition
3685 !! html
3686 <dl><dt>name</dt>
3687 <dd>Definition</dd></dl>
3688
3689 !!end
3690
3691 !! test
3692 Definition list with URL link
3693 !! wikitext
3694 ; http://example.com/ : definition
3695 !! html
3696 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3697 <dd> definition</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition list with bracketed URL link
3703 !! wikitext
3704 ;[http://www.example.com/ Example]:Something about it
3705 !! html
3706 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3707 <dd>Something about it</dd></dl>
3708
3709 !! end
3710
3711 !! test
3712 Definition list with wikilink containing colon
3713 !! wikitext
3714 ; [[Help:FAQ]]: The least-read page on Wikipedia
3715 !! html
3716 <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>
3717 <dd> The least-read page on Wikipedia</dd></dl>
3718
3719 !! end
3720
3721 # At Brion's and JeLuF's insistence... :)
3722 !! test
3723 Definition list with news link containing colon
3724 !! wikitext
3725 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3726 !! html/php
3727 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3728 <dd> This isn't even a real newsgroup!</dd></dl>
3729
3730 !! html/parsoid
3731 <dl><dt> <a rel="mw:ExtLink" 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>
3732 !! end
3733
3734 !! test
3735 Malformed definition list with colon
3736 !! wikitext
3737 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3738 !! html
3739 <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>
3740
3741 !! end
3742
3743 !! test
3744 Definition lists: colon in external link text
3745 !! wikitext
3746 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3747 !! html
3748 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3749 <dd> OK, I made that up</dd></dl>
3750
3751 !! end
3752
3753 !! test
3754 Definition lists: colon in HTML attribute
3755 !! wikitext
3756 ;<b style="display: inline">bold</b>
3757 !! html
3758 <dl><dt><b style="display: inline">bold</b></dt></dl>
3759
3760 !! end
3761
3762 !! test
3763 Definition lists: self-closed tag
3764 !! wikitext
3765 ;one<br/>two : two-line fun
3766 !! html
3767 <dl><dt>one<br />two&#160;</dt>
3768 <dd> two-line fun</dd></dl>
3769
3770 !! end
3771
3772 !! test
3773 Definition lists: ignore colons inside tags
3774 !! wikitext
3775 ;one <b>two : tag <i>fun:</i>:</b>: def
3776 !! html
3777 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3778 <dd> def</dd></dl>
3779
3780 !! end
3781
3782 !! test
3783 Definition lists: excess closed tags
3784 !! wikitext
3785 ;one</b>two : bad tag fun
3786 !! html/php+tidy
3787 <dl>
3788 <dt>onetwo&#160;</dt>
3789 <dd>bad tag fun</dd>
3790 </dl>
3791 !! html/parsoid
3792 <dl>
3793 <dt>onetwo</dt>
3794 <dd>bad tag fun</dd>
3795 </dl>
3796 !! end
3797
3798 !! test
3799 T13748: Literal closing tags
3800 !! wikitext
3801 <dl>
3802 <dt>test 1</dt>
3803 <dd>test test test test test</dd>
3804 <dt>test 2</dt>
3805 <dd>test test test test test</dd>
3806 </dl>
3807 !! html
3808 <dl>
3809 <dt>test 1</dt>
3810 <dd>test test test test test</dd>
3811 <dt>test 2</dt>
3812 <dd>test test test test test</dd>
3813 </dl>
3814
3815 !! end
3816
3817 !! test
3818 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3819 !! wikitext
3820 <ul><li>
3821 ; term : description
3822 * unordered
3823 </li></ul>
3824 !! html
3825 <ul><li>
3826 <dl><dt> term&#160;</dt>
3827 <dd> description</dd></dl>
3828 <ul><li> unordered</li></ul>
3829 </li></ul>
3830
3831 !! end
3832
3833 !! test
3834 Definition list with empty definition and following paragraph
3835 !! wikitext
3836 ; term:
3837 Paragraph text
3838 !! html
3839 <dl><dt> term</dt>
3840 <dd></dd></dl>
3841 <p>Paragraph text
3842 </p>
3843 !! end
3844
3845 !! test
3846 Nested definition lists using html syntax
3847 !! wikitext
3848 <dl><dt>x</dt>
3849 <dd>a</dd>
3850 <dd>b</dd></dl>
3851 !! html
3852 <dl><dt>x</dt>
3853 <dd>a</dd>
3854 <dd>b</dd></dl>
3855
3856 !! end
3857
3858 !! test
3859 Definition Lists: No nesting: Multiple dd's
3860 !! wikitext
3861 ;x
3862 :a
3863 :b
3864 !! html
3865 <dl><dt>x</dt>
3866 <dd>a</dd>
3867 <dd>b</dd></dl>
3868
3869 !! end
3870
3871 !! test
3872 Definition Lists: Indentation: Regular
3873 !! wikitext
3874 :i1
3875 ::i2
3876 :::i3
3877 !! html
3878 <dl><dd>i1
3879 <dl><dd>i2
3880 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3881
3882 !! end
3883
3884 !! test
3885 Definition Lists: Indentation: Missing 1st level
3886 !! wikitext
3887 ::i2
3888 :::i3
3889 !! html
3890 <dl><dd><dl><dd>i2
3891 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3892
3893 !! end
3894
3895 !! test
3896 Definition Lists: Indentation: Multi-level indent
3897 !! wikitext
3898 :::i3
3899 !! html
3900 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3901
3902 !! end
3903
3904 !! test
3905 Definition Lists: Hacky use to indent tables
3906 !! wikitext
3907 ::{|
3908 |foo
3909 |bar
3910 |}
3911 this text
3912 should be left alone
3913 !! html
3914 <dl><dd><dl><dd><table>
3915 <tr>
3916 <td>foo
3917 </td>
3918 <td>bar
3919 </td></tr></table></dd></dl></dd></dl>
3920 <p>this text
3921 should be left alone
3922 </p>
3923 !! end
3924
3925 !! test
3926 Definition Lists: Hacky use to indent tables, with comments (T65979)
3927 !! wikitext
3928 <!-- foo -->
3929 ::{|
3930 |foo
3931 |bar
3932 |}<!-- bar -->
3933 this text
3934 should be left alone
3935 !! html/parsoid
3936 <!-- foo -->
3937 <dl><dd><dl><dd><table><tr>
3938 <td>foo</td>
3939 <td>bar</td>
3940 </tr></table><!-- bar --></dd></dl></dd></dl>
3941 <p>this text
3942 should be left alone</p>
3943 !! end
3944
3945 !! test
3946 Definition Lists: Hacky use to indent tables, with comment before table
3947 !! wikitext
3948 ::<!-- foo -->{|
3949 |foo
3950 |}
3951 !! html/parsoid
3952 <dl><dd><dl><dd><!-- foo --><table><tr>
3953 <td>foo</td>
3954 </tr></table></dd></dl></dd></dl>
3955 !! end
3956
3957 # The trailing whitespace in this test is to catch a regression in
3958 # Parsoid after T54473.
3959 !! test
3960 Definition Lists: Hacky use to indent tables (WS-insensitive)
3961 !! wikitext
3962 : {|
3963 |a
3964 |}
3965 !! html/php
3966 <dl><dd><table>
3967 <tr>
3968 <td>a
3969 </td></tr></table></dd></dl>
3970
3971 !! html/parsoid
3972 <dl><dd> <table>
3973 <tbody><tr><td>a</td></tr>
3974 </tbody></table> </dd></dl>
3975 !! end
3976
3977 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3978 ## as an empty dt item. It also ignores all but the last ";" when followed
3979 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3980 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3981 ## ";"s.
3982 ##
3983 ## Ex: ";;t2 ::d2" is transformed into:
3984 ##
3985 ## <dl>
3986 ## <dt>t2 </dt>
3987 ## <dd>
3988 ## <dl>
3989 ## <dt></dt>
3990 ## <dd>d2</dd>
3991 ## </dl>
3992 ## </dd>
3993 ## </dl>
3994 ##
3995 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3996 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3997 ##
3998 ## <dl>
3999 ## <dt>
4000 ## <dl>
4001 ## <dt>t2 </dt>
4002 ## <dd>:d2</dd>
4003 ## </dl>
4004 ## </dt>
4005 ## </dl>
4006 ##
4007 ## All Parsoid only definition list tests have this difference.
4008 ##
4009 ## See also: https://phabricator.wikimedia.org/T8569
4010 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4011
4012 !! test
4013 Table / list interaction: indented table with lists in table contents
4014 !! wikitext
4015 :{|
4016 |-
4017 | a
4018 * b
4019 |-
4020 | c
4021 * d
4022 |}
4023 !! html
4024 <dl><dd><table>
4025
4026 <tr>
4027 <td> a
4028 <ul><li> b</li></ul>
4029 </td></tr>
4030 <tr>
4031 <td> c
4032 <ul><li> d</li></ul>
4033 </td></tr></table></dd></dl>
4034
4035 !! end
4036
4037 !!test
4038 Table / list interaction: lists nested in tables nested in indented lists
4039 !! wikitext
4040 :{|
4041 |
4042 :a
4043 :b
4044 |
4045 *c
4046 *d
4047 |}
4048
4049 *e
4050 *f
4051 !! html
4052 <dl><dd><table>
4053 <tr>
4054 <td>
4055 <dl><dd>a</dd>
4056 <dd>b</dd></dl>
4057 </td>
4058 <td>
4059 <ul><li>c</li>
4060 <li>d</li></ul>
4061 </td></tr></table></dd></dl>
4062 <ul><li>e</li>
4063 <li>f</li></ul>
4064
4065 !!end
4066
4067 !! test
4068 Definition Lists: Nesting: Multi-level (Parsoid only)
4069 !! options
4070 parsoid
4071 !! wikitext
4072 ;t1 :d1
4073 ;;t2 ::d2
4074 ;;;t3 :::d3
4075 !! html
4076 <dl>
4077 <dt>t1 </dt>
4078 <dd>d1</dd>
4079 <dt>
4080 <dl>
4081 <dt>t2 </dt>
4082 <dd>:d2</dd>
4083 <dt>
4084 <dl>
4085 <dt>t3 </dt>
4086 <dd>::d3</dd>
4087 </dl>
4088 </dt>
4089 </dl>
4090 </dt>
4091 </dl>
4092
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Nesting: Test 2 (Parsoid only)
4099 !! wikitext
4100 ;t1
4101 ::d2
4102 !! html/php+tidy
4103 <dl>
4104 <dt>t1</dt>
4105 <dd>
4106 <dl>
4107 <dd>d2</dd>
4108 </dl>
4109 </dd>
4110 </dl>
4111 !! html/parsoid
4112 <dl>
4113 <dt>t1</dt>
4114 <dd>
4115 <dl>
4116 <dd>d2</dd>
4117 </dl>
4118 </dd>
4119 </dl>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Nesting: Test 3 (Parsoid only)
4126 !! wikitext
4127 :;t1
4128 ::::d2
4129 !! html/php+tidy
4130 <dl>
4131 <dd>
4132 <dl>
4133 <dt>t1</dt>
4134 <dd>
4135 <dl>
4136 <dd>
4137 <dl>
4138 <dd>d2</dd>
4139 </dl>
4140 </dd>
4141 </dl>
4142 </dd>
4143 </dl>
4144 </dd>
4145 </dl>
4146 !! html/parsoid
4147 <dl>
4148 <dd>
4149 <dl>
4150 <dt>t1</dt>
4151 <dd>
4152 <dl>
4153 <dd>
4154 <dl>
4155 <dd>d2</dd>
4156 </dl>
4157 </dd>
4158 </dl>
4159 </dd>
4160 </dl>
4161 </dd>
4162 </dl>
4163
4164 !! end
4165
4166
4167 !! test
4168 Definition Lists: Nesting: Test 4
4169 !! wikitext
4170 ::;t3
4171 :::d3
4172 !! html
4173 <dl><dd><dl><dd><dl><dt>t3</dt>
4174 <dd>d3</dd></dl></dd></dl></dd></dl>
4175
4176 !! end
4177
4178
4179 ## The Parsoid team believes the following three test exposes a
4180 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4181 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4182 ## It also exposes a "misfeature" in tidy, which doesn't like
4183 ## <dl> tags with a single <dt> child; it converts the <dt> into
4184 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4185 !! test
4186 Definition Lists: Mixed Lists: Test 1
4187 !! wikitext
4188 :;* foo
4189 ::* bar
4190 :; baz
4191 !! html/php
4192 <dl><dd><dl><dt><ul><li> foo</li>
4193 <li> bar</li></ul></dt></dl>
4194 <dl><dt> baz</dt></dl></dd></dl>
4195
4196 !! html/php+tidy
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dd>
4201 <ul>
4202 <li>foo</li>
4203 <li>bar</li>
4204 </ul>
4205 </dd>
4206 </dl>
4207 <dl>
4208 <dt>baz</dt>
4209 </dl>
4210 </dd>
4211 </dl>
4212 !! html/parsoid
4213 <dl>
4214 <dd><dl>
4215 <dt><ul>
4216 <li> foo
4217 </li>
4218 </ul></dt>
4219 <dd><ul>
4220 <li> bar
4221 </li>
4222 </ul></dd>
4223 <dt> baz</dt>
4224 </dl></dd>
4225 </dl>
4226 !! end
4227
4228 !! test
4229 Definition Lists: Mixed Lists: Test 2
4230 !! wikitext
4231 *: d1
4232 *: d2
4233 !! html
4234 <ul><li><dl><dd> d1</dd>
4235 <dd> d2</dd></dl></li></ul>
4236
4237 !! end
4238
4239
4240 !! test
4241 Definition Lists: Mixed Lists: Test 3
4242 !! wikitext
4243 *::: d1
4244 *::: d2
4245 !! html
4246 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4247 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4248
4249 !! end
4250
4251
4252 !! test
4253 Definition Lists: Mixed Lists: Test 4
4254 !! wikitext
4255 *;d1 :d2
4256 *;d3 :d4
4257 !! html
4258 <ul><li><dl><dt>d1&#160;</dt>
4259 <dd>d2</dd>
4260 <dt>d3&#160;</dt>
4261 <dd>d4</dd></dl></li></ul>
4262
4263 !! end
4264
4265
4266 !! test
4267 Definition Lists: Mixed Lists: Test 5
4268 !! wikitext
4269 *:d1
4270 *:: d2
4271 !! html
4272 <ul><li><dl><dd>d1
4273 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4274
4275 !! end
4276
4277
4278 !! test
4279 Definition Lists: Mixed Lists: Test 6
4280 !! wikitext
4281 #*:d1
4282 #*::: d3
4283 !! html
4284 <ol><li><ul><li><dl><dd>d1
4285 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4286
4287 !! end
4288
4289
4290 !! test
4291 Definition Lists: Mixed Lists: Test 7
4292 !! wikitext
4293 :* d1
4294 :* d2
4295 !! html
4296 <dl><dd><ul><li> d1</li>
4297 <li> d2</li></ul></dd></dl>
4298
4299 !! end
4300
4301
4302 !! test
4303 Definition Lists: Mixed Lists: Test 8
4304 !! wikitext
4305 :* d1
4306 ::* d2
4307 !! html
4308 <dl><dd><ul><li> d1</li></ul>
4309 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4310
4311 !! end
4312
4313
4314 !! test
4315 Definition Lists: Mixed Lists: Test 9
4316 !! wikitext
4317 *;foo :bar
4318 !! html
4319 <ul><li><dl><dt>foo&#160;</dt>
4320 <dd>bar</dd></dl></li></ul>
4321
4322 !! end
4323
4324
4325 !! test
4326 Definition Lists: Mixed Lists: Test 10
4327 !! wikitext
4328 *#;foo :bar
4329 !! html
4330 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4331 <dd>bar</dd></dl></li></ol></li></ul>
4332
4333 !! end
4334
4335 # This is a regression test for T175099
4336 # html/php+tidy is insufficient since Tidy covers up the bug.
4337 # But once Tidy is replaced with RemexHTML, html/php+tidy is good enough
4338 !! test
4339 Definition Lists: Mixed Lists: Test 11
4340 !! wikitext
4341 ;a
4342 :*b
4343 !! html
4344 <dl><dt>a</dt>
4345 <dd>
4346 <ul><li>b</li></ul></dd></dl>
4347
4348 !! end
4349
4350 # The Parsoid team disagrees with the PHP parser's seemingly-random
4351 # rules regarding dd/dt on the next two tests. Parsoid is more
4352 # consistent, and recognizes the shared nesting and keeps the
4353 # still-open tags around until the nesting is complete.
4354 # (And tidy again converts <dt> to <dd> before 'bar'.)
4355
4356 !! test
4357 Definition Lists: Mixed Lists: Test 12
4358 !! wikitext
4359 *#*#;*;;foo :bar
4360 *#*#;boo :baz
4361 !! html/php
4362 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4363 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4364 <dl><dt>boo&#160;</dt>
4365 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4366
4367 !! html/php+tidy
4368 <ul>
4369 <li>
4370 <ol>
4371 <li>
4372 <ul>
4373 <li>
4374 <ol>
4375 <li>
4376 <dl>
4377 <dt>foo&#160;</dt>
4378 <dd>
4379 <ul>
4380 <li>
4381 <dl>
4382 <dd>
4383 <dl>
4384 <dt>bar</dt>
4385 </dl>
4386 </dd>
4387 </dl>
4388 </li>
4389 </ul>
4390 </dd>
4391 </dl>
4392 <dl>
4393 <dt>boo&#160;</dt>
4394 <dd>baz</dd>
4395 </dl>
4396 </li>
4397 </ol>
4398 </li>
4399 </ul>
4400 </li>
4401 </ol>
4402 </li>
4403 </ul>
4404 !! html/parsoid
4405 <ul>
4406 <li>
4407 <ol>
4408 <li>
4409 <ul>
4410 <li>
4411 <ol>
4412 <li>
4413 <dl>
4414 <dt>
4415 <ul>
4416 <li>
4417 <dl>
4418 <dt>
4419 <dl>
4420 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4421 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4422 </dl></dt>
4423 </dl></li>
4424 </ul></dt>
4425 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4426 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4427 </dl></li>
4428 </ol></li>
4429 </ul></li>
4430 </ol></li>
4431 </ul>
4432 !! end
4433
4434
4435 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4436 # From whitelist:
4437 # * The test is wrong, there are two colons where there should be :;
4438 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4439 !! test
4440 Definition Lists: Weird Ones: Test 1
4441 !! wikitext
4442 *#;*::;; foo : bar (who uses this?)
4443 !! html/php
4444 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4445 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4446
4447 !! html/php+tidy
4448 <ul>
4449 <li>
4450 <ol>
4451 <li>
4452 <dl>
4453 <dt>foo&#160;</dt>
4454 <dd>
4455 <ul>
4456 <li>
4457 <dl>
4458 <dd>
4459 <dl>
4460 <dd>
4461 <dl>
4462 <dd>
4463 <dl>
4464 <dt>bar (who uses this?)</dt>
4465 </dl>
4466 </dd>
4467 </dl>
4468 </dd>
4469 </dl>
4470 </dd>
4471 </dl>
4472 </li>
4473 </ul>
4474 </dd>
4475 </dl>
4476 </li>
4477 </ol>
4478 </li>
4479 </ul>
4480 !! html/parsoid
4481 <ul>
4482 <li>
4483 <ol>
4484 <li>
4485 <dl>
4486 <dt>
4487 <ul>
4488 <li>
4489 <dl>
4490 <dd>
4491 <dl>
4492 <dd>
4493 <dl>
4494 <dt>
4495 <dl>
4496 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4497 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4498 </dl></dt>
4499 </dl></dd>
4500 </dl></dd>
4501 </dl></li>
4502 </ul></dt>
4503 </dl></li>
4504 </ol></li>
4505 </ul>
4506 !! end
4507
4508 !! test
4509 Definition Lists: colons occurring in tags
4510 !! wikitext
4511 ;a:b
4512 ;'''a:b'''
4513 ;<i>a:b</i>
4514 ;<span>a:b</span>
4515 ;<div>a:b</div>
4516 ;<div>a
4517 :b</div>
4518 ;{{echo|a:b}}
4519 ;{{echo|''a:b''}}
4520 ;;;''a:b''
4521 !! html+tidy
4522 <dl>
4523 <dt>a</dt>
4524 <dd>b</dd>
4525 <dt><b>a:b</b></dt>
4526 <dt><i>a:b</i></dt>
4527 <dt><span>a:b</span></dt>
4528 <dd>
4529 <div>a:b</div>
4530 </dd>
4531 <dd>
4532 <div>a
4533 <dl>
4534 <dd>b</dd>
4535 </dl>
4536 </div>
4537 </dd>
4538 <dt>a</dt>
4539 <dd>b</dd>
4540 <dt><i>a:b</i></dt>
4541 </dl>
4542 <dl>
4543 <dd>
4544 <dl>
4545 <dd>
4546 <dl>
4547 <dt><i>a:b</i></dt>
4548 </dl>
4549 </dd>
4550 </dl>
4551 </dd>
4552 </dl>
4553 !! html/parsoid
4554 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4555 <dt><b>a:b</b></dt>
4556 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4557 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4558 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4559 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4560 <dd>b</dd>
4561 <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>
4562 <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>
4563 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4564 !! end
4565
4566 !! test
4567 Definition Lists: colons and tables 1
4568 !! wikitext
4569 :{|
4570 | x
4571 |}
4572 :{|
4573 | y
4574 |}
4575 !! html
4576 <dl><dd><table>
4577 <tr>
4578 <td> x
4579 </td></tr></table></dd></dl>
4580 <dl><dd><table>
4581 <tr>
4582 <td> y
4583 </td></tr></table></dd></dl>
4584
4585 !! end
4586
4587 # Parsoid's output (as documented below) differs from php's in this case.
4588 # This is probably a bug. If we fixup parsoid to match php's output, the
4589 # above test should pass and the below test case can be removed. It is
4590 # unclear which output is more desirable.
4591
4592 !! test
4593 Definition Lists: colons and tables 2
4594 !! wikitext
4595 :{|
4596 | x
4597 |}
4598 :{|
4599 | y
4600 |}
4601 !! html/parsoid
4602 <dl><dd><table>
4603 <tr>
4604 <td> x
4605 </td></tr></table></dd>
4606 <dd><table>
4607 <tr>
4608 <td> y
4609 </td></tr></table></dd></dl>
4610 !! end
4611
4612 !! test
4613 Definition Lists: template interaction
4614 !! wikitext
4615 ::{{definition_list}}
4616
4617 :one
4618 ::{{definition_list}}
4619 :::two
4620 :::three
4621 ::four
4622 !! html/parsoid
4623 <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">
4624 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4625
4626 <dl><dd data-parsoid='{}'>one
4627 <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">
4628 </span><dd about="#mwt2">two
4629 <dl><dd>two</dd>
4630 <dd>three</dd></dl></dd>
4631 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4632 !! end
4633
4634
4635 ###
4636 ### External links
4637 ###
4638 !! test
4639 External links: non-bracketed
4640 !! wikitext
4641 Non-bracketed: http://example.com
4642 !! html
4643 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4644 </p>
4645 !! end
4646
4647 # parsoid doesn't explicitly mark autonumbered links, see T55505
4648 !! test
4649 External links: numbered
4650 !! wikitext
4651 Numbered: [http://example.com]
4652 Numbered: [http://example.net]
4653 Numbered: [http://example.com]
4654 !! html/php
4655 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4656 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4657 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4658 </p>
4659 !! html/parsoid
4660 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4661 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4662 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4663 !!end
4664
4665 !! test
4666 External links: specified text
4667 !! wikitext
4668 Specified text: [http://example.com link]
4669 !! html
4670 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4671 </p>
4672 !!end
4673
4674 !! test
4675 External links: trail
4676 !! wikitext
4677 Linktrails should not work for external links: [http://example.com link]s
4678 !! html
4679 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4680 </p>
4681 !! end
4682
4683 !! test
4684 External links: dollar sign in URL
4685 !! wikitext
4686 http://example.com/1$2345
4687 !! html
4688 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4689 </p>
4690 !! end
4691
4692 # parsoid doesn't explicitly mark autonumbered links, see T55505
4693 !! test
4694 External links: dollar sign in URL (autonumber)
4695 !! wikitext
4696 [http://example.com/1$2345]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4702 !!end
4703
4704 !! test
4705 External links: open square bracket forbidden in URL (T6377)
4706 !! options
4707 parsoid=wt2html,wt2wt,html2html
4708 !! wikitext
4709 http://example.com/1[2345
4710 !! html/php
4711 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4712 </p>
4713 !! html/parsoid
4714 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4715 !! end
4716
4717 !! test
4718 External links: open square bracket forbidden in URL (named) (T6377)
4719 !! options
4720 parsoid=wt2html,html2html
4721 !! wikitext
4722 [http://example.com/1[2345]
4723 !! html/php
4724 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4725 </p>
4726 !! html/parsoid
4727 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4728 !!end
4729
4730 # parsoid adds a space before the link name
4731 !! test
4732 External links: open square bracket forbidden in URL (named) (T6377)
4733 Parsoid variant.
4734 !! wikitext
4735 [http://example.com/1 [2345]
4736 !! html
4737 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4738 </p>
4739 !!end
4740
4741 !! test
4742 External links: nowiki in URL link text (T8230)
4743 !! wikitext
4744 [http://example.com/ <nowiki>''example site''</nowiki>]
4745 !! html
4746 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4747 </p>
4748 !! end
4749
4750 !! test
4751 External links: newline forbidden in text (T8230 regression check)
4752 !! wikitext
4753 [http://example.com/ first
4754 second]
4755 !! html
4756 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4757 second]
4758 </p>
4759 !!end
4760
4761 !! test
4762 External links: Pipe char between url and text
4763 !! wikitext
4764 [http://example.com | link]
4765 !! html
4766 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4767 </p>
4768 !!end
4769
4770 !! test
4771 External links: protocol-relative URL in brackets
4772 !! wikitext
4773 [//example.com/ Test]
4774 !! html
4775 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4776 </p>
4777 !! end
4778
4779 # parsoid doesn't explicitly mark autonumbered links, see T55505
4780 !! test
4781 External links: protocol-relative URL in brackets without text
4782 !! wikitext
4783 [//example.com]
4784 !! html/php
4785 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4789 !! end
4790
4791 !! test
4792 External links: protocol-relative URL in free text is left alone
4793 !! wikitext
4794 //example.com/Foo
4795 !! html
4796 <p>//example.com/Foo
4797 </p>
4798 !!end
4799
4800 !! test
4801 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4802 !! wikitext
4803 foo//example.com/Foo
4804 !! html
4805 <p>foo//example.com/Foo
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: with no contents
4811 !! wikitext
4812 [http://en.wikipedia.org/wiki/Foo]
4813
4814 [[wikipedia:Foo|Bar]]
4815
4816 [[wikipedia:Foo|<span>Bar</span>]]
4817 !! html/php
4818 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4819 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4820 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4821 </p>
4822 !! html/parsoid
4823 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4824 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4825 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4826 !! end
4827
4828 !! test
4829 External links: Free with trailing punctuation
4830 !! wikitext
4831 http://example.com,
4832 http://example.com;
4833 http://example.com\
4834 http://example.com.
4835 http://example.com:
4836 http://example.com!
4837 http://example.com?
4838 http://example.com)
4839 http://example.com/url_with_(brackets)
4840 (http://example.com/url_without_brackets)
4841 http://example.com/url_with_entity&amp;
4842 http://example.com/url_with_entity&#x26;
4843 http://example.com/url_with_entity&#038;
4844 http://example.com/url_with_entity&nbsp;
4845 http://example.com/url_with_entity&#xA0;
4846 http://example.com/url_with_entity&#160;
4847 http://example.com/url_with_entity&lt;
4848 http://example.com/url_with_entity&#x3C;
4849 http://example.com/url_with_entity&#60;
4850 !! html/php
4851 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4852 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4853 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4854 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4855 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4856 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4857 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4858 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4859 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4860 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4861 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4862 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4863 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4864 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4865 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4866 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4867 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4868 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4869 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4870 </p>
4871 !! html/parsoid
4872 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4873 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4874 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4875 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4876 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4877 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4878 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4879 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4880 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4881 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4882 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4883 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4884 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4885 <a rel="mw:ExtLink" 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>
4886 <a rel="mw:ExtLink" 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>
4887 <a rel="mw:ExtLink" 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>
4888 <a rel="mw:ExtLink" 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>
4889 <a rel="mw:ExtLink" 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>
4890 <a rel="mw:ExtLink" 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>
4891 !! end
4892
4893 !! test
4894 External links: tricky Parsoid html2html case
4895 !! options
4896 parsoid=wt2html,wt2wt,html2html
4897 !! wikitext
4898 http://example.com/url_with_entity&amp;amp;
4899 !! html/php
4900 <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>;
4901 </p>
4902 !! html/parsoid
4903 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4904 !! end
4905
4906 !! test
4907 External links: Free with trailing quotes (T113666)
4908 !! wikitext
4909 '''News:''' Stuff here
4910
4911 news:'a'b''c''d e
4912 !! html/php
4913 <p><b>News:</b> Stuff here
4914 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4915 </p>
4916 !! html/parsoid
4917 <p><b>News:</b> Stuff here</p>
4918 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4919 !! end
4920
4921 !! test
4922 External links: with entity
4923 !! wikitext
4924 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4925 !! html/php
4926 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4927 </p>
4928 !! html/parsoid
4929 <p><a rel="mw:ExtLink" 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>
4930 !! end
4931
4932 !! test
4933 External links: Lone protocols are never linked (T105697)
4934 !! wikitext
4935 http://
4936 http://;
4937 (http://)
4938 bitcoin:
4939 bitcoin:;
4940 (bitcoin:)
4941 !! html
4942 <p>http://
4943 http://;
4944 (http://)
4945 bitcoin:
4946 bitcoin:;
4947 (bitcoin:)
4948 </p>
4949 !! end
4950
4951 !! test
4952 External links: No preceding word characters allowed (T67278)
4953 !! wikitext
4954 NOPEhttp://example.com
4955 N0http://example.com
4956 ok:http://example.com
4957 ok-http://example.com
4958 !! html
4959 <p>NOPEhttp://example.com
4960 N0http://example.com
4961 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4962 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4963 </p>
4964 !! end
4965
4966 !! test
4967 External links: nofollow domain exception
4968 !! wikitext
4969 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4970 !! html
4971 <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>.
4972 </p>
4973 !!end
4974
4975 !! test
4976 External image
4977 !! wikitext
4978 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4979 !! html
4980 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4981 </p>
4982 !! end
4983
4984 !! test
4985 External image from https
4986 !! wikitext
4987 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4988 !! html
4989 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4990 </p>
4991 !! end
4992
4993 !! test
4994 External image (when not allowed)
4995 !! options
4996 wgAllowExternalImages=0
4997 !! wikitext
4998 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4999 !! html
5000 <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>
5001 </p>
5002 !! end
5003
5004 !! test
5005 Link to non-http image, no img tag
5006 !! wikitext
5007 Link to non-http image, no img tag: ftp://example.com/test.jpg
5008 !! html
5009 <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>
5010 </p>
5011 !! end
5012
5013 !! test
5014 External links: terminating separator
5015 !! wikitext
5016 Terminating separator: http://example.com/thing,
5017 !! html
5018 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5019 </p>
5020 !! end
5021
5022 !! test
5023 External links: intervening separator
5024 !! wikitext
5025 Intervening separator: http://example.com/1,2,3
5026 !! html
5027 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 External links: old bug with URL in query
5033 !! wikitext
5034 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5035 !! html
5036 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 External links: old URL-in-URL bug, mixed protocols
5042 !! wikitext
5043 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5044 !! html
5045 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5046 </p>
5047 !!end
5048
5049 # Since Parsoid is starting to emit canonical wikitext for links,
5050 # [http://example.com http://example.com] will not RT back to that
5051 # form anymore.
5052 !! test
5053 External links: URL in text
5054 !! options
5055 parsoid=wt2html
5056 !! wikitext
5057 URL in text: [http://example.com http://example.com]
5058 !! html/php
5059 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5060 </p>
5061 !! html/parsoid
5062 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5063 !! end
5064
5065 !! test
5066 External links: Clickable images
5067 !! wikitext
5068 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5069 !! html/php
5070 <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>
5071 </p>
5072 !! html/parsoid
5073 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5074 !! end
5075
5076 !! test
5077 External links: raw ampersand
5078 !! wikitext
5079 Old &amp; use: http://x&y
5080 !! html
5081 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5082 </p>
5083 !! end
5084
5085 !! test
5086 External links: encoded ampersand
5087 !! wikitext
5088 Old &amp; use: http://x&amp;y
5089 !! html/php
5090 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5091 </p>
5092 !! html/parsoid
5093 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
5094 !! end
5095
5096 !! test
5097 External links: encoded equals (T8102)
5098 !! wikitext
5099 http://example.com/?foo&#61;bar
5100 !! html/php
5101 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5102 </p>
5103 !! html/parsoid
5104 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5105 !! end
5106
5107 ##
5108 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5109 ## does it number them. As discussed in T55505, we can identify
5110 ## autonumbered links via CSS.
5111 ##
5112
5113 !! test
5114 External links: [raw ampersand]
5115 !! wikitext
5116 Old &amp; use: [http://x&y]
5117 !! html/php
5118 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5119 </p>
5120 !! html/parsoid
5121 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5122 !! end
5123
5124 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5125 # mode will return the [raw ampersand] wikitext
5126 !! test
5127 External links: [encoded ampersand]
5128 !! options
5129 parsoid=wt2html,wt2wt,html2html
5130 !! wikitext
5131 Old &amp; use: [http://x&amp;y]
5132 !! html/php
5133 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5134 </p>
5135 !! html/parsoid
5136 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5137 !! end
5138
5139 !! test
5140 External links: [raw equals]
5141 !! wikitext
5142 [http://example.com/?foo=bar]
5143 !! html/php
5144 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5145 </p>
5146 !! html/parsoid
5147 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5148 !! end
5149
5150 # note that parsoid html is identical to [raw equals] case; so html2wt
5151 # mode will return the [raw equals] wikitext
5152 !! test
5153 External links: [encoded equals] (T8102)
5154 !! options
5155 parsoid=wt2html,wt2wt,html2html
5156 !! wikitext
5157 [http://example.com/?foo&#61;bar]
5158 !! html/php
5159 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5160 </p>
5161 !! html/parsoid
5162 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5163 !! end
5164
5165 # xxx parsoid strips the IDN character, so the round-trip tests will
5166 # obviously fail and are disabled. --cscott
5167 !! test
5168 External links: [IDN ignored character reference in hostname; strip it right off]
5169 !! options
5170 parsoid=wt2html,wt2wt,html2html
5171 !! wikitext
5172 [http://e&zwnj;xample.com/]
5173 !! html/php
5174 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5175 </p>
5176 !! html/parsoid
5177 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5178 !! end
5179
5180 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5181 # Where an external link could easily circumvent the sanitization of the text of
5182 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5183 # test demands a higher standard. That's a bit strange.
5184 #
5185 # Example:
5186 #
5187 # http://e‌xample.com -> [http://example.com|http://example.com]
5188 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5189 #
5190 # The first example is sanitized, but the second is not. Any security benefits
5191 # from this production are trivial to circumvent. Either remove this test and
5192 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5193 # the test accordingly.
5194 #
5195 # All our love,
5196 # The Parsoid team.
5197 # xxx parsoid strips the IDN character, so the round-trip tests will
5198 # obviously fail and are disabled. --cscott
5199 !! test
5200 External links: IDN ignored character reference in hostname; strip it right off
5201 !! options
5202 parsoid=wt2html,html2html
5203 !! wikitext
5204 http://e&zwnj;xample.com/
5205 !! html/php
5206 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5207 </p>
5208 !! html/parsoid
5209 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5210 !! end
5211
5212 !! test
5213 External links: www.jpeg.org (T2554)
5214 !! wikitext
5215 http://www.jpeg.org
5216 !! html
5217 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5218 </p>
5219 !! end
5220
5221 # parsoid doesn't explicitly mark autonumbered links, see T55505
5222 !! test
5223 External links: URL within URL (T2002)
5224 !! wikitext
5225 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5226 !! html/php
5227 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5228 </p>
5229 !! html/parsoid
5230 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5231 !! end
5232
5233 !! test
5234 T2361: URL inside bracketed URL
5235 !! wikitext
5236 [http://www.example.com/foo http://www.example.com/bar]
5237 !! html
5238 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5239 </p>
5240 !! end
5241
5242 !! test
5243 T2361: URL within URL, not bracketed
5244 !! wikitext
5245 http://www.example.com/foo?=http://www.example.com/bar
5246 !! html
5247 <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>
5248 </p>
5249 !! end
5250
5251 !! test
5252 T2289: ">"-token in URL-tail
5253 !! wikitext
5254 http://www.example.com/<hello>
5255 !! html
5256 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5257 </p>
5258 !!end
5259
5260 !! test
5261 T2289: literal ">"-token in URL-tail
5262 !! wikitext
5263 http://www.example.com/<b>html</b>
5264 !! html/php
5265 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5266 </p>
5267 !! html/parsoid
5268 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5269 !! end
5270
5271 !! test
5272 T2289: ">"-token in bracketed URL
5273 !! wikitext
5274 [http://www.example.com/<hello> stuff]
5275 !! html
5276 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5277 </p>
5278 !!end
5279
5280 !! test
5281 T2289: literal ">"-token in bracketed URL
5282 !! wikitext
5283 [http://www.example.com/<b>html</b> stuff]
5284 !! html
5285 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5286 </p>
5287 !!end
5288
5289 !! test
5290 T2289: literal double quote at end of URL
5291 !! wikitext
5292 http://www.example.com/"hello"
5293 !! html
5294 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5295 </p>
5296 !!end
5297
5298 !! test
5299 T2289: literal double quote in bracketed URL
5300 !! wikitext
5301 [http://www.example.com/"hello" stuff]
5302 !! html
5303 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5304 </p>
5305 !!end
5306
5307 !! test
5308 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5309 !! wikitext
5310 [http://www.example.com test]
5311 !! html
5312 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5313 </p>
5314 !! end
5315
5316 !! test
5317 External links: link text with spaces
5318 !! wikitext
5319 [http://www.example.com a b c]
5320 [http://www.example.com ''a'' ''b'']
5321 !! html
5322 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5323 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5324 </p>
5325 !! end
5326
5327 !! test
5328 External links: wiki links within external link (T5695)
5329 !! options
5330 parsoid=wt2html,html2html
5331 !! wikitext
5332 [http://example.com [[wikilink]] embedded in ext link]
5333 !! html/php
5334 <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>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5338 !! end
5339
5340 !! test
5341 T2787: Links with one slash after the url protocol are invalid
5342 !! wikitext
5343 http:/example.com
5344
5345 [http:/example.com title]
5346 !! html
5347 <p>http:/example.com
5348 </p><p>[http:/example.com title]
5349 </p>
5350 !! end
5351
5352 !! test
5353 Bracketed external links with template-generated invalid target
5354 !! wikitext
5355 [{{echo|http:/example.com}} title]
5356 !! html
5357 <p>[http:/example.com title]
5358 </p>
5359 !! end
5360
5361 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5362 !! test
5363 Broken wikilinks (but not external links) prevent templates from closing
5364 !! options
5365 parsoid=wt2html
5366 !! wikitext
5367 [http://example.com x
5368
5369 {{echo|[http://example.com x}}
5370
5371 [[Foo
5372
5373 {{echo|[[Foo}}
5374 !! html/php
5375 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5376 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5377 </p><p>[[Foo
5378 </p><p>{{echo|[[Foo}}
5379 </p>
5380 !! html/parsoid
5381 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a> x</p>
5382 <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" href="http://example.com">http://example.com</a> x</p>
5383 <p>[[Foo</p>
5384 <p>{{echo|[[Foo}}</p>
5385 !! end
5386
5387 !! test
5388 Wikilinks with embedded newlines are not broken
5389 !! wikitext
5390 {{echo|[[ Foo
5391 B
5392 C]]}}
5393 !! html/php
5394 <p>[[ Foo
5395 B
5396 C]]
5397 </p>
5398 !! html/parsoid
5399 <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>
5400 !! end
5401
5402 !! test
5403 Broken templates
5404 !! options
5405 parsoid=wt2html
5406 !! wikitext
5407 {{echo|[[Foo|}}]]
5408
5409 [[Foo|{{echo|]]}}
5410 !! html/php
5411 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5412 </p><p>[[Foo|]]
5413 </p>
5414 !! html/parsoid
5415 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5416 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5417 !! end
5418
5419 !! test
5420 T4702: Mismatched <i>, <b> and <a> tags are invalid
5421 !! wikitext
5422 ''[http://example.com text'']
5423 [http://example.com '''text]'''
5424 ''Something [http://example.com in italic'']
5425 ''Something [http://example.com mixed''''', even bold]'''
5426 '''''Now [http://example.com both''''']
5427 !! html
5428 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5429 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5430 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5431 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5432 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5433 </p>
5434 !! end
5435
5436
5437 !! test
5438 T6781: %26 in URL
5439 !! wikitext
5440 http://www.example.com/?title=AT%26T
5441 !! html/php
5442 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5443 </p>
5444 !! html/parsoid
5445 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5446 !! end
5447
5448 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5449 # % is actually legal in HTML5. Any change in output would need testing though.
5450 !! test
5451 T6781, T7267: %25 in URL
5452 !! wikitext
5453 http://www.example.com/?title=100%25_Bran
5454 !! html/php
5455 <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>
5456 </p>
5457 !! html/parsoid
5458 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5459 !! end
5460
5461 !! test
5462 T6781, T7267: %28, %29 in URL
5463 !! wikitext
5464 http://www.example.com/?title=Ben-Hur_%281959_film%29
5465 !! html/php
5466 <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>
5467 </p>
5468 !! html/parsoid
5469 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5470 !! end
5471
5472
5473 !! test
5474 T6781: %26 in autonumber URL
5475 !! wikitext
5476 [http://www.example.com/?title=AT%26T]
5477 !! html/php
5478 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5479 </p>
5480 !! html/parsoid
5481 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5482 !! end
5483
5484 !! test
5485 T6781, T7267: %26 in autonumber URL
5486 !! wikitext
5487 [http://www.example.com/?title=100%25_Bran]
5488 !! html/php
5489 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5490 </p>
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5493 !! end
5494
5495 !! test
5496 T6781, T7267: %28, %29 in autonumber URL
5497 !! wikitext
5498 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5499 !! html/php
5500 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5501 </p>
5502 !! html/parsoid
5503 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5504 !! end
5505
5506
5507 !! test
5508 T6781: %26 in bracketed URL
5509 !! wikitext
5510 [http://www.example.com/?title=AT%26T link]
5511 !! html/php
5512 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5513 </p>
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5516 !! end
5517
5518 !! test
5519 T6781, T7267: %25 in bracketed URL
5520 !! wikitext
5521 [http://www.example.com/?title=100%25_Bran link]
5522 !! html
5523 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5524 </p>
5525 !! end
5526
5527 !! test
5528 T6781, T7267: %28, %29 in bracketed URL
5529 !! wikitext
5530 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5531 !! html/php
5532 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5533 </p>
5534 !! html/parsoid
5535 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5536 !! end
5537
5538 !! test
5539 External link containing a period in the anchor. (T65947)
5540 !! wikitext
5541 [//foo.org/bar#baz. bang]
5542
5543 [//foo.org/bar. bang]
5544 !! html/php
5545 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5546 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5547 </p>
5548 !! html/parsoid
5549 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5550 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5551 !! end
5552
5553 !! test
5554 External link containing a single quote. (T65947)
5555 !! wikitext
5556 [//foo.org/bar'baz]
5557
5558 [//foo.org/bar'baz bang]
5559 !! html/php
5560 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5561 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5562 </p>
5563 !! html/parsoid
5564 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5565 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5566 !! end
5567
5568 !! test
5569 External link containing double-single-quotes in text '' (T6598 sanity check)
5570 !! wikitext
5571 Some [http://example.com/ pretty ''italics'' and stuff]!
5572 !! html
5573 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5574 </p>
5575 !! end
5576
5577 !! test
5578 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5579 !! wikitext
5580 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5581 !! html
5582 <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>
5583 </p>
5584 !! end
5585
5586 !! test
5587 External link containing double-single-quotes with no space separating the url from text in italics
5588 !! wikitext
5589 [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]].]
5590 !! html/php
5591 <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 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>.</a>
5592 </p>
5593 !! html/php+tidy
5594 <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>.</p>
5595 !! html/parsoid
5596 <p><a rel="mw:ExtLink" 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>
5597 !! end
5598
5599 !! test
5600 External link with comments in link text
5601 !! wikitext
5602 [http://www.google.com Google <!-- comment -->]
5603 !! html/php
5604 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5605 </p>
5606 !! html/parsoid
5607 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5608 !! end
5609
5610 !! test
5611 External link to bare IPv4 address
5612 !! wikitext
5613 [http://192.168.0.1 Link]
5614 !! html/php
5615 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5616 </p>
5617 !! html/parsoid
5618 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5619 !! end
5620
5621 !! test
5622 URL-encoding in URL functions (single parameter)
5623 !! wikitext
5624 {{localurl:Some page|amp=&}}
5625 !! html
5626 <p>/index.php?title=Some_page&amp;amp=&amp;
5627 </p>
5628 !! end
5629
5630 !! test
5631 URL-encoding in URL functions (multiple parameters)
5632 !! wikitext
5633 {{localurl:Some page|q=?&amp=&}}
5634 !! html
5635 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5636 </p>
5637 !! end
5638
5639 !! test
5640 Brackets in urls
5641 !! wikitext
5642 http://example.com/index.php?foozoid%5B%5D=bar
5643
5644 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5645 !! html/php
5646 <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>
5647 </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>
5648 </p>
5649 !! html/parsoid
5650 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5651
5652 <p><a rel="mw:ExtLink" 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>
5653 !! end
5654
5655 !! test
5656 IPv6 urls, autolink format (T23261)
5657 !! wikitext
5658 http://[2404:130:0:1000::187:2]/index.php
5659
5660 Examples from RFC 2373, section 2.2:
5661 * http://[1080::8:800:200C:417A]/unicast
5662 * http://[FF01::101]/multicast
5663 * http://[::1]/loopback
5664 * http://[::]/unspecified
5665 * http://[::13.1.68.3]/ipv4compat
5666 * http://[::FFFF:129.144.52.38]/ipv4compat
5667
5668 Examples from RFC 2732, section 2:
5669 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5670 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5671 * http://[3ffe:2a00:100:7031::1]
5672 * http://[1080::8:800:200C:417A]/foo
5673 * http://[::192.9.5.5]/ipng
5674 * http://[::FFFF:129.144.52.38]:80/index.html
5675 * http://[2010:836B:4179::836B:4179]
5676
5677 !! html/php
5678 <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>
5679 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5680 </p>
5681 <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>
5682 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5683 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5684 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5685 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5686 <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>
5687 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5688 </p>
5689 <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>
5690 <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>
5691 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5692 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5693 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5694 <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>
5695 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5696
5697 !! html/parsoid
5698 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5699
5700 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5701 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5702 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5703 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5704 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5705 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5706 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5707
5708 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5709 <ul><li> <a rel="mw:ExtLink" 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>
5710 <li> <a rel="mw:ExtLink" 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>
5711 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5712 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5713 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5714 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5715 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5716 !! end
5717
5718 !! test
5719 IPv6 urls, bracketed format (T23261)
5720 !! wikitext
5721 [http://[2404:130:0:1000::187:2]/index.php test]
5722
5723 Examples from RFC 2373, section 2.2:
5724 * [http://[1080::8:800:200C:417A] unicast]
5725 * [http://[FF01::101] multicast]
5726 * [http://[::1]/ loopback]
5727 * [http://[::] unspecified]
5728 * [http://[::13.1.68.3] ipv4compat]
5729 * [http://[::FFFF:129.144.52.38] ipv4compat]
5730
5731 Examples from RFC 2732, section 2:
5732 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5733 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5734 * [http://[3ffe:2a00:100:7031::1] 3]
5735 * [http://[1080::8:800:200C:417A]/foo 4]
5736 * [http://[::192.9.5.5]/ipng 5]
5737 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5738 * [http://[2010:836B:4179::836B:4179] 7]
5739
5740 !! html/php
5741 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5742 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5743 </p>
5744 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5745 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5746 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5747 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5748 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5749 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5750 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5751 </p>
5752 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5753 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5754 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5755 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5756 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5757 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5758 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5759
5760 !! html/parsoid
5761 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5762
5763 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5764 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5765 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5766 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5767 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5768 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5769 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5770
5771 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5772 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5773 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5774 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5775 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5776 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5777 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5778 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5779 !! end
5780
5781 !! test
5782 Non-extlinks in brackets
5783 !! wikitext
5784 [foo]
5785 [foo bar]
5786 [foo ''bar'']
5787 [fool's] errand
5788 [fool's errand]
5789 [{{echo|foo}}]
5790 [{{echo|foo}} bar]
5791 [{{echo|foo}} ''bar'']
5792 [{{echo|foo}}l's] errand
5793 [{{echo|foo}}l's errand]
5794 [url={{echo|foo}}]
5795 [url=http://example.com]
5796 [http:// bare protocols don't count]
5797 !! html/php
5798 <p>[foo]
5799 [foo bar]
5800 [foo <i>bar</i>]
5801 [fool's] errand
5802 [fool's errand]
5803 [foo]
5804 [foo bar]
5805 [foo <i>bar</i>]
5806 [fool's] errand
5807 [fool's errand]
5808 [url=foo]
5809 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5810 [http:// bare protocols don't count]
5811 </p>
5812 !! html/parsoid
5813 <p>[foo]
5814 [foo bar]
5815 [foo <i>bar</i>]
5816 [fool's] errand
5817 [fool's errand]
5818 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5819 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5820 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5821 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5822 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5823 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5824 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5825 [http:// bare protocols don't count]</p>
5826 !! end
5827
5828 !! test
5829 Percent encoding in external links
5830 !! wikitext
5831 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5832 !! html/php
5833 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5834 </p>
5835 !! html/parsoid
5836 <p><a rel="mw:ExtLink"
5837 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5838 !! end
5839
5840 !! test
5841 Use url link syntax for links where the content is equal the link target
5842 !! wikitext
5843 http://example.com
5844 !! html/php
5845 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5846 </p>
5847 !! html/parsoid
5848 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5849 !! end
5850
5851 !! test
5852 Parenthesis in external links, especially URL links
5853 !! wikitext
5854 http://example.com)
5855
5856 http://example.com/test)
5857
5858 http://example.com/(test)
5859
5860 http://example.com/((test)
5861
5862 (http://example.com/(test))
5863
5864 (http://example.com/(test)))))
5865
5866 http://example.com/a)b
5867
5868 [http://example.com) foo]
5869 !! html/php
5870 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5871 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5872 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5873 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5874 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5875 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5876 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5877 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5878 </p>
5879 !! html/parsoid
5880 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5881 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5882 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5883 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5884 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5885 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5886 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5887 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5888 !! end
5889
5890 !! test
5891 Parenthesis in external links, w/ transclusion or comment
5892 !! wikitext
5893 (http://example.com/{{echo|hi}})
5894
5895 (http://example.com<!-- hi -->)
5896 !! html/php
5897 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5898 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5899 </p>
5900 !! html/parsoid
5901 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" 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>
5902
5903 <p>(<a rel="mw:ExtLink" 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>
5904 !! end
5905
5906 !! test
5907 Serialize <a> tags with invalid link targets as plain text
5908 !! options
5909 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5910 !! html/parsoid
5911 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5912 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5913 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5914 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5915 !! wikitext
5916 text
5917 <nowiki>*</nowiki>text
5918 <nowiki>[[foo]]</nowiki>
5919 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5920 !! end
5921
5922 !! test
5923 mw:ExtLink -vs- mw:WikiLink (T94723)
5924 !! options
5925 parsoid=html2wt
5926 !! html/parsoid
5927 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5928 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5929 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5930 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5931 <p>
5932 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5933 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5934 </p>
5935 !! wikitext
5936 [[Foo|Bar]]
5937 [[Foo|Bar]]
5938 [[wikipedia:Foo|Bar]]
5939 [[wikipedia:Foo|Bar]]
5940
5941 [[wikipedia:European_Robin|European Robin]]
5942 [[wikipedia:European_Robin|European Robin]]
5943 !! end
5944
5945 !! test
5946 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5947 !! options
5948 parsoid=wt2wt
5949 !! wikitext
5950 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5951 !! html/parsoid
5952 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5953 !! end
5954
5955
5956 ###
5957 ### Quotes
5958 ###
5959
5960 !! test
5961 Quotes
5962 !! wikitext
5963 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5964
5965 Normal text. '''''Bold italic text.''''' Normal text.
5966 !! html
5967 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5968 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5969 </p>
5970 !! end
5971
5972
5973 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5974 # parser strips. The wikitext contains just the first half of the bold
5975 # quote pair.
5976 !! test
5977 Unclosed and unmatched quotes
5978 !! wikitext
5979 '''''Bold italic text '''with bold deactivated''' in between.'''''
5980
5981 '''''Bold italic text ''with italic deactivated'' in between.'''''
5982
5983 '''Bold text..
5984
5985 ..spanning two paragraphs (should not work).'''
5986
5987 '''Bold tag left open
5988
5989 ''Italic tag left open
5990
5991 Normal text.
5992
5993 <!-- Unmatching number of opening, closing tags: -->
5994 '''This year''''s election ''should'' beat '''last year''''s.
5995
5996 ''Tom'''s car is bigger than ''Susan'''s.
5997
5998 Plain ''italic'''s plain
5999 !! html/php
6000 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6001 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6002 </p><p><b>Bold text..</b>
6003 </p><p>..spanning two paragraphs (should not work).
6004 </p><p><b>Bold tag left open</b>
6005 </p><p><i>Italic tag left open</i>
6006 </p><p>Normal text.
6007 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6008 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6009 </p><p>Plain <i>italic'</i>s plain
6010 </p>
6011 !! html/parsoid
6012 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6013 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6014 </p><p><b>Bold text..</b>
6015 </p><p>..spanning two paragraphs (should not work).<b></b>
6016 </p><p><b>Bold tag left open</b>
6017 </p><p><i>Italic tag left open</i>
6018 </p><p>Normal text.
6019 </p>
6020 <!-- Unmatching number of opening, closing tags: -->
6021 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6022 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6023 </p><p>Plain <i>italic'</i>s plain
6024 </p>
6025 !! end
6026
6027 ###
6028 ### Tables
6029 ###
6030 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6031 ###
6032
6033 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6034 # is the bare minimum required by the spec, see:
6035 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6036 # Parsoid team replies: empty table tags are legal in HTML5
6037 !! test
6038 A table with no data.
6039 !! options
6040 parsoid=wt2html
6041 !! wikitext
6042 {||}
6043 !! html/php
6044
6045 !! html/parsoid
6046 <table></table>
6047
6048 !! end
6049
6050 !! test
6051 A table with stray table end tags on start tag line (wt2html)
6052 !! options
6053 parsoid=wt2html
6054 !! wikitext
6055 {|style="color: red;"|}
6056
6057 {|style="color: red;" |}
6058 |foo
6059 |}
6060
6061 {|style="color: red;"|} id="foo"
6062 |foo
6063 |}
6064
6065 {|style="color: red;" |} id="foo"
6066 |foo
6067 |}
6068 !! html
6069 <table style="color: red;"></table>
6070
6071 <table style="color: red;">
6072 <tbody><tr>
6073 <td>foo</td>
6074 </tr></tbody>
6075 </table>
6076
6077 <table style="color: red;" id="foo">
6078 <tbody><tr>
6079 <td>foo</td>
6080 </tr></tbody>
6081 </table>
6082
6083 <table style="color: red;" id="foo">
6084 <tbody><tr>
6085 <td>foo</td>
6086 </tr></tbody>
6087 </table>
6088
6089 !! end
6090
6091 !! test
6092 A table with no data (take 2)
6093 !! wikitext
6094 {|
6095 |}
6096 !! html/parsoid
6097 <table></table>
6098 !! end
6099
6100 # A table with nothing but a caption is invalid XHTML, we might want to render
6101 # this as <p>caption</p>
6102 # Parsoid team replies: table with only a caption is legal in HTML5
6103 !! test
6104 A table with nothing but a caption
6105 !! wikitext
6106 {|
6107 |+ caption
6108 |}
6109 !! html/php
6110 <table>
6111 <caption> caption
6112 </caption><tr><td></td></tr></table>
6113
6114 !! html/parsoid
6115 <table><caption> caption</caption></table>
6116 !! end
6117
6118 !! test
6119 A table with caption with default-spaced attributes and a table row
6120 !! wikitext
6121 {|
6122 |+ style="color: red;" | caption1
6123 |-
6124 | foo
6125 |}
6126 !! html
6127 <table>
6128 <caption style="color: red;"> caption1
6129 </caption>
6130 <tr>
6131 <td> foo
6132 </td></tr></table>
6133
6134 !! end
6135
6136 !! test
6137 A table with captions with non-default spaced attributes and a table row
6138 !! wikitext
6139 {|
6140 |+style="color: red;"|caption2
6141 |+ style="color: red;"| caption3
6142 |-
6143 | foo
6144 |}
6145 !! html
6146 <table>
6147 <caption style="color: red;">caption2
6148 </caption>
6149 <caption style="color: red;"> caption3
6150 </caption>
6151 <tr>
6152 <td> foo
6153 </td></tr></table>
6154
6155 !! end
6156
6157 !! test
6158 Table td-cell syntax variations
6159 !! wikitext
6160 {|
6161 | foo bar foo | baz
6162 | foo bar foo || baz
6163 | style='color:red;' | baz
6164 | style='color:red;' || baz
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <td> baz
6170 </td>
6171 <td> foo bar foo </td>
6172 <td> baz
6173 </td>
6174 <td style="color:red;"> baz
6175 </td>
6176 <td> style='color:red;' </td>
6177 <td> baz
6178 </td></tr></table>
6179
6180 !! end
6181
6182 !! test
6183 Simple table
6184 !! wikitext
6185 {|
6186 | 1 || 2
6187 |-
6188 | 3 || 4
6189 |}
6190 !! html
6191 <table>
6192 <tr>
6193 <td> 1 </td>
6194 <td> 2
6195 </td></tr>
6196 <tr>
6197 <td> 3 </td>
6198 <td> 4
6199 </td></tr></table>
6200
6201 !! end
6202
6203 !! test
6204 Simple table but with multiple dashes for row wikitext
6205 !! wikitext
6206 {|
6207 | foo
6208 |-----
6209 | bar
6210 |}
6211 !! html
6212 <table>
6213 <tr>
6214 <td> foo
6215 </td></tr>
6216 <tr>
6217 <td> bar
6218 </td></tr></table>
6219
6220 !! end
6221
6222 !! test
6223 Multiplication table
6224 !! wikitext
6225 {| border="1" cellpadding="2"
6226 |+Multiplication table
6227 |-
6228 ! &times; !! 1 !! 2 !! 3
6229 |-
6230 ! 1
6231 | 1 || 2 || 3
6232 |-
6233 ! 2
6234 | 2 || 4 || 6
6235 |-
6236 ! 3
6237 | 3 || 6 || 9
6238 |-
6239 ! 4
6240 | 4 || 8 || 12
6241 |-
6242 ! 5
6243 | 5 || 10 || 15
6244 |}
6245 !! html
6246 <table border="1" cellpadding="2">
6247 <caption>Multiplication table
6248 </caption>
6249 <tr>
6250 <th> &#215; </th>
6251 <th> 1 </th>
6252 <th> 2 </th>
6253 <th> 3
6254 </th></tr>
6255 <tr>
6256 <th> 1
6257 </th>
6258 <td> 1 </td>
6259 <td> 2 </td>
6260 <td> 3
6261 </td></tr>
6262 <tr>
6263 <th> 2
6264 </th>
6265 <td> 2 </td>
6266 <td> 4 </td>
6267 <td> 6
6268 </td></tr>
6269 <tr>
6270 <th> 3
6271 </th>
6272 <td> 3 </td>
6273 <td> 6 </td>
6274 <td> 9
6275 </td></tr>
6276 <tr>
6277 <th> 4
6278 </th>
6279 <td> 4 </td>
6280 <td> 8 </td>
6281 <td> 12
6282 </td></tr>
6283 <tr>
6284 <th> 5
6285 </th>
6286 <td> 5 </td>
6287 <td> 10 </td>
6288 <td> 15
6289 </td></tr></table>
6290
6291 !! end
6292
6293 !! test
6294 Accept "||" in table headings
6295 !! wikitext
6296 {|
6297 !h1 || h2
6298 |}
6299 !! html
6300 <table>
6301 <tr>
6302 <th>h1 </th>
6303 <th> h2
6304 </th></tr></table>
6305
6306 !! end
6307
6308 !! test
6309 Accept "!!" in table data
6310 !! wikitext
6311 {|
6312 | Foo!! ||
6313 |}
6314 !! html
6315 <table>
6316 <tr>
6317 <td> Foo!! </td>
6318 <td>
6319 </td></tr></table>
6320
6321 !! html/parsoid
6322 <table>
6323 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6324 </tbody></table>
6325 !! end
6326
6327 !! test
6328 Accept "||" in indented table headings
6329 !! wikitext
6330 :{|
6331 !h1 || h2
6332 |}
6333 !! html
6334 <dl><dd><table>
6335 <tr>
6336 <th>h1 </th>
6337 <th> h2
6338 </th></tr></table></dd></dl>
6339
6340 !! end
6341
6342 !! test
6343 Accept "!!" in templates
6344 !! wikitext
6345 {|
6346 !a {{echo|b!!c}}
6347 |}
6348 !! html/php
6349 <table>
6350 <tr>
6351 <th>a b</th>
6352 <th>c
6353 </th></tr></table>
6354
6355 !! html/parsoid
6356 <table>
6357 <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>
6358 !! end
6359
6360 !! test
6361 Accept "!!" in table headings after newline
6362 !! wikitext
6363 {|
6364 !a
6365 b!!c
6366 |}
6367 !! html/php
6368 <table>
6369 <tr>
6370 <th>a
6371 <p>b!!c
6372 </p>
6373 </th></tr></table>
6374
6375 !! html/parsoid
6376 <table>
6377 <tbody><tr><th>a
6378 <p>b!!c</p></th></tr>
6379 </tbody></table>
6380 !! end
6381
6382 !! test
6383 Accept "!!" in table data of mixed wikitext / html syntax
6384 !! wikitext
6385 {|
6386 !a
6387 <tr><td>b!!c</td></tr>
6388 |}
6389 !! html+tidy
6390 <table>
6391 <tr>
6392 <th>a</th>
6393 </tr>
6394 <tr>
6395 <td>b!!c</td>
6396 </tr>
6397 </table>
6398 !! html/parsoid
6399 <table>
6400 <tbody><tr><th>a</th></tr>
6401 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6402 </tbody></table>
6403 !! end
6404
6405 !! test
6406 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6407 !! wikitext
6408 {|
6409 !| h1
6410 || a
6411 |}
6412 !! html
6413 <table>
6414 <tr>
6415 <th> h1
6416 </th>
6417 <td> a
6418 </td></tr></table>
6419
6420 !! end
6421
6422 !!test
6423 Accept "| !" at start of line in tables (ignore !-attribute)
6424 !! wikitext
6425 {|
6426 |-
6427 | !style="color:red" | bar
6428 |}
6429 !! html
6430 <table>
6431
6432 <tr>
6433 <td> bar
6434 </td></tr></table>
6435
6436 !!end
6437
6438 !!test
6439 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 +/-
6440 !! wikitext
6441 {|
6442 |-
6443 |style='color:red;'|+1
6444 |style='color:blue;'|-1
6445 |-
6446 | 1 || 2 || 3
6447 | 1 ||+2 ||-3
6448 |-
6449 | +1
6450 | -1
6451 |}
6452 !! html
6453 <table>
6454
6455 <tr>
6456 <td style="color:red;">+1
6457 </td>
6458 <td style="color:blue;">-1
6459 </td></tr>
6460 <tr>
6461 <td> 1 </td>
6462 <td> 2 </td>
6463 <td> 3
6464 </td>
6465 <td> 1 </td>
6466 <td>+2 </td>
6467 <td>-3
6468 </td></tr>
6469 <tr>
6470 <td> +1
6471 </td>
6472 <td> -1
6473 </td></tr></table>
6474
6475 !!end
6476
6477 !! test
6478 Table rowspan
6479 !! wikitext
6480 {| border=1
6481 | Cell 1, row 1
6482 |rowspan=2| Cell 2, row 1 (and 2)
6483 | Cell 3, row 1
6484 |-
6485 | Cell 1, row 2
6486 | Cell 3, row 2
6487 |}
6488 !! html
6489 <table border="1">
6490 <tr>
6491 <td> Cell 1, row 1
6492 </td>
6493 <td rowspan="2"> Cell 2, row 1 (and 2)
6494 </td>
6495 <td> Cell 3, row 1
6496 </td></tr>
6497 <tr>
6498 <td> Cell 1, row 2
6499 </td>
6500 <td> Cell 3, row 2
6501 </td></tr></table>
6502
6503 !! end
6504
6505 !! test
6506 Nested table
6507 !! wikitext
6508 {| border=1
6509 | &alpha;
6510 |
6511 {| bgcolor=#ABCDEF border=2
6512 |nested
6513 |-
6514 |table
6515 |}
6516 |the original table again
6517 |}
6518 !! html
6519 <table border="1">
6520 <tr>
6521 <td> &#945;
6522 </td>
6523 <td>
6524 <table bgcolor="#ABCDEF" border="2">
6525 <tr>
6526 <td>nested
6527 </td></tr>
6528 <tr>
6529 <td>table
6530 </td></tr></table>
6531 </td>
6532 <td>the original table again
6533 </td></tr></table>
6534
6535 !! end
6536
6537 !! test
6538 Invalid attributes in table cell (T3830)
6539 !! wikitext
6540 {|
6541 |Cell:|broken
6542 |}
6543 !! html
6544 <table>
6545 <tr>
6546 <td>broken
6547 </td></tr></table>
6548
6549 !! end
6550
6551 !! test
6552 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6553 !! wikitext
6554 {|
6555 | title="foo" |bar
6556 | title="foo<nowiki>|</nowiki>" |bar
6557 | title="foo<nowiki>|</nowiki>" bar
6558 |}
6559 !! html/php
6560 <table>
6561 <tr>
6562 <td title="foo">bar
6563 </td>
6564 <td title="foo&#124;">bar
6565 </td>
6566 <td> title="foo|" bar
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table>
6571 <tbody><tr><td title="foo">bar</td>
6572 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6573 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6574 </tbody></table>
6575 !! end
6576
6577 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6578 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6579 # *2wt modes will fail.
6580 !! test
6581 Table security: embedded pipes
6582 !! options
6583 parsoid=wt2html,html2html
6584 !! wikitext
6585 {|
6586 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6587 !! html/php
6588 <table>
6589 <tr>
6590 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6591 <td>]" onmouseover="alert(document.cookie)"&gt;test
6592 </td>
6593 </tr>
6594 </table>
6595
6596 !! html/parsoid
6597 <table><tbody>
6598 <tr>
6599 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6600 !! end
6601
6602 !! test
6603 Element attributes with double ! should not be broken up by <th>
6604 !! wikitext
6605 {|
6606 ! hi <div class="!!">ha</div> ho
6607 |}
6608 !! html/php
6609 <table>
6610 <tr>
6611 <th> hi <div class="!!">ha</div> ho
6612 </th></tr></table>
6613
6614 !! html/parsoid
6615 <table>
6616 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6617 </tbody></table>
6618 !! end
6619
6620 !! test
6621 ! and || in element attributes should not be parsed as <th>/<td>
6622 !! wikitext
6623 {|
6624 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6625 |}
6626 !! html/php
6627 <table>
6628 <tr>
6629 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6630 </td></tr></table>
6631
6632 !! html/parsoid
6633 <table>
6634 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6635 </tbody></table>
6636 !! end
6637
6638 # FIXME: The output seems broken. Filed as T110268.
6639 !! test
6640 ! and || in td attributes should not be parsed as <th>/<td>
6641 !! options
6642 parsoid=wt2html
6643 !! wikitext
6644 {|
6645 | style="color: red !important;" data-contrived="put this here ||" | foo
6646 |}
6647 !! html/php
6648 <table>
6649 <tr>
6650 <td> style="color: red !important;" data-contrived="put this here </td>
6651 <td> foo
6652 </td></tr></table>
6653
6654 !! html/parsoid
6655 <table>
6656 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6657 </tbody></table>
6658 !! end
6659
6660 !! test
6661 Break on | in element attribute in template
6662 !! options
6663 parsoid=wt2html,html2html
6664 !! wikitext
6665 {{echo|1=<div class="hi|ho">ha</div>}}
6666 !! html/php
6667 <p>ho"&gt;ha&lt;/div&gt;
6668 </p>
6669 !! html/parsoid
6670 <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>
6671 !! end
6672
6673 !! test
6674 Break on | in element attribute name in template
6675 !! wikitext
6676 {{echo|<div cla|ss="hiho">ha</div>}}
6677 !! html/parsoid
6678 <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>
6679 !! end
6680
6681 !! test
6682 Don't break on | in extension attribute in template
6683 !! wikitext
6684 {{echo|<ref name="hi|ho">ha</ref>}}
6685
6686 <references />
6687 !! html/parsoid
6688 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' 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.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6689
6690 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6691 !! end
6692
6693 ## We don't support roundtripping of these attributes in Parsoid.
6694 ## Selective serialization takes care of preventing dirty diffs.
6695 ## But, on edits, we dirty-diff the invalid attribute text.
6696 !! test
6697 Invalid text in table attributes should be discarded
6698 !! options
6699 parsoid=wt2html
6700 !! wikitext
6701 {| <span>boo</span> style='border:1px solid black'
6702 | <span>boo</span> style='color:blue' | 1
6703 |<span>boo</span> style='color:blue'| 2
6704 |}
6705 !! html/php
6706 <table style="border:1px solid black">
6707 <tr>
6708 <td style="color:blue"> 1
6709 </td>
6710 <td style="color:blue"> 2
6711 </td></tr></table>
6712
6713 !! html/parsoid
6714 <table style="border:1px solid black">
6715 <tr>
6716 <td style="color:blue"> 1</td>
6717 <td style="color:blue"> 2</td>
6718 </tr>
6719 </table>
6720 !! end
6721
6722 !! test
6723 Invalid text in table attributes should be preserved by selective serializer
6724 !! options
6725 parsoid={
6726 "modes": ["selser"],
6727 "changes": [
6728 ["td:first-child", "text", "abc"],
6729 ["td + td", "text", "xyz"]
6730 ]
6731 }
6732 !! wikitext
6733 {| <span>boo</span> style='border:1px solid black'
6734 | <span>boo</span> style='color:blue' | 1
6735 |<span>boo</span> style='color:blue'| 2
6736 |}
6737 !! wikitext/edited
6738 {| <span>boo</span> style='border:1px solid black'
6739 | <span>boo</span> style='color:blue' |abc
6740 |<span>boo</span> style='color:blue'|xyz
6741 |}
6742 !! end
6743
6744 !! test
6745 1. Template-generated table cell attributes and cell content
6746 !! wikitext
6747 {|
6748 |{{table_attribs}}
6749 | {{table_attribs}}
6750 || {{table_attribs_5}}
6751 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6752 |align=center {{table_attribs}}
6753 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6754 |}
6755 !! html
6756 <table>
6757 <tr>
6758 <td style="color:red;">Foo
6759 </td>
6760 <td style="color:red;">Foo
6761 </td>
6762 <td> style="color:red;"</td>
6763 <td>Bar
6764 </td>
6765 <td style="color:red;">Foo
6766 </td>
6767 <td align="center" style="color:red;">Foo
6768 </td>
6769 <td align="center" style="color:red;">Foo
6770 </td></tr></table>
6771
6772 !! end
6773
6774 !! test
6775 2. Template-generated table cell attributes and cell content
6776 !! wikitext
6777 {|
6778 |{{table_attribs_2}}
6779 |}
6780 !! html/php
6781 <table>
6782 <tr>
6783 <td style="color:red;">Foo
6784 </td>
6785 <td>Bar</td>
6786 <td>Baz
6787 </td></tr></table>
6788
6789 !! html/parsoid
6790 <table>
6791 <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>
6792 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6793 </tbody></table>
6794 !! end
6795
6796 !! test
6797 3. Template-generated table cell attributes and cell content
6798 !! wikitext
6799 {|
6800 !align=center {{table_header_cells}}
6801 |-
6802 |align=center {{table_cells}}
6803 |}
6804 !! html/php
6805 <table>
6806 <tr>
6807 <th align="center" style="color:red;">Foo</th>
6808 <th style="color:red;"><i>Bar</i></th>
6809 <th style="color:brown;"><i>Foo</i> and Baz
6810 </th></tr>
6811 <tr>
6812 <td align="center" style="color:red;">Foo</td>
6813 <td style="color:red;"><i>Bar</i></td>
6814 <td style="color:brown;"><i>Foo</i> and Baz
6815 </td></tr></table>
6816
6817 !! html/parsoid
6818 <table>
6819 <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>
6820 <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>
6821 </tbody></table>
6822 !! end
6823
6824 !! test
6825 4. Template-generated table cell attributes and cell content inside a templated table
6826 !! wikitext
6827 {{tbl-start}}
6828 !align=center {{table_header_cells}}
6829 |-
6830 |align=center {{table_cells}}
6831 {{tbl-end}}
6832 !! html/php
6833 <table>
6834 <tr>
6835 <th align="center" style="color:red;">Foo</th>
6836 <th style="color:red;"><i>Bar</i></th>
6837 <th style="color:brown;"><i>Foo</i> and Baz
6838 </th></tr>
6839 <tr>
6840 <td align="center" style="color:red;">Foo</td>
6841 <td style="color:red;"><i>Bar</i></td>
6842 <td style="color:brown;"><i>Foo</i> and Baz
6843 </td></tr></table>
6844
6845 !! html/parsoid
6846 <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}}]}'>
6847 <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>
6848 <tr>
6849 <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>
6850 </tbody></table>
6851 !! end
6852
6853 ## Edge case fix to prevent future regressions
6854 !! test
6855 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6856 !! wikitext
6857 {|
6858 |{{table_attribs_7}}
6859 |}
6860 <references />
6861 !! html/parsoid
6862 <table>
6863 <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<span class="mw-ref" id="cite_ref-1" rel="dc:references" 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></span></td></tr>
6864 </tbody></table>
6865 <ol class="mw-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>
6866 !! end
6867
6868 !! test
6869 Table with row followed by newlines and table heading
6870 !! options
6871 parsoid=wt2html,html2html
6872 !! wikitext
6873 {|
6874 |-
6875
6876 ! foo
6877 |}
6878 !! html/*
6879 <table>
6880
6881
6882 <tr>
6883 <th> foo
6884 </th></tr></table>
6885
6886 !! end
6887
6888 !! test
6889 Table with empty line following the start tag
6890 !! options
6891 parsoid=wt2html,html2html
6892 !! wikitext
6893 {|
6894
6895 |-
6896 | foo
6897 |}
6898 !! html/*
6899 <table>
6900
6901
6902 <tr>
6903 <td> foo
6904 </td></tr></table>
6905
6906 !! end
6907
6908 !! test
6909 Table attributes with empty value
6910 !! options
6911 parsoid=wt2html,html2html
6912 !! wikitext
6913 {|
6914 | style=| hello
6915 |}
6916 !! html/php
6917 <table>
6918 <tr>
6919 <td style=""> hello
6920 </td></tr></table>
6921
6922 !! html/parsoid
6923 <table>
6924 <tbody><tr><td style=""> hello</td></tr>
6925 </tbody></table>
6926 !! end
6927
6928 !! test
6929 Wikitext table with a lot of comments
6930 !! wikitext
6931 {|
6932 <!-- c0 -->
6933 | foo
6934 <!-- c1 -->
6935 |-<!-- c2 -->
6936 <!-- c3 -->
6937 |<!-- c4 -->
6938 <!-- c5 -->
6939 |}
6940 !! html
6941 <table>
6942 <tr>
6943 <td> foo
6944 </td></tr>
6945 <tr>
6946 <td>
6947 </td></tr></table>
6948
6949 !! end
6950
6951 !! test
6952 Wikitext table comments represented in parsoid dom
6953 !! wikitext
6954 {|<!--c1--><!--c2-->
6955 |-<!--c3-->
6956 | x
6957 |}
6958 !! html/php+tidy
6959 <table>
6960 <tr>
6961 <td>x</td>
6962 </tr>
6963 </table>
6964 !! html/parsoid
6965 <table><!--c1--><!--c2-->
6966 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6967 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6968 </tbody></table>
6969 !! end
6970
6971 !! test
6972 Wikitext table with double-line table cell
6973 !! wikitext
6974 {|
6975 |a
6976 b
6977 |}
6978 !! html
6979 <table>
6980 <tr>
6981 <td>a
6982 <p>b
6983 </p>
6984 </td></tr></table>
6985
6986 !! end
6987
6988 !! test
6989 Table cell with a single comment
6990 !! wikitext
6991 {|
6992 | <!-- c1 -->
6993 | a
6994 |}
6995 !! html
6996 <table>
6997 <tr>
6998 <td>
6999 </td>
7000 <td> a
7001 </td></tr></table>
7002
7003 !! end
7004
7005 !! test
7006 Table-cell after a comment-only-empty-line
7007 !! wikitext
7008 {|
7009 |a
7010 <!--c1-->
7011 <!--c2-->| b
7012 |}
7013 !! html
7014 <table>
7015 <tr>
7016 <td>a
7017 </td>
7018 <td> b
7019 </td></tr></table>
7020
7021 !! html/parsoid
7022 <table>
7023 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7024 <!--c1-->
7025 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
7026 </tbody></table>
7027
7028 !! end
7029
7030 !! test
7031 Build table with {{!}}
7032 !! wikitext
7033 {{{!}} class="wikitable"
7034 ! header
7035 ! second header
7036 {{!}}- style="color:red;"
7037 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
7038 {{!}}}
7039 !! html
7040 <table class="wikitable">
7041 <tr>
7042 <th> header
7043 </th>
7044 <th> second header
7045 </th></tr>
7046 <tr style="color:red;">
7047 <td> data </td>
7048 <td style="color:red;"> second data
7049 </td></tr></table>
7050
7051 !! end
7052
7053 !! test
7054 Build table with pipe as data
7055 !! wikitext
7056 {| class="wikitable"
7057 ! header
7058 ! second header
7059 |- style="color:red;"
7060 | data || style="color:red;" | second data
7061 |-
7062 | style="color:red;" | data with | || style="color:red;" | second data with |
7063 |-
7064 || data with | ||| second data with |
7065 |}
7066 !! html
7067 <table class="wikitable">
7068 <tr>
7069 <th> header
7070 </th>
7071 <th> second header
7072 </th></tr>
7073 <tr style="color:red;">
7074 <td> data </td>
7075 <td style="color:red;"> second data
7076 </td></tr>
7077 <tr>
7078 <td style="color:red;"> data with | </td>
7079 <td style="color:red;"> second data with |
7080 </td></tr>
7081 <tr>
7082 <td> data with | </td>
7083 <td> second data with |
7084 </td></tr></table>
7085
7086 !! end
7087
7088 !! test
7089 Build table with wikilink
7090 !! wikitext
7091 {| class="wikitable"
7092 ! header || second header
7093 |- style="color:red;"
7094 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
7095 |-
7096 | data || second data [[Main Page|link|text with pipe]]
7097 |}
7098 !! html
7099 <table class="wikitable">
7100 <tr>
7101 <th> header </th>
7102 <th> second header
7103 </th></tr>
7104 <tr style="color:red;">
7105 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
7106 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7107 </td></tr>
7108 <tr>
7109 <td> data </td>
7110 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7111 </td></tr></table>
7112
7113 !! end
7114
7115 # The expected HTML structure in this test is debatable. The PHP parser does
7116 # not parse this kind of table at all. The main focus for Parsoid is on
7117 # round-tripping, so this output is ok for now. TODO: revisit!
7118 !! test
7119 Wikitext table with html-syntax row
7120 !! wikitext
7121 {|
7122 |-
7123 <td>foo</td>
7124 |}
7125 !! html/parsoid
7126 <table>
7127 <tbody>
7128 <tr>
7129 <td>foo</td></tr></tbody></table>
7130 !! end
7131
7132 !! test
7133 Implicit <td> after a |-
7134 !! options
7135 parsoid=wt2html,html2html
7136 !! wikitext
7137 {|
7138 |-
7139 a
7140 |}
7141 !! html/php
7142 <table>
7143
7144 a
7145 </table>
7146
7147 !! html/php+tidy
7148 <p>a</p>
7149 !! html/parsoid
7150 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7151 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7152
7153 </tr></tbody></table>
7154 !! end
7155
7156 !! test
7157 Lists should be recognized in an implicit <td> context
7158 !! options
7159 parsoid=wt2html,html2html
7160 !! wikitext
7161 {|
7162 |-
7163 *a
7164 |}
7165 !! html/php
7166 <table>
7167
7168 <ul><li>a</li></ul>
7169 </table>
7170
7171 !! html/php+tidy
7172 <ul>
7173 <li>a</li>
7174 </ul>
7175 !! html/parsoid
7176 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7177 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7178
7179 </tr></tbody></table>
7180 !! end
7181
7182 !! test
7183 Table cells not properly parsed in an implicit-td context
7184 !! wikitext
7185 {|
7186 |-
7187 {{table_attribs_4}} || a || b
7188 |}
7189 !! html/php+tidy
7190 <table>
7191 <tr>
7192 <td style="background-color:#DC241f;" width="10px"></td>
7193 <td>a</td>
7194 <td>b</td>
7195 </tr>
7196 </table>
7197 !! html/parsoid
7198 <table>
7199 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7200 <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>
7201 !! end
7202
7203 !! test
7204 Parsoid: Round-trip tables directly followed by content (T53219)
7205 !! options
7206 parsoid=wt2html,wt2wt
7207 !! wikitext
7208 {|
7209 |foo
7210 |} bar
7211
7212 {|
7213 |baz
7214 |}<b>quux</b>
7215 !! html+tidy
7216 <table>
7217 <tr>
7218 <td>foo</td>
7219 </tr>
7220 </table>
7221 <p>bar</p>
7222 <table>
7223 <tr>
7224 <td>baz</td>
7225 </tr>
7226 </table>
7227 <p><b>quux</b></p>
7228 !! end
7229
7230 !! test
7231 Parsoid: Default to a newline after tables in new content (T53219)
7232 !! options
7233 parsoid=html2wt
7234 !! html/parsoid
7235 <table><tbody>
7236 <tr><td>foo</td></tr></tbody></table> bar
7237 <table><tbody>
7238 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7239 !! wikitext
7240 {|
7241 |foo
7242 |}
7243 <nowiki> </nowiki>bar
7244 {|
7245 |baz
7246 |}
7247 '''quux'''
7248 !! end
7249
7250 !! test
7251 Parsoid: newline inducing block nodes don't suppress <nowiki>
7252 !! options
7253 parsoid=html2wt
7254 !! html/parsoid
7255 a<h1>foo</h1>
7256 !! wikitext
7257 <nowiki> </nowiki>a
7258
7259 = foo =
7260 !! end
7261
7262 !! test
7263 Parsoid: Row-syntax table headings followed by comment & table cells
7264 !! options
7265 parsoid=wt2html,wt2wt
7266 !! wikitext
7267 {|
7268 ! foo || bar
7269 <!-- foo --> || baz || quux
7270 |}
7271 !! html/php
7272 <table>
7273 <tr>
7274 <th> foo </th>
7275 <th> bar
7276 </th>
7277 <td> baz </td>
7278 <td> quux
7279 </td></tr></table>
7280
7281 !! html/parsoid
7282 <table>
7283 <tbody><tr><th> foo </th><th> bar
7284 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7285 </tbody></table>
7286 !! end
7287
7288 !!test
7289 Parsoid: Recover better from broken table attributes
7290 !!options
7291 parsoid=wt2html
7292 !!wikitext
7293 {| class="foo
7294 | class="bar" |
7295 foo
7296 |}
7297 !!html/php+tidy
7298 <table class="foo">
7299 <tr>
7300 <td class="bar">
7301 <p>foo</p>
7302 </td>
7303 </tr>
7304 </table>
7305 !!html/parsoid
7306 <table class="foo">
7307 <tr>
7308 <td class="bar">
7309 <p>foo</p></td></tr>
7310 </tbody></table>
7311 !!end
7312
7313 !! test
7314 Tables: Digest broken attributes on table and tr tag
7315 !! options
7316 parsoid=wt2html
7317 !! wikitext
7318 {| || |} ++
7319 |- || || ++ --
7320 |- > [
7321 |}
7322 !! html
7323 <table>
7324 <tbody>
7325 <tr></tr>
7326 <tr></tr>
7327 </tbody></table>
7328 !! end
7329
7330 # T137406: Whitespace in the HTML
7331 !! test
7332 1. Generate correct wikitext for tables with thead/tbody/tfoot
7333 !! options
7334 parsoid=html2wt
7335 !! html/parsoid
7336 <table>
7337 <caption>Test</caption>
7338 <thead>
7339 <tr>
7340 <th>Month</th>
7341 <th>Savings</th>
7342 </tr>
7343 </thead>
7344 <tbody>
7345 <tr>
7346 <td>January</td>
7347 <td>$100</td>
7348 </tr>
7349 <tr>
7350 <td>February</td>
7351 <td>$80</td>
7352 </tr>
7353 </tbody>
7354 <tfoot>
7355 <tr>
7356 <td>Sum</td>
7357 <td>$180</td>
7358 </tr>
7359 </tfoot>
7360 </table>
7361 !! wikitext
7362 {|
7363 |+Test
7364 !Month
7365 !Savings
7366 |-
7367 |January
7368 |$100
7369 |-
7370 |February
7371 |$80
7372 |-
7373 |Sum
7374 |$180
7375 |}
7376 !! html/php+tidy
7377 <table>
7378 <caption>Test</caption>
7379 <tr>
7380 <th>Month</th>
7381 <th>Savings</th>
7382 </tr>
7383 <tr>
7384 <td>January</td>
7385 <td>$100</td>
7386 </tr>
7387 <tr>
7388 <td>February</td>
7389 <td>$80</td>
7390 </tr>
7391 <tr>
7392 <td>Sum</td>
7393 <td>$180</td>
7394 </tr>
7395 </table>
7396 !! end
7397
7398 # T137406: No whitespace in the HTML
7399 !! test
7400 2. Generate correct wikitext for tables with thead/tbody/tfoot
7401 !! options
7402 parsoid=html2wt
7403 !! html/parsoid
7404 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7405 !! wikitext
7406 {|
7407 !heading
7408 |-
7409 |foo
7410 |}
7411 !! end
7412
7413 !! test
7414 Testing serialization after deletion in references
7415 !! options
7416 parsoid={
7417 "modes": ["wt2wt"],
7418 "changes": [
7419 ["#x", "remove"]
7420 ]
7421 }
7422 !! wikitext
7423 hi <ref><div id="x">ho</div></ref>
7424
7425 <references />
7426 !! wikitext/edited
7427 hi <ref></ref>
7428
7429 <references />
7430 !! end
7431
7432 !!test
7433 Testing serialization after deletion of table cells
7434 !!options
7435 parsoid={
7436 "modes": ["wt2wt", "selser"],
7437 "changes": [
7438 ["#x", "remove"]
7439 ]
7440 }
7441 !!wikitext
7442 {|
7443 !h1 !!h2 !!h3
7444 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7445 |}
7446 !! wikitext/edited
7447 {|
7448 !h1 !!h2 !!h3
7449 |c2 |||c3
7450 |}
7451 !!end
7452
7453 !! test
7454 Testing selser after addition of new row before first row (T125419)
7455 !! options
7456 parsoid={
7457 "modes": ["wt2wt", "selser"],
7458 "changes": [
7459 [ "tr", "before", "<tr><td>X</td></tr>" ]
7460 ]
7461 }
7462 !! wikitext
7463 {|
7464 |a
7465 |}
7466 !! wikitext/edited
7467 {|
7468 |X
7469 |-
7470 |a
7471 |}
7472 !! end
7473
7474 !! test
7475 Serialize new table rows in a HTML table using HTML tags
7476 !! options
7477 parsoid={
7478 "modes": ["wt2wt", "selser"],
7479 "changes": [
7480 [ "tr", "before", "<tr><td>X</td></tr>" ]
7481 ]
7482 }
7483 !! wikitext
7484 <table><tr><td>a</td></tr></table>
7485 !! wikitext/edited
7486 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7487 !! end
7488
7489 !! test
7490 Serialize new table cells in a HTML row using HTML tags
7491 !! options
7492 parsoid={
7493 "modes": ["wt2wt", "selser"],
7494 "changes": [
7495 [ "td", "before", "<td>X</td>" ]
7496 ]
7497 }
7498 !! wikitext
7499 <table><tr><td>a</td></tr></table>
7500 !! wikitext/edited
7501 <table><tr><td>X</td><td>a</td></tr></table>
7502 !! end
7503
7504 !! test
7505 Wikitext tables can be nested inside HTML tables
7506 !! options
7507 parsoid=html2wt
7508 !! html
7509 <table data-parsoid='{"stx":"html"}'>
7510 <tr><td>
7511 <table>
7512 <tr><td>foo</td></tr>
7513 </table>
7514 </td></tr>
7515 </table>
7516 !! wikitext
7517 <table>
7518 <tr><td>
7519 {|
7520 |foo
7521 |}
7522 </td></tr>
7523 </table>
7524 !! end
7525
7526 !! test
7527 Serialize wikitext list items as HTML list items when embedded in a HTML list
7528 !! options
7529 parsoid=html2wt
7530 !! html
7531 <ul data-parsoid='{"stx": "html"}'>
7532 <li data-parsoid='{}'>a</li>
7533 <li>b</li>
7534 </ul>
7535 !! wikitext
7536 <ul>
7537 <li>a</li>
7538 <li>b</li>
7539 </ul>
7540 !! end
7541
7542 # SSS FIXME: Is this actually a good thing given the
7543 # odd nested list output that is generated by MW?
7544 # <ul><li>foo<ul>..</ul></li></ul> instead of
7545 # <ul><li>foo</li><ul>..</ul></ul>
7546 !! test
7547 Wikitext lists can be nested inside HTML lists
7548 !! options
7549 parsoid=html2wt
7550 !! html
7551 <ul data-parsoid='{"stx": "html"}'>
7552 <li data-parsoid='{"stx": "html"}'>a
7553 <ul><li>b</li></ul>
7554 </li>
7555 </ul>
7556
7557 <ul data-parsoid='{"stx": "html"}'>
7558 <li>x
7559 <ul><li>y</li></ul>
7560 </li>
7561 </ul>
7562 !! wikitext
7563 <ul>
7564 <li>a
7565 * b
7566 </li>
7567 </ul>
7568
7569 <ul>
7570 <li>x
7571 * y
7572 </li>
7573 </ul>
7574 !! end
7575
7576 ###
7577 ### Internal links
7578 ###
7579 !! test
7580 Plain link, capitalized
7581 !! wikitext
7582 [[Main Page]]
7583 !! html
7584 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7585 </p>
7586 !! end
7587
7588 !! test
7589 Plain link, uncapitalized
7590 !! wikitext
7591 [[main Page]]
7592 !! html
7593 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7594 </p>
7595 !! end
7596
7597 !! test
7598 Piped link
7599 !! wikitext
7600 [[Main Page|The Main Page]]
7601 !! html
7602 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7603 </p>
7604 !! end
7605
7606 !! test
7607 Piped link with comment in link text
7608 !! wikitext
7609 [[Main Page|The Main<!--front--> Page]]
7610 !! html
7611 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7612 </p>
7613 !! end
7614
7615 !! test
7616 Piped link with multiple pipe characters in link text
7617 !! wikitext
7618 [[Main Page||The|Main|Page|]]
7619 !! html/php
7620 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7621 </p>
7622 !! html/parsoid
7623 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7624 !! end
7625
7626 !! test
7627 Piped link with no link text
7628 !! wikitext
7629 [[Thomas Bek (bishop of St David's)|]]
7630 !! html/php
7631 <p>[[Thomas Bek (bishop of St David's)|]]
7632 </p>
7633 !! html/parsoid
7634 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7635 !! end
7636
7637 !! test
7638 Piped link with empty link text
7639 !! wikitext
7640 [[Main Page|<nowiki/>]] - empty nowiki
7641 [[Main Page| ]] - empty space
7642 [[Main Page|&nbsp;]] - empty non breaking space
7643 !! html/php
7644 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7645 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7646 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7647 </p>
7648 !! html/parsoid
7649 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7650 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7651 <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>
7652 !! end
7653
7654 !! test
7655 Broken link
7656 !! wikitext
7657 [[Zigzagzogzagzig]]
7658 !! html
7659 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7660 </p>
7661 !! end
7662
7663 !! test
7664 Broken link with fragment
7665 !! wikitext
7666 [[Zigzagzogzagzig#zug]]
7667 !! html
7668 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7669 </p>
7670 !! end
7671
7672 !! test
7673 Special page link with fragment
7674 !! wikitext
7675 [[Special:Version#anchor]]
7676 !! html
7677 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Nonexistent special page link with fragment
7683 !! wikitext
7684 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7685 !! html
7686 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7687 </p>
7688 !! end
7689
7690 !! test
7691 Link with prefix
7692 !! wikitext
7693 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7694 !! html
7695 <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>
7696 </p>
7697 !! end
7698
7699 !! test
7700 Link with suffix
7701 !! wikitext
7702 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7703 !! html
7704 <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>!!!
7705 </p>
7706 !! end
7707
7708 !! article
7709 prefixed article
7710 !! text
7711 Some text
7712 !! endarticle
7713
7714 !! test
7715 T45661: Piped links with identical prefixes
7716 !! wikitext
7717 [[prefixed article|prefixed articles with spaces]]
7718
7719 [[prefixed article|prefixed articlesaoeu]]
7720
7721 [[Main Page|Main Page test]]
7722 !! html
7723 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7724 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7725 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7726 </p>
7727 !! end
7728
7729
7730 !! test
7731 Link with HTML entity in suffix / tail
7732 !! wikitext
7733 [[Main Page]]&quot;, [[Main Page]]&#97;
7734 !! html/php
7735 <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;
7736 </p>
7737 !! html/parsoid
7738 <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>
7739 !! end
7740
7741 !! test
7742 Link with 3 brackets
7743 !! wikitext
7744 [[[Main Page]]]
7745 Foo [[[Main Page]]]
7746 !! html
7747 <p>[[[Main Page]]]
7748 Foo [[[Main Page]]]
7749 </p>
7750 !! end
7751
7752 !! test
7753 Link with 4 brackets
7754 !! wikitext
7755 [[[[Main Page]]]]
7756 !! html
7757 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7758 </p>
7759 !! end
7760
7761 !! test
7762 Piped link with 3 brackets
7763 !! wikitext
7764 [[[main page|the main page]]]
7765 !! html
7766 <p>[[[main page|the main page]]]
7767 </p>
7768 !! end
7769
7770 !! test
7771 Piped link with extlink-like text
7772 !! wikitext
7773 [[Main Page|[bar]]]
7774 [[Main Page|This is a [bar]]]
7775 [[Main Page|[bar]]
7776 !! html/php
7777 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7778 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7779 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7780 </p>
7781 !! html/parsoid
7782 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7783 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7784 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7785 !! end
7786
7787 !! test
7788 Link with multiple pipes
7789 !! wikitext
7790 [[Main Page|The|Main|Page]]
7791 !! html
7792 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7793 </p>
7794 !! end
7795
7796 !! test
7797 Anchor containing a #. (T65430)
7798 !! wikitext
7799 [[Main Page#And#Link]]
7800 !! html/php
7801 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7802 </p>
7803 !! html/parsoid
7804 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7805 !! end
7806
7807 !! test
7808 Link to namespaces
7809 !! wikitext
7810 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7811 !! html
7812 <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>
7813 </p>
7814 !! end
7815
7816 !! test
7817 Link with space in namespace
7818 !! wikitext
7819 [[User talk:Foo bar]]
7820 !! html
7821 <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>
7822 </p>
7823 !! end
7824
7825 !! article
7826 MemoryAlpha:AlphaTest
7827 !! text
7828 This is an article in the MemoryAlpha namespace
7829 (which shadows the memoryalpha interwiki link).
7830 !! endarticle
7831
7832 !! test
7833 Namespace takes precedence over interwiki link (T53680)
7834 !! wikitext
7835 [[MemoryAlpha:AlphaTest]]
7836 !! html
7837 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7838 </p>
7839 !! end
7840
7841 # The previous test doesn't work correctly in html2*, due to not recognizing the
7842 # link as an internal one. This one checks for the correct behavior.
7843 !! test
7844 Link to namespace preferred over interwiki with correct rel attribute
7845 !! options
7846 parsoid=html2wt,html2html
7847 !! html/parsoid
7848 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7849 !! wikitext
7850 [[MemoryAlpha:AlphaTest]]
7851 !! end
7852
7853 !! test
7854 Piped link to namespace
7855 !! wikitext
7856 [[Meta:Disclaimers|The disclaimers]]
7857 !! html
7858 <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>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Link containing }
7864 !! wikitext
7865 [[Usually caused by a typo (oops}]]
7866 !! html
7867 <p>[[Usually caused by a typo (oops}]]
7868 </p>
7869 !! end
7870
7871 !! article
7872 7% Solution
7873 !! text
7874 Just a test of an article title containing a percent.
7875 !! endarticle
7876
7877 !! test
7878 Link containing % (not as a hex sequence)
7879 !! wikitext
7880 [[7% Solution]]
7881 [[7% Solution|7%25 Solution]]
7882 !! html/php
7883 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7884 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7885 </p>
7886 !! html/parsoid
7887 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7888 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7889 !! end
7890
7891 # note that the parsoid HTML is identical to the previous test output,
7892 # so the previous test ensures that the html2wt mode will generate the
7893 # "not as a hex sequence" wikitext.
7894 !! test
7895 Link containing % as a single hex sequence interpreted to char
7896 !! options
7897 parsoid=wt2wt,wt2html,html2html
7898 !! wikitext
7899 [[7%25 Solution]]
7900 [[7%25 Solution|7%25 Solution]]
7901 !! html/php
7902 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7903 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7904 </p>
7905 !! html/parsoid
7906 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7907 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7908 !!end
7909
7910 !! test
7911 Link containing % as a double hex sequence interpreted to hex sequence
7912 !! wikitext
7913 [[7%2525 Solution]]
7914 !! html
7915 <p>[[7%2525 Solution]]
7916 </p>
7917 !!end
7918
7919 ## Example for such a section: == < ==
7920 !! test
7921 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7922 !! wikitext
7923 [[%23%3c]][[%23%3e]]
7924 !! html/php
7925 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7929 !! end
7930
7931 !! test
7932 Link containing "<#" and ">#" as a hex sequences
7933 !! wikitext
7934 [[%3c%23]][[%3e%23]]
7935 !! html
7936 <p>[[%3c%23]][[%3e%23]]
7937 </p>
7938 !! end
7939
7940 !! test
7941 Link containing an equals sign
7942 !! wikitext
7943 [[Special:BookSources/isbn=4-00-026157-6]]
7944 !! html/php
7945 <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>
7946 </p>
7947 !! html/parsoid
7948 <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>
7949 !! end
7950
7951 !! article
7952 Foo~bar
7953 !! text
7954 Just a test of an article title containing a tilde.
7955 !! endarticle
7956
7957 # note that links containing signatures, like [[Foo~~~~]], are
7958 # massaged by the pre-save transform (PST) and so the tildes are never
7959 # seen by the parser.
7960 !! test
7961 Link containing a tilde
7962 !! wikitext
7963 [[Foo~bar]]
7964 !! html/php
7965 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7966 </p>
7967 !! html/parsoid
7968 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7969 !! end
7970
7971 !! test
7972 Link containing double-single-quotes '' (T6598)
7973 !! wikitext
7974 [[Lista d''e paise d''o munno]]
7975 !! html/php
7976 <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''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7977 </p>
7978 !! html/parsoid
7979 <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>
7980 !! end
7981
7982 !! test
7983 Link containing double quotes and spaces
7984 !! wikitext
7985 [[Cool "Gator"]]
7986 !! html/php
7987 <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>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Cool_%22Gator%22" title='Cool "Gator"'>Cool "Gator"</a></p>
7991 !! end
7992
7993 !! test
7994 File containing double quotes and spaces
7995 !! wikitext
7996 [[File:Cool "Gator".png]]
7997 !! html/parsoid
7998 <p><span 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></span></p>
7999 !! end
8000
8001 !! test
8002 Redirect containing double quotes and spaces
8003 !! wikitext
8004 #REDIRECT [[Cool "Gator"]]
8005 !! html/parsoid
8006 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8007 !! end
8008
8009 !! test
8010 Link containing double-single-quotes '' in text (T6598 sanity check)
8011 !! wikitext
8012 Some [[Link|pretty ''italics'' and stuff]]!
8013 !! html/php
8014 <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>!
8015 </p>
8016 !! html/parsoid
8017 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8018 !! end
8019
8020 !! test
8021 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8022 !! wikitext
8023 ''Some [[Link|pretty ''italics'' and stuff]]!''
8024 !! html
8025 <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>
8026 </p>
8027 !! end
8028
8029 !! test
8030 Link with double quotes in title part (literal) and alternate part (interpreted)
8031 !! wikitext
8032 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8033
8034 [[''Pentecoste'']]
8035
8036 [[''Pentecoste''|Pentecoste]]
8037
8038 [[''Pentecoste''|''Pentecoste'']]
8039 !! html/php
8040 <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>
8041 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
8042 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
8043 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
8044 </p>
8045 !! html/parsoid
8046 <p><span 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></span></p>
8047 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8048 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8049 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8050 !! end
8051
8052 !! test
8053 Broken image links with HTML captions (T41700)
8054 !! wikitext
8055 [[File:Nonexistent|<script></script>]]
8056 [[File:Nonexistent|100x100px|<script></script>]]
8057 [[File:Nonexistent|&lt;]]
8058 [[File:Nonexistent|a<i>b</i>c]]
8059 !! html/php
8060 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8061 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8062 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8063 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8064 </p>
8065 !! html/parsoid
8066 <p><span 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></span>
8067 <span 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></span>
8068 <span 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></span>
8069 <span 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></span></p>
8070 !! end
8071
8072 !! test
8073 Plain link to URL
8074 !! wikitext
8075 [[http://www.example.com]]
8076 !! html/php
8077 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8078 </p>
8079 !! html/parsoid
8080 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
8081 !! end
8082
8083 !! test
8084 Plain link to URL with link text
8085 !! wikitext
8086 [[http://www.example.com Link text]]
8087 !! html
8088 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8089 </p>
8090 !! end
8091
8092 !! test
8093 Plain link to protocol-relative URL
8094 !! wikitext
8095 [[//www.example.com]]
8096 !! html/php
8097 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8098 </p>
8099 !! html/parsoid
8100 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
8101 !! end
8102
8103 !! test
8104 Plain link to protocol-relative URL with link text
8105 !! wikitext
8106 [[//www.example.com Link text]]
8107 !! html
8108 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8109 </p>
8110 !! end
8111
8112 !! test
8113 Plain link to page with question mark in title
8114 !! wikitext
8115 [[A?b]]
8116
8117 [[A?b|Baz]]
8118 !! html
8119 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8120 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8121 </p>
8122 !! end
8123
8124 # I'm fairly sure the expected result here is wrong.
8125 # We want these to be URL links, not pseudo-pages with URLs for titles....
8126 # However the current output is also pretty screwy.
8127 #
8128 # ----
8129 # I'm changing it to match the current output--it arguably makes more
8130 # sense in the light of the test above. Old expected result was:
8131 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8132 #</p>
8133 # But I think this test is bordering on "garbage in, garbage out" anyway.
8134 # -- wtm
8135 !! test
8136 Piped link to URL
8137 !! wikitext
8138 Piped link to URL: [[http://www.example.com|an example URL]]
8139 !! html/php
8140 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8141 </p>
8142 !! html/parsoid
8143 <p>Piped link to URL: [<a rel="mw:ExtLink" 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>
8144 !! end
8145
8146 !! test
8147 Plain link in template argument
8148 !! options
8149 parsoid=wt2html
8150 !! wikitext
8151 {{echo|[http://www.example.com |123]}}
8152
8153 {{echo|[[http://www.example.com |123]]}}
8154
8155 {{echo|[[http://www.example.com |123]}}
8156
8157 {{echo|[http://www.example.com |123]]}}
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8160 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8161 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8162 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8163 </p>
8164 !! html/parsoid
8165 <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" href="http://www.example.com">http://www.example.com</a> </p>
8166
8167 <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" href="http://www.example.com">|123</a>]</p>
8168
8169 <p>{{echo|[<a rel="mw:ExtLink" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8170
8171 <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" href="http://www.example.com">http://www.example.com</a> </p>
8172 !! end
8173
8174 !! test
8175 T2002: [[page|http://url/]] should link to page, not http://url/
8176 !! wikitext
8177 [[Main Page|http://url/]]
8178 !! html/php
8179 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8180 </p>
8181 !! html/parsoid
8182 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8183 !! end
8184
8185 # Parsoid does not mark self-links, by design.
8186 !! test
8187 T2337: Escaped self-links should be bold
8188 !! options
8189 title=[[Bug462]]
8190 !! wikitext
8191 [[Bu&#103;462]] [[Bug462]]
8192 !! html/php
8193 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8194 </p>
8195 !! html/php+tidy
8196 <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a></p>
8197 !! html/parsoid
8198 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8199 !! end
8200
8201 !! test
8202 Self-link to section should not be bold
8203 !! options
8204 title=[[Main Page]]
8205 !! wikitext
8206 [[Main Page#section]]
8207 !! html
8208 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8209 </p>
8210 !! end
8211
8212 !! article
8213 00
8214 !! text
8215 This is 00.
8216 !! endarticle
8217
8218 !!test
8219 Self-link to numeric title
8220 !!options
8221 title=[[0]]
8222 !! wikitext
8223 [[0]]
8224 !! html
8225 <p><a class="mw-selflink selflink">0</a>
8226 </p>
8227 !!end
8228
8229 !!test
8230 Link to numeric-equivalent title
8231 !!options
8232 title=[[0]]
8233 !! wikitext
8234 [[00]]
8235 !! html
8236 <p><a href="/wiki/00" title="00">00</a>
8237 </p>
8238 !!end
8239
8240 !! test
8241 <nowiki> inside a link
8242 !! wikitext
8243 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8244 !! html
8245 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8246 </p>
8247 !! end
8248
8249 !! test
8250 Non-breaking spaces in title
8251 !! wikitext
8252 [[&nbsp; Main &nbsp; Page &nbsp;]]
8253 !! html
8254 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8255 </p>
8256 !!end
8257
8258 # Add new article for the test below so that it doesn't red-link
8259 !! article
8260 Foo bar baz
8261 !! text
8262 boo
8263 !! endarticle
8264
8265 !! test
8266 Multiple spaces in titles should normalize to a single underscore
8267 !! options
8268 parsoid=wt2html,wt2wt
8269 !! wikitext
8270 [[Foo bar baz|x]]
8271 [[Foo bar baz|x]]
8272 [[Foo bar baz|x]]
8273 !! html/php
8274 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8275 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8276 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8277 </p>
8278 !! html/parsoid
8279 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8280 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8281 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8282 </p>
8283 !! end
8284
8285 !! test
8286 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8287 !! options
8288 language=ca
8289 !! wikitext
8290 '''[[Main Page]]'''
8291 !! html
8292 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8293 </p>
8294 !! end
8295
8296 !! test
8297 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8298 !! options
8299 language=ca
8300 !! wikitext
8301 ''[[Main Page]]''
8302 !! html
8303 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8304 </p>
8305 !! end
8306
8307 !! test
8308 Internal link with en linktrail: no apostrophes (T29473)
8309 !! options
8310 language=en
8311 !! wikitext
8312 [[Something]]'nice
8313 !! html
8314 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8315 </p>
8316 !! end
8317
8318 !! test
8319 Internal link with ca linktrail with apostrophes (T29473)
8320 !! options
8321 language=ca
8322 !! wikitext
8323 [[Something]]'nice
8324 !! html
8325 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Internal link with kaa linktrail with apostrophes (T29473)
8331 !! options
8332 language=kaa
8333 !! wikitext
8334 [[Something]]'nice
8335 !! html
8336 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
8337 </p>
8338 !! end
8339
8340 !! test
8341 Link with multiple ":" in a subpage-supporting namespace (T65636)
8342 !! wikitext
8343 [[User:Foo/Test/63636:Bar|Test]]
8344 !! html/php
8345 <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>
8346 </p>
8347 !! html/parsoid
8348 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8349 !! end
8350
8351 ## Mainly a sanity check for Parsoid
8352 !! test
8353 Handle title parsing for subpages
8354 !! options
8355 title=[[/123123]]
8356 subpage
8357 !! wikitext
8358 123
8359 !! html/php
8360 <p>123
8361 </p>
8362 !! html/parsoid
8363 <p>123</p>
8364 !! end
8365
8366 !! article
8367 User:Test/123
8368 !! text
8369 test 123
8370 !! endarticle
8371
8372 !! test
8373 Link to a subpage from a namespace other than main
8374 !! options
8375 title=[[User:Test]]
8376 subpage
8377 !! wikitext
8378 [[/123]]
8379 !! html/php
8380 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8381 </p>
8382 !! html/parsoid
8383 <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>
8384 !! end
8385
8386 !! test
8387 Ensure that transclusion titles are not url-decoded
8388 !! options
8389 subpage title=[[Test]]
8390 parsoid=wt2html
8391 !! wikitext
8392 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8393 !! html/php
8394 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8395 </p>
8396 !! html/parsoid
8397 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8398 !! end
8399
8400 !! test
8401 Purely hash wikilink
8402 !! options
8403 title=[[User:Test/123]]
8404 subpage
8405 !! wikitext
8406 [[#a|b]]
8407 !! html/php
8408 <p><a href="#a">b</a>
8409 </p>
8410 !! html/parsoid
8411 <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>
8412 !! end
8413
8414 !! test
8415 Serialization of purely hash wikilink
8416 !! options
8417 title=[[User:Test/123]]
8418 subpage
8419 parsoid=html2wt
8420 !! html/parsoid
8421 <p><a href="#a">[[</a></p>
8422 !! wikitext
8423 [[#a|<nowiki>[[</nowiki>]]
8424 !! html/php
8425 <p><a href="#a">[[</a>
8426 </p>
8427 !! end
8428
8429 !! test
8430 1. Interaction of linktrail and template encapsulation
8431 !! wikitext
8432 {{echo|[[Foo]]}}l
8433 !! html/parsoid
8434 <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>
8435 !! end
8436
8437 !! test
8438 2. Interaction of linktrail and template encapsulation
8439 !! options
8440 parsoid
8441 !! wikitext
8442 {{echo|Some [[Fool]]}}s
8443 !! html
8444 <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>
8445 !! end
8446
8447 !! test
8448 3. Interaction of linktrail and template encapsulation
8449 !! options
8450 parsoid
8451 !! wikitext
8452 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8453 !! html
8454 <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>
8455 !! end
8456
8457 !! article
8458 Söfnuður
8459 !! text
8460 Test.
8461 !! endarticle
8462
8463 !! test
8464 Internal link with is link prefix
8465 !! options
8466 language=is
8467 !! wikitext
8468 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8469 !! html
8470 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8471 </p>
8472 !! end
8473
8474 !! article
8475 Mótmælendatrú
8476 !! text
8477 Test.
8478 !! endarticle
8479
8480 !! test
8481 Internal link with is link trail and link prefix
8482 !! options
8483 language=is
8484 !! wikitext
8485 [[mótmælendatrú|xxx]]ar
8486 [[mótmælendatrú]]ar
8487 mótmælenda[[söfnuður]]
8488 mótmælenda[[söfnuður|söfnuðir]]
8489 mótmælenda[[söfnuður|söfnuðir]]xxx
8490 !! html
8491 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8492 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8493 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8494 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8495 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8496 </p>
8497 !! end
8498
8499 !! test
8500 Parsoid link trail escaping
8501 !! options
8502 parsoid=html2wt,html2html
8503 !! html/parsoid
8504 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8505 !! wikitext
8506 [[apple]]<nowiki/>s
8507 !! end
8508
8509 !! test
8510 Parsoid link prefix escaping
8511 !! options
8512 language=is
8513 parsoid=html2wt,html2html
8514 !! html/parsoid
8515 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8516 !! wikitext
8517 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8518 !! end
8519
8520 !! test
8521 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8522 !! wikitext
8523 [[Foo| bar]]
8524
8525 [[Foo| ''bar'']]
8526
8527 [http://wp.org foo]
8528
8529 [http://wp.org ''foo'']
8530 !! html
8531 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8532 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8533 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8534 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8535 </p>
8536 !! end
8537
8538 !! test
8539 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8540 !! wikitext
8541 [[Foo|{{echo|a}} b {{echo|c}}]]
8542 !! html/parsoid
8543 <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>
8544 !! end
8545
8546 !! test
8547 Link with angle bracket after anchor
8548 !! wikitext
8549 [[Foo#<bar>]]
8550 !! html/php
8551 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8552 </p>
8553 !! html/parsoid
8554 <p><a rel="mw:WikiLink" href="./Foo#.3Cbar.3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#.3Cbar.3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8555 !! end
8556
8557 ###
8558 ### Interwiki links (see maintenance/interwiki.sql)
8559 ###
8560
8561 !! test
8562 Inline interwiki link
8563 !! options
8564 parsoid=wt2html,wt2wt,html2html
8565 !! wikitext
8566 [[MeatBall:SoftSecurity]]
8567 !! html/php
8568 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8569 </p>
8570 !! html/parsoid
8571 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8572 !! end
8573
8574 !! test
8575 Inline interwiki link with empty title (T4372)
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 [[MeatBall:]]
8580 !! html/php
8581 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8582 </p>
8583 !! html/parsoid
8584 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8585 !! end
8586
8587 !! test
8588 Interwiki link encoding conversion (T3636)
8589 !! wikitext
8590 *[[Wikipedia:ro:Olteni&#0355;a]]
8591 *[[Wikipedia:ro:Olteni&#355;a]]
8592 !! html
8593 <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>
8594 <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>
8595
8596 !! html+tidy
8597 <ul>
8598 <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>
8599 <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>
8600 </ul>
8601 !! end
8602
8603 !! test
8604 Interwiki link with fragment (T4130)
8605 !! wikitext
8606 [[MeatBall:SoftSecurity#foo]]
8607 !! html
8608 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8609 </p>
8610 !! end
8611
8612 !! test
8613 Link scenarios with escaped fragments
8614 !! wikitext
8615 [[#Is this great?]]
8616 [[Foo#Is this great?]]
8617 [[meatball:Foo#Is this great?]]
8618 !! html/php
8619 <p><a href="#Is_this_great.3F">#Is this great?</a>
8620 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8621 <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>
8622 </p>
8623 !! html/parsoid
8624 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8625 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8626 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8627 !! end
8628
8629 # Ideally the wikipedia: prefix here should be proto-relative too
8630 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8631 # define the 'en' prefix, and originally the test used 'wikipedia',
8632 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8633 # article.
8634 !! test
8635 Different interwiki prefixes mapping to the same URL
8636 !! wikitext
8637 [[:en:Foo]]
8638
8639 [[:en:Foo|Foo]]
8640
8641 [[wikipedia:Foo]]
8642
8643 [[:wikipedia:Foo|Foo]]
8644
8645 [[wikipedia:en:Foo]]
8646
8647 [[:wikipedia:en:Foo]]
8648
8649 [[ wikiPEdia :Foo]]
8650 !! html/parsoid
8651 <p><a rel="mw:ExtLink" 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>
8652
8653 <p><a rel="mw:ExtLink" 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>
8654
8655 <p><a rel="mw:ExtLink" 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>
8656
8657 <p><a rel="mw:ExtLink" 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>
8658
8659 <p><a rel="mw:ExtLink" 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>
8660
8661 <p><a rel="mw:ExtLink" 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>
8662
8663 <p><a rel="mw:ExtLink" 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>
8664 !! end
8665
8666 !! test
8667 Interwiki links that cannot be represented in wiki syntax
8668 !! wikitext
8669 [[meatball:ok]]
8670 [[meatball:ok#foo|ok with fragment]]
8671 [[meatball:ok_as_well?|ok ending with ? mark]]
8672 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8673 [http://de.wikipedia.org/wiki/#foo is just fragment]
8674
8675 !! html/php
8676 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8677 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8678 <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>
8679 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8680 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8681 </p>
8682 !! html/parsoid
8683 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8684 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8685 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8686 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8687 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8688 !! end
8689
8690 !! test
8691 Interwiki links: trail
8692 !! wikitext
8693 [[wikipedia:Foo|Ba]]r
8694 !! html/php
8695 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8696 </p>
8697 !! html/parsoid
8698 <p><a rel="mw:ExtLink" 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>
8699 !! end
8700
8701 !! test
8702 Local interwiki link
8703 !! options
8704 parsoid=wt2html,wt2wt,html2html
8705 !! wikitext
8706 [[local:Template:Foo]]
8707 !! html/php
8708 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8709 </p>
8710 !! html/parsoid
8711 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8712 !! end
8713
8714 # Parsoid does not mark self-links, by design.
8715 !! test
8716 Local interwiki link: self-link to current page
8717 !! options
8718 title=[[Main Page]]
8719 parsoid=wt2html,wt2wt,html2html
8720 !! wikitext
8721 [[local:Main Page]]
8722 !! html/php
8723 <p><a class="mw-selflink selflink">local:Main Page</a>
8724 </p>
8725 !! html/parsoid
8726 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8727 !! end
8728
8729 !! test
8730 Local interwiki link: prefix only (T66167)
8731 !! options
8732 parsoid=wt2html,wt2wt,html2html
8733 !! wikitext
8734 [[local:]]
8735 !! html/php
8736 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8737 </p>
8738 !! html/parsoid
8739 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8740 !! end
8741
8742 !! test
8743 Local interwiki link: with additional interwiki prefix (T63357)
8744 !! options
8745 parsoid=wt2html,wt2wt,html2html
8746 !! wikitext
8747 [[local:meatball:Hello]]
8748 !! html/php
8749 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8750 </p>
8751 !! html/parsoid
8752 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8753 !! end
8754
8755 !! test
8756 Multiple local interwiki link prefixes
8757 !! wikitext
8758 [[local:local:local:local:mi:local:Foo]]
8759 !! options
8760 parsoid=wt2html,wt2wt,html2html
8761 !! html/php
8762 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8763 </p>
8764 !! html/parsoid
8765 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8766 !! end
8767
8768 ###
8769 ### Interlanguage links
8770 ### Language links (so that searching for '### language' matches..)
8771 ###
8772
8773 !! test
8774 Interlanguage link
8775 !! wikitext
8776 Blah blah blah
8777 [[zh:Chinese]]
8778 !! html/php
8779 <p>Blah blah blah
8780 </p>
8781 !! html/parsoid
8782 <p>Blah blah blah</p>
8783 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8784 !! end
8785
8786 ## parsoid html2wt will lose the space variations
8787 !! test
8788 Interlanguage link with spacing
8789 !! options
8790 parsoid=wt2html,wt2wt,html2html
8791 !! wikitext
8792 Blah blah blah
8793 [[ zh : Chinese ]]
8794 !! html/php
8795 <p>Blah blah blah
8796 </p>
8797 !! html/parsoid
8798 <p>Blah blah blah</p>
8799 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8800 !! end
8801
8802 !! test
8803 Double interlanguage link
8804 !! wikitext
8805 Blah blah blah
8806 [[es:Spanish]]
8807 [[zh:Chinese]]
8808 !! html/php
8809 <p>Blah blah blah
8810 </p>
8811 !! html/parsoid
8812 <p>Blah blah blah</p>
8813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8814 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8815 !! end
8816
8817 ## parsoid html2wt will lose the space variations
8818 !! test
8819 Interlanguage link variations
8820 !! options
8821 parsoid=wt2html,wt2wt,html2html
8822 !! wikitext
8823 Blah blah blah
8824 [[ es :Spanish]]
8825 [[ ZH :Chinese]]
8826 [[es:Foo_bar]]
8827 !! html/php
8828 <p>Blah blah blah
8829 </p>
8830 !! html/parsoid
8831 <p>Blah blah blah</p>
8832 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8833 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8834 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8835 !! end
8836
8837 !! test
8838 Escaping of interlanguage links (T129218, T156308)
8839 !! wikitext
8840 Blah blah blah
8841 [[:es:Spanish]]
8842 [[ : zh : Chinese ]]
8843 !! html/php
8844 <p>Blah blah blah
8845 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8846 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8847 </p>
8848 !! html/parsoid
8849 <p>Blah blah blah
8850 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8851 <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8852 !! end
8853
8854 !! test
8855 Multiple colons escaping interlanguage links
8856 !! options
8857 parsoid=wt2html
8858 !! wikitext
8859 [[:es:Spanish]]
8860 [[::es:Spanish]]
8861 [[:::es:Spanish]]
8862 !! html/php
8863 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8864 [[::es:Spanish]]
8865 [[:::es:Spanish]]
8866 </p>
8867 !! html/parsoid
8868 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8869 [[::es:Spanish]]
8870 [[:::es:Spanish]]</p>
8871 !! end
8872
8873 ## parsoid html2wt will normalize the space to _
8874 !! test
8875 Space and question mark encoding in interlanguage links (T95473)
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 Blah blah blah
8880 [[es:Foo bar?]]
8881 !! html/php
8882 <p>Blah blah blah
8883 </p>
8884 !! html/parsoid
8885 <p>Blah blah blah</p>
8886 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8887 !! end
8888
8889 !! test
8890 Interlanguage link, with prefix links
8891 !! options
8892 language=ln
8893 !! wikitext
8894 Blah blah blah
8895 [[zh:Chinese]]
8896 !! html/php
8897 <p>Blah blah blah
8898 </p>
8899 !! html/parsoid
8900 <p>Blah blah blah</p>
8901 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8902 !! end
8903
8904 !! test
8905 Double interlanguage link, with prefix links (T10897)
8906 !! options
8907 language=ln
8908 !! wikitext
8909 Blah blah blah
8910 [[es:Spanish]]
8911 [[zh:Chinese]]
8912 !! html/php
8913 <p>Blah blah blah
8914 </p>
8915 !! html/parsoid
8916 <p>Blah blah blah</p>
8917 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8918 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8919 !! end
8920
8921 !! test
8922 "Extra" interlanguage links (T34189 / gerrit 111390)
8923 !! wikitext
8924 Blah blah blah
8925 [[mul:Article]]
8926 !! html/php
8927 <p>Blah blah blah
8928 </p>
8929 !! html/parsoid
8930 <p>Blah blah blah</p>
8931 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8932 !! end
8933
8934 ## PHP parser tests script needs an update
8935 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8936 !! test
8937 Language links render as inline links if $wgInterwikiMagic=false
8938 !! options
8939 wgInterwikiMagic=false
8940 parsoid=wt2html,wt2wt,html2html
8941 !! wikitext
8942 Blah blah blah
8943 [[zh:Chinese]]
8944 !! html/parsoid
8945 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8946 !! end
8947
8948 ## PHP parser tests script needs an update
8949 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8950 !! test
8951 Language links render as inline links in the Talk namespace
8952 !! options
8953 title=Talk:Foo
8954 parsoid=wt2html,wt2wt,html2html
8955 !! wikitext
8956 Blah blah blah
8957 [[zh:Chinese]]
8958 !! html/parsoid
8959 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8960 !! end
8961
8962 !! test
8963 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8964 !! options
8965 language=ln
8966 !! wikitext
8967 [[WW&nbsp;II]]
8968 !! html
8969 <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>
8970 </p>
8971 !! end
8972
8973 !! test
8974 Parsoid T55221: Wikilinks should be properly entity-escaped
8975 !! options
8976 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8977 !! html/parsoid
8978 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8979 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8980 !! wikitext
8981 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8982
8983 He&amp;nbsp;llo He&amp;nbsp;llo
8984 !! html/php
8985 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8986 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8987 </p>
8988 !! end
8989
8990 # html2wt will fail because of title normalization without data-parsoid
8991 !! test
8992 Parsoid: handle constructor well
8993 !! options
8994 parsoid=wt2html,wt2wt
8995 !! wikitext
8996 [[constructor]]
8997
8998 [[constructor:foo]]
8999 !! html/php
9000 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9001 </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>
9002 </p>
9003 !! html/parsoid
9004 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9005
9006 <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>
9007 !! end
9008
9009 !! article
9010 ko:
9011 !! text
9012 Test.
9013 !! endarticle
9014
9015 # Note that `ko` isn't a known interlanguage prefix
9016 !! test
9017 Parsoid: recognize interlanguage links without a target page
9018 !! options
9019 ill
9020 !! wikitext
9021 [[es:]]
9022
9023 [[ko:]]
9024 !! html/php
9025 es:
9026 !! html/parsoid
9027 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9028
9029 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9030 !! end
9031
9032 # Note that `ko` isn't a known interwiki prefix
9033 !! test
9034 Parsoid: recognize interwiki links without a target page
9035 !! options
9036 parsoid=wt2html,wt2wt,html2html
9037 !! wikitext
9038 [[:es:]]
9039
9040 [[:ko:]]
9041 !! html/php
9042 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9043 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9044 </p>
9045 !! html/parsoid
9046 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9047 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9048 !! end
9049
9050 !! test
9051 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9052 !! wikitext
9053 [[mi:Foo]]
9054 !! html/php
9055 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9056 </p>
9057 !! html/parsoid
9058 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9059 !! end
9060
9061 !! test
9062 Interlanguage link with preceding local interwiki link (T70085)
9063 !! options
9064 parsoid=wt2html,wt2wt,html2html
9065 !! wikitext
9066 Blah blah blah
9067 [[local:es:Spanish]]
9068 !! html/php
9069 <p>Blah blah blah
9070 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9071 </p>
9072 !! html/parsoid
9073 <p>Blah blah blah
9074 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9075 !! end
9076
9077 !! test
9078 Looks like an interlanguage link, but is actually a local interwiki
9079 !! options
9080 parsoid=wt2html,wt2wt,html2html
9081 !! wikitext
9082 Blah blah blah
9083 [[mi:Template:Foo]]
9084 !! html/php
9085 <p>Blah blah blah
9086 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9087 </p>
9088 !! html/parsoid
9089 <p>Blah blah blah
9090 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9091 !! end
9092
9093 ###
9094 ### Redirects, Parsoid-only
9095 ###
9096
9097 !! test
9098 1. Simple redirect to page
9099 !! wikitext
9100 #REDIRECT [[Main Page]]
9101 !! html/parsoid
9102 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9103 !! end
9104
9105 !! test
9106 2. Other redirect variants
9107 !! wikitext
9108 #REDIRECT [[Main_Page]]
9109 !! html/parsoid
9110 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9111 !! end
9112
9113 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9114 # This tests the Parsoid bail-out code.
9115 !! test
9116 3. Other redirect variants
9117 !! wikitext
9118 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9119 !! html/parsoid
9120 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
9121 !! end
9122
9123 !! test
9124 4. Redirect to a templated destination
9125 !! wikitext
9126 #REDIRECT [[{{echo|Foo}}bar]]
9127 !! html/parsoid
9128 <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"}]]}'/>
9129 !! end
9130
9131 !! test
9132 Empty redirect
9133 !! options
9134 parsoid=wt2html,wt2wt
9135 !! wikitext
9136 #REDIRECT [[]]
9137 !! html/parsoid
9138 <ol>
9139 <li>REDIRECT [[]]</li></ol>
9140 !! end
9141
9142 !! test
9143 Optional colon in #REDIRECT
9144 !! options
9145 # the colon is archaic syntax. we support it for wt2html, but we
9146 # don't care that it roundtrips back to the modern syntax.
9147 parsoid=wt2html,html2html
9148 !! wikitext
9149 #REDIRECT:[[Main Page]]
9150 !! html/parsoid
9151 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9152 !! end
9153
9154 !! test
9155 Whitespace in #REDIRECT with optional colon
9156 !! options
9157 # the colon and gratuitous whitespace is archaic syntax. we support
9158 # it for wt2html, but we don't care that it roundtrips back to the
9159 # modern syntax (without extra whitespace)
9160 parsoid=wt2html,html2html
9161 !! wikitext
9162
9163 #REDIRECT
9164 :
9165 [[Main Page]]
9166 !! html/parsoid
9167 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9168 !! end
9169
9170 !! test
9171 Piped link in #REDIRECT
9172 !! options
9173 # content after piped link is ignored. we support this syntax,
9174 # but don't care that the piped link is lost when we roundtrip this.
9175 parsoid=wt2html
9176 !! wikitext
9177 #REDIRECT [[Main Page|bar]]
9178 !! html/parsoid
9179 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9180 !! end
9181
9182 !! test
9183 Redirect to category (T104502)
9184 !! options
9185 parsoid=wt2html,wt2wt
9186 !! wikitext
9187 #REDIRECT [[Category:Foo]]
9188 !! html/parsoid
9189 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9190 !! end
9191
9192 !! test
9193 Redirect to category with URL encoding (T104502)
9194 !! options
9195 parsoid=wt2html
9196 !! wikitext
9197 #REDIRECT [[Category%3AFoo]]
9198 !! html/parsoid
9199 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9200 !! end
9201
9202 !! test
9203 Redirect to category page
9204 !! wikitext
9205 #REDIRECT [[:Category:Foo]]
9206 !! html/parsoid
9207 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9208 !! end
9209
9210 !! test
9211 Redirect to image page (1)
9212 !! wikitext
9213 #REDIRECT [[File:Wiki.png]]
9214 !! html/parsoid
9215 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9216 !! end
9217
9218 !! test
9219 Redirect to image page (2)
9220 !! wikitext
9221 #REDIRECT [[Image:Wiki.png]]
9222 !! html/parsoid
9223 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9224 !! end
9225
9226 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9227 # Next test confirms this.
9228 !! test
9229 Redirect to language (1) (T104918)
9230 !! options
9231 parsoid=wt2html,wt2wt,html2html
9232 !! wikitext
9233 #REDIRECT [[en:File:Wiki.png]]
9234 !! html/parsoid
9235 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9236 !! end
9237
9238 !! test
9239 Redirect to language (2) (T104918)
9240 !! wikitext
9241 #REDIRECT [[:en:File:Wiki.png]]
9242 !! html/parsoid
9243 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9244 !! end
9245
9246 !! test
9247 Redirect to interwiki (T104918)
9248 !! wikitext
9249 #REDIRECT [[meatball:File:Wiki.png]]
9250 !! html/parsoid
9251 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9252 !! end
9253
9254 !! test
9255 Non-English #REDIRECT
9256 !! options
9257 language=is
9258 !! wikitext
9259 #TILVÍSUN [[Main Page]]
9260 !! html/parsoid
9261 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9262 !! end
9263
9264 !! test
9265 Redirect syntax under text isn't considered a redirect
9266 !! wikitext
9267 some text
9268 #redirect [[Main Page]]
9269 !! html/parsoid
9270 <p>some text</p>
9271 <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>
9272 !! end
9273
9274 !! test
9275 New redirect
9276 !! options
9277 parsoid=html2wt
9278 !! html/parsoid
9279 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9280 !! wikitext
9281 #REDIRECT [[Foo]]
9282 Foo
9283 !! end
9284
9285 !! test
9286 Redirect followed by block on the same line
9287 !! options
9288 parsoid=wt2html
9289 !! wikitext
9290 #REDIRECT [[Main Page]]<!-- haha -->== hi ==
9291 !! html/parsoid
9292 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi"> hi </h2>
9293 !! end
9294
9295 !! test
9296 Redirect followed by a newline
9297 !! wikitext
9298 #REDIRECT [[Main Page]]
9299 A newline
9300 !! html/parsoid
9301 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9302 <p>A newline</p>
9303 !! end
9304
9305 !! test
9306 Redirect followed by multiple newlines
9307 !! wikitext
9308 #REDIRECT [[Main Page]]
9309
9310
9311 A newline
9312 !! html/parsoid
9313 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9314
9315 <p><br/>
9316 A newline</p>
9317 !! end
9318
9319 !! test
9320 Drop duplicate redirects
9321 !! options
9322 parsoid=html2wt
9323 !! html/parsoid
9324 <link rel="mw:PageProp/redirect" href="./Foo"/>
9325 <link rel="mw:PageProp/redirect" href="./Bar"/>
9326 <link rel="mw:PageProp/redirect" href="./Baz"/>
9327 !! wikitext
9328 #REDIRECT [[Foo]]
9329 !! end
9330
9331 ##
9332 ## XHTML tidiness
9333 ###
9334
9335 !! test
9336 <br> to <br />
9337 !! wikitext
9338 1<br>2<br />3
9339 !! html
9340 <p>1<br />2<br />3
9341 </p>
9342 !! end
9343
9344 !! test
9345 Broken br tag sanitization
9346 !! wikitext
9347 </br>
9348 !! html/php
9349 <p>&lt;/br&gt;
9350 </p>
9351 !! end
9352
9353 # TODO: Fix html2html mode (T53055)!
9354 !! test
9355 Parsoid: Broken br tag recognition
9356 !! options
9357 parsoid=wt2html
9358 !! wikitext
9359 </br>
9360
9361 <br/ >
9362 !! html+tidy
9363 <p><br /></p>
9364 <p><br /></p>
9365 !! end
9366
9367 !! test
9368 Incorrecly removing closing slashes from correctly formed XHTML
9369 !! wikitext
9370 <br style="clear:both;" />
9371 !! html
9372 <p><br style="clear:both;" />
9373 </p>
9374 !! end
9375
9376 !! test
9377 Failing to transform badly formed HTML into correct XHTML
9378 !! wikitext
9379 <br style="clear: left;">
9380 <br style="clear: right;">
9381 <br style="clear: both;">
9382 !! html
9383 <p><br style="clear: left;" />
9384 <br style="clear: right;" />
9385 <br style="clear: both;" />
9386 </p>
9387 !!end
9388
9389 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9390 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9391 !! test
9392 Handling html with a div self-closing tag
9393 !! wikitext
9394 <div title />
9395 <div title/>
9396 <div title/ >
9397 <div title=bar />
9398 <div title=bar/>
9399 <div title=bar/ >
9400 !! html/php
9401 <p>&lt;div title /&gt;
9402 &lt;div title/&gt;
9403 </p>
9404 <div>
9405 <p>&lt;div title=bar /&gt;
9406 &lt;div title=bar/&gt;
9407 </p>
9408 <div title="bar/"></div>
9409 </div>
9410
9411 !! html/parsoid
9412 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9413 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9414 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9415 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9416 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9417 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9418 !! end
9419
9420 !! test
9421 Handling html with a br self-closing tag
9422 !! wikitext
9423 <br title />
9424 <br title/>
9425 <br title/ >
9426 <br title=bar />
9427 <br title=bar/>
9428 <br title=bar/ >
9429 !! html/php
9430 <p><br title="" />
9431 <br title="" />
9432 <br />
9433 <br title="bar" />
9434 <br title="bar" />
9435 <br title="bar/" />
9436 </p>
9437 !! html/parsoid
9438 <p><br title="" />
9439 <br title="" />
9440 <br title="" />
9441 <br title="bar" />
9442 <br title="bar" />
9443 <br title="bar/" />
9444 </p>
9445 !! end
9446
9447 !! test
9448 Horizontal ruler (should it add that extra space?)
9449 !! wikitext
9450 <hr>
9451 <hr >
9452 foo <hr
9453 > bar
9454 !! html+tidy
9455 <hr />
9456 <hr />
9457 <p>foo</p>
9458 <hr />
9459 <p>bar</p>
9460 !! end
9461
9462 !! test
9463 Horizontal ruler -- 4+ dashes render hr
9464 !! wikitext
9465 ----
9466 !! html
9467 <hr />
9468
9469 !! end
9470
9471 !! test
9472 Horizontal ruler -- eats additional dashes on the same line
9473 !! wikitext
9474 ---------
9475 !! html
9476 <hr />
9477
9478 !! end
9479
9480 !! test
9481 Horizontal ruler -- does not collapse dashes on consecutive lines
9482 !! wikitext
9483 ----
9484 ----
9485 !! html
9486 <hr />
9487 <hr />
9488
9489 !! end
9490
9491 !! test
9492 Horizontal ruler -- <4 dashes render as plain text
9493 !! wikitext
9494 ---
9495 !! html
9496 <p>---
9497 </p>
9498 !! end
9499
9500 !! test
9501 Horizontal ruler -- Supports content following dashes on same line
9502 !! wikitext
9503 ---- Foo
9504 !! html
9505 <hr /> Foo
9506
9507 !! html+tidy
9508 <hr />
9509 <p>Foo</p>
9510 !! end
9511
9512 ###
9513 ### Block-level elements
9514 ###
9515 !! test
9516 Common list
9517 !! wikitext
9518 *Common list
9519 * item 2
9520 *item 3
9521 !! html
9522 <ul><li>Common list</li>
9523 <li> item 2</li>
9524 <li>item 3</li></ul>
9525
9526 !! end
9527
9528 !! test
9529 Numbered list
9530 !! wikitext
9531 #Numbered list
9532 #item 2
9533 # item 3
9534 !! html
9535 <ol><li>Numbered list</li>
9536 <li>item 2</li>
9537 <li> item 3</li></ol>
9538
9539 !! end
9540
9541 !! test
9542 Mixed list
9543 !! wikitext
9544 *Mixed list
9545 *# with numbers
9546 ** and bullets
9547 *# and numbers
9548 *bullets again
9549 **bullet level 2
9550 ***bullet level 3
9551 ***#Number on level 4
9552 **bullet level 2
9553 **#Number on level 3
9554 **#Number on level 3
9555 *#number level 2
9556 *Level 1
9557 *** Level 3
9558 #** Level 3, but ordered
9559 !! html
9560 <ul><li>Mixed list
9561 <ol><li> with numbers</li></ol>
9562 <ul><li> and bullets</li></ul>
9563 <ol><li> and numbers</li></ol></li>
9564 <li>bullets again
9565 <ul><li>bullet level 2
9566 <ul><li>bullet level 3
9567 <ol><li>Number on level 4</li></ol></li></ul></li>
9568 <li>bullet level 2
9569 <ol><li>Number on level 3</li>
9570 <li>Number on level 3</li></ol></li></ul>
9571 <ol><li>number level 2</li></ol></li>
9572 <li>Level 1
9573 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9574 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9575
9576 !! end
9577
9578 !! test
9579 1. Nested mixed wikitext and html list
9580 !! wikitext
9581 * hi
9582 * <ul><li>ho</li></ul>
9583 * hi
9584 ** ho
9585 !! html/php
9586 <ul><li> hi</li>
9587 <li> <ul><li>ho</li></ul></li>
9588 <li> hi
9589 <ul><li> ho</li></ul></li></ul>
9590
9591 !! html/parsoid
9592 <ul><li> hi</li>
9593 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9594 <li> hi
9595 <ul><li> ho</li></ul></li></ul>
9596 !! end
9597
9598 !! test
9599 2. Nested mixed wikitext and html list (incompatible)
9600 !! wikitext
9601 ; hi
9602 : {{echo|<li>ho</li>}}
9603 !! html/php
9604 <dl><dt> hi</dt>
9605 <dd> <li>ho</li></dd></dl>
9606
9607 !! html/parsoid
9608 <dl><dt> hi</dt>
9609 <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>
9610 !! end
9611
9612 !! test
9613 Nested lists 1
9614 !! wikitext
9615 *foo
9616 **bar
9617 !! html
9618 <ul><li>foo
9619 <ul><li>bar</li></ul></li></ul>
9620
9621 !! end
9622
9623 !! test
9624 Nested lists 2
9625 !! wikitext
9626 **foo
9627 *bar
9628 !! html
9629 <ul><li><ul><li>foo</li></ul></li>
9630 <li>bar</li></ul>
9631
9632 !! end
9633
9634 !! test
9635 Nested lists 3 (first element empty)
9636 !! wikitext
9637 *
9638 **bar
9639 !! html
9640 <ul><li>
9641 <ul><li>bar</li></ul></li></ul>
9642
9643 !! end
9644
9645 !! test
9646 Nested lists 4 (first element empty)
9647 !! wikitext
9648 **
9649 *bar
9650 !! html
9651 <ul><li><ul><li></li></ul></li>
9652 <li>bar</li></ul>
9653
9654 !! end
9655
9656 !! test
9657 Nested lists 5 (both elements empty)
9658 !! wikitext
9659 **
9660 *
9661 !! html
9662 <ul><li><ul><li></li></ul></li>
9663 <li></li></ul>
9664
9665 !! end
9666
9667 !! test
9668 Nested lists 6 (both elements empty)
9669 !! wikitext
9670 *
9671 **
9672 !! html
9673 <ul><li>
9674 <ul><li></li></ul></li></ul>
9675
9676 !! end
9677
9678 !! test
9679 Nested lists 7 (skip initial nesting levels)
9680 !! wikitext
9681 *** foo
9682 !! html
9683 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9684
9685 !! end
9686
9687 !! test
9688 Nested lists 8 (multiple nesting transitions)
9689 !! wikitext
9690 * foo
9691 *** bar
9692 ** baz
9693 * boo
9694 !! html
9695 <ul><li> foo
9696 <ul><li><ul><li> bar</li></ul></li>
9697 <li> baz</li></ul></li>
9698 <li> boo</li></ul>
9699
9700 !! end
9701
9702 !! test
9703 Nested lists 9 (extension interaction)
9704 !! options
9705 parsoid
9706 !! wikitext
9707 *<references />
9708 !! html/parsoid
9709 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9710 !! end
9711
9712 !! test
9713 1. Lists with start-of-line-transparent tokens before bullets: Comments
9714 !! wikitext
9715 *foo
9716 *<!--cmt-->bar
9717 <!--cmt-->*baz
9718 !! html
9719 <ul><li>foo</li>
9720 <li>bar</li>
9721 <li>baz</li></ul>
9722
9723 !! end
9724
9725 !! test
9726 2. Lists with start-of-line-transparent tokens before bullets: Template close
9727 !! wikitext
9728 *foo {{echo|bar
9729 }}*baz
9730 !! html
9731 <ul><li>foo bar</li>
9732 <li>baz</li></ul>
9733
9734 !! end
9735
9736 !! test
9737 List items are not parsed correctly following a <pre> block (T2785)
9738 !! wikitext
9739 * <pre>foo</pre>
9740 * <pre>bar</pre>
9741 * zar
9742 !! html/php
9743 <ul><li> <pre>foo</pre></li>
9744 <li> <pre>bar</pre></li>
9745 <li> zar</li></ul>
9746
9747 !! html/parsoid
9748 <ul><li> <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9749 <li> <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9750 <li> zar</li></ul>
9751 !! end
9752
9753 !! test
9754 List items from template
9755 !! wikitext
9756
9757 {{inner list}}
9758 * item 2
9759
9760 * item 0
9761 {{inner list}}
9762 * item 2
9763
9764 * item 0
9765 * notSOL{{inner list}}
9766 * item 2
9767 !! html
9768 <ul><li> item 1</li>
9769 <li> item 2</li></ul>
9770 <ul><li> item 0</li>
9771 <li> item 1</li>
9772 <li> item 2</li></ul>
9773 <ul><li> item 0</li>
9774 <li> notSOL</li>
9775 <li> item 1</li>
9776 <li> item 2</li></ul>
9777
9778 !! end
9779
9780 !! test
9781 List interrupted by empty line or heading
9782 !! wikitext
9783 * foo
9784
9785 ** bar
9786 == A heading ==
9787 * Another list item
9788 !! html
9789 <ul><li> foo</li></ul>
9790 <ul><li><ul><li> bar</li></ul></li></ul>
9791 <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>
9792 <ul><li> Another list item</li></ul>
9793
9794 !!end
9795
9796 !!test
9797 Multiple list tags generated by templates
9798 !! wikitext
9799 {{echo|<li>}}a
9800 {{echo|<li>}}b
9801 {{echo|<li>}}c
9802 !! html
9803 <li>a
9804 <li>b
9805 <li>c</li>
9806 </li>
9807 </li>
9808
9809 !! html+tidy
9810 <ul>
9811 <li>a</li>
9812 <li>b</li>
9813 <li>c</li>
9814 </ul>
9815 !!end
9816
9817 !!test
9818 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9819 !! wikitext
9820 *a
9821 <!--This line will NOT split the list-->
9822 *b
9823 <!--This line will NOT split the list either-->
9824 *c
9825 <!--foo--> <!----> <!--This line NOT split the list either-->
9826 *d
9827 !! html
9828 <ul><li>a</li>
9829 <li>b</li>
9830 <li>c</li>
9831 <li>d</li></ul>
9832
9833 !!end
9834
9835 !!test
9836 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9837 !! wikitext
9838 *a
9839 <!--This line will NOT split the list-->
9840 *b
9841 <!--This line will NOT split the list either-->
9842 *c
9843 <!--foo--> <!----> <!--This line NOT split the list
9844 either-->
9845 *d
9846 !! html
9847 <ul><li>a</li>
9848 <li>b</li>
9849 <li>c</li>
9850 <li>d</li></ul>
9851
9852 !!end
9853
9854 !!test
9855 Test the li-hack
9856 (The PHP parser relies on Tidy for the hack)
9857 !!options
9858 parsoid=wt2html,wt2wt
9859 !! wikitext
9860 * foo
9861 * <li>li-hack
9862 * {{echo|<li>templated li-hack}}
9863 * <!--foo--> <li> unsupported li-hack with preceding comments
9864
9865 <ul>
9866 <li><li>not a li-hack
9867 </li>
9868 </ul>
9869 !! html+tidy
9870 <ul>
9871 <li>foo</li>
9872 <li>li-hack</li>
9873 <li>templated li-hack</li>
9874 <li>unsupported li-hack with preceding comments</li>
9875 </ul>
9876 <ul>
9877 <li>not a li-hack</li>
9878 </ul>
9879 !!end
9880
9881 !! test
9882 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9883 !! options
9884 parsoid
9885 !! wikitext
9886 # foo
9887 ## bar
9888 * foo
9889 ** bar
9890 : foo
9891 :: bar
9892 !! html
9893 <ol>
9894 <li> foo<ol>
9895 <li> bar</li>
9896 </ol></li>
9897 </ol><ul>
9898 <li> foo<ul>
9899 <li> bar</li>
9900 </ul></li>
9901 </ul><dl>
9902 <dd> foo<dl>
9903 <dd> bar</dd>
9904 </dl></dd>
9905 </dl>
9906 !! end
9907
9908 !! test
9909 Parsoid: Test of whitespace serialization with Templated bullets
9910 !! options
9911 parsoid
9912 !! wikitext
9913 * {{bullet}}
9914 !! html
9915 <ul>
9916 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9917 </ul>
9918 !! end
9919
9920 # ------------------------------------------------------------------------
9921 # The next set of tests are about Parsoid's ability to handle badly nested
9922 # tags (parse, minimize scope of fixup, and roundtrip back)
9923 # ------------------------------------------------------------------------
9924
9925 !! test
9926 Unbalanced closing block tags break a list
9927 (php parser relies on Tidy to fix up)
9928 !! wikitext
9929 <div>
9930 *a</div><div>
9931 *b</div>
9932 !! html+tidy
9933 <div>
9934 <ul>
9935 <li>a</li>
9936 </ul>
9937 </div>
9938 <div>
9939 <ul>
9940 <li>b</li>
9941 </ul>
9942 </div>
9943 !! end
9944
9945 # Parsoid fails this test, but it might be tricky to support properly.
9946 # See T70395.
9947 !! test
9948 Unbalanced closing non-block tags don't break a list
9949 (php parser relies on Tidy to fix up)
9950 !! wikitext
9951 <span>
9952 *a</span><span>
9953 *b</span>
9954 !! html/php+tidy
9955 <ul>
9956 <li><span>a</span></li>
9957 <li><span>b</span></li>
9958 </ul>
9959 !! html/parsoid
9960 <span>
9961 <ul>
9962 <li>a<span></span>
9963 </li>
9964 <li>b
9965 </li>
9966 </ul>
9967 </span>
9968 !! end
9969
9970 !! test
9971 Unclosed formatting tags that straddle lists are closed and reopened
9972 (php parser relies on Tidy to fix up)
9973 !! options
9974 parsoid=wt2html,wt2wt,html2html
9975 !! wikitext
9976 # <s> a
9977 # b </s>
9978 !! html/php+tidy
9979 <ol>
9980 <li><s>a</s></li>
9981 <li><s>b</s></li>
9982 </ol>
9983 !! html/parsoid
9984 <ol><li> <s> a</s></li>
9985 <li><s> b </s></li></ol>
9986 !! end
9987
9988 # See T70395.
9989 !!test
9990 1. List embedded in a formatting tag
9991 !! wikitext
9992 <small>
9993 * foo
9994 </small>
9995 !! html/php+tidy
9996 <ul>
9997 <li><small>foo</small></li>
9998 </ul>
9999 !! html/parsoid
10000 <small>
10001 <ul>
10002 <li> foo</li>
10003 </ul>
10004 </small>
10005 !!end
10006
10007 ## Ugly Parsoid output here
10008 ## Not sure what the right output is.
10009 !!test
10010 2. List embedded in a formatting tag
10011 !! wikitext
10012 <small>
10013 *a
10014 *b</small>
10015 !! html/php+tidy
10016 <ul>
10017 <li><small>a</small></li>
10018 <li><small>b</small></li>
10019 </ul>
10020 !! html/parsoid
10021 <small></small>
10022 <ul><small>
10023 <li>a</li>
10024 </small>
10025 <li><small>b</small></li>
10026 </ul>
10027 !!end
10028
10029 # Ugly Parsoid and PHP parser output here
10030 # Not sure if we want to make this a test!
10031 #
10032 ## !!test
10033 ## 3. Unclosed formatting tags in list elements
10034 ## !! wikitext
10035 ## *<small>a
10036 ## *<small>b
10037 ## !! html/php+tidy
10038 ## <ul>
10039 ## <li><small>a</small></li>
10040 ## <li><small><small>b</small></small></li>
10041 ## </ul>
10042 ## !! html/parsoid
10043 ## <ul>
10044 ## <li><small>a</small></li>
10045 ## <small>
10046 ## <li><small>b</small></li>
10047 ## </small></ul>
10048 ## !!end
10049
10050 # This is a bug in the PHP parser + tidy combination.
10051 # (The </tr> tag gets parsed as text and html-escaped by PHP,
10052 # and then fostered out of the table by tidy.)
10053 # We believe the Parsoid output to be correct.
10054 !! test
10055 Table with missing opening <tr> tag
10056 !! options
10057 parsoid=wt2html,wt2wt
10058 !! wikitext
10059 <table>
10060 <td>foo</td>
10061 </tr>
10062 </table>
10063 !! html+tidy
10064 <table>
10065 <tr>
10066 <td>foo</td>
10067 </tr>
10068 </table>
10069 !! end
10070
10071 ###
10072 ### Magic Words
10073 ###
10074
10075 # Note that the current date is hard-coded as
10076 # 1970-01-01T00:02:03Z (a Thursday)
10077 # when running parser tests. The timezone is also fixed to GMT, so
10078 # local date will be identical to current date.
10079
10080 !! test
10081 Magic Word: {{CURRENTDAY}}
10082 !! wikitext
10083 {{CURRENTDAY}}
10084 !! html
10085 <p>1
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{CURRENTDAY2}}
10091 !! wikitext
10092 {{CURRENTDAY2}}
10093 !! html
10094 <p>01
10095 </p>
10096 !! end
10097
10098 !! test
10099 Magic Word: {{CURRENTDAYNAME}}
10100 !! wikitext
10101 {{CURRENTDAYNAME}}
10102 !! html
10103 <p>Thursday
10104 </p>
10105 !! end
10106
10107 !! test
10108 Magic Word: {{CURRENTDOW}}
10109 !! wikitext
10110 {{CURRENTDOW}}
10111 !! html
10112 <p>4
10113 </p>
10114 !! end
10115
10116 !! test
10117 Magic Word: {{CURRENTMONTH}}
10118 !! wikitext
10119 {{CURRENTMONTH}}
10120 !! html
10121 <p>01
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{CURRENTMONTH1}}
10127 !! wikitext
10128 {{CURRENTMONTH1}}
10129 !! html
10130 <p>1
10131 </p>
10132 !! end
10133
10134 !! test
10135 Magic Word: {{CURRENTMONTHABBREV}}
10136 !! wikitext
10137 {{CURRENTMONTHABBREV}}
10138 !! html
10139 <p>Jan
10140 </p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{CURRENTMONTHNAME}}
10145 !! wikitext
10146 {{CURRENTMONTHNAME}}
10147 !! html
10148 <p>January
10149 </p>
10150 !! end
10151
10152 !! test
10153 Magic Word: {{CURRENTMONTHNAMEGEN}}
10154 !! wikitext
10155 {{CURRENTMONTHNAMEGEN}}
10156 !! html
10157 <p>January
10158 </p>
10159 !! end
10160
10161 !! test
10162 Magic Word: {{CURRENTTIME}}
10163 !! wikitext
10164 {{CURRENTTIME}}
10165 !! html
10166 <p>00:02
10167 </p>
10168 !! end
10169
10170 !! test
10171 Magic Word: {{CURRENTHOUR}}
10172 !! wikitext
10173 {{CURRENTHOUR}}
10174 !! html
10175 <p>00
10176 </p>
10177 !! end
10178
10179 !! test
10180 Magic Word: {{CURRENTWEEK}} (T6594)
10181 !! wikitext
10182 {{CURRENTWEEK}}
10183 !! html
10184 <p>1
10185 </p>
10186 !! end
10187
10188 !! test
10189 Magic Word: {{CURRENTYEAR}}
10190 !! wikitext
10191 {{CURRENTYEAR}}
10192 !! html
10193 <p>1970
10194 </p>
10195 !! end
10196
10197 !! test
10198 Magic Word: {{CURRENTTIMESTAMP}}
10199 !! wikitext
10200 {{CURRENTTIMESTAMP}}
10201 !! html
10202 <p>19700101000203
10203 </p>
10204 !! end
10205
10206 !! test
10207 Magic Words LOCAL (UTC)
10208 !! wikitext
10209 * {{LOCALMONTH}}
10210 * {{LOCALMONTH1}}
10211 * {{LOCALMONTHNAME}}
10212 * {{LOCALMONTHNAMEGEN}}
10213 * {{LOCALMONTHABBREV}}
10214 * {{LOCALDAY}}
10215 * {{LOCALDAY2}}
10216 * {{LOCALDAYNAME}}
10217 * {{LOCALYEAR}}
10218 * {{LOCALTIME}}
10219 * {{LOCALHOUR}}
10220 * {{LOCALWEEK}}
10221 * {{LOCALDOW}}
10222 * {{LOCALTIMESTAMP}}
10223 !! html
10224 <ul><li> 01</li>
10225 <li> 1</li>
10226 <li> January</li>
10227 <li> January</li>
10228 <li> Jan</li>
10229 <li> 1</li>
10230 <li> 01</li>
10231 <li> Thursday</li>
10232 <li> 1970</li>
10233 <li> 00:02</li>
10234 <li> 00</li>
10235 <li> 1</li>
10236 <li> 4</li>
10237 <li> 19700101000203</li></ul>
10238
10239 !! end
10240
10241 !! test
10242 Magic Word: {{FULLPAGENAME}}
10243 !! options
10244 title=[[User:Ævar Arnfjörð Bjarmason]]
10245 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10246 !! wikitext
10247 {{FULLPAGENAME}}
10248 !! html/*
10249 <p>User:Ævar Arnfjörð Bjarmason
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{FULLPAGENAMEE}}
10255 !! options
10256 title=[[User:Ævar Arnfjörð Bjarmason]]
10257 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10258 !! wikitext
10259 {{FULLPAGENAMEE}}
10260 !! html/*
10261 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{TALKSPACE}}
10267 !! options
10268 title=[[User:Ævar Arnfjörð Bjarmason]]
10269 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10270 !! wikitext
10271 {{TALKSPACE}}
10272 !! html/*
10273 <p>User talk
10274 </p>
10275 !! end
10276
10277 !! test
10278 Magic Word: {{TALKSPACE}}, same namespace
10279 !! options
10280 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10281 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10282 !! wikitext
10283 {{TALKSPACE}}
10284 !! html/*
10285 <p>User talk
10286 </p>
10287 !! end
10288
10289 !! test
10290 Magic Word: {{TALKSPACE}}, main namespace
10291 !! options
10292 title=[[Parser Test]]
10293 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10294 !! wikitext
10295 {{TALKSPACE}}
10296 !! html/*
10297 <p>Talk
10298 </p>
10299 !! end
10300
10301 !! test
10302 Magic Word: {{TALKSPACEE}}
10303 !! options
10304 title=[[User:Ævar Arnfjörð Bjarmason]]
10305 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10306 !! wikitext
10307 {{TALKSPACEE}}
10308 !! html/*
10309 <p>User_talk
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{SUBJECTSPACE}}
10315 !! options
10316 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10317 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10318 !! wikitext
10319 {{SUBJECTSPACE}}
10320 !! html/*
10321 <p>User
10322 </p>
10323 !! end
10324
10325 !! test
10326 Magic Word: {{SUBJECTSPACE}}, same namespace
10327 !! options
10328 title=[[User:Ævar Arnfjörð Bjarmason]]
10329 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10330 !! wikitext
10331 {{SUBJECTSPACE}}
10332 !! html/*
10333 <p>User
10334 </p>
10335 !! end
10336
10337 !! test
10338 Magic Word: {{SUBJECTSPACE}}, main namespace
10339 !! options
10340 title=[[Parser Test]]
10341 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10342 !! wikitext
10343 {{SUBJECTSPACE}}
10344 !! html/*
10345
10346 !! end
10347
10348 !! test
10349 Magic Word: {{SUBJECTSPACEE}}
10350 !! options
10351 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10352 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10353 !! wikitext
10354 {{SUBJECTSPACEE}}
10355 !! html/*
10356 <p>User
10357 </p>
10358 !! end
10359
10360 !! test
10361 Magic Word: {{NAMESPACE}}
10362 !! options
10363 title=[[User:Ævar Arnfjörð Bjarmason]]
10364 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10365 !! wikitext
10366 {{NAMESPACE}}
10367 !! html/*
10368 <p>User
10369 </p>
10370 !! end
10371
10372 !! test
10373 Magic Word: {{NAMESPACEE}}
10374 !! options
10375 title=[[User:Ævar Arnfjörð Bjarmason]]
10376 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10377 !! wikitext
10378 {{NAMESPACEE}}
10379 !! html/*
10380 <p>User
10381 </p>
10382 !! end
10383
10384 !! test
10385 Magic Word: {{NAMESPACENUMBER}}
10386 !! options
10387 title=[[User:Ævar Arnfjörð Bjarmason]]
10388 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10389 !! wikitext
10390 {{NAMESPACENUMBER}}
10391 !! html/*
10392 <p>2
10393 </p>
10394 !! end
10395
10396 !! test
10397 Magic Word: {{SUBPAGENAME}}
10398 !! options
10399 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10400 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10401 !! wikitext
10402 {{SUBPAGENAME}}
10403 !! html/*
10404 <p>sub ö
10405 </p>
10406 !! end
10407
10408 !! test
10409 Magic Word: {{SUBPAGENAMEE}}
10410 !! options
10411 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10412 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10413 !! wikitext
10414 {{SUBPAGENAMEE}}
10415 !! html/*
10416 <p>sub_%C3%B6
10417 </p>
10418 !! end
10419
10420 !! test
10421 Magic Word: {{ROOTPAGENAME}}
10422 !! options
10423 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10424 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10425 !! wikitext
10426 {{ROOTPAGENAME}}
10427 !! html/*
10428 <p>Ævar Arnfjörð Bjarmason
10429 </p>
10430 !! end
10431
10432 !! test
10433 Magic Word: {{ROOTPAGENAMEE}}
10434 !! options
10435 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 !! wikitext
10438 {{ROOTPAGENAMEE}}
10439 !! html/*
10440 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10441 </p>
10442 !! end
10443
10444 !! test
10445 Magic Word: {{BASEPAGENAME}}
10446 !! options
10447 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10448 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10449 !! wikitext
10450 {{BASEPAGENAME}}
10451 !! html/*
10452 <p>Ævar Arnfjörð Bjarmason
10453 </p>
10454 !! end
10455
10456 !! test
10457 Magic Word: {{BASEPAGENAMEE}}
10458 !! options
10459 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10460 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10461 !! wikitext
10462 {{BASEPAGENAMEE}}
10463 !! html/*
10464 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10465 </p>
10466 !! end
10467
10468 !! test
10469 Magic Word: {{TALKPAGENAME}}
10470 !! options
10471 title=[[User:Ævar Arnfjörð Bjarmason]]
10472 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10473 !! wikitext
10474 {{TALKPAGENAME}}
10475 !! html/*
10476 <p>User talk:Ævar Arnfjörð Bjarmason
10477 </p>
10478 !! end
10479
10480 !! test
10481 Magic Word: {{TALKPAGENAMEE}}
10482 !! options
10483 title=[[User:Ævar Arnfjörð Bjarmason]]
10484 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10485 !! wikitext
10486 {{TALKPAGENAMEE}}
10487 !! html/*
10488 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10489 </p>
10490 !! end
10491
10492 !! test
10493 Magic Word: {{SUBJECTPAGENAME}}
10494 !! options
10495 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10496 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10497 !! wikitext
10498 {{SUBJECTPAGENAME}}
10499 !! html/*
10500 <p>User:Ævar Arnfjörð Bjarmason
10501 </p>
10502 !! end
10503
10504 !! test
10505 Magic Word: {{SUBJECTPAGENAMEE}}
10506 !! options
10507 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10508 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10509 !! wikitext
10510 {{SUBJECTPAGENAMEE}}
10511 !! html/*
10512 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10513 </p>
10514 !! end
10515
10516 !! test
10517 Magic Word: {{NUMBEROFFILES}}
10518 !! options
10519 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10520 !! wikitext
10521 {{NUMBEROFFILES}}
10522 !! html/*
10523 <p>7
10524 </p>
10525 !! end
10526
10527 !! test
10528 Magic Word: {{PAGENAME}}
10529 !! options
10530 title=[[User:Ævar Arnfjörð Bjarmason]]
10531 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10532 !! wikitext
10533 {{PAGENAME}}
10534 !! html/*
10535 <p>Ævar Arnfjörð Bjarmason
10536 </p>
10537 !! end
10538
10539 !! test
10540 Magic Word: {{PAGENAME}} with metacharacters
10541 !! options
10542 title=[['foo & bar = baz']]
10543 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10544 !! wikitext
10545 ''{{PAGENAME}}''
10546 !! html/php
10547 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10548 </p>
10549 !! html+tidy
10550 <p><i>'foo &amp; bar = baz'</i></p>
10551 !! end
10552
10553 !! test
10554 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10555 !! options
10556 title=[[*RFC 1234 http://example.com/]]
10557 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10558 !! wikitext
10559 {{PAGENAME}}
10560 !! html/php
10561 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10562 </p>
10563 !! html+tidy
10564 <p>*RFC 1234 http://example.com/</p>
10565 !! end
10566
10567 !! test
10568 Magic Word: {{PAGENAMEE}}
10569 !! options
10570 title=[[User:Ævar Arnfjörð Bjarmason]]
10571 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10572 !! wikitext
10573 {{PAGENAMEE}}
10574 !! html/*
10575 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10576 </p>
10577 !! end
10578
10579 !! test
10580 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10581 !! options
10582 title=[[*RFC 1234 http://example.com/]]
10583 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10584 !! wikitext
10585 {{PAGENAMEE}}
10586 !! html/php
10587 <p>&#42;RFC_1234_http&#58;//example.com/
10588 </p>
10589 !! html+tidy
10590 <p>*RFC_1234_http://example.com/</p>
10591 !! end
10592
10593 !! test
10594 Magic Word: {{REVISIONID}}
10595 !! options
10596 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10597 showflags
10598 !! wikitext
10599 {{REVISIONID}}
10600 !! html/*
10601 <p>1337
10602 </p>
10603 flags=vary-revision-id
10604 !! end
10605
10606 !! test
10607 Magic Word: {{SCRIPTPATH}}
10608 !! options
10609 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10610 !! wikitext
10611 {{SCRIPTPATH}}
10612 !! html/*
10613
10614 !! end
10615
10616 !! test
10617 Magic Word: {{STYLEPATH}}
10618 !! options
10619 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10620 !! wikitext
10621 {{STYLEPATH}}
10622 !! html/*
10623 <p>/skins
10624 </p>
10625 !! end
10626
10627 !! test
10628 Magic Word: {{SERVER}}
10629 !! options
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{SERVER}}
10633 !! html/*
10634 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{SERVERNAME}}
10640 !! options
10641 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10642 !! wikitext
10643 {{SERVERNAME}}
10644 !! html/*
10645 <p>example.org
10646 </p>
10647 !! end
10648
10649 !! test
10650 Magic Word: {{SITENAME}}
10651 !! options
10652 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10653 !! wikitext
10654 {{SITENAME}}
10655 !! html/*
10656 <p>MediaWiki
10657 </p>
10658 !! end
10659
10660 !! test
10661 Magic Word: {{PAGELANGUAGE}}
10662 !! options
10663 language=fr
10664 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10665 !! wikitext
10666 {{PAGELANGUAGE}}
10667 !! html/*
10668 <p>fr
10669 </p>
10670 !! end
10671
10672 !! test
10673 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10674 !! options
10675 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10676 !! wikitext
10677 {{PAGELANGUAGE}}
10678 !! html/*
10679 <p>en
10680 </p>
10681 !! end
10682
10683 !! test
10684 Case-sensitive magic words, when cased differently, should just be template transclusions
10685 !! wikitext
10686 {{CurrentMonth}}
10687 {{currentday}}
10688 {{cURreNTweEK}}
10689 {{currentHour}}
10690 !! html
10691 <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>
10692 <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>
10693 <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>
10694 <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>
10695 </p>
10696 !! end
10697
10698 !! test
10699 Case-insensitive magic words should still work with weird casing.
10700 !! wikitext
10701 {{sErVeRNaMe}}
10702 {{LCFirst:AOEU}}
10703 {{ucFIRST:aoeu}}
10704 {{SERver}}
10705 !! html
10706 <p>example.org
10707 aOEU
10708 Aoeu
10709 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10710 </p>
10711 !! end
10712
10713 # From plwiki:PLOS_ONE
10714 !! test
10715 Parsoid: Page property magic word with magic word contents
10716 !! wikitext
10717 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10718 !! html/parsoid
10719 <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>"}]]}'/>
10720 !! end
10721
10722 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10723 # But, this is a limitation of our representation and is documented in
10724 # TemplateHandler.js in processSpecialMagicWord
10725 !! test
10726 Parsoid: Template-generated DISPLAYTITLE
10727 !! wikitext
10728 {{{{echo|DISPLAYTITLE}}:Foo}}
10729 !! options
10730 showtitle
10731 !! config
10732 wgAllowDisplayTitle=true
10733 wgRestrictDisplayTitle=false
10734 !! html/php
10735 Foo
10736
10737 !! html/parsoid
10738 <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"}]]}'/>
10739 !! end
10740
10741 !! test
10742 Namespace 1 {{ns:1}}
10743 !! wikitext
10744 {{ns:1}}
10745 !! html
10746 <p>Talk
10747 </p>
10748 !! end
10749
10750 !! test
10751 Namespace 1 {{ns:01}}
10752 !! wikitext
10753 {{ns:01}}
10754 !! html
10755 <p>Talk
10756 </p>
10757 !! end
10758
10759 !! test
10760 Namespace 0 {{ns:0}} (T6783)
10761 !! wikitext
10762 {{ns:0}}
10763 !! html
10764
10765 !! end
10766
10767 !! test
10768 Namespace 0 {{ns:00}} (T6783)
10769 !! wikitext
10770 {{ns:00}}
10771 !! html
10772
10773 !! end
10774
10775 !! test
10776 Namespace -1 {{ns:-1}}
10777 !! wikitext
10778 {{ns:-1}}
10779 !! html
10780 <p>Special
10781 </p>
10782 !! end
10783
10784 !! test
10785 Namespace User {{ns:User}}
10786 !! wikitext
10787 {{ns:User}}
10788 !! html
10789 <p>User
10790 </p>
10791 !! end
10792
10793 !! test
10794 Namespace User talk {{ns:User_talk}}
10795 !! wikitext
10796 {{ns:User_talk}}
10797 !! html
10798 <p>User talk
10799 </p>
10800 !! end
10801
10802 !! test
10803 Namespace User talk {{ns:uSeR tAlK}}
10804 !! wikitext
10805 {{ns:uSeR tAlK}}
10806 !! html
10807 <p>User talk
10808 </p>
10809 !! end
10810
10811 !! test
10812 Namespace File {{ns:File}}
10813 !! wikitext
10814 {{ns:File}}
10815 !! html
10816 <p>File
10817 </p>
10818 !! end
10819
10820 !! test
10821 Namespace File {{ns:Image}}
10822 !! wikitext
10823 {{ns:Image}}
10824 !! html
10825 <p>File
10826 </p>
10827 !! end
10828
10829 !! test
10830 Namespace (lang=de) Benutzer {{ns:User}}
10831 !! options
10832 language=de
10833 !! wikitext
10834 {{ns:User}}
10835 !! html
10836 <p>Benutzer
10837 </p>
10838 !! end
10839
10840 !! test
10841 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10842 !! options
10843 language=de
10844 !! wikitext
10845 {{ns:3}}
10846 !! html
10847 <p>Benutzer Diskussion
10848 </p>
10849 !! end
10850
10851 !! test
10852 Urlencode
10853 !! wikitext
10854 {{urlencode:hi world?!}}
10855 {{urlencode:hi world?!|WIKI}}
10856 {{urlencode:hi world?!|PATH}}
10857 {{urlencode:hi world?!|QUERY}}
10858 !! html/php
10859 <p>hi+world%3F%21
10860 hi_world%3F!
10861 hi%20world%3F%21
10862 hi+world%3F%21
10863 </p>
10864 !! end
10865
10866 !! test
10867 Magic Word: prioritize type info over data-parsoid
10868 !! options
10869 parsoid=html2wt
10870 !! html/parsoid
10871 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10872 !! wikitext
10873 __FORCETOC__
10874 !! end
10875
10876 !! test
10877 Magic Word: serialize on separate line (parsoid)
10878 !! options
10879 parsoid=wt2wt,html2wt
10880 !! wikitext
10881 foo
10882 __NOTOC__
10883 bar
10884 !! html/parsoid
10885 foo<meta property="mw:PageProp/notoc"/>bar
10886 !! end
10887
10888 !! test
10889 Magic Word: rt non-english wikis
10890 !! options
10891 parsoid=wt2wt
10892 language=de
10893 !! wikitext
10894 __NOEDITSECTION__
10895 !! html/parsoid
10896 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10897 !! end
10898
10899 !!test
10900 __proto__ is treated as normal wikitext (T105997)
10901 !!wikitext
10902 __proto__
10903 !!html
10904 <p>__proto__
10905 </p>
10906 !!end
10907
10908 ###
10909 ### Magic links
10910 ###
10911 !! test
10912 Magic links: internal link to RFC (T2479)
10913 !! wikitext
10914 [[RFC 123]]
10915 !! html/php
10916 <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>
10917 </p>
10918 !! html/parsoid
10919 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10920 !! end
10921
10922 !! test
10923 Magic links: RFC (T2479)
10924 !! wikitext
10925 RFC 822
10926 !! html/php
10927 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10928 </p>
10929 !! html/parsoid
10930 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10931 !! end
10932
10933 !! test
10934 Magic links: RFC (T67278)
10935 !! wikitext
10936 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10937 !! html/php
10938 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10939 </p>
10940 !! html/parsoid
10941 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10942 !! end
10943
10944 !! test
10945 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10946 !! wikitext
10947 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10948 RFC
10949 822
10950 !! html/php
10951 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10952 RFC
10953 822
10954 </p>
10955 !! html/parsoid
10956 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">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>
10957 RFC
10958 822</p>
10959 !! end
10960
10961 !! test
10962 Magic links: ISBN (T3937)
10963 !! wikitext
10964 ISBN 0-306-40615-2
10965 !! html/php
10966 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10967 </p>
10968 !! html/parsoid
10969 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10970 !! end
10971
10972 !! test
10973 Magic links: ISBN (T67278)
10974 !! wikitext
10975 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10976 !! html/php
10977 <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.
10978 </p>
10979 !! html/parsoid
10980 <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>
10981 !! end
10982
10983 !! test
10984 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10985 !! wikitext
10986 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10987 ISBN
10988 9780316098113
10989 ISBN 978
10990 0316098113
10991 !! html/php
10992 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10993 ISBN
10994 9780316098113
10995 ISBN 978
10996 0316098113
10997 </p>
10998 !! html/parsoid
10999 <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>
11000 ISBN
11001 9780316098113
11002 ISBN 978
11003 0316098113</p>
11004 !! end
11005
11006 !! test
11007 Magic links: PMID incorrectly converts space to underscore
11008 !! wikitext
11009 PMID 1234
11010 !! html/php
11011 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11012 </p>
11013 !! html/parsoid
11014 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
11015 !! end
11016
11017 !! test
11018 Magic links: PMID (T67278)
11019 !! wikitext
11020 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11021 !! html/php
11022 <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.
11023 </p>
11024 !! html/parsoid
11025 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11026 !! end
11027
11028 !! test
11029 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11030 !! wikitext
11031 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11032 PMID
11033 1234
11034 !! html/php
11035 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11036 PMID
11037 1234
11038 </p>
11039 !! html/parsoid
11040 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">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>
11041 PMID
11042 1234</p>
11043 !! end
11044
11045 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11046 # since these are ExtLinkText, not MagicLinkText
11047 !! test
11048 Magic links: use appropriate serialization for "almost" magic links.
11049 !! wikitext
11050 X[[Special:BookSources/0978739256|foo]]
11051
11052 X[//tools.ietf.org/html/rfc1234 foo]
11053 !! html/php
11054 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11055 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
11056 </p>
11057 !! html/parsoid
11058 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11059 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
11060 !! end
11061
11062 !! test
11063 Magic links: All disabled (T47942)
11064 !! options
11065 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11066 !! wikitext
11067 ISBN 0-306-40615-2
11068 PMID 1234
11069 RFC 4321
11070 !! html/php
11071 <p>ISBN 0-306-40615-2
11072 PMID 1234
11073 RFC 4321
11074 </p>
11075 !! end
11076
11077 ###
11078 ### Templates
11079 ####
11080
11081 !! test
11082 Nonexistent template
11083 !! wikitext
11084 {{thistemplatedoesnotexist}}
11085 !! html
11086 <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>
11087 </p>
11088 !! end
11089
11090 !! test
11091 Template with invalid target containing tags
11092 !! wikitext
11093 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11094 !! html
11095 <p>{{a<b>b</b>|foo|a=b|a = b}}
11096 </p>
11097 !! end
11098
11099 !! test
11100 Template with invalid target containing unclosed tag
11101 !! wikitext
11102 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11103 !! html
11104 <p>{{a<b>|foo|a=b|a = b}}</b>
11105 </p>
11106 !! end
11107
11108 !! test
11109 Template with invalid target containing wikilink
11110 !! wikitext
11111 {{[[Main Page]]}}
11112 !! html/php
11113 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11114 </p>
11115 !! html/parsoid
11116 <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>
11117 !! end
11118
11119 !! test
11120 Template with just whitespace in it, T70421
11121 !! wikitext
11122 {{echo|{{ }}}}
11123 !! html/parsoid
11124 <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>
11125 !! end
11126
11127 !! article
11128 Template:test
11129 !! text
11130 This is a test template
11131 !! endarticle
11132
11133 !! test
11134 Simple template
11135 !! wikitext
11136 {{test}}
11137 !! html
11138 <p>This is a test template
11139 </p>
11140 !! end
11141
11142 !! test
11143 Template with explicit namespace
11144 !! wikitext
11145 {{Template:test}}
11146 !! html
11147 <p>This is a test template
11148 </p>
11149 !! end
11150
11151
11152 !! article
11153 Template:paramtest
11154 !! text
11155 This is a test template with parameter {{{param}}}
11156 !! endarticle
11157
11158 !! test
11159 Template parameter
11160 !! wikitext
11161 {{paramtest|param=foo}}
11162 !! html
11163 <p>This is a test template with parameter foo
11164 </p>
11165 !! end
11166
11167 !! article
11168 Template:paramtestnum
11169 !! text
11170 [[{{{1}}}|{{{2}}}]]
11171 !! endarticle
11172
11173 !! test
11174 Template unnamed parameter
11175 !! wikitext
11176 {{paramtestnum|Main Page|the main page}}
11177 !! html
11178 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11179 </p>
11180 !! end
11181
11182 !! article
11183 Template:templatesimple
11184 !! text
11185 (test)
11186 !! endarticle
11187
11188 !! article
11189 Template:templateredirect
11190 !! text
11191 #redirect [[Template:templatesimple]]
11192 !! endarticle
11193
11194 !! article
11195 Template:templateasargtestnum
11196 !! text
11197 {{{{{1}}}}}
11198 !! endarticle
11199
11200 !! article
11201 Template:templateasargtest
11202 !! text
11203 {{template{{{templ}}}}}
11204 !! endarticle
11205
11206 !! article
11207 Template:templateasargtest2
11208 !! text
11209 {{{{{templ}}}}}
11210 !! endarticle
11211
11212 !! test
11213 Template with template name as unnamed argument
11214 !! wikitext
11215 {{templateasargtestnum|templatesimple}}
11216 !! html
11217 <p>(test)
11218 </p>
11219 !! end
11220
11221 !! test
11222 Template with template name as argument
11223 !! wikitext
11224 {{templateasargtest|templ=simple}}
11225 !! html
11226 <p>(test)
11227 </p>
11228 !! end
11229
11230 !! test
11231 Template with template name as argument (2)
11232 !! wikitext
11233 {{templateasargtest2|templ=templatesimple}}
11234 !! html
11235 <p>(test)
11236 </p>
11237 !! end
11238
11239 !! article
11240 Template:templateasargtestdefault
11241 !! text
11242 {{{{{templ|templatesimple}}}}}
11243 !! endarticle
11244
11245 !! article
11246 Template:templa
11247 !! text
11248 '''templ'''
11249 !! endarticle
11250
11251 !! test
11252 Template with default value
11253 !! wikitext
11254 {{templateasargtestdefault}}
11255 !! html
11256 <p>(test)
11257 </p>
11258 !! end
11259
11260 !! test
11261 Template with default value (value set)
11262 !! wikitext
11263 {{templateasargtestdefault|templ=templa}}
11264 !! html
11265 <p><b>templ</b>
11266 </p>
11267 !! end
11268
11269 !! test
11270 Template redirect
11271 !! wikitext
11272 {{templateredirect}}
11273 !! html/php
11274 <p>(test)
11275 </p>
11276 !! html/parsoid
11277 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11278 !! end
11279
11280 !! test
11281 Template with argument in separate line
11282 !! wikitext
11283 {{ templateasargtest |
11284 templ = simple }}
11285 !! html
11286 <p>(test)
11287 </p>
11288 !! end
11289
11290 !! test
11291 Template with complex template as argument
11292 !! wikitext
11293 {{paramtest|
11294 param ={{ templateasargtest |
11295 templ = simple }}}}
11296 !! html
11297 <p>This is a test template with parameter (test)
11298 </p>
11299 !! end
11300
11301 !! test
11302 Templates with templated name
11303 !! wikitext
11304 {{{{echo|echo}}|foo}}
11305 {{{{echo|inner list}} }}
11306 !! html
11307 <p>foo
11308 </p>
11309 <ul><li> item 1</li></ul>
11310
11311 !! html/parsoid
11312 <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>
11313 <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>
11314 !! end
11315
11316 # Parsoid markup is deliberate "broken". This is an edge case.
11317 # See long comment in TemplateHandler.js:convertAttribsToString.
11318 !! test
11319 Templates with invalid templated targets
11320 !! wikitext
11321 {{echo
11322 {{echo|foo}}
11323 }}
11324 !! html/php
11325 <p>{{echo
11326 foo
11327 }}
11328 </p>
11329 !! html/parsoid
11330 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11331 foo }}</p>
11332 !! end
11333
11334 !! test
11335 Template with thumb image (with link in description)
11336 !! wikitext
11337 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11338 !! html/php
11339 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>
11340
11341 !! html+tidy
11342 <p>This is a test template with parameter</p>
11343 <div class="thumb tright">
11344 <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>
11345 <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>
11346 </div>
11347 </div>
11348 !! html/parsoid
11349 <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>
11350 !! end
11351
11352 !! article
11353 Template:complextemplate
11354 !! text
11355 {{{1}}} {{paramtest|
11356 param ={{{param}}}}}
11357 !! endarticle
11358
11359 !! test
11360 Template with complex arguments
11361 !! wikitext
11362 {{complextemplate|
11363 param ={{ templateasargtest |
11364 templ = simple }}|[[Template:complextemplate|link]]}}
11365 !! html
11366 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11367 </p>
11368 !! end
11369
11370 !! test
11371 T2553: link with two variables in a piped link
11372 !! wikitext
11373 {|
11374 |[[{{{1}}}|{{{2}}}]]
11375 |}
11376 !! html/php
11377 <table>
11378 <tr>
11379 <td>[[{{{1}}}|{{{2}}}]]
11380 </td></tr></table>
11381
11382 !! html/parsoid
11383 <table>
11384 <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>
11385 </tbody></table>
11386 !! end
11387
11388 # See: T2553
11389 !! test
11390 Abort table cell attribute parsing on wikilink
11391 !! wikitext
11392 {|
11393 | testing [[one|two]] | three || four
11394 | testing one two | three || four
11395 | testing="[[one|two]]" | three || four
11396 |}
11397 !! html/php
11398 <table>
11399 <tr>
11400 <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>
11401 <td> four
11402 </td>
11403 <td> three </td>
11404 <td> four
11405 </td>
11406 <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>
11407 <td> four
11408 </td></tr></table>
11409
11410 !! html/parsoid
11411 <table>
11412 <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_v":"row","autoInsertedEnd":true}'> four</td>
11413 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
11414 <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_v":"row","autoInsertedEnd":true}'> four</td></tr>
11415 </tbody></table>
11416 !! end
11417
11418 !! test
11419 Don't abort table cell attribute parsing if wikilink is found in template arg
11420 !! wikitext
11421 {|
11422 | Test {{#tag:ref|One two "[[three]]" four}}
11423 |}
11424 !! html/parsoid
11425 <table>
11426 <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>
11427 </tbody></table>
11428 !! end
11429
11430 !! test
11431 Magic variable as template parameter
11432 !! wikitext
11433 {{paramtest|param={{SITENAME}}}}
11434 !! html
11435 <p>This is a test template with parameter MediaWiki
11436 </p>
11437 !! end
11438
11439 !! article
11440 Template:linktest
11441 !! text
11442 [[{{{param}}}|link]]
11443 !! endarticle
11444
11445 !! test
11446 Template parameter as link source
11447 !! wikitext
11448 {{linktest|param=Main Page}}
11449 !! html
11450 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11451 </p>
11452 !! end
11453
11454 !!article
11455 Template:paramtest2
11456 !! text
11457 including another template, {{paramtest|param={{{arg}}}}}
11458 !! endarticle
11459
11460 !! test
11461 Template passing argument to another template
11462 !! wikitext
11463 {{paramtest2|arg='hmm'}}
11464 !! html
11465 <p>including another template, This is a test template with parameter 'hmm'
11466 </p>
11467 !! end
11468
11469 !! article
11470 Template:Linktest2
11471 !! text
11472 Main Page
11473 !! endarticle
11474
11475 !! test
11476 Template as link source
11477 !! wikitext
11478 [[{{linktest2}}]]
11479
11480 [[{{linktest2}}|Main Page]]
11481
11482 [[{{linktest2}}]]Page
11483 !! html
11484 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11485 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11486 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11487 </p>
11488 !! end
11489
11490
11491 !! article
11492 Template:loop1
11493 !! text
11494 {{loop2}}
11495 !! endarticle
11496
11497 !! article
11498 Template:loop2
11499 !! text
11500 {{loop1}}
11501 !! endarticle
11502
11503 !! test
11504 Template infinite loop
11505 !! wikitext
11506 {{loop1}}
11507 !! html
11508 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11509 </p>
11510 !! end
11511
11512 !! test
11513 Template from main namespace
11514 !! wikitext
11515 {{:Main Page}}
11516 !! html
11517 <p>blah blah
11518 </p>
11519 !! end
11520
11521 !! article
11522 Template:table
11523 !! text
11524 {|
11525 | 1 || 2
11526 |-
11527 | 3 || 4
11528 |}
11529 !! endarticle
11530
11531 !! test
11532 T2529: Template with table, not included at beginning of line
11533 !! wikitext
11534 foo {{table}}
11535 !! html
11536 <p>foo
11537 </p>
11538 <table>
11539 <tr>
11540 <td> 1 </td>
11541 <td> 2
11542 </td></tr>
11543 <tr>
11544 <td> 3 </td>
11545 <td> 4
11546 </td></tr></table>
11547
11548 !! end
11549
11550 !! test
11551 T2523: Template shouldn't eat newline (or add an extra one before table)
11552 !! wikitext
11553 foo
11554 {{table}}
11555 !! html
11556 <p>foo
11557 </p>
11558 <table>
11559 <tr>
11560 <td> 1 </td>
11561 <td> 2
11562 </td></tr>
11563 <tr>
11564 <td> 3 </td>
11565 <td> 4
11566 </td></tr></table>
11567
11568 !! end
11569
11570 !! test
11571 T2041: Template parameters shown as broken links
11572 !! wikitext
11573 {{{parameter}}}
11574 !! html
11575 <p>{{{parameter}}}
11576 </p>
11577 !! end
11578
11579 !! test
11580 Template with targets containing wikilinks
11581 !! options
11582 parsoid=wt2html
11583 !! wikitext
11584 {{[[foo]]}}
11585
11586 {{[[{{echo|foo}}]]}}
11587
11588 {{{{echo|[[foo}}]]}}
11589 !! html/php
11590 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11591 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11592 </p><p>{{[[foo}}]]
11593 </p>
11594 !! html/parsoid
11595 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11596 <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>
11597 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11598 !! end
11599
11600 !! article
11601 Template:''
11602 !! text
11603 bar
11604 !! endarticle
11605
11606 !! test
11607 Templates: Double quotes as template target
11608 !! wikitext
11609 foo {{''}} baz
11610 !! html/php
11611 <p>foo bar baz
11612 </p>
11613 !! html/parsoid
11614 <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
11615 </p>
11616 !! end
11617
11618 ## This test is about making sure Parsoid's data-mw is well formed in the
11619 ## face of multiple templates with intersecting and overlapping ranges. The
11620 ## wikitext itself is wretched.
11621 !! test
11622 Templates with intersecting and overlapping ranges
11623 !! wikitext
11624 {|{{echo|
11625 <p>ha</p>}}
11626 {|{{echo|
11627 <p>ho</p>}}
11628 {{echo|{{!}}hi}}
11629 |}
11630 !! html/php+tidy
11631 <p>ha</p>
11632 <p>ho</p>
11633 <table>
11634 <tr>
11635 <td></td>
11636 </tr>
11637 <tr>
11638 <td>hi</td>
11639 </tr>
11640 </table>
11641 <table>
11642 <tr>
11643 <td></td>
11644 </tr>
11645 </table>
11646 !! html/parsoid
11647 <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":""}]]}'>
11648
11649 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11650
11651 <tbody><tr><td>hi</td></tr>
11652 </tbody></table>
11653 !! end
11654
11655 !! article
11656 Template:MSGNW test
11657 !! text
11658 ''None'' of '''this''' should be
11659 * interpreted
11660 but rather passed unmodified
11661 {{test}}
11662 <gallery>
11663 File:Foobar.jpg
11664 </gallery>
11665 <!-- comment -->
11666 !! endarticle
11667
11668 # hmm, fix this or just deprecate msgnw and document its behavior?
11669 !! test
11670 msgnw keyword
11671 !! wikitext
11672 {{msgnw:MSGNW test}}
11673 !! html/php
11674 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11675 &#42; interpreted
11676 &#32;but rather passed unmodified
11677 &#123;&#123;test&#125;&#125;
11678 &#60;gallery&#62;
11679 File:Foobar.jpg
11680 &#60;/gallery&#62;
11681 &#60;!-- comment --&#62;
11682 </p>
11683 !! end
11684
11685 !! test
11686 int keyword
11687 !! wikitext
11688 {{int:youhavenewmessages|lots of money|not!}}
11689 !! html
11690 <p>You have lots of money (not!).
11691 </p>
11692 !! end
11693
11694 !! test
11695 int keyword - non-existing message
11696 !! wikitext
11697 {{int:var}}
11698 !! html
11699 <p>⧼var⧽
11700 </p>
11701 !! end
11702
11703 !! article
11704 Template:Includes
11705 !! text
11706 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11707 !! endarticle
11708
11709 !! test
11710 <includeonly> and <noinclude> being included
11711 !! wikitext
11712 {{Includes}}
11713 !! html
11714 <p>Foobar
11715 </p>
11716 !! end
11717
11718 !! article
11719 Template:Includes2
11720 !! text
11721 <onlyinclude>Foo</onlyinclude>bar
11722 !! endarticle
11723
11724 !! test
11725 <onlyinclude> being included
11726 !! wikitext
11727 {{Includes2}}
11728 !! html
11729 <p>Foo
11730 </p>
11731 !! end
11732
11733
11734 !! article
11735 Template:Includes3
11736 !! text
11737 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11738 !! endarticle
11739
11740 !! test
11741 <onlyinclude> and <includeonly> being included
11742 !! wikitext
11743 {{Includes3}}
11744 !! html
11745 <p>Foo
11746 </p>
11747 !! end
11748
11749 !! test
11750 <includeonly> and <noinclude> on a page
11751 !! wikitext
11752 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11753 !! html
11754 <p>Foozar
11755 </p>
11756 !! end
11757
11758 !! test
11759 Un-closed <noinclude>
11760 !! wikitext
11761 <noinclude>
11762 !! html
11763 !! end
11764
11765 !! test
11766 <onlyinclude> on a page
11767 !! wikitext
11768 <onlyinclude>Foo</onlyinclude>bar
11769 !! html
11770 <p>Foobar
11771 </p>
11772 !! end
11773
11774 !! test
11775 Un-closed <onlyinclude>
11776 !! wikitext
11777 <onlyinclude>
11778 !! html
11779 !! end
11780
11781 !!test
11782 Self-closed noinclude, includeonly, onlyinclude tags
11783 !! wikitext
11784 <noinclude />
11785 <includeonly />
11786 <onlyinclude />
11787 !! html
11788 <p><br />
11789 </p>
11790 !!end
11791
11792 !!test
11793 Unbalanced includeonly and noinclude tags
11794 !! wikitext
11795 {|
11796 |a</noinclude>
11797 |b</noinclude></noinclude>
11798 |c</noinclude></includeonly>
11799 |d</includeonly></includeonly>
11800 |}
11801 !! html
11802 <table>
11803 <tr>
11804 <td>a
11805 </td>
11806 <td>b
11807 </td>
11808 <td>c&lt;/includeonly&gt;
11809 </td>
11810 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11811 </td></tr></table>
11812
11813 !!end
11814
11815 !! article
11816 Template:Includeonly section
11817 !! text
11818 <includeonly>
11819 ==Includeonly section==
11820 </includeonly>
11821 ==Section T-1==
11822 !!endarticle
11823
11824 !! test
11825 T8563: Edit link generation for section shown by <includeonly>
11826 !! wikitext
11827 {{includeonly section}}
11828 !! html
11829 <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>
11830 <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>
11831
11832 !! end
11833
11834 # Uses same input as the contents of [[Template:Includeonly section]]
11835 !! test
11836 T8563: Section extraction for section shown by <includeonly>
11837 !! options
11838 section=T-2
11839 !! wikitext
11840 <includeonly>
11841 ==Includeonly section==
11842 </includeonly>
11843 ==Section T-2==
11844 !! html
11845 ==Section T-2==
11846 !! end
11847
11848 !! test
11849 T8563: Edit link generation for section suppressed by <includeonly>
11850 !! wikitext
11851 <includeonly>
11852 ==Includeonly section==
11853 </includeonly>
11854 ==Section 1==
11855 !! html
11856 <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>
11857
11858 !! end
11859
11860 !! test
11861 T8563: Section extraction for section suppressed by <includeonly>
11862 !! options
11863 section=1
11864 !! wikitext
11865 <includeonly>
11866 ==Includeonly section==
11867 </includeonly>
11868 ==Section 1==
11869 !! html
11870 ==Section 1==
11871 !! end
11872
11873 !! test
11874 Un-closed <includeonly>
11875 !! wikitext
11876 <includeonly>
11877 !! html/php
11878 !! html/parsoid
11879 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11880 !! end
11881
11882 ## We used to, but no longer wt2wt this test since the default serializer
11883 ## will normalize the include directives to serialize on their own line.
11884 ## Selser will take care of preserving formatting in scenarios where they
11885 ## intermingled with other wikitext.
11886 !! test
11887 Includes and comments at SOL
11888 !! options
11889 parsoid=wt2html,html2html
11890 !! wikitext
11891 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11892
11893 <noinclude>
11894 some
11895 </noinclude>* stuff
11896 * here
11897
11898 <includeonly>can have stuff</includeonly>=== here ===
11899
11900 !! html/php
11901 <h2><span class="mw-headline" id="hu">hu</span></h2>
11902 <p>some
11903 </p>
11904 <ul><li> stuff</li>
11905 <li> here</li></ul>
11906 <h3><span class="mw-headline" id="here">here</span></h3>
11907
11908 !! html/parsoid
11909 <!-- 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> hu </h2>
11910
11911 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11912 <p>some</p>
11913 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11914 <li> here</li></ul>
11915
11916 <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> here </h3>
11917
11918 !! end
11919
11920 # TODO: test with DOM fragment reuse!
11921 !! test
11922 Parsoid: DOM fragment reuse
11923 !! options
11924 parsoid=wt2wt,wt2html
11925 !! wikitext
11926 a{{echo|b<table></table>c}}d
11927
11928 a{{echo|b
11929 <table></table>
11930 c}}d
11931
11932 {{echo|a
11933
11934 <table></table>
11935
11936 b}}
11937 !! html
11938 <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>
11939
11940 <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">
11941 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11942 </span><p about="#mwt2">cd</p>
11943
11944 <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">
11945
11946 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11947
11948 </span><p about="#mwt3">b</p>
11949 !! end
11950
11951 !! test
11952 Parsoid: Merge double tds (T52603)
11953 !! options
11954 parsoid
11955 !! wikitext
11956 {|
11957 |{{echo|{{!}} foo}}
11958 |}
11959 !! html
11960 <table><tbody>
11961 <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>
11962 </tbody></table>
11963 !! end
11964
11965 !! test
11966 Parsoid: Merge double tds in nested transclusion content (T52603)
11967 !! options
11968 parsoid
11969 !! wikitext
11970 {{echo|<div>}}
11971 {|
11972 |{{echo|{{!}} foo}}
11973 |}
11974 {{echo|</div>}}
11975 !! html
11976 <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}}]}'>
11977 <table><tbody>
11978 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11979 </tbody></table>
11980 </div>
11981 !! end
11982
11983 ###
11984 ### <includeonly> and <noinclude> in attributes
11985 ###
11986 !!test
11987 0. includeonly around the entire attribute
11988 !! wikitext
11989 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11990 !! html
11991 <p><span id="v2">bar</span>
11992 </p>
11993 !!end
11994
11995 !!test
11996 1. includeonly in html attr key
11997 !! wikitext
11998 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11999 !! html
12000 <p><span id="foo">bar</span>
12001 </p>
12002 !!end
12003
12004 !!test
12005 2. includeonly in html attr value
12006 !! wikitext
12007 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12008 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12009 !! html
12010 <p><span id="v1">bar</span>
12011 <span id="v1">bar</span>
12012 </p>
12013 !!end
12014
12015 !!test
12016 3. includeonly in part of an attr value
12017 !! wikitext
12018 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12019 !! html
12020 <p><span style="color:red;">bar</span>
12021 </p>
12022 !!end
12023
12024 !!test
12025 4. includeonly in table attributes
12026 !! wikitext
12027 {|
12028 |- <noinclude>
12029 |-
12030 |a
12031 </noinclude>
12032 |- <includeonly>
12033 |-
12034 |b
12035 </includeonly>
12036 |}
12037 !! html
12038 <table>
12039
12040
12041 <tr>
12042 <td>a
12043 </td></tr>
12044 </table>
12045
12046 !!end
12047
12048 ###
12049 ### Preprocessor precedence tests
12050 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12051 ###
12052 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12053 !! test
12054 Preprocessor precedence 1: link is rightmost opening
12055 !! options
12056 parsoid=wt2html
12057 !! wikitext
12058 {{[[Foo|bar}}]]
12059
12060 But close-brace is not a valid character in a link title:
12061 {{[[Foo}}|bar]]
12062
12063 However, we can still tell this was handled as a link in the preprocessor:
12064 {{echo|[[Foo}}|bar]]|bat}}
12065 !! html/php
12066 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12067 </p><p>But close-brace is not a valid character in a link title:
12068 {{[[Foo}}|bar]]
12069 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12070 [[Foo}}|bar]]
12071 </p>
12072 !! html/parsoid
12073 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12074 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12075 <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>
12076 !! end
12077
12078 !! test
12079 Preprocessor precedence 2: template is rightmost opening
12080 !! options
12081 language=zh
12082 !! wikitext
12083 -{{echo|foo}-}}-
12084 !! html/php
12085 <p>-foo}--
12086 </p>
12087 !! html/parsoid
12088 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12089 !! end
12090
12091 !! test
12092 Preprocessor precedence 3: language converter is rightmost opening
12093 !! options
12094 language=zh
12095 parsoid=wt2html
12096 !! wikitext
12097 {{echo|hi}}
12098
12099 {{-{R|echo|hi}}}-
12100
12101 [[-{R|raw]]}-
12102 !! html/php
12103 <p>hi
12104 </p><p>{{echo|hi}}
12105 </p><p>[[raw]]
12106 </p>
12107 !! html/parsoid
12108 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12109 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12110 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12111 !! end
12112
12113 !! test
12114 Preprocessor precedence 4: left-most angle bracket
12115 !! options
12116 language=zh
12117 !! wikitext
12118 <!--{raw}-->
12119 !! html/php
12120 !! html/parsoid
12121 <!--{raw}-->
12122 !! end
12123
12124 !! article
12125 Template:Precedence5
12126 !! text
12127 {{{{{1}}}}}
12128 !! endarticle
12129
12130 !! test
12131 Preprocessor precedence 5: tplarg takes precedence over template
12132 !! wikitext
12133 {{Precedence5|Bullet}}
12134 !! html/php
12135 <ul><li> Bar</li></ul>
12136
12137 !! html/parsoid
12138 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12139 !! end
12140
12141 !! test
12142 Preprocessor precedence 6: broken link is rightmost opening
12143 !! options
12144 parsoid=wt2html
12145 !! wikitext
12146 {{echo|[[Foo}}
12147
12148 {{echo|[[Foo|bar|bat=baz}}
12149 !! html/php
12150 <p>{{echo|[[Foo}}
12151 </p><p>{{echo|[[Foo|bar|bat=baz}}
12152 </p>
12153 !! html/parsoid
12154 <p>{{echo|[[Foo}}</p>
12155 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12156 !! end
12157
12158 # This next test exposes a difference between PHP and Parsoid:
12159 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12160 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12161 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12162 # outer `[[Foo` extends until the `y]]`
12163 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12164 # intermediate result (after template expansion), and link processing
12165 # happens on this intermediate result, which moves the wikilink
12166 # boundary leftward to `[[Foo|Bar]]`
12167 # 2b) Parsoid works in a single step, so it's going to keep the
12168 # wikilink as extending to the `y]]`
12169 # 3a) Then PHP does linktrail processing which slurps up the trailing
12170 # `xy` inside the link.
12171 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12172 # `z` inside the link.
12173 # This is "correct" behavior. Parsoid's basic worldview is that the
12174 # `]]` inside the template shouldn't be allowed to leak out to affect
12175 # the surrounding wikilink. PHP may match Parsoid (in the future)
12176 # if you use {{#balance}} (T114445).
12177
12178 !! test
12179 Preprocessor precedence 7: broken template is rightmost opening
12180 !! options
12181 parsoid=wt2html
12182 !! wikitext
12183 [[Foo|{{echo|Bar]]
12184
12185 [[Foo|{{echo|Bar]]-x}}-y]]-z
12186
12187 Careful: linktrails can move the end of the wikilink:
12188 [[Foo|{{echo|y']]a}}l]]l
12189 !! html/php
12190 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12191 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12192 </p><p>Careful: linktrails can move the end of the wikilink:
12193 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12194 </p>
12195 !! html/parsoid
12196 <p>[[Foo|{{echo|Bar]]</p>
12197 <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>
12198 <p>Careful: linktrails can move the end of the wikilink:
12199 <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>
12200 !! end
12201
12202 !! test
12203 Preprocessor precedence 8: broken language converter is rightmost opening
12204 !! options
12205 language=zh
12206 !! wikitext
12207 [[Foo-{R|raw]]
12208 !! html
12209 <p>[[Foo-{R|raw]]
12210 </p>
12211 !! end
12212
12213 !! article
12214 Template:Preprocessor_precedence_9
12215 !! text
12216 ;4: {{{{1}}}}
12217 ;5: {{{{{2}}}}}
12218 ;6: {{{{{{3}}}}}}
12219 ;7: {{{{{{{4}}}}}}}
12220 !! endarticle
12221
12222 !! test
12223 Preprocessor precedence 9: groups of braces
12224 !! wikitext
12225 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12226 !! html/php
12227 <dl><dt>4</dt>
12228 <dd> {Four}</dd>
12229 <dt>5</dt>
12230 <dd> </dd></dl>
12231 <ul><li> Bar</li></ul>
12232 <dl><dt>6</dt>
12233 <dd> Four</dd>
12234 <dt>7</dt>
12235 <dd> {Bullet}</dd></dl>
12236
12237 !! html/parsoid
12238 <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}}]}'>
12239 <dt>4</dt>
12240 <dd>{Four}</dd>
12241 <dt>5</dt>
12242 <dd></dd>
12243 </dl><ul about="#mwt1">
12244 <li>Bar</li>
12245 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12246 <dt>6</dt>
12247 <dd>Four</dd>
12248 <dt>7</dt>
12249 <dd>{Bullet}</dd>
12250 </dl>
12251 !! end
12252
12253 !! article
12254 Template:Preprocessor_precedence_10
12255 !! text
12256 ;1: -{R|raw}-
12257 ;2: -{{Bullet}}-
12258 ;3: -{{{1}}}-
12259 ;4: -{{{{2}}}}-
12260 ;5: -{{{{{3}}}}}-
12261 ;6: -{{{{{{4}}}}}}-
12262 ;7: -{{{{{{{5}}}}}}}-
12263 !! endarticle
12264
12265 !! test
12266 Preprocessor precedence 10: groups of braces with leading dash
12267 !! options
12268 language=zh
12269 !! wikitext
12270 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12271 !! html/php
12272 <dl><dt>1</dt>
12273 <dd> raw</dd>
12274 <dt>2</dt>
12275 <dd> -</dd></dl>
12276 <ul><li> Bar-</li></ul>
12277 <dl><dt>3</dt>
12278 <dd> -Three-</dd>
12279 <dt>4</dt>
12280 <dd> raw2</dd>
12281 <dt>5</dt>
12282 <dd> -</dd></dl>
12283 <ul><li> Bar-</li></ul>
12284 <dl><dt>6</dt>
12285 <dd> -Three-</dd>
12286 <dt>7</dt>
12287 <dd> raw2</dd></dl>
12288
12289 !! html/parsoid
12290 <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}}]}'>
12291 <dt>1</dt>
12292 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12293 <dt>2</dt>
12294 <dd>-</dd>
12295 </dl><ul about="#mwt1">
12296 <li>Bar-</li>
12297 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12298 <dt>3</dt>
12299 <dd>-Three-</dd>
12300 <dt>4</dt>
12301 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12302 <dt>5</dt>
12303 <dd>-</dd>
12304 </dl><ul about="#mwt1">
12305 <li>Bar-</li>
12306 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12307 <dt>6</dt>
12308 <dd>-Three-</dd>
12309 <dt>7</dt>
12310 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12311 </dl>
12312 !! end
12313
12314 !! test
12315 Preprocessor precedence 11: found during visual diff testing
12316 !! wikitext
12317 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12318
12319 {{echo|-{{echo|-{{echo|x}}}}}}
12320
12321 {{echo|-{{echo|x}}}}
12322 !! html/php
12323 <p><span>-<span>-x</span></span>
12324 </p><p>--x
12325 </p><p>-x
12326 </p>
12327 !! html/parsoid
12328 <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>
12329
12330 <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>
12331
12332 <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>
12333 !! end
12334
12335 !! test
12336 Preprocessor precedence 12: broken language converter closed by brace.
12337 !! options
12338 parsoid=wt2html
12339 !! wikitext
12340 This form breaks the template, which is unfortunate:
12341 * {{echo|foo-{bar}bat}}
12342
12343 But if the broken language converter markup is inside an extension
12344 tag, nothing bad happens:
12345 * <nowiki>foo-{bar}bat</nowiki>
12346 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12347 * <pre>foo-{bar}bat</pre>
12348 * {{echo|<pre>foo-{bar}bat</pre>}}
12349
12350 <tag>foo-{bar}bat</tag>
12351 {{echo|<tag>foo-{bar}bat</tag>}}
12352
12353 !! html/php+tidy
12354 <p>This form breaks the template, which is unfortunate:</p>
12355 <ul>
12356 <li>{{echo|foo-{bar}bat}}</li>
12357 </ul>
12358 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12359 <ul>
12360 <li>foo-{bar}bat</li>
12361 <li>foo-{bar}bat</li>
12362 <li>
12363 <pre>
12364 foo-{bar}bat
12365 </pre></li>
12366 <li>
12367 <pre>
12368 foo-{bar}bat
12369 </pre></li>
12370 </ul>
12371 <pre>
12372 'foo-{bar}bat'
12373 array (
12374 )
12375 </pre>
12376 <pre>
12377 'foo-{bar}bat'
12378 array (
12379 )
12380 </pre>
12381 !! html/parsoid
12382 <p>This form breaks the template, which is unfortunate:</p>
12383 <ul>
12384 <li>{{echo|foo-{bar}bat}}</li>
12385 </ul>
12386 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12387 <ul>
12388 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12389 <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>
12390 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12391 <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>
12392 </ul>
12393 <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>
12394 !! end
12395
12396 !! test
12397 Preprocessor precedence 13: broken language converter in external link
12398 !! options
12399 parsoid=wt2html
12400 !! wikitext
12401 * [http://example.com/-{foo Example in URL]
12402 * [http://example.com Example in -{link} description]
12403 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12404 !! html/php+tidy
12405 <ul>
12406 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12407 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12408 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12409 </ul>
12410 !! html/parsoid
12411 <ul>
12412 <li><a rel="mw:ExtLink" href="http://example.com/-{foo">Example in URL</a></li>
12413 <li><a rel="mw:ExtLink" href="http://example.com">Example in -{link} description</a></li>
12414 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12415 </ul>
12416 !! end
12417
12418 !! test
12419 Preprocessor precedence 14: broken language converter in comment
12420 !! wikitext
12421 * <!--{{foo}}--> ...should be ok
12422 * <!---{{foo}}--> ...extra dashes
12423 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12424 !! html/php+tidy
12425 <ul>
12426 <li>...should be ok</li>
12427 <li>...extra dashes</li>
12428 <li>foobat ...should be ok</li>
12429 </ul>
12430 !! html/parsoid
12431 <ul>
12432 <li><!--{{foo}}--> ...should be ok</li>
12433 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12434 <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>
12435 </ul>
12436 !! end
12437
12438 !! test
12439 Preprocessor precedence 15: broken brace markup in headings
12440 !! options
12441 parsoid=wt2html
12442 !! wikitext
12443 __NOTOC__ __NOEDITSECTION__
12444 ===1 foo[bar 1===
12445 1
12446 ===2 foo[[bar 2===
12447 2
12448 ===3 foo{bar 3===
12449 3
12450 ===4 foo{{bar 4===
12451 4
12452 ===5 foo{{{bar 5===
12453 5
12454 ===6 foo-{bar 6===
12455 6
12456 !! html/php+tidy
12457 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12458 <p>1</p>
12459 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12460 <p>2</p>
12461 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12462 <p>3</p>
12463 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12464 <p>4</p>
12465 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12466 <p>5</p>
12467 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12468 <p>6</p>
12469 !! html/parsoid
12470 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/
12471 >
12472 <h3>1 foo[bar 1</h3>
12473 <p>1</p>
12474 <h3>2 foo[[bar 2</h3>
12475 <p>2</p>
12476 <h3>3 foo{bar 3</h3>
12477 <p>3</p>
12478 <h3>4 foo{{bar 4</h3>
12479 <p>4</p>
12480 <h3>5 foo{{{bar 5</h3>
12481 <p>5</p>
12482 <h3>6 foo-{bar 6</h3>
12483 <p>6</p>
12484 !! end
12485
12486 !! test
12487 Preprocessor precedence 16: matching closing braces to opening braces
12488 !! options
12489 language=zh
12490 parsoid=wt2html
12491 !! wikitext
12492 -{{{echo|foo}}bar}-
12493 !! html/php
12494 <p>foobar
12495 </p>
12496 !! html/parsoid
12497 <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>
12498 !! end
12499
12500 ###
12501 ### Token Stream Patcher tests
12502 ###
12503 ### These tests won't always pass wt2wt and other modes because
12504 ### on serialization, the table will be output on a new line.
12505 ### For now, we are blacklisting them, and using this to test selser.
12506 ###
12507
12508 !!test
12509 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12510 !!options
12511 parsoid=wt2html,wt2wt
12512 !!wikitext
12513 {{echo|}}{| width = '100%'
12514 |foo
12515 |}
12516 !!html/parsoid
12517 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12518 <tbody><tr><td>foo</td></tr>
12519 </tbody></table>
12520 !!end
12521
12522 ## We used to, but no longer wt2wt this test since the default serializer
12523 ## will normalize the include directives to serialize on their own line.
12524 ## Selser will take care of preserving formatting in scenarios where they
12525 ## intermingled with other wikitext.
12526 !!test
12527 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12528 !!options
12529 parsoid=wt2html
12530 !!wikitext
12531 <includeonly>a</includeonly>{| {{{b}}}
12532 |c
12533 |}
12534 !!html/parsoid
12535 <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":""}]]}'>
12536 <tbody><tr><td>c</td></tr>
12537 </tbody></table>
12538 !!end
12539
12540 !! test
12541 Table wikitext syntax outside wiki-tables
12542 !! wikitext
12543 a
12544 |+ not a caption
12545 ! not a table heading
12546 |- not a table row
12547 | not a table cell
12548 | class="foo bar" | baz
12549 b
12550 |}
12551 |-
12552 c
12553 !! html
12554 <p>a
12555 |+ not a caption
12556 ! not a table heading
12557 |- not a table row
12558 | not a table cell
12559 | class="foo bar" | baz
12560 b
12561 |}
12562 |-
12563 c
12564 </p>
12565 !! end
12566
12567 ###
12568 ### Testing parsing of templates where a template arg
12569 ### has the same name as the template itself.
12570 ###
12571
12572 !! article
12573 Template:quote
12574 !! text
12575 {{{quote|{{{1}}}}}}
12576 !! endarticle
12577
12578 !!test
12579 Templates: Template Name/Arg clash: 1. Use of positional param
12580 !! wikitext
12581 {{quote|foo}}
12582 !! html
12583 <p>foo
12584 </p>
12585 !!end
12586
12587 !!test
12588 Templates: Template Name/Arg clash: 2. Use of named param
12589 !! wikitext
12590 {{quote|quote=foo}}
12591 !! html
12592 <p>foo
12593 </p>
12594 !!end
12595
12596 !!test
12597 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12598 !! wikitext
12599 {{quote|quote}}
12600 !! html
12601 <p>quote
12602 </p>
12603 !!end
12604
12605 ###
12606 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12607 ###
12608
12609 !!test
12610 Templates: 1. Simple use
12611 !! wikitext
12612 {{echo|Foo}}
12613 !! html
12614 <p>Foo
12615 </p>
12616 !!end
12617
12618 !!test
12619 Templates: 2. Inside a block tag
12620 !! wikitext
12621 <div>{{echo|Foo}}</div>
12622 <blockquote>{{echo|Foo}}</blockquote>
12623 !! html
12624 <div>Foo</div>
12625 <blockquote>Foo</blockquote>
12626
12627 !! html+tidy
12628 <div>Foo</div>
12629 <blockquote>
12630 <p>Foo</p>
12631 </blockquote>
12632 !!end
12633
12634 !!test
12635 Templates: P-wrapping: 1a. Templates on consecutive lines
12636 !! wikitext
12637 {{echo|Foo}}
12638 {{echo|bar}}
12639 !! html
12640 <p>Foo
12641 bar
12642 </p>
12643 !!end
12644
12645 !!test
12646 Templates: P-wrapping: 1b. Templates on consecutive lines
12647 !! wikitext
12648 Foo
12649
12650 {{echo|bar}}
12651 {{echo|baz}}
12652 !! html
12653 <p>Foo
12654 </p><p>bar
12655 baz
12656 </p>
12657 !!end
12658
12659 !!test
12660 Templates: P-wrapping: 1c. Templates on consecutive lines
12661 !! wikitext
12662 {{echo|Foo}}
12663 {{echo|bar}} <div>baz</div>
12664 !! html
12665 <p>Foo
12666 </p>
12667 bar <div>baz</div>
12668
12669 !! html+tidy
12670 <p>Foo</p>
12671 <p>bar</p>
12672 <div>baz</div>
12673 !! end
12674
12675 !!test
12676 Templates: P-wrapping: 1d. Template preceded by comment-only line
12677 !!options
12678 parsoid
12679 !! wikitext
12680 <!-- foo -->
12681 {{echo|Bar}}
12682 !! html
12683 <!-- foo -->
12684
12685 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12686 !!end
12687
12688 !!test
12689 Templates: Inline Text: 1. Multiple template uses
12690 !! wikitext
12691 {{echo|Foo}}bar{{echo|baz}}
12692 !! html
12693 <p>Foobarbaz
12694 </p>
12695 !!end
12696
12697 !!test
12698 Templates: Inline Text: 2. Back-to-back template uses
12699 !! wikitext
12700 {{echo|Foo}}{{echo|bar}}
12701 !! html
12702 <p>Foobar
12703 </p>
12704 !!end
12705
12706 !!test
12707 Templates: Block Tags: 1. Multiple template uses
12708 !! wikitext
12709 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12710 !! html
12711 <div>Foo</div><div>bar</div><div>baz</div>
12712
12713 !!end
12714
12715 !!test
12716 Templates: Block Tags: 2. Back-to-back template uses
12717 !! wikitext
12718 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12719 !! html
12720 <div>Foo</div><div>bar</div>
12721
12722 !!end
12723
12724 # This is an edge case relating to paragraph wrapping.
12725 !!test
12726 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12727 !! wikitext
12728 {{echo|a
12729 b</p>}}
12730 !! html/parsoid
12731 <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
12732 b</p>
12733 !!end
12734
12735 !!test
12736 Templates: Links: 1. Simple example
12737 !! wikitext
12738 {{echo|[[Foo|bar]]}}
12739 !! html
12740 <p><a href="/wiki/Foo" title="Foo">bar</a>
12741 </p>
12742 !!end
12743
12744 !!test
12745 Templates: Links: 2. Generation of link href
12746 !! wikitext
12747 [[{{echo|Foo}}|bar]]
12748 !! html
12749 <p><a href="/wiki/Foo" title="Foo">bar</a>
12750 </p>
12751 !!end
12752
12753 !!test
12754 Templates: Links: 3. Generation of part of a link href
12755 !! wikitext
12756 [[Fo{{echo|o}}|bar]]
12757
12758 [[Foo{{echo|bar}}]]
12759
12760 [[Foo{{echo|bar}}baz]]
12761
12762 [[Foo{{echo|bar}}|bar]]
12763
12764 [[:Foo{{echo|bar}}]]
12765
12766 [[:Foo{{echo|bar}}|bar]]
12767 !! html
12768 <p><a href="/wiki/Foo" title="Foo">bar</a>
12769 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12770 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12771 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12772 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12773 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12774 </p>
12775 !!end
12776
12777 !!test
12778 Templates: Links: 4. Multiple templates generating link href
12779 !! wikitext
12780 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12781 !! html
12782 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12783 </p>
12784 !!end
12785
12786 !!test
12787 Templates: Links: 5. Generation of link text
12788 !! wikitext
12789 [[Foo|{{echo|bar}}]]
12790 !! html
12791 <p><a href="/wiki/Foo" title="Foo">bar</a>
12792 </p>
12793 !!end
12794
12795 !!test
12796 Templates: Links: 5. Nested templates (only outermost template should be marked)
12797 !! wikitext
12798 {{echo|[[{{echo|Foo}}|bar]]}}
12799 !! html
12800 <p><a href="/wiki/Foo" title="Foo">bar</a>
12801 </p>
12802 !!end
12803
12804 !!test
12805 Templates: HTML Tag: 1. Generation of HTML attr. key
12806 !! wikitext
12807 <div {{echo|style}}="color:red;">foo</div>
12808 !! html
12809 <div style="color:red;">foo</div>
12810
12811 !!end
12812
12813 !!test
12814 Templates: HTML Tag: 2. Generation of HTML attr. value
12815 !! wikitext
12816 <div style={{echo|'color:red;'}}>foo</div>
12817 !! html
12818 <div style="color:red;">foo</div>
12819
12820 !!end
12821
12822 !!test
12823 Templates: HTML Tag: 3. Generation of HTML attr key and value
12824 !! wikitext
12825 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12826 !! html
12827 <div style="color:red;">foo</div>
12828
12829 !!end
12830
12831 !!test
12832 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12833 !! wikitext
12834 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12835 !! html
12836 <div title="This is a long title with just one piece templated">foo</div>
12837
12838 !!end
12839
12840 !!test
12841 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12842 !! wikitext
12843 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12844 !! html
12845 <div title="This is a long title with just one piece templated">foo</div>
12846
12847 !!end
12848
12849 !!test
12850 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12851 !! wikitext
12852 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12853 !! html
12854 <div title="This is a long title with just one piece templated">foo</div>
12855
12856 !!end
12857
12858 # SSS FIXME: While it is great we added support for all this,
12859 # do we want to make this part of the spec? Maybe we want to
12860 # deprecate this kind of usage in the future?
12861 !!test
12862 Templates: HTML Tag: 7. Generation of partial attribute key string
12863 !! wikitext
12864 <div st{{echo|yle}}="color:red;">foo</div>
12865 !! html
12866 <div style="color:red;">foo</div>
12867
12868 !!end
12869
12870 !! test
12871 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12872 !! wikitext
12873 <div {{echo|1=id="v1"}}>bar</div>
12874 !! html
12875 <div id="v1">bar</div>
12876
12877 !!end
12878
12879 !! test
12880 Templates: HTML Tag: 9. Multiple template-generated attributes
12881 !! wikitext
12882 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12883 !! html
12884 <div id="v1" title="foo">bar</div>
12885
12886 !!end
12887
12888 !! test
12889 Templates: Support for templates generating attributes and content
12890 !! wikitext
12891 {| {{mixed_attr_content_template}}
12892 |-
12893 |bar
12894 |}
12895 !! html/php
12896 <table style="color:red;" title="T48811">
12897
12898 <tr>
12899 <td>foo
12900 </td></tr>
12901 <tr>
12902 <td>bar
12903 </td></tr></table>
12904
12905 !! html/parsoid
12906 <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|}"]}'>
12907 <tbody><tr>
12908 <td>foo</td></tr>
12909 <tr>
12910 <td>bar</td></tr>
12911 </tbody></table>
12912 !!end
12913
12914 !! test
12915 1. Entities and nowikis inside templated attributes should be handled correctly
12916 !! wikitext
12917 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12918 !! html/php
12919 <div style="background:#f9f9f9;">foo</div>
12920
12921 !! html/parsoid
12922 <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>
12923 !! end
12924
12925 !! test
12926 2. Entities and nowikis inside templated attributes should be handled correctly
12927 !! wikitext
12928 {|
12929 |{{table_attribs_3}}
12930 |}
12931 !! html/php
12932 <table>
12933 <tr>
12934 <td style="background:#f9f9f9;">Foo
12935 </td></tr></table>
12936
12937 !! html/parsoid
12938 <table>
12939 <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>
12940 </tbody></table>
12941 !! end
12942
12943 !! test
12944 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12945 !! wikitext
12946 {{tbl-start}}
12947 |{{table_attribs_3}}
12948 {{tbl-end}}
12949 !! html/php
12950 <table>
12951 <tr>
12952 <td style="background:#f9f9f9;">Foo
12953 </td></tr></table>
12954
12955 !! html/parsoid
12956 <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}}]}'>
12957 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12958 </tbody></table>
12959 !! end
12960
12961 # T107622
12962 !! test
12963 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12964 !! wikitext
12965 {|
12966 | {{table_attribs_6}} hi
12967 |}
12968 !! html/php
12969 <table>
12970 <tr>
12971 <td style="background: red;"> hi
12972 </td></tr></table>
12973
12974 !! html/parsoid
12975 <table>
12976 <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>
12977 </tbody></table>
12978 !! end
12979
12980 !!test
12981 Templates: HTML Tables: 1. Generating start of a HTML table
12982 !! wikitext
12983 {{echo|<table><tr><td>foo</td>}}</tr></table>
12984 !! html
12985 <table><tr><td>foo</td></tr></table>
12986
12987 !!end
12988
12989 !!test
12990 Templates: HTML Tables: 2a. Generating middle of a HTML table
12991 !! wikitext
12992 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12993 !! html
12994 <table><tr><td>foo</td></tr></table>
12995
12996 !!end
12997
12998 !!test
12999 Templates: HTML Tables: 2b. Generating middle of a HTML table
13000 !! wikitext
13001 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13002 !! html
13003 <table><tr><td>foo</td></tr></table>
13004
13005 !!end
13006
13007 !!test
13008 Templates: HTML Tables: 3. Generating end of a HTML table
13009 !! wikitext
13010 <table><tr>{{echo|<td>foo</td></tr></table>}}
13011 !! html
13012 <table><tr><td>foo</td></tr></table>
13013
13014 !!end
13015
13016 !!test
13017 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13018 !! wikitext
13019 {{echo|<table>}}<tr><td>foo</td></tr></table>
13020 !! html
13021 <table><tr><td>foo</td></tr></table>
13022
13023 !!end
13024
13025 !!test
13026 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13027 !! wikitext
13028 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13029 !! html
13030 <table><tr><td>foo</td></tr></table>
13031
13032 !!end
13033
13034 !!test
13035 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13036 !! wikitext
13037 <table><tr>{{echo|<td>}}foo</td></tr></table>
13038 !! html
13039 <table><tr><td>foo</td></tr></table>
13040
13041 !!end
13042
13043 !!test
13044 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13045 !! wikitext
13046 <table><tr><td>foo{{echo|</td>}}</tr></table>
13047 !! html
13048 <table><tr><td>foo</td></tr></table>
13049
13050 !!end
13051
13052 !!test
13053 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13054 !! wikitext
13055 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13056 !! html
13057 <table><tr><td>foo</td></tr></table>
13058
13059 !!end
13060
13061 !!test
13062 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13063 !! wikitext
13064 <table><tr><td>foo</td></tr>{{echo|</table>}}
13065 !! html
13066 <table><tr><td>foo</td></tr></table>
13067
13068 !!end
13069
13070 !!test
13071 Templates: HTML Tables: 5. Proper fostering of categories from inside
13072 !!options
13073 parsoid=wt2html,wt2wt
13074 !! wikitext
13075 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13076 <!--Two categories (T52330)-->
13077 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13078 !! html
13079 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13080 <!--Two categories (T52330)-->
13081 <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>
13082 !!end
13083
13084 !!test
13085 Templates: Wiki Tables: 1a. Fostering of entire template content
13086 !! wikitext
13087 {|
13088 {{echo|a}}
13089 |}
13090 !! html
13091 <table>
13092 a
13093 <tr><td></td></tr></table>
13094
13095 !! html+tidy
13096 <p>a</p>
13097 <table>
13098 <tr>
13099 <td></td>
13100 </tr>
13101 </table>
13102 !! end
13103
13104 !!test
13105 Templates: Wiki Tables: 1b. Fostering of entire template content
13106 !! wikitext
13107 {|
13108 {{echo|<div>}}
13109 foo
13110 {{echo|</div>}}
13111 |}
13112 !! html
13113 <table>
13114 <div>
13115 <p>foo
13116 </p>
13117 </div>
13118 <tr><td></td></tr></table>
13119
13120 !! html+tidy
13121 <div>
13122 <p>foo</p>
13123 </div>
13124 <table>
13125 <tr>
13126 <td></td>
13127 </tr>
13128 </table>
13129 !! end
13130
13131 !!test
13132 Templates: Wiki Tables: 2. Fostering of partial template content
13133 !! wikitext
13134 {|
13135 {{echo|a
13136 <div>b</div>}}
13137 |}
13138 !! html
13139 <table>
13140 a
13141 <div>b</div>
13142 <tr><td></td></tr></table>
13143
13144 !! html+tidy
13145 <p>a</p>
13146 <div>b</div>
13147 <table>
13148 <tr>
13149 <td></td>
13150 </tr>
13151 </table>
13152 !! end
13153
13154 !!test
13155 Templates: Wiki Tables: 3. td-content via multiple templates
13156 !! wikitext
13157 {|
13158 {{echo|{{pipe}}a}}{{echo|b}}
13159 |}
13160 !! html
13161 <table>
13162 <tr>
13163 <td>ab
13164 </td></tr></table>
13165
13166 !!end
13167
13168 !!test
13169 Templates: Wiki Tables: 4. Templated tags, no content
13170 !! wikitext
13171 {{tbl-start}}
13172 {{tbl-end}}
13173 !! html
13174 <table>
13175 <tr><td></td></tr></table>
13176
13177 !!end
13178
13179 !!test
13180 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13181 !! wikitext
13182 {{tbl-start}}
13183 |foo
13184 {{tbl-end}}
13185 !! html
13186 <table>
13187 <tr>
13188 <td>foo
13189 </td></tr></table>
13190
13191 !!end
13192
13193 !!test
13194 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13195 !! wikitext
13196 {{tbl-start}}
13197 {{!}}foo
13198 {{tbl-end}}
13199 !! html
13200 <table>
13201 <tr>
13202 <td>foo
13203 </td></tr></table>
13204
13205 !!end
13206
13207 ## This test case is very specific to Parsoid's internals
13208 ## and is hence only tested for Parsoid's code. Parsoid uses
13209 ## a <meta> marker tag for <ref> tags and they are expanded
13210 ## much later. We are verifying that this <meta> tag usage
13211 ## doesn't prevent foster parenting.
13212 !!test
13213 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13214 !!wikitext
13215 {{PartialTable}}<ref>foo</ref>
13216 |}
13217
13218 <references />
13219 !!html/parsoid
13220 <span 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></span><table about="#mwt2">
13221 <tbody>
13222 </tbody></table>
13223
13224 <ol class="mw-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>
13225 !!end
13226
13227 !! test
13228 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13229 !! wikitext
13230 {{echo|
13231 {{{!}}
13232 {{!}}-}}
13233 <onlyinclude>
13234 |foo
13235 </onlyinclude>
13236 {{!}}}
13237 !! html/parsoid
13238 <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{{!}}}"]}'>
13239 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13240 <tbody><tr>
13241
13242 <td>foo
13243 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13244 </tbody></table>
13245 !! end
13246
13247 !!test
13248 Templates: Lists: Multi-line list-items via templates
13249 !! wikitext
13250 *{{echo|a {{nonexistent|
13251 unused}}}}
13252 *{{echo|b {{nonexistent|
13253 unused}}}}
13254 !! html
13255 <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>
13256 <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>
13257
13258 !!end
13259
13260 !!test
13261 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13262 !! wikitext
13263 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13264 !! html
13265 <p><i>ab</i>c<i>d</i>e
13266 </p>
13267 !!end
13268
13269 !!test
13270 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13271 (PHP parser generates misnested html)
13272 !! wikitext
13273 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13274 !! html/parsoid
13275 <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>
13276 !!end
13277
13278 !!test
13279 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13280 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13281 !! options
13282 parsoid=wt2html,wt2wt
13283 !! wikitext
13284 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13285 !! html
13286 <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>
13287 <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>
13288 <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>
13289 !!end
13290
13291 !!test
13292 Templates: Ugly nesting: 4. Divs opened/closed across templates
13293 !! wikitext
13294 a<div>b{{echo|c</div>d}}e
13295 !! html
13296 a<div>bc</div>de
13297
13298 !! html+tidy
13299 <p>a</p>
13300 <div>bc</div>
13301 <p>de</p>
13302 !! end
13303
13304 !!test
13305 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13306 (Parsoid-centric)
13307 !! options
13308 parsoid
13309 !! wikitext
13310 {|
13311 |{{echo|foo</table>}}
13312 |bar
13313 |}
13314 !! html
13315 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
13316
13317 <tbody>
13318 <tr>
13319 <td>foo</td></tr></tbody></table><span about="#mwt1">
13320 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13321 |}</span>
13322 !!end
13323
13324 !!test
13325 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13326 (Parsoid-centric)
13327 !! options
13328 parsoid
13329 !! wikitext
13330 <table>
13331 <tr>
13332 <td>
13333 <table>
13334 <tr>
13335 <td>1. {{echo|foo </table>}}</td>
13336 <td> bar </td>
13337 <td>2. {{echo|baz </table>}}</td>
13338 </tr>
13339 <tr>
13340 <td>abc</td>
13341 </tr>
13342 </table>
13343 </td>
13344 </tr>
13345 <tr>
13346 <td>xyz</td>
13347 </tr>
13348 </table>
13349 !! html
13350 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
13351 <tbody><tr>
13352 <td>
13353 <table>
13354 <tbody><tr>
13355 <td>1. foo </td></tr></tbody></table></td>
13356 <td> bar </td>
13357 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13358 </span><span about="#mwt2">
13359 </span><span about="#mwt2">
13360 </span><span about="#mwt2">abc</span><span about="#mwt2">
13361 </span><span about="#mwt2">
13362 </span><span about="#mwt2">
13363 </span><span about="#mwt2">
13364 </span><span about="#mwt2">
13365 </span><span about="#mwt2">
13366 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13367 </span><span about="#mwt2">
13368 </span>
13369 !!end
13370
13371 !! test
13372 Templates: Ugly templates: 3. newline-only template parameter
13373 !! wikitext
13374 foo {{echo|
13375 }}
13376 !! html
13377 <p>foo
13378 </p>
13379 !! end
13380
13381 # This looks like a bug: a single newline triggers p/br for some reason.
13382 !! test
13383 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13384 !! wikitext
13385 {{echo|
13386 }}
13387 !! html
13388 <p><br />
13389 </p>
13390 !! end
13391
13392 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13393 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13394 !! test
13395 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13396 !! wikitext
13397 {{echo|<table>}}
13398 {{echo|<div>foo}}
13399 {{echo|</table>}}
13400 !! html/parsoid
13401 <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
13402 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13403 </table>
13404 !! end
13405
13406 # T66017 -- ugly wikitext with fostered content generates two template ranges
13407 # that are "identical" and generate nesting cycles in the algorithm
13408 !! test
13409 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13410 !! wikitext
13411 {{echo|<table><tr><td><table>}}
13412 {{echo|<div>}}
13413 {{echo|</div>}}
13414 !! html/parsoid
13415 <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"}'>
13416 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13417 </table></td></tr></tbody></table>
13418 !! end
13419
13420 !! test
13421 Templates: Parameters substituted at the top-level
13422 !! wikitext
13423 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13424
13425 {{{foo|bar|baz}}}
13426 !! html/php
13427 <p><i>who</i> me? <b>never!</b>
13428 </p><p>bar
13429 </p>
13430 !! html/parsoid
13431 <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>
13432
13433 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13434 !! end
13435
13436 !! test
13437 Templates: Param with empty arg in the final position
13438 !! wikitext
13439 {{{hi|}}}
13440 !! html/parsoid
13441 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13442 !! end
13443
13444 !!test
13445 Parser Functions: 1. Simple example
13446 !! wikitext
13447 {{uc:foo}}
13448 !! html
13449 <p>FOO
13450 </p>
13451 !!end
13452
13453 !!test
13454 Parser Functions: 2. Nested use (only outermost should be marked up)
13455 !! wikitext
13456 {{uc:{{lc:FOO}}}}
13457 !! html
13458 <p>FOO
13459 </p>
13460 !!end
13461
13462 ###
13463 ### Pre-save transform tests
13464 ###
13465 !! test
13466 pre-save transform: subst:
13467 !! options
13468 pst
13469 !! wikitext
13470 {{subst:test}}
13471 !! html/php
13472 This is a test template
13473 !! end
13474
13475 !! test
13476 pre-save transform: normal template
13477 !! options
13478 pst
13479 !! wikitext
13480 {{test}}
13481 !! html/php
13482 {{test}}
13483 !! end
13484
13485 !! test
13486 pre-save transform: nonexistent template
13487 !! options
13488 pst
13489 !! wikitext
13490 {{thistemplatedoesnotexist}}
13491 !! html/php
13492 {{thistemplatedoesnotexist}}
13493 !! end
13494
13495 !! test
13496 pre-save transform: subst magic variables
13497 !! options
13498 pst
13499 !! wikitext
13500 {{subst:SITENAME}}
13501 !! html/php
13502 MediaWiki
13503 !! end
13504
13505 # This is T2089, which I fixed. -- wtm
13506 !! test
13507 pre-save transform: subst: templates with parameters
13508 !! options
13509 pst
13510 !! wikitext
13511 {{subst:paramtest|param="something else"}}
13512 !! html/php
13513 This is a test template with parameter "something else"
13514 !! end
13515
13516 !! article
13517 Template:nowikitest
13518 !! text
13519 <nowiki>'''not wiki'''</nowiki>
13520 !! endarticle
13521
13522 !! test
13523 pre-save transform: nowiki in subst (T3188)
13524 !! options
13525 pst
13526 !! wikitext
13527 {{subst:nowikitest}}
13528 !! html/php
13529 <nowiki>'''not wiki'''</nowiki>
13530 !! end
13531
13532 !! article
13533 Template:commenttest
13534 !! text
13535 This template has <!-- a comment --> in it.
13536 !! endarticle
13537
13538 !! test
13539 pre-save transform: comment in subst (T3936)
13540 !! options
13541 pst
13542 !! wikitext
13543 {{subst:commenttest}}
13544 !! html/php
13545 This template has <!-- a comment --> in it.
13546 !! end
13547
13548 !! test
13549 pre-save transform: unclosed tag
13550 !! options
13551 pst
13552 !! wikitext
13553 <nowiki>'''not wiki'''
13554 !! html/php
13555 <nowiki>'''not wiki'''
13556 !! end
13557
13558 !! test
13559 pre-save transform: mixed tag case
13560 !! options
13561 pst
13562 !! wikitext
13563 <NOwiki>'''not wiki'''</noWIKI>
13564 !! html/php
13565 <NOwiki>'''not wiki'''</noWIKI>
13566 !! end
13567
13568 !! test
13569 pre-save transform: unclosed comment in <nowiki>
13570 !! options
13571 pst
13572 !! wikitext
13573 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13574 !! html/php
13575 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13576 !!end
13577
13578 # Leading @ in this template definition works around a limitation
13579 # in parsoid's parserTests which otherwise strips the <span> from the
13580 # result (confusing it for a template wrapper)
13581 !! article
13582 Template:dangerous
13583 !!text
13584 @<span onmouseover="alert('crap')">Oh no</span>
13585 !!endarticle
13586
13587 !!test
13588 (confirming safety of fix for subst T3936)
13589 !! wikitext
13590 {{Template:dangerous}}
13591 !! html
13592 <p>@<span>Oh no</span>
13593 </p>
13594 !! end
13595
13596 !! test
13597 pre-save transform: comment containing gallery (T7024)
13598 !! options
13599 pst
13600 !! wikitext
13601 <!-- <gallery>data</gallery> -->
13602 !! html/php
13603 <!-- <gallery>data</gallery> -->
13604 !!end
13605
13606 !! test
13607 pre-save transform: comment containing extension
13608 !! options
13609 pst
13610 !! wikitext
13611 <!-- <tag>data</tag> -->
13612 !! html/php
13613 <!-- <tag>data</tag> -->
13614 !!end
13615
13616 !! test
13617 pre-save transform: comment containing nowiki
13618 !! options
13619 pst
13620 !! wikitext
13621 <!-- <nowiki>data</nowiki> -->
13622 !! html/php
13623 <!-- <nowiki>data</nowiki> -->
13624 !!end
13625
13626 !! test
13627 pre-save transform: <noinclude> in subst (T5298)
13628 !! options
13629 pst
13630 !! wikitext
13631 {{subst:Includes}}
13632 !! html/php
13633 Foobar
13634 !! end
13635
13636 !! test
13637 pre-save transform: <onlyinclude> in subst (T5298)
13638 !! options
13639 pst
13640 !! wikitext
13641 {{subst:Includes2}}
13642 !! html/php
13643 Foo
13644 !! end
13645
13646 !! article
13647 Template:SubstTest
13648 !!text
13649 {{<includeonly>subst:</includeonly>Includes}}
13650 !! endarticle
13651
13652 !! article
13653 Template:SafeSubstTest
13654 !! text
13655 {{<includeonly>safesubst:</includeonly>Includes}}
13656 !! endarticle
13657
13658 !! test
13659 T24297: safesubst: works during PST
13660 !! options
13661 pst
13662 !! wikitext
13663 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13664 !! html/php
13665 FoobarFoobar
13666 !! end
13667
13668 !! test
13669 T24297: safesubst: works during normal parse
13670 !! wikitext
13671 {{SafeSubstTest}}
13672 !! html
13673 <p>Foobar
13674 </p>
13675 !! end
13676
13677 !! test
13678 subst: does not work during normal parse
13679 !! wikitext
13680 {{SubstTest}}
13681 !! html
13682 <p>{{subst:Includes}}
13683 </p>
13684 !! end
13685
13686 !! test
13687 pre-save transform: context links ("pipe trick")
13688 !! options
13689 pst
13690 !! wikitext
13691 [[Article (context)|]]
13692 [[Bar:Article|]]
13693 [[:Bar:Article|]]
13694 [[Bar:Article (context)|]]
13695 [[:Bar:Article (context)|]]
13696 [[|Article]]
13697 [[|Article (context)]]
13698 [[Bar:X (Y) Z|]]
13699 [[:Bar:X (Y) Z|]]
13700 !! html/php
13701 [[Article (context)|Article]]
13702 [[Bar:Article|Article]]
13703 [[:Bar:Article|Article]]
13704 [[Bar:Article (context)|Article]]
13705 [[:Bar:Article (context)|Article]]
13706 [[Article]]
13707 [[Article (context)]]
13708 [[Bar:X (Y) Z|X (Y) Z]]
13709 [[:Bar:X (Y) Z|X (Y) Z]]
13710 !! end
13711
13712 !! test
13713 pre-save transform: context links ("pipe trick") with interwiki prefix
13714 !! options
13715 pst
13716 !! wikitext
13717 [[interwiki:Article|]]
13718 [[:interwiki:Article|]]
13719 [[interwiki:Bar:Article|]]
13720 [[:interwiki:Bar:Article|]]
13721 !! html/php
13722 [[interwiki:Article|Article]]
13723 [[:interwiki:Article|Article]]
13724 [[interwiki:Bar:Article|Bar:Article]]
13725 [[:interwiki:Bar:Article|Bar:Article]]
13726 !! end
13727
13728 !! test
13729 pre-save transform: context links ("pipe trick") with parens in title
13730 !! options
13731 pst title=[[Somearticle (context)]]
13732 !! wikitext
13733 [[|Article]]
13734 !! html/php
13735 [[Article (context)|Article]]
13736 !! end
13737
13738 !! test
13739 pre-save transform: context links ("pipe trick") with comma in title
13740 !! options
13741 pst title=[[Someplace, Somewhere]]
13742 !! wikitext
13743 [[|Otherplace]]
13744 [[Otherplace, Elsewhere|]]
13745 [[Otherplace, Elsewhere, Anywhere|]]
13746 !! html/php
13747 [[Otherplace, Somewhere|Otherplace]]
13748 [[Otherplace, Elsewhere|Otherplace]]
13749 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13750 !! end
13751
13752 !! test
13753 pre-save transform: context links ("pipe trick") with parens and comma
13754 !! options
13755 pst title=[[Someplace (IGNORED), Somewhere]]
13756 !! wikitext
13757 [[|Otherplace]]
13758 [[Otherplace (place), Elsewhere|]]
13759 !! html/php
13760 [[Otherplace, Somewhere|Otherplace]]
13761 [[Otherplace (place), Elsewhere|Otherplace]]
13762 !! end
13763
13764 !! test
13765 pre-save transform: context links ("pipe trick") with comma and parens
13766 !! options
13767 pst title=[[Who, me? (context)]]
13768 !! wikitext
13769 [[|Yes, you.]]
13770 [[Me, Myself, and I (1937 song)|]]
13771 !! html/php
13772 [[Yes, you. (context)|Yes, you.]]
13773 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13774 !! end
13775
13776 !! test
13777 pre-save transform: context links ("pipe trick") with namespace
13778 !! options
13779 pst title=[[Ns:Somearticle]]
13780 !! wikitext
13781 [[|Article]]
13782 !! html/php
13783 [[Ns:Article|Article]]
13784 !! end
13785
13786 !! test
13787 pre-save transform: context links ("pipe trick") with namespace and parens
13788 !! options
13789 pst title=[[Ns:Somearticle (context)]]
13790 !! wikitext
13791 [[|Article]]
13792 !! html/php
13793 [[Ns:Article (context)|Article]]
13794 !! end
13795
13796 !! test
13797 pre-save transform: context links ("pipe trick") with namespace and comma
13798 !! options
13799 pst title=[[Ns:Somearticle, Context, Whatever]]
13800 !! wikitext
13801 [[|Article]]
13802 !! html/php
13803 [[Ns:Article, Context, Whatever|Article]]
13804 !! end
13805
13806 !! test
13807 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13808 !! options
13809 pst title=[[Ns:Somearticle, Context (context)]]
13810 !! wikitext
13811 [[|Article]]
13812 !! html/php
13813 [[Ns:Article (context)|Article]]
13814 !! end
13815
13816 !! test
13817 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13818 !! options
13819 pst title=[[Ns:Somearticle (IGNORED), Context]]
13820 !! wikitext
13821 [[|Article]]
13822 !! html/php
13823 [[Ns:Article, Context|Article]]
13824 !! end
13825
13826 !! test
13827 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13828 !! options
13829 pst
13830 !! wikitext
13831 [[Article(context)|]]
13832 [[Bar:Article(context)|]]
13833 [[:Bar:Article(context)|]]
13834 [[|Article(context)]]
13835 [[Bar:X(Y)Z|]]
13836 [[:Bar:X(Y)Z|]]
13837 !! html/php
13838 [[Article(context)|Article]]
13839 [[Bar:Article(context)|Article]]
13840 [[:Bar:Article(context)|Article]]
13841 [[Article(context)]]
13842 [[Bar:X(Y)Z|X(Y)Z]]
13843 [[:Bar:X(Y)Z|X(Y)Z]]
13844 !! end
13845
13846 !! test
13847 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13848 !! options
13849 pst
13850 !! wikitext
13851 [[Article (context)|]]
13852 [[Bar:Article (context)|]]
13853 [[:Bar:Article (context)|]]
13854 [[|Article (context)]]
13855 [[Bar:X (Y) Z|]]
13856 [[:Bar:X (Y) Z|]]
13857 !! html/php
13858 [[Article (context)|Article]]
13859 [[Bar:Article (context)|Article]]
13860 [[:Bar:Article (context)|Article]]
13861 [[Article (context)]]
13862 [[Bar:X (Y) Z|X (Y) Z]]
13863 [[:Bar:X (Y) Z|X (Y) Z]]
13864 !! end
13865
13866 !! test
13867 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13868 !! options
13869 pst
13870 !! wikitext
13871 [[Article(context)|]]
13872 [[Bar:Article(context)|]]
13873 [[:Bar:Article(context)|]]
13874 [[|Article(context)]]
13875 [[Bar:X(Y)Z|]]
13876 [[:Bar:X(Y)Z|]]
13877 !! html/php
13878 [[Article(context)|Article]]
13879 [[Bar:Article(context)|Article]]
13880 [[:Bar:Article(context)|Article]]
13881 [[Article(context)]]
13882 [[Bar:X(Y)Z|X(Y)Z]]
13883 [[:Bar:X(Y)Z|X(Y)Z]]
13884 !! end
13885
13886 !! test
13887 pre-save transform: context links ("pipe trick") with commas (T23660)
13888 !! options
13889 pst
13890 !! wikitext
13891 [[Article (context), context|]]
13892 [[Article (context),context|]]
13893 [[Bar:Article (context), context|]]
13894 [[Bar:Article (context),context|]]
13895 [[:Bar:Article (context), context|]]
13896 [[:Bar:Article (context),context|]]
13897 !! html/php
13898 [[Article (context), context|Article]]
13899 [[Article (context),context|Article]]
13900 [[Bar:Article (context), context|Article]]
13901 [[Bar:Article (context),context|Article]]
13902 [[:Bar:Article (context), context|Article]]
13903 [[:Bar:Article (context),context|Article]]
13904 !! end
13905
13906 !! test
13907 Parsoid: backwards pipe trick
13908 !! wikitext
13909 [[|'''bar''']]
13910 !! html/php
13911 <p>[[|<b>bar</b>]]
13912 </p>
13913 !! html/parsoid
13914 <p>[[|<b>bar</b>]]</p>
13915 !! end
13916
13917 !! test
13918 pre-save transform: trim trailing empty lines
13919 !! options
13920 pst
13921 !! wikitext
13922 Empty lines are trimmed
13923
13924
13925
13926
13927 !! html/php
13928 Empty lines are trimmed
13929 !! end
13930
13931 !! test
13932 pre-save transform: Signature expansion
13933 !! options
13934 pst
13935 !! wikitext
13936 * ~~~
13937 * ~~~~
13938 * ~~~~~
13939 * <noinclude>~~~</noinclude>
13940 * <includeonly>~~~</includeonly>
13941 * <onlyinclude>~~~</onlyinclude>
13942 !! html/php
13943 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13944 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13945 * 00:02, 1 January 1970 (UTC)
13946 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13947 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13948 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13949 !! end
13950
13951
13952 !! test
13953 ParserOutput flags from signature expansion (T84843)
13954 !! options
13955 pst
13956 showflags
13957 !! wikitext
13958 ~~~~
13959 !! html/php
13960 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13961 flags=user-signature
13962 !! end
13963
13964
13965 !! test
13966 pre-save transform: Signature expansion in nowiki tags (T2093)
13967 !! options
13968 pst disabled
13969 !! wikitext
13970 Shall not expand:
13971
13972 <nowiki>~~~~</nowiki>
13973
13974 <includeonly><nowiki>~~~~</nowiki></includeonly>
13975
13976 <noinclude><nowiki>~~~~</nowiki></noinclude>
13977
13978 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13979
13980 {{subst:Foo}} shall be converted to FOO
13981
13982 As well as inside noinclude/onlyinclude
13983 <noinclude>{{subst:Foo}}</noinclude>
13984 <onlyinclude>{{subst:Foo}}</onlyinclude>
13985
13986 But not inside includeonly
13987 <includeonly>{{subst:Foo}}</includeonly>
13988 !! html/php
13989 Shall not expand:
13990
13991 <nowiki>~~~~</nowiki>
13992
13993 <includeonly><nowiki>~~~~</nowiki></includeonly>
13994
13995 <noinclude><nowiki>~~~~</nowiki></noinclude>
13996
13997 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13998
13999 FOO shall be converted to FOO
14000
14001 As well as inside noinclude/onlyinclude
14002 <noinclude>FOO</noinclude>
14003 <onlyinclude>FOO</onlyinclude>
14004
14005 But not inside includeonly
14006 <includeonly>{{subst:Foo}}</includeonly>
14007 !! end
14008
14009 !! test
14010 Parsoid: Recognize nowiki with trailing space in tags
14011 !! options
14012 parsoid=wt2html
14013 !! wikitext
14014 <nowiki ><div>[[foo]]</nowiki >
14015
14016 a<nowiki / >b
14017
14018 c<nowiki />d
14019
14020 e<nowiki/ >f
14021 !! html
14022 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14023 <p>ab</p>
14024 <p>cd</p>
14025 <p>ef</p>
14026 !! end
14027
14028 !! test
14029 Parsoid: Recognize nowiki with odd capitalization
14030 !! options
14031 parsoid=wt2html
14032 !! wikitext
14033 <noWikI ><div>[[foo]]</Nowiki >
14034 !! html
14035 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14036 !! end
14037
14038
14039 !! test
14040 Parsoid: Escape nowiki with trailing space in tags
14041 !! options
14042 parsoid=html2wt
14043 !! html/parsoid
14044 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14045 <p>a&lt;nowiki /&gt;b</p>
14046 <p>c&lt;nowiki/ &gt;d</p>
14047 !! wikitext
14048 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14049
14050 a&lt;nowiki /&gt;b
14051
14052 c&lt;nowiki/ &gt;d
14053 !! end
14054
14055 !! test
14056 Parsoid: Escape weird noWikI capitalizations
14057 !! options
14058 parsoid=html2wt
14059 !! html/parsoid
14060 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14061 !! wikitext
14062 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14063 !! end
14064
14065 ###
14066 ### Message transform tests
14067 ###
14068 !! test
14069 message transform: magic variables
14070 !! options
14071 msg
14072 !! wikitext
14073 {{SITENAME}}
14074 !! html
14075 MediaWiki
14076 !! end
14077
14078 !! test
14079 message transform: should not transform wiki markup
14080 !! options
14081 msg
14082 !! wikitext
14083 ''test''
14084 !! html
14085 ''test''
14086 !! end
14087
14088 !! test
14089 message transform: <noinclude> in transcluded template (T6926)
14090 !! options
14091 msg
14092 !! wikitext
14093 {{Includes}}
14094 !! html
14095 Foobar
14096 !! end
14097
14098 !! test
14099 message transform: <onlyinclude> in transcluded template (T6926)
14100 !! options
14101 msg
14102 !! wikitext
14103 {{Includes2}}
14104 !! html
14105 Foo
14106 !! end
14107
14108 !! test
14109 {{#special:}} page name, known
14110 !! options
14111 msg
14112 !! wikitext
14113 {{#special:Recentchanges}}
14114 !! html
14115 Special:RecentChanges
14116 !! end
14117
14118 !! test
14119 {{#special:}} page name with subpage, known
14120 !! options
14121 msg
14122 !! wikitext
14123 {{#special:Recentchanges/param}}
14124 !! html
14125 Special:RecentChanges/param
14126 !! end
14127
14128 !! test
14129 {{#special:}} page name, unknown
14130 !! options
14131 msg
14132 !! wikitext
14133 {{#special:foobar nonexistent}}
14134 !! html
14135 Special:Foobar nonexistent
14136 !! end
14137
14138 !! test
14139 {{#speciale:}} page name, known
14140 !! options
14141 msg
14142 !! wikitext
14143 {{#speciale:Recentchanges}}
14144 !! html
14145 Special:RecentChanges
14146 !! end
14147
14148 !! test
14149 {{#speciale:}} page name with subpage, known
14150 !! options
14151 msg
14152 !! wikitext
14153 {{#speciale:Recentchanges/param}}
14154 !! html
14155 Special:RecentChanges/param
14156 !! end
14157
14158 !! test
14159 {{#speciale:}} page name, unknown
14160 !! options
14161 msg
14162 !! wikitext
14163 {{#speciale:foobar nonexistent}}
14164 !! html
14165 Special:Foobar_nonexistent
14166 !! end
14167
14168 ###
14169 ### Images
14170 ###
14171 ### For Parsoid-specific tests, see
14172 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14173
14174 !! test
14175 Simple image
14176 !! options
14177 parsoid=wt2html,wt2wt,html2html
14178 !! wikitext
14179 [[Image:foobar.jpg]]
14180 !! html/php
14181 <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>
14182 </p>
14183 !! html/parsoid
14184 <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>
14185 !! end
14186
14187 !! test
14188 Serialize simple image with figure-inline wrapper
14189 !! options
14190 parsoid=html2wt
14191 !! html/parsoid
14192 <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>
14193 !! wikitext
14194 [[File:Foobar.jpg]]
14195 !! end
14196
14197 !! test
14198 Simple image (using File: namespace, now canonical)
14199 !! wikitext
14200 [[File:Foobar.jpg]]
14201 !! html/php
14202 <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>
14203 </p>
14204 !! html/parsoid
14205 <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>
14206 !! end
14207
14208 !! test
14209 Right-aligned image
14210 !! wikitext
14211 [[File:Foobar.jpg|right]]
14212 !! html/php
14213 <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>
14214
14215 !! html/parsoid
14216 <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>
14217 !! end
14218
14219 !! test
14220 Image with caption
14221 !! wikitext
14222 [[File:Foobar.jpg|right|Caption text]]
14223 !! html/php
14224 <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>
14225
14226 !! html/parsoid
14227 <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>
14228 !! end
14229
14230 !! test
14231 Image with caption, T55312 #1
14232 !! wikitext
14233 [[File:Foobar.jpg|right|Caption page stuff]]
14234 !! html/php
14235 <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>
14236
14237 !! html/parsoid
14238 <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>
14239 !! end
14240
14241 !! test
14242 Image with caption, T55312 #2
14243 !! wikitext
14244 [[File:Foobar.jpg|right|Caption page=]]
14245 !! html/php
14246 <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>
14247
14248 !! html/parsoid
14249 <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>
14250 !! end
14251
14252 !! test
14253 Image with caption, T55312 #3
14254 !! wikitext
14255 [[File:Foobar.jpg|right|Caption page=stuff]]
14256 !! html/php
14257 <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>
14258
14259 !! html/parsoid
14260 <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>
14261 !! end
14262
14263 !! test
14264 Allow empty links in image captions (T62753)
14265 !! options
14266 thumbsize=220
14267 !! wikitext
14268 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14269 [[]]
14270 [[Link2]]
14271 ]]
14272 !! html/php
14273 <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>
14274
14275 !! html/parsoid
14276 <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>
14277 [[]]
14278 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14279 </figcaption></figure>
14280 !! end
14281
14282 !! test
14283 Titles in unlinked images (T23454)
14284 !! wikitext
14285 [[File:Foobar.jpg|link=|stuff]]
14286 !! html/php
14287 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14288 </p>
14289 !! end
14290
14291 !! test
14292 Link with empty target
14293 !! wikitext
14294 [[]]
14295 !! html
14296 <p>[[]]
14297 </p>
14298 !! end
14299
14300 !! test
14301 Image with link trail
14302 !! wikitext
14303 Linktrails should not work for images: [[File:Foobar.jpg]]s
14304 !! html/php
14305 <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
14306 </p>
14307 !! html/parsoid
14308 <p>Linktrails should not work for images: <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>s</p>
14309 !! end
14310
14311 !! test
14312 Image with empty attribute
14313 !! options
14314 parsoid=wt2html,wt2wt,html2html
14315 !! wikitext
14316 [[File:Foobar.jpg|right||Caption text]]
14317 !! html/php
14318 <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>
14319
14320 !! html/parsoid
14321 <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>
14322 !! end
14323
14324 !! test
14325 1. Block image with individual attributes from templates
14326 !! wikitext
14327 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14328 !! html/php
14329 <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>
14330
14331 !! html/parsoid
14332 <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>
14333 !! end
14334
14335 !! test
14336 2. Block Image with individual attributes from templates
14337 !! wikitext
14338 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14339 !! html/php
14340 <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>
14341
14342 !! html/parsoid
14343 <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>
14344 !! end
14345
14346 !! test
14347 3. Inline image with individual attributes from templates
14348 !! wikitext
14349 [[File:Foobar.jpg|{{echo|50px}}]]
14350 !! html/php
14351 <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>
14352 </p>
14353 !! html/parsoid
14354 <p><span 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></span></p>
14355 !! end
14356
14357 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14358 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14359 !! test
14360 Image with multiple attributes from the same template
14361 !! wikitext
14362 [[File:Foobar.jpg|{{image_attribs}}]]
14363 !! html/php
14364 <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>
14365
14366 !! html/parsoid
14367 <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>
14368 !! end
14369
14370 !! test
14371 Image with link tails
14372 !! options
14373 thumbsize=220
14374 !! wikitext
14375 123[[File:Foobar.jpg]]456
14376 123[[File:Foobar.jpg|right]]456
14377 123[[File:Foobar.jpg|thumb]]456
14378 !! html/php
14379 <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
14380 </p>
14381 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
14382 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
14383
14384 !! html/php+tidy
14385 <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</p>
14386 <p>123</p>
14387 <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>
14388 <p>456 123</p>
14389 <div class="thumb tright">
14390 <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>
14391 <div class="thumbcaption">
14392 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14393 </div>
14394 </div>
14395 </div>
14396 <p>456</p>
14397 !! html/parsoid
14398 <p>123<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>456</p>
14399 <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>
14400 <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>
14401 !! end
14402
14403 !! test
14404 Image with multiple captions -- only last one is accepted
14405 !! wikitext
14406 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14407 !! html/php
14408 <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>
14409
14410 !! html/parsoid
14411 <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>
14412 !! end
14413
14414 !! test
14415 Image with multiple widths -- use last
14416 !! wikitext
14417 [[File:Foobar.jpg|200px|300px|caption]]
14418 !! html/php
14419 <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>
14420 </p>
14421 !! html/parsoid
14422 <p><span 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></span></p>
14423 !! end
14424
14425 !! test
14426 Image with multiple alignments -- use first (T50664)
14427 !! options
14428 thumbsize=220
14429 !! wikitext
14430 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14431
14432 [[File:Foobar.jpg|middle|text-top|caption]]
14433 !! html/php
14434 <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>
14435 <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>
14436 </p>
14437 !! html/parsoid
14438 <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>
14439 <p><span 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></span></p>
14440 !! end
14441
14442 !! test
14443 Image with width attribute at different positions
14444 !! wikitext
14445 [[File:Foobar.jpg|200px|right|Caption]]
14446 [[File:Foobar.jpg|right|200px|Caption]]
14447 [[File:Foobar.jpg|right|Caption|200px]]
14448 !! html/php
14449 <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>
14450 <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>
14451 <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>
14452
14453 !! html/parsoid
14454 <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>
14455 <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>
14456 <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>
14457 !! end
14458
14459 # a sad bit of backward-compatibility
14460 !! test
14461 Image with size specified with pxpx (T15500, T53628)
14462 !! options
14463 parsoid=wt2html,wt2wt,html2html
14464 !! wikitext
14465 [[File:Foobar.jpg|20pxpx]]
14466 [[File:Foobar.jpg|200x20pxpx]]
14467 !! html/php
14468 <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>
14469 <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>
14470 </p>
14471 !! html/parsoid
14472 <p><span 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></span> <span 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></span></p>
14473 !! end
14474
14475 !! test
14476 Image with link parameter, wiki target
14477 !! wikitext
14478 [[File:Foobar.jpg|link=Main Page]]
14479 !! html/php
14480 <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>
14481 </p>
14482 !! html/parsoid
14483 <p><span 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></span></p>
14484 !! end
14485
14486 # parsoid T51293 (part 1)
14487 !! test
14488 Image with link parameter, URL target
14489 !! wikitext
14490 [[File:Foobar.jpg|link=http://example.com/]]
14491 !! html/php
14492 <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>
14493 </p>
14494 !! html/parsoid
14495 <p><span 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></span></p>
14496 !! end
14497
14498 # parsoid T51293 (part 2)
14499 !! test
14500 Image with link parameter, protocol-less URL target
14501 !! wikitext
14502 [[File:Foobar.jpg|link=//example.com/]]
14503 !! html/php
14504 <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>
14505 </p>
14506 !! html/parsoid
14507 <p><span 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></span></p>
14508 !! end
14509
14510 !! test
14511 Escaping non-block captions (T107435)
14512 !! options
14513 parsoid={
14514 "modes": ["wt2wt"],
14515 "changes": [
14516 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14517 ]
14518 }
14519 !! wikitext
14520 [[Image:Foobar.jpg|caption]]
14521 !! wikitext/edited
14522 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14523 !! end
14524
14525 # wgExternalLinkTarget not supported by Parsoid
14526 !! test
14527 Image with link parameter, wgExternalLinkTarget
14528 !! wikitext
14529 [[Image:foobar.jpg|link=http://example.com/]]
14530 !! config
14531 wgExternalLinkTarget='foobar'
14532 !! html/php
14533 <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>
14534 </p>
14535 !! end
14536
14537 !! test
14538 Image with link parameter, wgNoFollowLinks set to false
14539 !! wikitext
14540 [[Image:foobar.jpg|link=http://example.com/]]
14541 !! config
14542 wgNoFollowLinks=false
14543 !! html
14544 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14545 </p>
14546 !! end
14547
14548 !! test
14549 Image with link parameter, wgNoFollowDomainExceptions
14550 !! wikitext
14551 [[Image:foobar.jpg|link=http://example.com/]]
14552 !! config
14553 wgNoFollowDomainExceptions='example.com'
14554 !! html
14555 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14556 </p>
14557 !! end
14558
14559 # wgExternalLinkTarget not supported by Parsoid
14560 !! test
14561 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14562 !! wikitext
14563 [[Image:foobar.jpg|link=http://example.com/|Title]]
14564 !! config
14565 wgExternalLinkTarget='foobar'
14566 !! html/php
14567 <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>
14568 </p>
14569 !! end
14570
14571 !! test
14572 Image with empty link parameter
14573 !! wikitext
14574 [[File:Foobar.jpg|link=]]
14575 !! html/php
14576 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14577 </p>
14578 !! html/parsoid
14579 <p><span 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></span></p>
14580 !! end
14581
14582 !! test
14583 Image with link parameter (wiki target) and unnamed parameter
14584 !! wikitext
14585 [[File:Foobar.jpg|link=Main_Page|Title]]
14586 !! html/php
14587 <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>
14588 </p>
14589 !! html/parsoid
14590 <p><span 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></span></p>
14591 !! end
14592
14593 !! test
14594 Image with link parameter (URL target) and unnamed parameter
14595 !! wikitext
14596 [[File:Foobar.jpg|link=http://example.com/|Title]]
14597 !! html/php
14598 <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>
14599 </p>
14600 !! html/parsoid
14601 <p><span 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></span></p>
14602 !! end
14603
14604 !! test
14605 Thumbnail image with link parameter
14606 !! options
14607 thumbsize=220
14608 parsoid=wt2html,wt2wt,html2html
14609 !! wikitext
14610 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14611 !! html/php
14612 <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>
14613
14614 !! html/parsoid
14615 <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>
14616 !! end
14617
14618 !! test
14619 Manually-specified thumbnail image
14620 !! options
14621 thumbsize=220
14622 !! wikitext
14623 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14624 !! html/php
14625 <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>
14626
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 !! test
14632 Manually-specified thumbnail image with explicit link to wiki page
14633 !! options
14634 thumbsize=220
14635 parsoid=wt2html,wt2wt,html2html
14636 !! wikitext
14637 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14638 !! html/php
14639 <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>
14640
14641 !! html/parsoid
14642 <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>
14643 !! end
14644
14645 !! test
14646 Manually-specified thumbnail image with explicit link to url
14647 !! options
14648 thumbsize=220
14649 parsoid=wt2html,wt2wt,html2html
14650 !! wikitext
14651 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14652 !! html/php
14653 <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>
14654
14655 !! html/parsoid
14656 <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>
14657 !! end
14658
14659 !! test
14660 Manually-specified thumbnail image with explicit no link
14661 !! options
14662 thumbsize=220
14663 parsoid=wt2html,wt2wt,html2html
14664 !! wikitext
14665 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14666 !! html/php
14667 <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>
14668
14669 !! html/parsoid
14670 <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>
14671 !! end
14672
14673 !! test
14674 Manually-specified thumbnail image with explicit link and alt text
14675 !! options
14676 thumbsize=220
14677 parsoid=wt2html,wt2wt,html2html
14678 !! wikitext
14679 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14680 !! html/php
14681 <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>
14682
14683 !! html/parsoid
14684 <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>
14685 !! end
14686
14687 !! test
14688 Image with frame and link
14689 !! options
14690 parsoid=wt2html,wt2wt,html2html
14691 !! wikitext
14692 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14693 !! html/php
14694 <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>
14695
14696 !! html/parsoid
14697 <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>
14698 !! end
14699
14700 !! test
14701 Image with frame and link and explicit alt
14702 !! options
14703 parsoid=wt2html,wt2wt,html2html
14704 !! wikitext
14705 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14706 !! html/php
14707 <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>
14708
14709 !! html/parsoid
14710 <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>
14711 !! end
14712
14713 !! test
14714 Image with wiki markup in implicit alt
14715 !! wikitext
14716 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14717
14718 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14719 !! html/php
14720 <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>
14721 </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>
14722 </p>
14723 !! html/parsoid
14724 <p><span 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></span></p>
14725
14726 <p><span 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></span></p>
14727 !! end
14728
14729 !! test
14730 Alt image option should handle most kinds of wikitext without barfing
14731 !! wikitext
14732 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14733 !! html/php
14734 <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>
14735
14736 !! html/parsoid
14737 <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|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"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>
14738 !! end
14739
14740 ###################
14741 # Conflicting image format options.
14742 # First option specified should 'win'.
14743 # All three cases in each test should be identical.
14744
14745 !! test
14746 Image with 'frameless' first.
14747 !! options
14748 parsoid=wt2html,wt2wt,html2html
14749 !! wikitext
14750 [[File:Foobar.jpg|frameless|caption]]
14751
14752 [[File:Foobar.jpg|frameless|frame|caption]]
14753
14754 [[File:Foobar.jpg|frameless|thumb|caption]]
14755 !! html/php
14756 <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>
14757 </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>
14758 </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>
14759 </p>
14760 !! html/parsoid
14761 <p><span 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></span></p>
14762 <p><span 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></span></p>
14763 <p><span 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></span></p>
14764 !! end
14765
14766 !! test
14767 Image with 'frame' first.
14768 !! options
14769 parsoid=wt2html,wt2wt,html2html
14770 !! wikitext
14771 [[File:Foobar.jpg|frame|caption]]
14772 [[File:Foobar.jpg|frame|frameless|caption]]
14773 [[File:Foobar.jpg|frame|thumb|caption]]
14774 !! html/php
14775 <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>
14776 <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>
14777 <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>
14778
14779 !! html/parsoid
14780 <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>
14781 <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>
14782 <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>
14783 !! end
14784
14785 !! test
14786 Image with 'thumb' first.
14787 !! options
14788 parsoid=wt2html,wt2wt,html2html
14789 !! wikitext
14790 [[File:Foobar.jpg|thumb|caption]]
14791 [[File:Foobar.jpg|thumb|frameless|caption]]
14792 [[File:Foobar.jpg|thumb|frame|caption]]
14793 !! html/php
14794 <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>
14795 <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>
14796 <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>
14797
14798 !! html/parsoid
14799 <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>
14800 <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>
14801 <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>
14802 !! end
14803
14804 ###################
14805 # Image sizing.
14806 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14807 # and https://phabricator.wikimedia.org/T64258
14808 # Foobar has actual size of 1941x220
14809 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14810 # a scalable format.
14811 # 2. Framed images always ignore size options; always render at default size.
14812 # 3. "Unspecified format" and border are the only types which can be
14813 # enlarged.
14814
14815 !! test
14816 Image: unspecified format and border enlarge
14817 !! options
14818 parsoid=wt2html,wt2wt,html2html
14819 !! wikitext
14820 [[File:Foobar.jpg|2000px]]
14821
14822 [[File:Foobar.jpg|border|2000px]]
14823 !! html/php
14824 <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>
14825 </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>
14826 </p>
14827 !! html/parsoid
14828 <p><span 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></span></p>
14829 <p><span 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></span></p>
14830 !! end
14831
14832 !! test
14833 Image: "unspecified format" and border reduce
14834 !! options
14835 parsoid=wt2html,wt2wt,html2html
14836 !! wikitext
14837 [[File:Foobar.jpg|1000px]]
14838
14839 [[File:Foobar.jpg|border|1000px]]
14840 !! html/php
14841 <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>
14842 </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>
14843 </p>
14844 !! html/parsoid
14845 <p><span 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></span></p>
14846 <p><span 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></span></p>
14847 !! end
14848
14849 !! test
14850 Image: thumbs reduce
14851 !! options
14852 parsoid=wt2html,wt2wt,html2html
14853 !! wikitext
14854 [[File:Foobar.jpg|thumb|50px]]
14855 !! html/php
14856 <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>
14857
14858 !! html/parsoid
14859 <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>
14860 !! end
14861
14862 !! test
14863 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14864 !! options
14865 parsoid=wt2html,wt2wt,html2html
14866 !! wikitext
14867 [[File:Foobar.jpg|thumb|2000px]]
14868
14869 [[File:Foobar.svg|thumb|2000px]]
14870 !! html/php
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 class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14872 <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>
14873
14874 !! html/parsoid
14875 <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>
14876 <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>
14877 !! end
14878
14879 !! test
14880 Image: frameless can reduce in size
14881 !! options
14882 parsoid=wt2html,wt2wt,html2html
14883 !! wikitext
14884 [[File:Foobar.jpg|frameless|50px]]
14885 !! html/php
14886 <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>
14887 </p>
14888 !! html/parsoid
14889 <p><span 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></span></p>
14890 !! end
14891
14892 !! test
14893 Image: bitmap frameless can't be enlarged past original size, but vector can
14894 !! options
14895 parsoid=wt2html,wt2wt,html2html
14896 !! wikitext
14897 [[File:Foobar.jpg|frameless|2000px]]
14898
14899 [[File:Foobar.svg|frameless|2000px]]
14900 !! html/php
14901 <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>
14902 </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>
14903 </p>
14904 !! html/parsoid
14905 <p><span 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></span></p>
14906 <p><span 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></span></p>
14907 !! end
14908
14909 !! test
14910 Image: framed images are always unscaled.
14911 !! options
14912 parsoid=wt2html,wt2wt,html2html
14913 !! wikitext
14914 [[File:Foobar.jpg|frame]]
14915
14916 [[File:Foobar.jpg|frame|50px]]
14917
14918 [[File:Foobar.jpg|frame|50x50px]]
14919
14920 [[File:Foobar.jpg|frame|2000px]]
14921 !! html/php
14922 <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>
14923 <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>
14924 <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>
14925 <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>
14926
14927 !! html/parsoid
14928 <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>
14929 <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>
14930 <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>
14931 <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>
14932 !! end
14933
14934 ###################
14935
14936 !! test
14937 Link to image page- image page normally doesn't exists, hence edit link
14938 Add test with existing image page
14939 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14940 !! wikitext
14941 [[:Image:test]]
14942 !! html
14943 <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>
14944 </p>
14945 !! end
14946
14947 !! test
14948 T20784 Link to non-existent image page with caption should use caption as link text
14949 !! wikitext
14950 [[:Image:test|caption]]
14951 !! html
14952 <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>
14953 </p>
14954 !! end
14955
14956 !! test
14957 Frameless image caption with a free URL
14958 !! wikitext
14959 [[File:Foobar.jpg|http://example.com]]
14960 !! html/php
14961 <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>
14962 </p>
14963 !! html/parsoid
14964 <p><span 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></span></p>
14965 !! end
14966
14967 !! test
14968 Thumbnail image caption with a free URL
14969 !! options
14970 thumbsize=220
14971 !! wikitext
14972 [[File:Foobar.jpg|thumb|http://example.com]]
14973 !! html/php
14974 <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>
14975
14976 !! html/parsoid
14977 <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" href="http://example.com">http://example.com</a></figcaption></figure>
14978 !! end
14979
14980 !! test
14981 Thumbnail image caption with a free URL and explicit alt
14982 !! options
14983 thumbsize=220
14984 parsoid=wt2html,wt2wt,html2html
14985 !! wikitext
14986 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14987 !! html/php
14988 <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>
14989
14990 !! html/parsoid
14991 <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" href="http://example.com">http://example.com</a></figcaption></figure>
14992 !! end
14993
14994 !! test
14995 SVG thumbnails with no language set
14996 !! options
14997 !! wikitext
14998 [[File:Foobar.svg|thumb|caption]]
14999 !! html/php
15000 <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>
15001
15002 !! html/parsoid
15003 <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>
15004 !! end
15005
15006 !! test
15007 SVG thumbnails with language de
15008 !! options
15009 parsoid=wt2html,wt2wt,html2html
15010 !! wikitext
15011 [[File:Foobar.svg|thumb|caption|lang=de]]
15012 !! html/php
15013 <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>
15014
15015 !! html/parsoid
15016 <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>
15017 !! end
15018
15019 !! test
15020 SVG thumbnails with invalid language code
15021 !! options
15022 parsoid=wt2html,wt2wt,html2html
15023 !! wikitext
15024 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
15025 !! html/php
15026 <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>
15027
15028 !! html/parsoid
15029 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
15030 !! end
15031
15032 !! test
15033 T3887: A ISBN with a thumbnail
15034 !! wikitext
15035 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15036 !! html/php
15037 <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>
15038
15039 !! html/parsoid
15040 <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>
15041 !! end
15042
15043 !! test
15044 T3887: A RFC with a thumbnail
15045 !! wikitext
15046 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15047 !! html/php
15048 <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="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15049
15050 !! html/parsoid
15051 <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="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
15052 !! end
15053
15054 !! test
15055 T3887: A mailto link with a thumbnail
15056 !! wikitext
15057 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15058 !! html/php
15059 <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>
15060
15061 !! html/parsoid
15062 <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" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15063 !! end
15064
15065 # Pending resolution to T2368
15066 !! test
15067 T2648: Frameless image caption with a link
15068 !! wikitext
15069 [[File:Foobar.jpg|text with a [[link]] in it]]
15070 !! html/php
15071 <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>
15072 </p>
15073 !! html/parsoid
15074 <p><span 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></span></p>
15075 !! end
15076
15077 !! test
15078 T2648: Frameless image caption with a link (suffix)
15079 !! wikitext
15080 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15081 !! html/php
15082 <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>
15083 </p>
15084 !! html/parsoid
15085 <p><span 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></span></p>
15086 !! end
15087
15088 !! test
15089 T2648: Frameless image caption with an interwiki link
15090 !! wikitext
15091 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15092 !! html/php
15093 <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>
15094 </p>
15095 !! html/parsoid
15096 <p><span 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:ExtLink\" 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></span></p>
15097 !! end
15098
15099 !! test
15100 T2648: Frameless image caption with a piped interwiki link
15101 !! wikitext
15102 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15103 !! html/php
15104 <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>
15105 </p>
15106 !! html/parsoid
15107 <p><span 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:ExtLink\" 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></span></p>
15108 !! end
15109
15110 !! test
15111 T107474: Frameless image caption with <nowiki>
15112 !! wikitext
15113 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15114 !! html/parsoid
15115 <p><span 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></span></p>
15116 !! end
15117
15118 !! test
15119 Escape HTML special chars in image alt text
15120 !! wikitext
15121 [[File:Foobar.jpg|& < > "]]
15122 !! html/php
15123 <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>
15124 </p>
15125 !! html/parsoid
15126 <p><span 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></span></p>
15127 !! end
15128
15129 !! test
15130 Escape HTML special chars in image alt text with LanguageConverter
15131 !! options
15132 language=zh
15133 !! wikitext
15134 [[File:Foobar.jpg|& < > "]]
15135 !! html/php
15136 <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>
15137 </p>
15138 !! html/parsoid
15139 <p><span 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></span></p>
15140 !! end
15141
15142 !! test
15143 Entities in file name and attributes
15144 !! wikitext
15145 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15146 !! html/php
15147 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15148 </p>
15149 !! html/parsoid
15150 <p><span 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></span></p>
15151 !! end
15152
15153 !! test
15154 T2499: Alt text should have &#1234;, not &amp;1234;
15155 !! wikitext
15156 [[File:Foobar.jpg|&#9792;]]
15157 !! html/php
15158 <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>
15159 </p>
15160 !! html/parsoid
15161 <p><span 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></span></p>
15162 !! end
15163
15164 !! test
15165 Broken image caption with link
15166 !! options
15167 parsoid=wt2html,wt2wt,html2html
15168 !! wikitext
15169 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15170 !! html/php
15171 <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.
15172 </p>
15173 !! html/parsoid
15174 <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>
15175 !! end
15176
15177 !! test
15178 Image caption containing another image
15179 !! wikitext
15180 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15181 !! html/php
15182 <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>
15183
15184 !! html/parsoid
15185 <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 <span 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></span> inside it!</figcaption></figure>
15186 !! end
15187
15188 !! test
15189 Image: caption containing a newline
15190 !! wikitext
15191 [[File:Foobar.jpg|This
15192 *is some text]]
15193 !! html/php
15194 <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>
15195 </p>
15196 !! html/parsoid
15197 <p><span 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></span></p>
15198 !!end
15199
15200 !!test
15201 Image: caption containing leading space
15202 (The leading space should not trigger nowiki escaping in wt2wt mode)
15203 !! wikitext
15204 [[File:Foobar.jpg|thumb| bar]]
15205 !! html/php
15206 <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>
15207
15208 !! html/parsoid
15209 <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>
15210 !!end
15211
15212 !! test
15213 Image: caption containing a table
15214 !! options
15215 parsoid=wt2html,wt2wt,html2html
15216 !! wikitext
15217 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15218 {|
15219 ! Foo !! Bar
15220 |-
15221 | Foo1 || Bar1
15222 |}
15223 and some more text.]]
15224 !! html/php
15225 <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>
15226
15227 !! html/parsoid
15228 <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
15229 <table>
15230 <tbody>
15231 <tr><th>Foo </th><th>Bar</th></tr>
15232 <tr>
15233 <td>Foo1 </td>
15234 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15235 !! end
15236
15237 !! test
15238 T5090: External links other than http: in image captions
15239 !! wikitext
15240 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15241 !! html/php
15242 <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>
15243
15244 !! html/parsoid
15245 <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" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
15246 !! end
15247
15248 !! test
15249 Custom class
15250 !! options
15251 parsoid=wt2html,wt2wt,html2html
15252 !! wikitext
15253 [[Image:foobar.jpg|a|class=b]]
15254 !! html/php
15255 <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>
15256 </p>
15257 !! html/parsoid
15258 <p><span 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></span></p>
15259 !! end
15260
15261 !! test
15262 Localized image handling (1).
15263 !! options
15264 parsoid=wt2html,wt2wt,html2html
15265 language=es
15266 !! wikitext
15267 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15268 !! html/php
15269 <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>
15270
15271 !! html/parsoid
15272 <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>
15273 !! end
15274
15275 !! test
15276 Localized image handling (2).
15277 !! options
15278 thumbsize=220
15279 parsoid=wt2html,wt2wt,html2html
15280 language=es
15281 !! wikitext
15282 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15283 !! html/php
15284 <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>
15285
15286 !! html/parsoid
15287 <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>
15288 !! end
15289
15290 !! test
15291 Localized image handling (3).
15292 !! options
15293 language=fa
15294 parsoid=html2wt
15295 !! html/parsoid
15296 <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>
15297 !! wikitext
15298 [[File:Foobar.jpg|بندانگشتی]]
15299 !! end
15300
15301 !! test
15302 "border", "frameless" and "class" attributes on an image.
15303 !! options
15304 thumbsize=220
15305 parsoid=wt2html,wt2wt,html2html
15306 !! wikitext
15307 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15308 !! html/php
15309 <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>
15310 </p>
15311 !! html/parsoid
15312 <p><span 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></span></p>
15313 !! end
15314
15315 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15316 !! test
15317 Invalid image attributes (T64500)
15318 !! options
15319 thumbsize=220
15320 parsoid=wt2html,wt2wt,html2html
15321 !! wikitext
15322 [[File:Foobar.jpg|thumb|float|left|caption]]
15323
15324 [[File:Foobar.jpg|thumb|righ|caption]]
15325
15326 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15327 !! html/php
15328 <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>
15329 <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>
15330 <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>
15331
15332 !! html/parsoid
15333 <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>
15334 <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>
15335 <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>
15336 !! end
15337
15338 !! article
15339 File:Barfoo.jpg
15340 !! text
15341 #REDIRECT [[File:Barfoo.jpg]]
15342 !! endarticle
15343
15344 # FIXME: Parsoid should run this test -- but we'd need to teach the
15345 # mockAPI about the redirected Barfoo.jpg image.
15346 !! test
15347 Redirected image
15348 !! wikitext
15349 [[Image:Barfoo.jpg]]
15350 !! html/php
15351 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15352 </p>
15353 !! end
15354
15355 !! test
15356 Missing image with uploads disabled
15357 !! options
15358 wgEnableUploads=0
15359 !! wikitext
15360 [[File:Foobaz.jpg]]
15361 !! html/php
15362 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15363 </p>
15364 !! html/parsoid
15365 <p><span 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></span></p>
15366 !! end
15367
15368 # Parsoid-specific testing for images
15369 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15370 # Currently imperfect due to a flaw in the Parsoid testrunner
15371 # Work in progress
15372 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15373 # image tests.
15374
15375 !! test
15376 Parsoid-specific image handling - simple image with size and middle alignment
15377 !! wikitext
15378 [[File:Foobar.jpg|middle|50px]]
15379 !! html/parsoid
15380 <p><span 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></span></p>
15381 !! end
15382
15383 !! test
15384 Parsoid-specific image handling - simple image with size, middle alignment,
15385 non-standard namespace alias
15386 !! options
15387 parsoid=wt2wt,wt2html,html2html
15388 !! wikitext
15389 [[Image:Foobar.jpg|middle|50px]]
15390 !! html/parsoid
15391 <p><span 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></span></p>
15392 !! end
15393
15394 !! test
15395 Parsoid-specific image handling - simple image with size and middle alignment
15396 (existing content)
15397 !! wikitext
15398 [[File:Foobar.jpg|50px|middle]]
15399 !! html/parsoid
15400 <p><span 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></span></p>
15401 !! end
15402
15403 !! test
15404 Parsoid-specific image handling - simple image with size and middle alignment
15405 and non-standard namespace name
15406 !! options
15407 parsoid=wt2html,wt2wt,html2html
15408 !! wikitext
15409 [[Image:Foobar.jpg|50px|middle]]
15410 !! html/parsoid
15411 <p><span 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></span></p>
15412 !! end
15413
15414 !! test
15415 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15416 !! wikitext
15417 [[File:Foobar.jpg|500x10px|baseline|caption]]
15418 !! html/parsoid
15419 <p><span 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></span></p>
15420 !! end
15421
15422 !! test
15423 Parsoid-specific image handling - simple image with border and size spec
15424 !! wikitext
15425 [[File:Foobar.jpg|50px|border|caption]]
15426 !! html/parsoid
15427 <p><span 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></span></p>
15428 !! end
15429
15430 !! test
15431 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15432 !! wikitext
15433 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15434 !! html/parsoid
15435 <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>
15436 !! end
15437
15438 !! test
15439 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15440 (existing content)
15441 !! wikitext
15442 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15443 !! html/parsoid
15444 <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>
15445 !! end
15446
15447 !! test
15448 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15449 !! wikitext
15450 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15451 !! html/parsoid
15452 <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>
15453 !! end
15454
15455 !! test
15456 Parsoid-specific image handling - thumbnail with specific size, halign,
15457 valign, and caption (existing content)
15458 !! wikitext
15459 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15460 !! html/parsoid
15461 <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>
15462 !! end
15463
15464 !! test
15465 Parsoid-specific image handling - framed image with specific size and caption
15466 (size is ignored)
15467 !! options
15468 parsoid=wt2html,wt2wt,html2html
15469 !! wikitext
15470 [[File:Foobar.jpg|frame|500x50px|caption]]
15471 !! html/parsoid
15472 <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>
15473 !! end
15474
15475 !! test
15476 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15477 (size is ignored)
15478 !! options
15479 parsoid=wt2html,wt2wt,html2html
15480 !! wikitext
15481 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15482 !! html/parsoid
15483 <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>
15484 !! end
15485
15486 !! test
15487 Parsoid-specific image handling - frameless image with specific size, border, and caption
15488 !! wikitext
15489 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15490 !! html/parsoid
15491 <p><span 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></span></p>
15492 !! end
15493
15494 !! test
15495 Parsoid-specific image handling - simple image with a formatted caption
15496 !! wikitext
15497 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15498 !! html/parsoid
15499 <p><span 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></span></p>
15500 !! end
15501
15502 !! test
15503 Parsoid-specific image handling - caption with a template in it
15504 !! wikitext
15505 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15506 !! html/parsoid
15507 <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>
15508 !! end
15509
15510 !! test
15511 Parsoid-specific image handling - caption with unbalanced tags in it
15512 !! options
15513 parsoid=wt2html,wt2wt,html2html
15514 !! wikitext
15515 foo
15516 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15517 bar
15518 !! html/parsoid
15519 <p>foo</p>
15520 <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>
15521 <p>bar</p>
15522 !! end
15523
15524 !! test
15525 Parsoid-specific image handling - empty caption (1)
15526 !! options
15527 parsoid=wt2html,wt2wt
15528 !! wikitext
15529 [[File:Foobar.jpg|thumb|]]
15530 !! html/parsoid
15531 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
15532 !! end
15533
15534 # empty captions don't get serialized unless we're in the "round trip" case
15535 !! test
15536 Parsoid-specific image handling - empty caption (2)
15537 !! options
15538 parsoid=html2wt
15539 !! html/parsoid
15540 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15541 <a href="./File:Foobar.jpg">
15542 <img resource="./File:Foobar.jpg"
15543 src="//example.com/images/3/3a/Foobar.jpg"
15544 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15545 height="25" width="220"/>
15546 </a>
15547 <figcaption></figcaption>
15548 </figure>
15549 !! wikitext
15550 [[File:Foobar.jpg|thumb]]
15551 !! end
15552
15553 !! test
15554 Parsoid-specific image handling - whitespace caption
15555 !! wikitext
15556 [[File:Foobar.jpg|thumb| ]]
15557 !! html/parsoid
15558 <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>
15559 !! end
15560
15561 !! test
15562 Parsoid-specific image handling - lang option
15563 !! wikitext
15564 foo
15565 [[File:Foobar.svg|lang=de|caption]]
15566 bar
15567 !! html/parsoid
15568 <p>foo
15569 <span 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></span>
15570 bar</p>
15571 !! end
15572
15573 ## Edge case bugs in Parsoid from T93580
15574 !! test
15575 T93580: 1. Templated <ref> inside block images
15576 !! wikitext
15577 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15578
15579 <references />
15580 !! html/parsoid
15581 <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: <span 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></span></figcaption></figure>
15582
15583 <ol class="mw-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>
15584 !! end
15585
15586 !! test
15587 T93580: 2. <ref> inside inline images
15588 !! wikitext
15589 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15590
15591 <references />
15592 !! html/parsoid
15593 <p><span 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;span 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;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><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></span></p>
15594
15595 <ol class="mw-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" data-parsoid="{}">foo</span></li></ol>
15596 !! end
15597
15598 !! test
15599 T93580: 3. Templated <ref> inside inline images
15600 !! wikitext
15601 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15602
15603 <references />
15604 !! html/parsoid
15605 <p><span 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;span 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;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"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;/>"}'><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></span></p>
15606
15607 <ol class="mw-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>
15608 !! end
15609
15610 ###
15611 ### Subpages
15612 ###
15613 !! article
15614 Subpage test/subpage
15615 !! text
15616 foo
15617 !! endarticle
15618
15619 !! test
15620 Subpage link
15621 !! options
15622 subpage title=[[Subpage test]]
15623 !! wikitext
15624 [[/subpage]]
15625 !! html
15626 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15627 </p>
15628 !! end
15629
15630 !! test
15631 Subpage noslash link
15632 !! options
15633 subpage title=[[Subpage test]]
15634 !! wikitext
15635 [[/subpage/]]
15636 !! html
15637 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15638 </p>
15639 !! end
15640
15641 !! article
15642 Subpage test/1/2/subpage
15643 !! text
15644 blah
15645 !! endarticle
15646
15647 !! test
15648 Relative subpage noslash link
15649 !! options
15650 parsoid=wt2wt,wt2html,html2html
15651 subpage title=[[Subpage test/1/2/3/4]]
15652 !! wikitext
15653 [[../../subpage/]]
15654
15655 [[../../subpage]]
15656 !! html/php
15657 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15658 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15659 </p>
15660 !! html/parsoid
15661 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15662 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15663 !! end
15664
15665 !! test
15666 Parsoid: dot-slash prefixed wikilinks
15667 !! wikitext
15668 [[./foo]]
15669
15670 [[././bar]]
15671
15672 [[././baz/]]
15673 !! html/php
15674 <p>[[./foo]]
15675 </p><p>[[././bar]]
15676 </p><p>[[././baz/]]
15677 </p>
15678 !! html/parsoid
15679 <p>[[./foo]]
15680 </p><p>[[././bar]]
15681 </p><p>[[././baz/]]
15682 </p>
15683 !! end
15684
15685 !! test
15686 Render invalid page names as plain text (T53090)
15687 !! wikitext
15688 [[./../foo|bar]]
15689 [[foo�|bar]]
15690 [[foo/.|bar]]
15691 [[foo/..|bar]]
15692 [[foo~~~bar]]
15693 [[foo>bar]]
15694 [[foo[bar]]
15695 [[.]]
15696 [[..]]
15697 [[foo././bar]]
15698 [[foo[http://example.com]xyz]]
15699
15700 [[{{echo|./../foo}}|bar]]
15701 [[{{echo|foo/.}}|bar]]
15702 [[{{echo|foo/..}}|bar]]
15703 [[{{echo|foo~~~~bar}}]]
15704 [[{{echo|foo>bar}}]]
15705 [[{{echo|foo././bar}}]]
15706 [[{{echo|foo{bar}}]]
15707 [[{{echo|foo}bar}}]]
15708 [[{{echo|foo[bar}}]]
15709 [[{{echo|foo]bar}}]]
15710 [[{{echo|foo<bar}}]]
15711 !!html/php
15712 <p>[[./../foo|bar]]
15713 [[foo�|bar]]
15714 [[foo/.|bar]]
15715 [[foo/..|bar]]
15716 [[foo~~~bar]]
15717 [[foo&gt;bar]]
15718 [[foo[bar]]
15719 [[.]]
15720 [[..]]
15721 [[foo././bar]]
15722 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15723 </p><p>[[./../foo|bar]]
15724 [[foo/.|bar]]
15725 [[foo/..|bar]]
15726 [[foo~~~~bar]]
15727 [[foo&gt;bar]]
15728 [[foo././bar]]
15729 [[foo{bar]]
15730 [[foo}bar]]
15731 [[foo[bar]]
15732 [[foo]bar]]
15733 [[foo&lt;bar]]
15734 </p>
15735 !!html/parsoid
15736 <p>[[./../foo|bar]]
15737 [[foo�|bar]]
15738 [[foo/.|bar]]
15739 [[foo/..|bar]]
15740 [[foo~~~bar]]
15741 [[foo>bar]]
15742 [[foo[bar]]
15743 [[.]]
15744 [[..]]
15745 [[foo././bar]]
15746 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15747
15748 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15749 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15750 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15751 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15752 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15753 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15754 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15755 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15756 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15757 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15758 [[<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>
15759 !!end
15760
15761 !! test
15762 Disabled subpages
15763 !! wikitext
15764 [[/subpage]]
15765 !! html
15766 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15767 </p>
15768 !! end
15769
15770 !! test
15771 T2561: {{/Subpage}}
15772 !! options
15773 subpage title=[[Page]]
15774 !! wikitext
15775 {{/Subpage}}
15776 !! html
15777 <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>
15778 </p>
15779 !! end
15780
15781 ###
15782 ### Categories
15783 ###
15784 !! article
15785 Category:MediaWiki User's Guide
15786 !! text
15787 blah
15788 !! endarticle
15789
15790 !! test
15791 Link to category
15792 !! wikitext
15793 [[:Category:MediaWiki User's Guide]]
15794 !! html
15795 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15796 </p>
15797 !! end
15798
15799 !! test
15800 Simple category
15801 !! options
15802 cat
15803 !! wikitext
15804 [[Category:MediaWiki User's Guide]]
15805 !! html/php
15806 cat=MediaWiki_User's_Guide sort=
15807 !! html/parsoid
15808 <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"}}'/>
15809 !! end
15810
15811 !! test
15812 PAGESINCATEGORY invalid title fatal (r33546 fix)
15813 !! wikitext
15814 {{PAGESINCATEGORY:<bogus>}}
15815 !! html
15816 <p>0
15817 </p>
15818 !! end
15819
15820 !! test
15821 Category with different sort key
15822 !! options
15823 cat
15824 !! wikitext
15825 [[Category:MediaWiki User's Guide|Foo]]
15826 !! html/php
15827 cat=MediaWiki_User's_Guide sort=Foo
15828 !! html/parsoid
15829 <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"}}'/>
15830 !! end
15831
15832 !! test
15833 Category with identical sort key
15834 !! options
15835 cat
15836 !! wikitext
15837 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15838 !! html/php
15839 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15840 !! html/parsoid
15841 <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"}}'/>
15842 !! end
15843
15844 !! test
15845 Category with empty sort key
15846 !! options
15847 cat
15848 pst
15849 !! wikitext
15850 [[Category:MediaWiki User's Guide|]]
15851 !! html/php
15852 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15853 !! end
15854
15855 !! test
15856 Category with empty sort key and parentheses
15857 !! options
15858 cat
15859 pst
15860 !! wikitext
15861 [[Category:Foo (bar)|]]
15862 !! html/php
15863 [[Category:Foo (bar)|Foo]]
15864 !! end
15865
15866 !! test
15867 Category with link tail
15868 !! options
15869 cat
15870 pst
15871 !! wikitext
15872 123[[Category:Foo]]456
15873 !! html/php
15874 123[[Category:Foo]]456
15875 !! end
15876
15877 !! test
15878 Category with template
15879 !! options
15880 cat
15881 pst
15882 !! wikitext
15883 [[Category:{{echo|Foo}}]]
15884 !! html/php
15885 [[Category:{{echo|Foo}}]]
15886 !! end
15887
15888 !! test
15889 Category with template in sort key
15890 !! options
15891 cat
15892 pst
15893 !! wikitext
15894 [[Category:Foo|{{echo|Bar}}]]
15895 !! html/php
15896 [[Category:Foo|{{echo|Bar}}]]
15897 !! end
15898
15899 !! test
15900 Category with template in sort key and title
15901 !! options
15902 cat
15903 pst
15904 !! wikitext
15905 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15906 !! html/php
15907 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15908 !! end
15909
15910 ## We used to, but no longer wt2wt this test since the default serializer
15911 ## will normalize all categories to serialize on their own line.
15912 ## This wikitext usage is going to be fairly uncommon in production and
15913 ## selser will take care of preserving formatting in those scenarios.
15914 !! test
15915 Category / paragraph interactions
15916 !! options
15917 parsoid=wt2html
15918 !! wikitext
15919 Foo [[Category:Baz]] Bar
15920
15921 Foo [[Category:Baz]]
15922 Bar
15923
15924 Foo
15925 [[Category:Baz]]
15926 Bar
15927
15928 Foo
15929 [[Category:Baz]] Bar
15930
15931 Foo
15932 [[Category:Baz]]
15933 [[Category:Baz]]
15934 [[Category:Baz]]
15935 Bar
15936
15937 [[Category:Baz]]
15938 [[Category:Baz]]
15939 [[Category:Baz]]
15940
15941 [[Category:Baz]]
15942 {{echo|[[Category:Baz]]}}
15943 [[Category:Baz]]
15944 !! html/php
15945 <p>Foo Bar
15946 </p><p>Foo
15947 Bar
15948 </p><p>Foo
15949 Bar
15950 </p><p>Foo Bar
15951 </p><p>Foo
15952 Bar
15953 </p>
15954 !! html/parsoid
15955 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15956 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15957 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15958 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15959 <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 <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}}]}'/></p>
15960 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15961 !! end
15962
15963 ## We used to, but no longer wt2wt this test since the default serializer
15964 ## will normalize all categories to serialize on their own line.
15965 ## This wikitext usage is going to be fairly uncommon in production and
15966 ## selser will take care of preserving formatting in those scenarios.
15967 ##
15968 ## The whitespace on the empty line is part of the test. Please do not delete
15969 !! test
15970 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15971 !! options
15972 parsoid=wt2html
15973 !! wikitext
15974 This
15975
15976 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15977
15978 {{echo|[[Category:Foo]] and so should this!}}
15979 !! html/php
15980 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15981 </p>
15982 !! html/parsoid
15983 <p>This
15984
15985 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15986
15987 <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>
15988 !! end
15989
15990 ## Parsoid will not try to wt2wt this while preserving newlines because
15991 ## it suppresses excess newlines within list items -- and we don't want to
15992 ## introduce a special case just for categories, which is, in reality somewhat
15993 ## odd behavior -- categories are unlikely to be used in list items like this
15994 ## in top-level pages and are only likely to show up in template-generated
15995 ## list items where this RT-ing is a non-issue.
15996 ##
15997 ## The whitespace on the empty line is part of the test. Please do not delete
15998 !! test
15999 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16000 !! options
16001 parsoid=wt2html
16002 !! wikitext
16003 * This
16004
16005 [[Category:Foo]] and this should be part of the same list item
16006 * So should this
16007
16008 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16009 !! html
16010 <ul><li>This and this should be part of the same list item</li>
16011 <li>So should this and this should be part of the same list item</li></ul>
16012 !! html/parsoid
16013 <ul>
16014 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16015 <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>
16016 </ul>
16017 !! end
16018
16019 ## Newlines and categories that follow the last item of a list
16020 ## are treated differently because this (list followed by categories)
16021 ## is an extremely common pattern on wikis.
16022 !! test
16023 3. Categories and newlines: newline suppression for last list item should RT properly
16024 !! wikitext
16025 * a
16026 * b
16027
16028 [[Category:Foo]]
16029
16030 [[Category:Bar]]
16031 [[Category:Baz]]
16032 !! html/parsoid
16033 <ul><li> a</li>
16034 <li> b</li></ul>
16035
16036 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16037
16038 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16039 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16040 !! end
16041
16042 !! test
16043 4. Categories and newlines: newline suppression for last list item should RT properly
16044 !! wikitext
16045 * a
16046 **** b
16047
16048 [[Category:Foo]]
16049 !! html/parsoid
16050 <ul><li> a
16051 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16052
16053 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16054 !! end
16055
16056 ## only wt2html for this to make sure the algo only applies to the rightmost path
16057 !! test
16058 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16059 !! options
16060 parsoid=wt2html
16061 !! wikitext
16062 * a
16063 ** b
16064 [[Category:Foo]]
16065 * c
16066 ** d
16067 [[Category:Foo]]
16068 !! html/parsoid
16069 <ul><li> a
16070 <ul><li> b
16071 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16072 <li> c
16073 <ul><li> d</li></ul></li></ul>
16074 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16075 !! end
16076
16077 ## We used to, but no longer wt2wt this test since the default serializer
16078 ## will normalize all categories to serialize on their own line.
16079 ## This wikitext usage is going to be fairly uncommon in production and
16080 ## selser will take care of preserving formatting in those scenarios.
16081 !! test
16082 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16083 !! options
16084 parsoid=wt2html
16085 !! wikitext
16086 * a [[Category:Foo]]
16087 !! html/parsoid
16088 <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>
16089 !! end
16090
16091 # This test also demonstrates because of newline+category tunneling
16092 # through the list hander, template wrapping doesn't expand to the
16093 # containing list when the list item swallows the category.
16094 !! test
16095 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16096 !! wikitext
16097 * {{echo|a
16098 [[Category:Foo]]}}
16099 !! html/parsoid
16100 <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
16101 </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>
16102 !! end
16103
16104 !! test
16105 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16106 !! wikitext
16107 * a
16108
16109 {{echo|[[Category:Foo]]
16110 [[Category:Bar]]}}
16111 [[Category:Baz]]
16112 !! html/parsoid
16113 <ul><li> a</li></ul>
16114
16115 <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">
16116 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16117 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16118 !! end
16119
16120 !! test
16121 Category links with multiple namespaces
16122 !! wikitext
16123 [[Category:Project:Foo]]
16124 !! html/parsoid
16125 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16126 !! end
16127
16128 !! test
16129 Parsoid: Serialize link to category page with colon escape
16130 !! options
16131 parsoid
16132 !! wikitext
16133
16134 [[:Category:Foo]]
16135 [[:Category:Foo|Bar]]
16136 !! html
16137 <p>
16138 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16139 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16140 </p>
16141 !! end
16142
16143 # We used to, but no longer wt2wt this test since the default serializer
16144 # will normalize all categories to serialize on their own line.
16145 # This wikitext usage is going to be fairly uncommon in production and
16146 # selser will take care of preventing whitespace insertion if this
16147 # occurs in an article.
16148 #
16149 # html2html disabled for the same reason (whitespace insertion between
16150 # x and y).
16151 #
16152 # html2wt disabled because it localizes the "Category" namespace.
16153 !! test
16154 Link prefix/suffixes aren't applied to category links
16155 !! options
16156 parsoid=wt2html
16157 language=is
16158 !! wikitext
16159 x[[Category:Foo]]y
16160 !! html/php
16161 <p>xy
16162 </p>
16163 !! html/parsoid
16164 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16165 !! end
16166
16167 !! test
16168 Parsoid: Serialize link to file page with colon escape
16169 !! options
16170 parsoid
16171 !! wikitext
16172
16173 [[:File:Foo.png]]
16174 [[:File:Foo.png|Bar]]
16175 !! html
16176 <p>
16177 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16178 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16179 </p>
16180 !! end
16181
16182 !! test
16183 Parsoid: Serialize a genuine category link without colon escape
16184 !! options
16185 parsoid
16186 !! wikitext
16187 [[Category:Foo]]
16188 [[Category:Foo|Bar]]
16189 !! html
16190 <link rel="mw:PageProp/Category" href="./Category:Foo">
16191 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16192 !! end
16193
16194 !! test
16195 Normalize hrefs properly before testing for invalid link targets (T72894)
16196 !! options
16197 parsoid=html2wt
16198 !! html/parsoid
16199 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16200 !! wikitext
16201 [[Category:Toxine bactérienne]]
16202 !! end
16203
16204 !! test
16205 Parsoid: Defaultsort
16206 !! wikitext
16207 {{DEFAULTSORT:Foo}}
16208 !! html/parsoid
16209 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16210 !! end
16211
16212 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16213 # But, this is a limitation of our representation and is documented in
16214 # TemplateHandler.js in processSpecialMagicWord
16215 !! test
16216 Parsoid: Defaultsort (template-generated)
16217 !! wikitext
16218 {{{{echo|DEFAULTSORT}}:Foo}}
16219 !! html/parsoid
16220 <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"}]]}'/>
16221 !! end
16222
16223 ###
16224 ### Inter-language links
16225 ###
16226 !! test
16227 Interlanguage links
16228 !! options
16229 ill
16230 !! wikitext
16231 [[es:Alimento]]
16232 [[fr:Nourriture]]
16233 [[zh:食品]]
16234 !! html/php
16235 es:Alimento fr:Nourriture zh:食品
16236 !! html/parsoid
16237 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16238 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16239 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16240 !! end
16241
16242 !! test
16243 Duplicate interlanguage links (T26502)
16244 !! options
16245 ill
16246 !! wikitext
16247 [[es:1]]
16248 [[es:2]]
16249 [[fr:1]]
16250 [[fr:2]]
16251 !! html/php
16252 es:1 fr:1
16253 !! html/parsoid
16254 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16255 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16256 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16257 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16258 !! end
16259
16260 ###
16261 ### Sections
16262 ###
16263 !! test
16264 Basic section headings
16265 !! wikitext
16266 == Headline 1 ==
16267 Some text
16268
16269 ==Headline 2==
16270 More
16271 ===Smaller headline===
16272 Blah blah
16273 !! html
16274 <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>
16275 <p>Some text
16276 </p>
16277 <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>
16278 <p>More
16279 </p>
16280 <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>
16281 <p>Blah blah
16282 </p>
16283 !! end
16284
16285 !! test
16286 Section headings with TOC
16287 !! wikitext
16288 == Headline 1 ==
16289 === Subheadline 1 ===
16290 ===== Skipping a level =====
16291 ====== Skipping a level ======
16292
16293 == Headline 2 ==
16294 Some text
16295 ===Another headline===
16296 !! html
16297 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16298 <ul>
16299 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16300 <ul>
16301 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16302 <ul>
16303 <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>
16304 <ul>
16305 <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>
16306 </ul>
16307 </li>
16308 </ul>
16309 </li>
16310 </ul>
16311 </li>
16312 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16313 <ul>
16314 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16315 </ul>
16316 </li>
16317 </ul>
16318 </div>
16319
16320 <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>
16321 <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>
16322 <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>
16323 <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>
16324 <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>
16325 <p>Some text
16326 </p>
16327 <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>
16328
16329 !! end
16330
16331 !! test
16332 TOC anchors don't collide
16333 !! wikitext
16334 __FORCETOC__
16335 == Headline 2 ==
16336 == Headline ==
16337 == Headline 2 ==
16338 == Headline ==
16339 !! html/php
16340 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16341 <ul>
16342 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16343 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16344 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16345 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16346 </ul>
16347 </div>
16348
16349 <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>
16350 <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>
16351 <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>
16352 <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>
16353
16354 !! end
16355
16356 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16357 !! test
16358 Handling of sections up to level 6 and beyond
16359 !! wikitext
16360 = Level 1 Heading=
16361 == Level 2 Heading==
16362 === Level 3 Heading===
16363 ==== Level 4 Heading====
16364 ===== Level 5 Heading=====
16365 ====== Level 6 Heading======
16366 ======= Level 7 Heading=======
16367 ======== Level 8 Heading========
16368 ========= Level 9 Heading=========
16369 ========== Level 10 Heading==========
16370 !! html
16371 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16372 <ul>
16373 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16374 <ul>
16375 <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>
16376 <ul>
16377 <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>
16378 <ul>
16379 <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>
16380 <ul>
16381 <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>
16382 <ul>
16383 <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>
16384 <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>
16385 <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>
16386 <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>
16387 <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>
16388 </ul>
16389 </li>
16390 </ul>
16391 </li>
16392 </ul>
16393 </li>
16394 </ul>
16395 </li>
16396 </ul>
16397 </li>
16398 </ul>
16399 </div>
16400
16401 <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>
16402 <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>
16403 <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>
16404 <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>
16405 <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>
16406 <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>
16407 <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>
16408 <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>
16409 <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>
16410 <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>
16411
16412 !! end
16413
16414 !! test
16415 TOC regression (T11764)
16416 !! wikitext
16417 == title 1 ==
16418 === title 1.1 ===
16419 ==== title 1.1.1 ====
16420 === title 1.2 ===
16421 == title 2 ==
16422 === title 2.1 ===
16423 !! html
16424 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16425 <ul>
16426 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16427 <ul>
16428 <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>
16429 <ul>
16430 <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>
16431 </ul>
16432 </li>
16433 <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>
16434 </ul>
16435 </li>
16436 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16437 <ul>
16438 <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>
16439 </ul>
16440 </li>
16441 </ul>
16442 </div>
16443
16444 <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>
16445 <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>
16446 <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>
16447 <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>
16448 <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>
16449 <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>
16450
16451 !! end
16452
16453 !! test
16454 TOC for heading containing <span id="..."></span> (T96153)
16455 !! wikitext
16456 __FORCETOC__
16457 ==<span id="old-anchor"></span>New title==
16458 !! html/php
16459 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16460 <ul>
16461 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16462 </ul>
16463 </div>
16464
16465 <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>
16466
16467 !! end
16468
16469 !! test
16470 TOC with wgMaxTocLevel=3 (T8204)
16471 !! options
16472 wgMaxTocLevel=3
16473 !! wikitext
16474 == title 1 ==
16475 === title 1.1 ===
16476 ==== title 1.1.1 ====
16477 === title 1.2 ===
16478 == title 2 ==
16479 === title 2.1 ===
16480 !! html
16481 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16482 <ul>
16483 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16484 <ul>
16485 <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>
16486 <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>
16487 </ul>
16488 </li>
16489 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16490 <ul>
16491 <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>
16492 </ul>
16493 </li>
16494 </ul>
16495 </div>
16496
16497 <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>
16498 <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>
16499 <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>
16500 <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>
16501 <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>
16502 <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>
16503
16504 !! end
16505
16506 !! test
16507 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16508 !! options
16509 wgMaxTocLevel=3
16510 !! wikitext
16511 ==Section 1==
16512 ===Section 1.1===
16513 ====Section 1.1.1====
16514 ====Section 1.1.1.1====
16515 ==Section 2==
16516 !! html
16517 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16518 <ul>
16519 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16520 <ul>
16521 <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>
16522 </ul>
16523 </li>
16524 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16525 </ul>
16526 </div>
16527
16528 <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>
16529 <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>
16530 <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>
16531 <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>
16532 <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>
16533
16534 !! end
16535
16536
16537 !! test
16538 Resolving duplicate section names
16539 !! wikitext
16540 == Foo bar ==
16541 == Foo bar ==
16542 !! html
16543 <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>
16544 <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>
16545
16546 !! end
16547
16548 !! test
16549 Resolving duplicate section names with differing case (T12721)
16550 !! wikitext
16551 == Foo bar ==
16552 == Foo Bar ==
16553 !! html
16554 <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>
16555 <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>
16556
16557 !! end
16558
16559 !! article
16560 Template:sections
16561 !! text
16562 ===Section 1===
16563 ==Section 2==
16564 !! endarticle
16565
16566 !! test
16567 Template with sections, __NOTOC__
16568 !! wikitext
16569 __NOTOC__
16570 ==Section 0==
16571 {{sections}}
16572 ==Section 4==
16573 !! html
16574 <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>
16575 <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>
16576 <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>
16577 <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>
16578
16579 !! end
16580
16581 !! test
16582 __NOEDITSECTION__ keyword
16583 !! wikitext
16584 __NOEDITSECTION__
16585 ==Section 1==
16586 ==Section 2==
16587 !! html
16588 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16589 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16590
16591 !! end
16592
16593 !! test
16594 Link inside a section heading
16595 !! wikitext
16596 ==Section with a [[Main Page|link]] in it==
16597 !! html
16598 <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>
16599
16600 !! end
16601
16602 !! test
16603 TOC regression (T14077)
16604 !! wikitext
16605 __TOC__
16606 == title 1 ==
16607 === title 1.1 ===
16608 == title 2 ==
16609 !! html
16610 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16611 <ul>
16612 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16613 <ul>
16614 <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>
16615 </ul>
16616 </li>
16617 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16618 </ul>
16619 </div>
16620
16621 <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>
16622 <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>
16623 <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>
16624
16625 !! end
16626
16627 !! test
16628 T3219 URL next to image (good)
16629 !! wikitext
16630 http://example.com [[File:Foobar.jpg]]
16631 !! html/php
16632 <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>
16633 </p>
16634 !! html/parsoid
16635 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <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>
16636 !!end
16637
16638 !! test
16639 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16640 !! wikitext
16641 ===
16642 The line above must have a trailing space!
16643 === <!--
16644 --> <!-- -->
16645 But just in case it doesn't...
16646 !! html
16647 <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>
16648 <p>The line above must have a trailing space!
16649 </p>
16650 <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>
16651 <p>But just in case it doesn't...
16652 </p>
16653 !! end
16654
16655 !! test
16656 Header with special characters (T27462)
16657 !! wikitext
16658 The tooltips shall not show entities to the user (ie. be double escaped)
16659
16660 == text > text ==
16661 section 1
16662
16663 == text < text ==
16664 section 2
16665
16666 == text & text ==
16667 section 3
16668
16669 == text ' text ==
16670 section 4
16671
16672 == text " text ==
16673 section 5
16674 !! html
16675 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16676 </p>
16677 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16678 <ul>
16679 <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>
16680 <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>
16681 <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>
16682 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16683 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16684 </ul>
16685 </div>
16686
16687 <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>
16688 <p>section 1
16689 </p>
16690 <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>
16691 <p>section 2
16692 </p>
16693 <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>
16694 <p>section 3
16695 </p>
16696 <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 ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16697 <p>section 4
16698 </p>
16699 <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>
16700 <p>section 5
16701 </p>
16702 !! end
16703
16704 !! test
16705 Header with space, plus and underscore as entity
16706 !! wikitext
16707 Id should not contain + for spaces
16708
16709 == Space between Text ==
16710 section 1
16711
16712 == Space-Entity&#32;between&#32;Text ==
16713 section 2
16714
16715 == Plus+between+Text ==
16716 section 3
16717
16718 == Plus-Entity&#43;between&#43;Text ==
16719 section 4
16720
16721 == Underscore_between_Text ==
16722 section 5
16723
16724 == Underscore-Entity&#95;between&#95;Text ==
16725 section 6
16726
16727 [[#Space between Text]]
16728 [[#Space-Entity&#32;between&#32;Text]]
16729 [[#Plus+between+Text]]
16730 [[#Plus-Entity&#43;between&#43;Text]]
16731 [[#Underscore_between_Text]]
16732 [[#Underscore-Entity&#95;between&#95;Text]]
16733 !! html
16734 <p>Id should not contain + for spaces
16735 </p>
16736 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16737 <ul>
16738 <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>
16739 <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>
16740 <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>
16741 <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>
16742 <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>
16743 <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>
16744 </ul>
16745 </div>
16746
16747 <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>
16748 <p>section 1
16749 </p>
16750 <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>
16751 <p>section 2
16752 </p>
16753 <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>
16754 <p>section 3
16755 </p>
16756 <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>
16757 <p>section 4
16758 </p>
16759 <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>
16760 <p>section 5
16761 </p>
16762 <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>
16763 <p>section 6
16764 </p><p><a href="#Space_between_Text">#Space between Text</a>
16765 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16766 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16767 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16768 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16769 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16770 </p>
16771 !! end
16772
16773 !! test
16774 Headers with excess '=' characters
16775 (Are similar tests necessary beyond the 1st level?)
16776 !! wikitext
16777 =foo==
16778 ==foo=
16779 =''italic'' heading==
16780 ==''italic'' heading=
16781 !! html
16782 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16783 <ul>
16784 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16785 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16786 <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>
16787 <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>
16788 </ul>
16789 </div>
16790
16791 <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>
16792 <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>
16793 <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>
16794 <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>
16795
16796 !! end
16797
16798 !! test
16799 HTML headers vs TOC (T25393)
16800 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16801 !! wikitext
16802 <h1>Header 1</h1>
16803 == Header 1.1 ==
16804 == Header 1.2 ==
16805
16806 <h1>Header 2
16807 </h1>
16808 == Header 2.1 ==
16809 == Header 2.2 ==
16810 __NOEDITSECTION__
16811 !! html
16812 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16813 <ul>
16814 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16815 <ul>
16816 <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>
16817 <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>
16818 </ul>
16819 </li>
16820 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16821 <ul>
16822 <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>
16823 <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>
16824 </ul>
16825 </li>
16826 </ul>
16827 </div>
16828
16829 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16830 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16831 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16832 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16833 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16834 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16835
16836 !! end
16837
16838 !! test
16839 Single-line or multiline-comments can follow headings
16840 !! options
16841 parsoid=wt2html,wt2wt
16842 !! wikitext
16843 ==foo==<!---->
16844 ==bar==<!--c1-->
16845 ==baz==<!--
16846 c2
16847 c3-->
16848 !! html
16849 <h2><span class="mw-headline" id="foo">foo</span></h2>
16850 <h2><span class="mw-headline" id="bar">bar</span></h2>
16851 <h2><span class="mw-headline" id="baz">baz</span></h2>
16852
16853 !! end
16854
16855 !! test
16856 T3219 URL next to image (broken)
16857 !! wikitext
16858 http://example.com[[File:Foobar.jpg]]
16859 !! html/php
16860 <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>
16861 </p>
16862 !! html/parsoid
16863 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><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>
16864 !!end
16865
16866 !! test
16867 T3186 news: in the middle of text
16868 !! wikitext
16869 http://en.wikinews.org/wiki/Wikinews:Workplace
16870 !! html
16871 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16872 </p>
16873 !!end
16874
16875
16876 !! test
16877 Namespaced link must have a title
16878 !! wikitext
16879 [[Project:]]
16880 !! html
16881 <p>[[Project:]]
16882 </p>
16883 !!end
16884
16885 !! test
16886 Namespaced link must have a title (bad fragment version)
16887 !! wikitext
16888 [[Project:#fragment]]
16889 !! html
16890 <p>[[Project:#fragment]]
16891 </p>
16892 !!end
16893
16894
16895 ###
16896 ### HTML tags and HTML attributes
16897 ###
16898
16899 !! test
16900 div with no attributes
16901 !! wikitext
16902 <div>HTML rocks</div>
16903 !! html
16904 <div>HTML rocks</div>
16905
16906 !! end
16907
16908 !! test
16909 div with double-quoted attribute
16910 !! wikitext
16911 <div id="rock">HTML rocks</div>
16912 !! html
16913 <div id="rock">HTML rocks</div>
16914
16915 !! end
16916
16917 !! test
16918 div with single-quoted attribute
16919 !! wikitext
16920 <div id='rock'>HTML rocks</div>
16921 !! html
16922 <div id="rock">HTML rocks</div>
16923
16924 !! end
16925
16926 !! test
16927 div with unquoted attribute
16928 !! wikitext
16929 <div id=rock>HTML rocks</div>
16930 !! html
16931 <div id="rock">HTML rocks</div>
16932
16933 !! end
16934
16935 !! test
16936 div with illegal double attributes
16937 !! wikitext
16938 <div id="a" id="b">HTML rocks</div>
16939 !! html
16940 <div id="b">HTML rocks</div>
16941
16942 !!end
16943
16944 !! test
16945 div with empty attribute value, space before equals
16946 !! options
16947 parsoid=wt2html,html2html
16948 !! wikitext
16949 <div class =>HTML rocks</div>
16950 !! html/php
16951 <div class="">HTML rocks</div>
16952
16953 !! html/parsoid
16954 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16955 !! end
16956
16957 !! test
16958 div with multiple empty attribute values
16959 !! options
16960 parsoid=wt2html,html2html
16961 !! wikitext
16962 <div id= title=>HTML rocks</div>
16963 !! html/php
16964 <div id="title.3D">HTML rocks</div>
16965
16966 !! html/parsoid
16967 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16968 !! end
16969
16970 !! test
16971 table with multiple empty attribute values
16972 !! options
16973 parsoid=wt2html,html2html
16974 !! wikitext
16975 {| title= id=
16976 | hi
16977 |}
16978 !! html/php
16979 <table title="id=">
16980 <tr>
16981 <td> hi
16982 </td></tr></table>
16983
16984 !! html/parsoid
16985 <table title="id=">
16986 <tbody><tr><td> hi</td></tr>
16987 </tbody></table>
16988 !! end
16989
16990 !! test
16991 div with braces in attribute value
16992 !! wikitext
16993 <div title="{}">Foo</div>
16994 !! html/php
16995 <div title="&#123;&#125;">Foo</div>
16996
16997 !! html/parsoid
16998 <div title="{}">Foo</div>
16999 !! end
17000
17001 !! test
17002 div with empty attribute value, no space before equals
17003 !! options
17004 parsoid=wt2html,html2html
17005 !! wikitext
17006 <div class=>HTML rocks</div>
17007 !! html/php
17008 <div class="">HTML rocks</div>
17009
17010 !! html/parsoid
17011 <div class="">HTML rocks</div>
17012 !! end
17013
17014 !! test
17015 HTML multiple attributes correction
17016 !! wikitext
17017 <p class="error" class="awesome">Awesome!</p>
17018 !! html
17019 <p class="awesome">Awesome!</p>
17020
17021 !!end
17022
17023 !! test
17024 Table multiple attributes correction
17025 !! wikitext
17026 {|
17027 !+ class="error" class="awesome"| status
17028 |}
17029 !! html
17030 <table>
17031 <tr>
17032 <th class="awesome"> status
17033 </th></tr></table>
17034
17035 !!end
17036
17037 !! test
17038 DIV IN UPPERCASE
17039 !! wikitext
17040 <DIV ID="x">HTML ROCKS</DIV>
17041 !! html
17042 <div id="x">HTML ROCKS</div>
17043
17044 !!end
17045
17046 !! test
17047 Non-ASCII pseudo-tags are rendered as text
17048 !! wikitext
17049 <khyô>
17050 !! html
17051 <p>&lt;khyô&gt;
17052 </p>
17053 !! end
17054
17055 !! test
17056 Pseudo-tag with URL 'name' renders as url link
17057 !! wikitext
17058 <http://example.com/>
17059 !! html
17060 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17061 </p>
17062 !! end
17063
17064 !! test
17065 text with amp in the middle of nowhere
17066 !! wikitext
17067 Remember AT&T?
17068 !! html
17069 <p>Remember AT&amp;T?
17070 </p>
17071 !! end
17072
17073 !! test
17074 text with character entity: eacute
17075 !! wikitext
17076 I always thought &eacute; was a cute letter.
17077 !! html
17078 <p>I always thought &#233; was a cute letter.
17079 </p>
17080 !! html+tidy
17081 <p>I always thought é was a cute letter.</p>
17082 !! end
17083
17084 !! test
17085 text with entity-escaped character entity-like string: eacute
17086 !! wikitext
17087 I always thought &amp;eacute; was a cute letter.
17088 !! html
17089 <p>I always thought &amp;eacute; was a cute letter.
17090 </p>
17091 !! end
17092
17093 !! test
17094 text with undefined character entity: xacute
17095 !! wikitext
17096 I always thought &xacute; was a cute letter.
17097 !! html
17098 <p>I always thought &amp;xacute; was a cute letter.
17099 </p>
17100 !! end
17101
17102 !! test
17103 HTML5 tags
17104 !! wikitext
17105 <data value="5">five</data>
17106 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17107 <mark>This highlighted text</mark>
17108 !! html
17109 <p><data value="5">five</data>
17110 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17111 <mark>This highlighted text</mark>
17112 </p>
17113 !! end
17114
17115 !! test
17116 HTML tag with leading space is parsed as text
17117 !! wikitext
17118 < div>foo< /div>
17119 !! html
17120 <p>&lt; div&gt;foo&lt; /div&gt;
17121 </p>
17122 !! end
17123
17124 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17125 ## the HTML5 parsing spec.
17126 !! test
17127 Element with broken attribute syntax
17128 !! options
17129 parsoid=wt2html
17130 !! wikitext
17131 <div style=" style="123">hi</div>
17132 <div =>ho</div>
17133 !! html/php
17134 <div style="123">hi</div>
17135 <div>ho</div>
17136
17137 !! html/parsoid
17138 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17139 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17140 !! end
17141
17142 ###
17143 ### Nesting tests (see T43545, T52604, T53081)
17144 ###
17145
17146 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17147 # Note that html2wt is considerably more difficult if we use <b> in
17148 # the test case, instead of <small>
17149 !! test
17150 Ensure that HTML adoption agency algorithm is properly implemented.
17151 !! wikitext
17152 <small>X<small>Y</small>Z</small>
17153 !! html
17154 <p><small>X<small>Y</small>Z</small>
17155 </p>
17156 !! end
17157
17158 # This was T43545 in the PHP parser.
17159 # Note that tidy doesn't handle this correctly.
17160 !! test
17161 Nesting of <kbd>
17162 !! wikitext
17163 <kbd>X<kbd>Y</kbd>Z</kbd>
17164 !! html
17165 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17166 </p>
17167 !! end
17168
17169 # The following cases were T53081 in the PHP parser.
17170 # Note that there are some other nestable tags (b, i, etc) which are
17171 # not covered; see T53081 for discussion.
17172
17173 # Note that tidy doesn't handle this correctly.
17174 !! test
17175 Nesting of <em>
17176 !! wikitext
17177 <em>X<em>Y</em>Z</em>
17178 !! html
17179 <p><em>X<em>Y</em>Z</em>
17180 </p>
17181 !! end
17182
17183 # Note that tidy doesn't handle this correctly.
17184 !! test
17185 Nesting of <strong>
17186 !! wikitext
17187 <strong>X<strong>Y</strong>Z</strong>
17188 !! html
17189 <p><strong>X<strong>Y</strong>Z</strong>
17190 </p>
17191 !! end
17192
17193 !! test
17194 Nesting of <q>
17195 !! wikitext
17196 <q>X<q>Y</q>Z</q>
17197 !! html+tidy
17198 <p><q>X<q>Y</q>Z</q></p>
17199 !! end
17200
17201 # Note that tidy doesn't handle this correctly.
17202 !! test
17203 Nesting of <ruby>
17204 !! wikitext
17205 <ruby>X<ruby>Y</ruby>Z</ruby>
17206 !! html
17207 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17208 </p>
17209 !! end
17210
17211 # Note that tidy doesn't handle this correctly.
17212 !! test
17213 Nesting of <bdo>
17214 !! wikitext
17215 <bdo>X<bdo>Y</bdo>Z</bdo>
17216 !! html
17217 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17218 </p>
17219 !! end
17220
17221
17222 ###
17223 ### Media links
17224 ###
17225
17226 !! test
17227 Media link
17228 !! wikitext
17229 [[Media:Foobar.jpg]]
17230 [[Media:Video.ogv]]
17231 [[:Media:Video.ogv]]
17232 !! html/php
17233 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17234 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17235 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17236 </p>
17237 !! html/parsoid
17238 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17239 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17240 <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>
17241 !! end
17242
17243 !! test
17244 Media link with text
17245 !! wikitext
17246 [[Media:Foobar.jpg|A neat file to look at]]
17247 !! html/php
17248 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17249 </p>
17250 !! html/parsoid
17251 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17252 !! end
17253
17254 # FIXME: this is still bad HTML tag nesting
17255 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17256 !! test
17257 Media link with nasty text
17258 !! wikitext
17259 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17260 !! html/php
17261 <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>
17262
17263 !! html+php/tidy
17264 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17265 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17266 !! html/parsoid
17267 <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>
17268
17269 !! end
17270
17271 !! test
17272 Media link to nonexistent file (T3702)
17273 !! wikitext
17274 [[Media:No such.jpg]]
17275 [[Media:No_such file.jpg]]
17276 !! html/php
17277 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17278 <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>
17279 </p>
17280 !! html/parsoid
17281 <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>
17282 <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>
17283 !! end
17284
17285 !! test
17286 Image link to nonexistent file (T3850 - good)
17287 !! wikitext
17288 [[File:No_such.jpg]]
17289 !! html/php
17290 <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>
17291 </p>
17292 !! html/parsoid
17293 <p><span 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></span></p>
17294 !! end
17295
17296 !! test
17297 :Image link to nonexistent file (T3850 - bad)
17298 !! wikitext
17299 [[:Image:No such.jpg]]
17300 !! html/php
17301 <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>
17302 </p>
17303 !! html/parsoid
17304 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17305 !! end
17306
17307 !! test
17308 Character reference normalization in link text (T3938)
17309 !! wikitext
17310 [[Main Page|this&that]]
17311 !! html
17312 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17313 </p>
17314 !!end
17315
17316 !! article
17317 אַ
17318 !! text
17319 Test for unicode normalization
17320
17321 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17322 !! endarticle
17323
17324 !! test
17325 (T21451) Links should refer to the normalized form.
17326 !! wikitext
17327 [[&#xFB2E;]]
17328 [[&#x5d0;&#x5b7;]]
17329 [[&#x5d0;ַ]]
17330 [[א&#x5b7;]]
17331 [[אַ]]
17332 !! html
17333 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17334 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17335 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17336 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17337 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17338 </p>
17339 !! end
17340
17341 !! test
17342 Empty attribute crash test (T4067)
17343 !! wikitext
17344 <font color="">foo</font>
17345 !! html
17346 <p><font color="">foo</font>
17347 </p>
17348 !! end
17349
17350 !! test
17351 Empty attribute crash test single-quotes (T4067)
17352 !! wikitext
17353 <font color=''>foo</font>
17354 !! html
17355 <p><font color="">foo</font>
17356 </p>
17357 !! end
17358
17359 !! test
17360 Attribute test: equals, then nothing
17361 !! options
17362 parsoid=wt2html,html2html
17363 !! wikitext
17364 <font color=>foo</font>
17365 !! html/php
17366 <p><font color="">foo</font>
17367 </p>
17368 !! html/parsoid
17369 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17370 !! end
17371
17372 !! test
17373 Attribute test: unquoted value
17374 !! options
17375 parsoid=wt2html,html2html
17376 !! wikitext
17377 <font color=x>foo</font>
17378 !! html/php
17379 <p><font color="x">foo</font>
17380 </p>
17381 !! html/parsoid
17382 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17383 !! end
17384
17385 !! test
17386 Attribute test: unquoted but illegal value (hash)
17387 !! wikitext
17388 <font color=#x>foo</font>
17389 !! html
17390 <p><font color="#x">foo</font>
17391 </p>
17392 !! end
17393
17394 # Parsoid does not serialize to empty attribute syntax,
17395 # so wt2wt and html2wt cases are skipped
17396 !! test
17397 Attribute test: no value (T54330)
17398 !! options
17399 parsoid=wt2html,html2html
17400 !! wikitext
17401 <font color>foo</font>
17402 !! html/php
17403 <p><font color="">foo</font>
17404 </p>
17405 !! html/parsoid
17406 <p><font color="">foo</font></p>
17407 !! end
17408
17409 !! test
17410 T4095: link with three closing brackets
17411 !! wikitext
17412 [[Main Page]]]
17413 !! html/php
17414 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17415 </p>
17416 !! html/parsoid
17417 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17418 !! end
17419
17420 !! test
17421 T4095: link with pipe and three closing brackets
17422 !! wikitext
17423 [[Main Page|link]]]
17424 !! html/php
17425 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17426 </p>
17427 !! html/parsoid
17428 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17429 !! end
17430
17431 !! test
17432 T4095: link with pipe and three closing brackets, version 2
17433 !! wikitext
17434 [[Main Page|[http://example.com/]]]
17435 !! html/php
17436 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17437 </p>
17438 !! html/parsoid
17439 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17440 !! end
17441
17442
17443 ###
17444 ### Safety
17445 ###
17446
17447 !! article
17448 Template:Dangerous attribute
17449 !! text
17450 " onmouseover="alert(document.cookie)
17451 !! endarticle
17452
17453 !! article
17454 Template:Dangerous style attribute
17455 !! text
17456 border-size: expression(alert(document.cookie))
17457 !! endarticle
17458
17459 !! article
17460 Template:Div style
17461 !! text
17462 <div style="float: right; {{{1}}}">Magic div</div>
17463 !! endarticle
17464
17465 !! test
17466 T4304: HTML attribute safety (safe template; regression T4309)
17467 !! wikitext
17468 <div title="{{test}}"></div>
17469 !! html/php
17470 <div title="This is a test template"></div>
17471
17472 !! html/parsoid
17473 <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>
17474 !! end
17475
17476 # Parsoid has enough context to handle this case
17477 !! test
17478 T4304: HTML attribute safety (dangerous template; 2309)
17479 !! wikitext
17480 <div title="{{dangerous attribute}}"></div>
17481 !! html/php
17482 <div title=""></div>
17483
17484 !! html/parsoid
17485 <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>
17486 !! end
17487
17488 !! test
17489 T4304: HTML attribute safety (dangerous style template; 2309)
17490 !! wikitext
17491 <div style="{{dangerous style attribute}}"></div>
17492 !! html/php
17493 <div style="/* insecure input */"></div>
17494
17495 !! html/parsoid
17496 <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>
17497 !! end
17498
17499 !! test
17500 T4304: HTML attribute safety (safe parameter; 2309)
17501 !! wikitext
17502 {{div style|width: 200px}}
17503 !! html/php
17504 <div style="float: right; width: 200px">Magic div</div>
17505
17506 !! html/parsoid
17507 <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>
17508 !! end
17509
17510 !! test
17511 T4304: HTML attribute safety (unsafe parameter; 2309)
17512 !! wikitext
17513 {{div style|width: expression(alert(document.cookie))}}
17514 !! html/php
17515 <div style="/* insecure input */">Magic div</div>
17516
17517 !! html/parsoid
17518 <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>
17519 !! end
17520
17521 ## Parsoid output here differs; needs investigation.
17522 !! test
17523 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17524 !! wikitext
17525 {{div style|"><script>alert(document.cookie)</script>}}
17526 !! html
17527 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17528
17529 !! end
17530
17531 ## Parsoid output here differs; needs investigation.
17532 !! test
17533 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17534 !! wikitext
17535 {{div style|" ><script>alert(document.cookie)</script>}}
17536 !! html
17537 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17538
17539 !! end
17540
17541 !! test
17542 T4304: HTML attribute safety (link)
17543 !! wikitext
17544 <div title="[[Main Page]]"></div>
17545 !! html
17546 <div title="&#91;&#91;Main Page]]"></div>
17547
17548 !! end
17549
17550 !! test
17551 T4304: HTML attribute safety (italics)
17552 !! wikitext
17553 <div title="''foobar''"></div>
17554 !! html
17555 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17556
17557 !! end
17558
17559 !! test
17560 T4304: HTML attribute safety (bold)
17561 !! wikitext
17562 <div title="'''foobar'''"></div>
17563 !! html
17564 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17565
17566 !! end
17567
17568 !! test
17569 T4304: HTML attribute safety (ISBN)
17570 !! wikitext
17571 <div title="ISBN 1234567890"></div>
17572 !! html
17573 <div title="&#73;SBN 1234567890"></div>
17574
17575 !! end
17576
17577 !! test
17578 T4304: HTML attribute safety (RFC)
17579 !! wikitext
17580 <div title="RFC 1234"></div>
17581 !! html
17582 <div title="&#82;FC 1234"></div>
17583
17584 !! end
17585
17586 !! test
17587 T4304: HTML attribute safety (PMID)
17588 !! wikitext
17589 <div title="PMID 1234567890"></div>
17590 !! html
17591 <div title="&#80;MID 1234567890"></div>
17592
17593 !! end
17594
17595 !! test
17596 T4304: HTML attribute safety (web link)
17597 !! wikitext
17598 <div title="http://example.com/"></div>
17599 !! html
17600 <div title="http&#58;//example.com/"></div>
17601
17602 !! end
17603
17604 !! test
17605 T4304: HTML attribute safety (named web link)
17606 !! wikitext
17607 <div title="[http://example.com/ link]"></div>
17608 !! html
17609 <div title="&#91;http&#58;//example.com/ link]"></div>
17610
17611 !! end
17612
17613 !! test
17614 T5244: HTML attribute safety (extension; safe)
17615 !! wikitext
17616 <div style="<nowiki>background:blue</nowiki>"></div>
17617 !! html/php
17618 <div style="background:blue"></div>
17619
17620 !! html/parsoid
17621 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17622 !! end
17623
17624 !! test
17625 T5244: HTML attribute safety (extension; unsafe)
17626 !! wikitext
17627 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17628 !! html/php
17629 <div style="/* insecure input */"></div>
17630
17631 !! html/parsoid
17632 <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>
17633 !! end
17634
17635 # More MSIE fun discovered by Tom Gilder
17636
17637 !! test
17638 MSIE CSS safety test: spurious slash
17639 !! wikitext
17640 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17641 !! html/php
17642 <div style="/* insecure input */">evil</div>
17643
17644 !! html/parsoid
17645 <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>
17646 !! end
17647
17648 !! test
17649 MSIE CSS safety test: hex code
17650 !! wikitext
17651 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17652 !! html/php
17653 <div style="/* insecure input */">evil</div>
17654
17655 !! html/parsoid
17656 <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>
17657 !! end
17658
17659 !! test
17660 MSIE CSS safety test: comment in url
17661 !! wikitext
17662 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17663 !! html/php
17664 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17665
17666 !! html/parsoid
17667 <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>
17668 !! end
17669
17670 !! test
17671 MSIE CSS safety test: comment in expression
17672 !! wikitext
17673 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17674 !! html/php
17675 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17676
17677 !! html/parsoid
17678 <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>
17679 !! end
17680
17681 !! test
17682 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17683 !! wikitext
17684 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17685 !! html/php
17686 <p style="/* invalid control char */">A</p>
17687
17688 !! html/parsoid
17689 <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>
17690 !! end
17691
17692 !! test
17693 MSIE 6 CSS safety test: Fullwidth (T57332)
17694 !! wikitext
17695 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17696 <div style="top:EXPRESSION(alert())">B</div>
17697 !! html/php
17698 <p style="/* insecure input */">A</p>
17699 <div style="/* insecure input */">B</div>
17700
17701 !! html/parsoid
17702 <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>
17703 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17704 !! end
17705
17706 !! test
17707 MSIE 6 CSS safety test: IPA extensions (T57332)
17708 !! wikitext
17709 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17710 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17711 !! html/php
17712 <div style="/* insecure input */">A</div>
17713 <p style="/* insecure input */">B</p>
17714
17715 !! html/parsoid
17716 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17717 <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>
17718 !! end
17719
17720 !! test
17721 MSIE 6 CSS safety test: sup/sub script (T57332)
17722 !! wikitext
17723 <div style="background-image:url⁽javascript:alert())">A</div>
17724 <div style="background-image:url₍javascript:alert())">B</div>
17725 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17726 !! html/php
17727 <div style="/* insecure input */">A</div>
17728 <div style="/* insecure input */">B</div>
17729 <p style="/* insecure input */">C</p>
17730
17731 !! html/parsoid
17732 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17733 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17734 <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>
17735 !! end
17736
17737 !! test
17738 Opera -o-link CSS
17739 !! options
17740 parsoid=wt2html,html2html
17741 !! wikitext
17742 <div
17743 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;"
17744 style="-o-link:attr(title);-o-link-source:current">X</div>
17745 !! html/php
17746 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17747
17748 !! html/parsoid
17749 <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>
17750 !! end
17751
17752 !! test
17753 MSIE 6 CSS safety test: Repetition markers (T57332)
17754 !! wikitext
17755 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17756 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17757 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17758 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17759 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17760 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17761 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17762 !! html/php
17763 <p style="/* insecure input */">A</p>
17764 <p style="/* insecure input */">B</p>
17765 <p style="/* insecure input */">C</p>
17766 <p style="/* insecure input */">D</p>
17767 <p style="/* insecure input */">E</p>
17768 <p style="/* insecure input */">F</p>
17769 <p style="/* insecure input */">G</p>
17770
17771 !! html/parsoid
17772 <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>
17773 <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>
17774 <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>
17775 <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>
17776 <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>
17777 <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>
17778 <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>
17779 !! end
17780
17781 !! test
17782 Table attribute legitimate extension
17783 !! wikitext
17784 {|
17785 !+ style="<nowiki>color:blue</nowiki>"| status
17786 |}
17787 !! html
17788 <table>
17789 <tr>
17790 <th style="color:blue"> status
17791 </th></tr></table>
17792
17793 !!end
17794
17795 !! test
17796 Table attribute safety
17797 !! wikitext
17798 {|
17799 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17800 |}
17801 !! html
17802 <table>
17803 <tr>
17804 <th style="/* insecure input */"> status
17805 </th></tr></table>
17806
17807 !! end
17808
17809 !! test
17810 CSS line continuation 1
17811 !! wikitext
17812 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17813 !! html
17814 <div style="/* insecure input */"></div>
17815
17816 !! end
17817
17818 !! test
17819 CSS line continuation 2
17820 !! wikitext
17821 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17822 !! html
17823 <div style="/* invalid control char */"></div>
17824
17825 !! end
17826
17827 !! article
17828 Template:Identity
17829 !! text
17830 {{{1}}}
17831 !! endarticle
17832
17833 !! test
17834 Expansion of multi-line templates in attribute values (T8255)
17835 !! wikitext
17836 <div style="background: {{identity|#00FF00}}">-</div>
17837 !! html
17838 <div style="background: #00FF00">-</div>
17839
17840 !! end
17841
17842 !! test
17843 Expansion of multi-line templates in attribute values (T8255 sanity check)
17844 !! wikitext
17845 <div style="background:
17846 #00FF00">-</div>
17847 !! html/php
17848 <div style="background: #00FF00">-</div>
17849
17850 !! html/parsoid
17851 <div style="background:
17852 #00FF00">-</div>
17853 !! end
17854
17855 !! test
17856 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17857 !! wikitext
17858 <div style="background: &#10;#00FF00">-</div>
17859 !! html
17860 <div style="background: &#10;#00FF00">-</div>
17861
17862 !! end
17863
17864 !! test
17865 Tags which are hidden from Tidy cannot pass through the Sanitizer
17866 !! wikitext
17867 <mw:toc><script>alert();</script></mw:toc>
17868 !! html+tidy
17869 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17870 !! end
17871
17872 ###
17873 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17874 ###
17875
17876 !! test
17877 Parser hook: empty input
17878 !! wikitext
17879 <tag></tag>
17880 !! html/php
17881 <pre>
17882 ''
17883 array (
17884 )
17885 </pre>
17886
17887 !! html/parsoid
17888 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17889 !! end
17890
17891 ## Don't expect parsoid to rt this form.
17892 !! test
17893 Parser hook: empty input using terminated empty elements
17894 !! options
17895 parsoid=wt2html,html2html
17896 !! wikitext
17897 <tag/>
17898 !! html/php
17899 <pre>
17900 NULL
17901 array (
17902 )
17903 </pre>
17904
17905 !! html/parsoid
17906 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17907 !! end
17908
17909 !! test
17910 Parser hook: empty input using terminated empty elements (space before)
17911 !! wikitext
17912 <tag />
17913 !! html/php
17914 <pre>
17915 NULL
17916 array (
17917 )
17918 </pre>
17919
17920 !! html/parsoid
17921 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17922 !! end
17923
17924 !! test
17925 Parser hook: basic input
17926 !! wikitext
17927 <tag>input</tag>
17928 !! html/php
17929 <pre>
17930 'input'
17931 array (
17932 )
17933 </pre>
17934
17935 !! html/parsoid
17936 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17937 !! end
17938
17939 ## Don't expect parsoid to rt this form.
17940 !! test
17941 Parser hook: case insensitive
17942 !! options
17943 parsoid=wt2html,html2html
17944 !! wikitext
17945 <TAG>input</TAG>
17946 !! html/php
17947 <pre>
17948 'input'
17949 array (
17950 )
17951 </pre>
17952
17953 !! html/parsoid
17954 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17955 !! end
17956
17957 ## Don't expect parsoid to rt this form.
17958 !! test
17959 Parser hook: case insensitive, redux
17960 !! options
17961 parsoid=wt2html,html2html
17962 !! wikitext
17963 <TaG>input</TAg>
17964 !! html/php
17965 <pre>
17966 'input'
17967 array (
17968 )
17969 </pre>
17970
17971 !! html/parsoid
17972 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17973 !! end
17974
17975 !! test
17976 Parser hook: nested tags
17977 !! wikitext
17978 <tag><tag></tag></tag>
17979 !! html/php
17980 <pre>
17981 '<tag>'
17982 array (
17983 )
17984 </pre>&lt;/tag&gt;
17985
17986 !! html/parsoid
17987 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
17988 !! end
17989
17990 !! test
17991 Parser hook: basic arguments
17992 !! wikitext
17993 <tag width="200" height="100" depth="50" square=""></tag>
17994 !! html/php
17995 <pre>
17996 ''
17997 array (
17998 'width' => '200',
17999 'height' => '100',
18000 'depth' => '50',
18001 'square' => '',
18002 )
18003 </pre>
18004
18005 !! html/parsoid
18006 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18007 !! end
18008
18009 ## Don't expect parsoid to rt this form.
18010 !! test
18011 Parser hook: basic arguments, variations
18012 !! options
18013 parsoid=wt2html,html2html
18014 !! wikitext
18015 <tag width=200 height = "100" depth = '50' square></tag>
18016 !! html/php
18017 <pre>
18018 ''
18019 array (
18020 'width' => '200',
18021 'height' => '100',
18022 'depth' => '50',
18023 'square' => '',
18024 )
18025 </pre>
18026
18027 !! html/parsoid
18028 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18029 !! end
18030
18031 !! test
18032 Parser hook: argument containing a forward slash (T7344)
18033 !! wikitext
18034 <tag filename="/tmp/bla"></tag>
18035 !! html/php
18036 <pre>
18037 ''
18038 array (
18039 'filename' => '/tmp/bla',
18040 )
18041 </pre>
18042
18043 !! html/parsoid
18044 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18045 !! end
18046
18047 ## Don't expect parsoid to rt this form.
18048 !! test
18049 Parser hook: empty input using terminated empty elements (T4374)
18050 !! options
18051 parsoid=wt2html,html2html
18052 !! wikitext
18053 <tag foo=bar/>text
18054 !! html/php
18055 <pre>
18056 NULL
18057 array (
18058 'foo' => 'bar',
18059 )
18060 </pre>text
18061
18062 !! html/parsoid
18063 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18064 !! end
18065
18066 ## </tag> should be output literally since there is no matching tag that begins it
18067 ## Don't expect parsoid to rt this form.
18068 !! test
18069 Parser hook: basic arguments using terminated empty elements (T4374)
18070 !! options
18071 parsoid=wt2html
18072 !! wikitext
18073 <tag width=200 height = "100" depth = '50' square/>
18074 other stuff
18075 </tag>
18076 !! html/php
18077 <pre>
18078 NULL
18079 array (
18080 'width' => '200',
18081 'height' => '100',
18082 'depth' => '50',
18083 'square' => '',
18084 )
18085 </pre>
18086 <p>other stuff
18087 &lt;/tag&gt;
18088 </p>
18089 !! html/parsoid
18090 <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
18091 &lt;/tag></p>
18092 !! end
18093
18094 ## Don't expect parsoid to rt this form.
18095 !! test
18096 Parser hook: Don't allow unclosed extension tags
18097 !! options
18098 parsoid=wt2html
18099 !! wikitext
18100 test <tag>123
18101
18102 this is a '''test'''
18103 !! html/php
18104 <p>test &lt;tag&gt;123
18105 </p><p>this is a <b>test</b>
18106 </p>
18107 !! html/parsoid
18108 <p>test &lt;tag>123</p>
18109
18110 <p>this is a <b>test</b></p>
18111 !! end
18112
18113 ###
18114 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18115 ###
18116
18117 !! test
18118 Parser hook: static parser hook not inside a comment
18119 !! wikitext
18120 <statictag>hello, world</statictag>
18121
18122 <statictag action="flush" />
18123 !! html/php
18124 <p><br />
18125 hello, world
18126 </p>
18127 !! html/parsoid
18128 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18129 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18130 !! end
18131
18132 !! test
18133 Parser hook: static parser hook inside a comment
18134 !! wikitext
18135 <!-- <statictag>hello, world</statictag> -->
18136 <statictag action="flush" />
18137 !! html/php
18138 <p><br />
18139 </p>
18140 !! html/parsoid
18141 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18142 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
18143 !! end
18144
18145 # Nested template calls; this case was broken by Parser.php rev 1.506,
18146 # since reverted.
18147
18148 !! article
18149 Template:One-parameter
18150 !! text
18151 (My parameter is: {{{1}}})
18152 !! endarticle
18153
18154 !! article
18155 Template:Map-one-parameter
18156 !! text
18157 {{{{{1}}}|{{{2}}}}}
18158 !! endarticle
18159
18160 !! test
18161 Nested template calls
18162 !! wikitext
18163 {{Map-one-parameter|One-parameter|param}}
18164 !! html
18165 <p>(My parameter is: param)
18166 </p>
18167 !! end
18168
18169
18170 ###
18171 ### Sanitizer
18172 ###
18173
18174 # HTML+Tidy effectively strips out the empty tags completely
18175 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
18176 # which Tidy would have done for the PHP parser had there been content inside it.
18177 !! test
18178 Sanitizer: Closing of open tags
18179 !! wikitext
18180 <s></s><table></table>
18181 !! html
18182 <s></s><table></table>
18183
18184 !! html/parsoid
18185 <p><s></s></p><table></table>
18186 !! end
18187
18188 !! test
18189 Sanitizer: Closing of open but not closed tags
18190 !! wikitext
18191 <s>foo
18192 !! html
18193 <p><s>foo</s>
18194 </p>
18195 !! end
18196
18197 !! test
18198 Sanitizer: Closing of closed but not open tags
18199 !! options
18200 parsoid=wt2html
18201 !! wikitext
18202 </s>
18203 !! html/php+tidy
18204 !! html/parsoid
18205 !! end
18206
18207 !! test
18208 Sanitizer: Closing of closed but not open table tags
18209 !! options
18210 parsoid=wt2html
18211 !! wikitext
18212 Table not started</td></tr></table>
18213 !! html/php+tidy
18214 <p>Table not started</p>
18215 !! html/parsoid
18216 <p>Table not started</p>
18217 !! end
18218
18219 !! test
18220 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18221 !! wikitext
18222 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18223 !! html/php
18224 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18225 </p>
18226 !! html/parsoid
18227 <p><span id=".C3.A6:_v" data-parsoid='{"stx":"html","a":{"id":".C3.A6:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#.C3.A6:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#.C3.A6:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
18228 !! end
18229
18230 # In HTML5, the restrictions are that id must contain at least one character,
18231 # and must not contain any space characters.
18232 !! test
18233 Sanitizer: Validating the contents of the id attribute (T6515)
18234 !! options
18235 disabled
18236 !! wikitext
18237 <br id="" /><br id="a space" />
18238 !! html
18239 Something ...
18240 !! end
18241
18242 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18243 !! test
18244 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18245 !! options
18246 disabled
18247 !! wikitext
18248 <br id="foo" /><br id="foo" />
18249 !! html
18250 Something need to be done. foo-2 ?
18251 !! end
18252
18253 !! test
18254 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18255 !! wikitext
18256 <div itemscope>
18257 <meta itemprop="hello" content="world">
18258 <meta http-equiv="refresh" content="5">
18259 <meta itemprop="hello" http-equiv="refresh" content="5">
18260 <link itemprop="hello" href="{{SERVER}}">
18261 <link rel="stylesheet" href="{{SERVER}}">
18262 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18263 </div>
18264 !! html
18265 <div itemscope="">
18266 <p> <meta itemprop="hello" content="world" />
18267 &lt;meta http-equiv="refresh" content="5"&gt;
18268 <meta itemprop="hello" content="5" />
18269 <link itemprop="hello" href="http&#58;//example.org" />
18270 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18271 <link itemprop="hello" href="http&#58;//example.org" />
18272 </p>
18273 </div>
18274
18275 !! end
18276
18277 !! test
18278 Sanitizer: Strip comments from CSS attributes
18279 !! options
18280 parsoid=wt2html,wt2wt
18281 !! wikitext
18282 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18283 !! html/php
18284 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18285 </p>
18286 !! html/parsoid
18287 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18288 !! end
18289
18290 !! test
18291 Language converter: output gets cut off unexpectedly (T7757)
18292 !! options
18293 language=zh
18294 !! wikitext
18295 this bit is safe: }-
18296
18297 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18298
18299 then we get cut off here: }-
18300
18301 all additional text is vanished
18302 !! html/php
18303 <p>this bit is safe: }-
18304 </p><p>but if we add a conversion instance: xxx
18305 </p><p>then we get cut off here: }-
18306 </p><p>all additional text is vanished
18307 </p>
18308 !! html/parsoid
18309 <p>this bit is safe: }-</p>
18310 <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>
18311 <p>then we get cut off here: }-</p>
18312 <p>all additional text is vanished</p>
18313 !! end
18314
18315 !! test
18316 Self closed html pairs (T7487)
18317 !! wikitext
18318 <center><font id="bug" />Centered text</center>
18319 <div><font id="bug2" />In div text</div>
18320 !! html+tidy
18321 <center><font id="bug"></font>Centered text</center>
18322 <div><font id="bug2"></font>In div text</div>
18323 !! end
18324
18325 #
18326 #
18327 #
18328
18329 !! test
18330 Punctuation: nbsp before exclamation
18331 !! wikitext
18332 C'est grave !
18333 !! html
18334 <p>C'est grave&#160;!
18335 </p>
18336 !! end
18337
18338 !! test
18339 Punctuation: CSS !important (T13874)
18340 !! wikitext
18341 <div style="width:50% !important">important</div>
18342 !! html
18343 <div style="width:50% !important">important</div>
18344
18345 !!end
18346
18347 !! test
18348 Punctuation: CSS ! important (T13874; with space after)
18349 !! wikitext
18350 <div style="width:50% ! important">important</div>
18351 !! html
18352 <div style="width:50% ! important">important</div>
18353
18354 !!end
18355
18356 !! test
18357 HTML bullet list, closed tags (T7497)
18358 !! wikitext
18359 <ul>
18360 <li>One</li>
18361 <li>Two</li>
18362 </ul>
18363 !! html/php
18364 <ul>
18365 <li>One</li>
18366 <li>Two</li>
18367 </ul>
18368
18369 !! html/parsoid
18370 <ul data-parsoid='{"stx":"html"}'>
18371 <li data-parsoid='{"stx":"html"}'>One</li>
18372 <li data-parsoid='{"stx":"html"}'>Two</li>
18373 </ul>
18374
18375 !! end
18376
18377 !! test
18378 HTML bullet list, unclosed tags (T7497)
18379 !! wikitext
18380 <ul>
18381 <li>One
18382 <li>Two
18383 </ul>
18384 !! html/php+tidy
18385 <ul>
18386 <li>One</li>
18387 <li>Two</li>
18388 </ul>
18389 !! html/parsoid
18390 <ul data-parsoid='{"stx":"html"}'>
18391 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18392 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18393 </ul>
18394
18395 !! end
18396
18397 !! test
18398 HTML ordered list, closed tags (T7497)
18399 !! wikitext
18400 <ol>
18401 <li>One</li>
18402 <li>Two</li>
18403 </ol>
18404 !! html/php
18405 <ol>
18406 <li>One</li>
18407 <li>Two</li>
18408 </ol>
18409
18410 !! html/parsoid
18411 <ol data-parsoid='{"stx":"html"}'>
18412 <li data-parsoid='{"stx":"html"}'>One</li>
18413 <li data-parsoid='{"stx":"html"}'>Two</li>
18414 </ol>
18415
18416 !! end
18417
18418 !! test
18419 HTML ordered list, unclosed tags (T7497)
18420 !! options
18421 !! wikitext
18422 <ol>
18423 <li>One
18424 <li>Two
18425 </ol>
18426 !! html/php+tidy
18427 <ol>
18428 <li>One</li>
18429 <li>Two</li>
18430 </ol>
18431 !! html/parsoid
18432 <ol data-parsoid='{"stx":"html"}'>
18433 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18434 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18435 </ol>
18436
18437 !! end
18438
18439 !! test
18440 HTML nested bullet list, closed tags (T7497)
18441 !! wikitext
18442 <ul>
18443 <li>One</li>
18444 <li>Two:
18445 <ul>
18446 <li>Sub-one</li>
18447 <li>Sub-two</li>
18448 </ul>
18449 </li>
18450 </ul>
18451 !! html/php
18452 <ul>
18453 <li>One</li>
18454 <li>Two:
18455 <ul>
18456 <li>Sub-one</li>
18457 <li>Sub-two</li>
18458 </ul>
18459 </li>
18460 </ul>
18461
18462 !! html/parsoid
18463 <ul data-parsoid='{"stx":"html"}'>
18464 <li data-parsoid='{"stx":"html"}'>One</li>
18465 <li data-parsoid='{"stx":"html"}'>Two:
18466 <ul data-parsoid='{"stx":"html"}'>
18467 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18468 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18469 </ul>
18470 </li>
18471 </ul>
18472 !! end
18473
18474 !! test
18475 HTML nested bullet list, open tags (T7497)
18476 !! wikitext
18477 <ul>
18478 <li>One
18479 <li>Two:
18480 <ul>
18481 <li>Sub-one
18482 <li>Sub-two
18483 </ul>
18484 </ul>
18485 !! html/php+tidy
18486 <ul>
18487 <li>One</li>
18488 <li>Two:
18489 <ul>
18490 <li>Sub-one</li>
18491 <li>Sub-two</li>
18492 </ul>
18493 </li>
18494 </ul>
18495 !! html/parsoid
18496 <ul>
18497 <li>One
18498 </li>
18499 <li>Two:
18500 <ul>
18501 <li>Sub-one
18502 </li>
18503 <li>Sub-two
18504 </li>
18505 </ul>
18506 </li>
18507 </ul>
18508
18509 !! end
18510
18511 !! test
18512 HTML nested ordered list, closed tags (T7497)
18513 !! wikitext
18514 <ol>
18515 <li>One</li>
18516 <li>Two:
18517 <ol>
18518 <li>Sub-one</li>
18519 <li>Sub-two</li>
18520 </ol>
18521 </li>
18522 </ol>
18523 !! html
18524 <ol>
18525 <li>One</li>
18526 <li>Two:
18527 <ol>
18528 <li>Sub-one</li>
18529 <li>Sub-two</li>
18530 </ol>
18531 </li>
18532 </ol>
18533
18534 !! end
18535
18536 !! test
18537 HTML nested ordered list, open tags (T7497)
18538 !! wikitext
18539 <ol>
18540 <li>One
18541 <li>Two:
18542 <ol>
18543 <li>Sub-one
18544 <li>Sub-two
18545 </ol>
18546 </ol>
18547 !! html/php
18548 <ol>
18549 <li>One
18550 <li>Two:
18551 <ol>
18552 <li>Sub-one
18553 <li>Sub-two
18554 </ol>
18555 </ol>
18556
18557 !! html/parsoid
18558 <ol>
18559 <li>One
18560 </li>
18561 <li>Two:
18562 <ol>
18563 <li>Sub-one
18564 </li>
18565 <li>Sub-two
18566 </li>
18567 </ol>
18568 </li>
18569 </ol>
18570
18571 !! end
18572
18573 !! test
18574 HTML ordered list item with parameters oddity
18575 !! wikitext
18576 <ol><li id="fragment">One</li>
18577 </ol>
18578 !! html
18579 <ol><li id="fragment">One</li>
18580 </ol>
18581
18582 !! end
18583
18584 # parsoid doesn't explicitly mark autonumbered links, see T55505
18585 !!test
18586 T7918: autonumbering
18587 !! wikitext
18588 [http://first/] [http://second] [ftp://ftp]
18589
18590 ftp://inlineftp
18591
18592 [mailto:enclosed@mail.tld With target]
18593
18594 [mailto:enclosed@mail.tld]
18595
18596 mailto:inline@mail.tld
18597 !! html/php
18598 <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>
18599 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18600 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18601 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18602 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18603 </p>
18604 !! html/parsoid
18605 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
18606 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18607 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18608 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18609 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18610 !! end
18611
18612
18613 #
18614 # Security and HTML correctness
18615 # From Nick Jenkins' fuzz testing
18616 #
18617
18618 !! test
18619 Fuzz testing: Parser13
18620 !! wikitext
18621 {|
18622 | http://a|
18623 !! html
18624 <table>
18625 <tr>
18626 <td>
18627 </td>
18628 </tr>
18629 </table>
18630
18631 !! end
18632
18633 !! test
18634 Fuzz testing: Parser14
18635 !! wikitext
18636 == onmouseover= ==
18637 http://__TOC__
18638 !! html
18639 <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>
18640 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18641 <ul>
18642 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18643 </ul>
18644 </div>
18645
18646
18647 !! html+tidy
18648 <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>
18649 <p>http://</p>
18650 <div id="toc" class="toc">
18651 <div class="toctitle">
18652 <h2>Contents</h2>
18653 </div>
18654 <ul>
18655 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18656 </ul>
18657 </div>
18658 <p></p>
18659 !! end
18660
18661 !! test
18662 Fuzz testing: Parser14-table
18663 !! options
18664 parsoid=wt2html,html2html
18665 !! wikitext
18666 ==a==
18667 {| STYLE=__TOC__
18668 !! html
18669 <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>
18670 <table style="&#95;_TOC&#95;_">
18671 <tr><td></td></tr>
18672 </table>
18673
18674 !! html+tidy
18675 <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>
18676 <table style="__TOC__">
18677 <tr>
18678 <td></td>
18679 </tr>
18680 </table>
18681 !! html/parsoid
18682 <h2>a</h2>
18683 <table style="__TOC__"></table>
18684 !! end
18685
18686 # Known to produce bogus xml (extra </td>)
18687 !! test
18688 Fuzz testing: Parser16
18689 !! wikitext
18690 {|
18691 !https://||||||
18692 !! html
18693 <table>
18694 <tr>
18695 <th>https://</th>
18696 <th></th>
18697 <th></th>
18698 <th>
18699 </td>
18700 </tr>
18701 </table>
18702
18703 !! html+tidy
18704 <table>
18705 <tr>
18706 <th>https://</th>
18707 <th></th>
18708 <th></th>
18709 <th></th>
18710 </tr>
18711 </table>
18712 !! end
18713
18714 !! test
18715 Fuzz testing: Parser21
18716 !! wikitext
18717 {|
18718 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18719 |
18720 !! html
18721 <table>
18722 <tr>
18723 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18724 </th>
18725 <td>
18726 </td>
18727 </tr>
18728 </table>
18729
18730 !! end
18731
18732 !! test
18733 Fuzz testing: Parser22
18734 !! wikitext
18735 http://===r:::https://b
18736
18737 {|
18738 !! html
18739 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18740 </p>
18741 <table>
18742 <tr><td></td></tr>
18743 </table>
18744
18745 !! end
18746
18747 # Known to produce bad XML for now
18748 !! test
18749 Fuzz testing: Parser24
18750 !! options
18751 parsoid=wt2html
18752 !! wikitext
18753 {|
18754 {{{|
18755 <u CLASS=
18756 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18757 <br style="onmouseover='alert(document.cookie);' " />
18758
18759 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18760 |
18761 !! html/php
18762 <table>
18763 {{{|
18764 <u class="&#124;">}}}} &gt;
18765 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18766
18767 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18768 <tr>
18769 <td></u>
18770 </td>
18771 </tr>
18772 </table>
18773
18774 !! html/parsoid
18775 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18776 <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>"}'/>}}}} >
18777 <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}'>
18778
18779
18780
18781 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18782 !! end
18783
18784 # Note: the current result listed for this is not what the original one was,
18785 # but the original bug was JavaScript injection, which is fixed in any case.
18786 # It's not clear that the original result listed was any more correct than the
18787 # current one. Original result:
18788 # <p>{{{|
18789 # </p>
18790 # <li class="&#124;&#124;">
18791 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18792 !!test
18793 Fuzz testing: Parser25 (T8055)
18794 !! wikitext
18795 {{{
18796 |
18797 <LI CLASS=||
18798 >
18799 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18800 !! html/php
18801 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18802 </p>
18803 !! html/parsoid
18804 <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"]}'>
18805 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18806 !! end
18807
18808 !!test
18809 Fuzz testing: URL adjacent extension (with space, clean)
18810 !! wikitext
18811 http://example.com <nowiki>junk</nowiki>
18812 !! html/php
18813 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18814 </p>
18815 !! html/parsoid
18816 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18817 !! end
18818
18819 !!test
18820 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18821 !! wikitext
18822 http://example.com<nowiki>junk</nowiki>
18823 !! html/php
18824 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18825 </p>
18826 !! html/parsoid
18827 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18828 !! end
18829
18830 !! test
18831 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18832 !! wikitext
18833 http://example.com<pre>junk</pre>
18834 !! html/php
18835 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18836
18837 !! html/php+tidy
18838 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18839 <pre>
18840 junk
18841 </pre>
18842 !! html/parsoid
18843 <p><a rel="mw:ExtLink" 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>
18844 !! end
18845
18846 !! test
18847 Fuzz testing: image with bogus manual thumbnail
18848 !! wikitext
18849 [[Image:foobar.jpg|thumbnail= ]]
18850 !! html/php
18851 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18852
18853 !! html/parsoid
18854 <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>
18855 !! end
18856
18857 !! test
18858 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18859 !! wikitext
18860 <pre dir="&#10;"></pre>
18861 !! html/php
18862 <pre dir="&#10;"></pre>
18863
18864 !! html/parsoid
18865 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18866 !! end
18867
18868 !! test
18869 Parsing optional HTML elements (T8171)
18870 !! options
18871 !! wikitext
18872 <table>
18873 <tr>
18874 <td> Some tabular data</td>
18875 <td> More tabular data ...
18876 <td> And yet som tabular data</td>
18877 </tr>
18878 </table>
18879 !! html
18880 <table>
18881 <tr>
18882 <td> Some tabular data</td>
18883 <td> More tabular data ...
18884 </td><td> And yet som tabular data</td>
18885 </tr>
18886 </table>
18887
18888 !! end
18889
18890 !! test
18891 Correct handling of <td>, <tr> (T8171)
18892 !! options
18893 !! wikitext
18894 <table>
18895 <tr>
18896 <td> Some tabular data</td>
18897 <td> More tabular data ...</td>
18898 <td> And yet som tabular data</td>
18899 </tr>
18900 </table>
18901 !! html
18902 <table>
18903 <tr>
18904 <td> Some tabular data</td>
18905 <td> More tabular data ...</td>
18906 <td> And yet som tabular data</td>
18907 </tr>
18908 </table>
18909
18910 !! end
18911
18912
18913 !! test
18914 Parsing crashing regression (fr:JavaScript)
18915 !! wikitext
18916 </body></x>
18917 !! html
18918 <p>&lt;/body&gt;&lt;/x&gt;
18919 </p>
18920 !! end
18921
18922 !! test
18923 Inline wiki vs wiki block nesting
18924 !! wikitext
18925 '''Bold paragraph
18926
18927 New wiki paragraph
18928 !! html
18929 <p><b>Bold paragraph</b>
18930 </p><p>New wiki paragraph
18931 </p>
18932 !! end
18933
18934 # FIXME: The current php output is documented
18935 # and desired output is the parsoid target.
18936 !! test
18937 Inline HTML vs wiki block nesting
18938 !! wikitext
18939 <b>Bold paragraph
18940
18941 New wiki paragraph
18942 !! html/php
18943 <p><b>Bold paragraph
18944 </p><p>New wiki paragraph</b>
18945 </p>
18946 !! html/parsoid
18947 <p><b>Bold paragraph</b>
18948 </p><p>New wiki paragraph
18949 </p>
18950 !! end
18951
18952 # Original result was this:
18953 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18954 # </p>
18955 # While that might be marginally more intuitive, maybe, the six-apostrophe
18956 # construct is clearly pathological and the result stated here (which is what
18957 # the parser actually does) is about as reasonable as anything.
18958 !!test
18959 Mixing markup for italics and bold
18960 !! options
18961 !! wikitext
18962 '''bold''''''bold''bolditalics'''''
18963 !! html
18964 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18965 </p>
18966 !! end
18967
18968
18969 !! article
18970 Xyzzyx
18971 !! text
18972 Article for special page transclusion test
18973 !! endarticle
18974
18975 !! test
18976 Special page transclusion
18977 !! options
18978 !! wikitext
18979 {{Special:Prefixindex/Xyzzyx}}
18980 !! html
18981 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18982 </ul>
18983
18984 !! end
18985
18986 !! test
18987 Special page transclusion twice (T7021)
18988 !! options
18989 !! wikitext
18990 {{Special:Prefixindex/Xyzzyx}}
18991 {{Special:Prefixindex/Xyzzyx}}
18992 !! html
18993 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18994 </ul>
18995 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
18996 </ul>
18997
18998 !! end
18999
19000 !! test
19001 Transclusion of default MediaWiki message
19002 !! wikitext
19003 {{MediaWiki:Mainpage}}
19004 !! html
19005 <p>Main Page
19006 </p>
19007 !! end
19008
19009 !! test
19010 Transclusion of nonexistent MediaWiki message
19011 !! wikitext
19012 {{MediaWiki:Mainpagexxx}}
19013 !! html
19014 <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>
19015 </p>
19016 !! end
19017
19018 !! test
19019 Transclusion of MediaWiki message with underscore
19020 !! wikitext
19021 {{MediaWiki:history_short}}
19022 !! html
19023 <p>History
19024 </p>
19025 !! end
19026
19027 !! test
19028 Transclusion of MediaWiki message with space
19029 !! wikitext
19030 {{MediaWiki:history short}}
19031 !! html
19032 <p>History
19033 </p>
19034 !! end
19035
19036 !! test
19037 Invalid header with following text
19038 !! wikitext
19039 = x = y
19040 !! html
19041 <p>= x = y
19042 </p>
19043 !! end
19044
19045
19046 !! test
19047 Section extraction test (section 0)
19048 !! options
19049 section=0
19050 !! wikitext
19051 start
19052 ==a==
19053 ===aa===
19054 ====aaa====
19055 ==b==
19056 ===ba===
19057 ===bb===
19058 ====bba====
19059 ===bc===
19060 ==c==
19061 ===ca===
19062 !! html/php
19063 start
19064 !! end
19065
19066 !! test
19067 Section extraction test (section 1)
19068 !! options
19069 section=1
19070 !! wikitext
19071 start
19072 ==a==
19073 ===aa===
19074 ====aaa====
19075 ==b==
19076 ===ba===
19077 ===bb===
19078 ====bba====
19079 ===bc===
19080 ==c==
19081 ===ca===
19082 !! html/php
19083 ==a==
19084 ===aa===
19085 ====aaa====
19086 !! end
19087
19088 !! test
19089 Section extraction test (section 2)
19090 !! options
19091 section=2
19092 !! wikitext
19093 start
19094 ==a==
19095 ===aa===
19096 ====aaa====
19097 ==b==
19098 ===ba===
19099 ===bb===
19100 ====bba====
19101 ===bc===
19102 ==c==
19103 ===ca===
19104 !! html/php
19105 ===aa===
19106 ====aaa====
19107 !! end
19108
19109 !! test
19110 Section extraction test (section 3)
19111 !! options
19112 section=3
19113 !! wikitext
19114 start
19115 ==a==
19116 ===aa===
19117 ====aaa====
19118 ==b==
19119 ===ba===
19120 ===bb===
19121 ====bba====
19122 ===bc===
19123 ==c==
19124 ===ca===
19125 !! html/php
19126 ====aaa====
19127 !! end
19128
19129 !! test
19130 Section extraction test (section 4)
19131 !! options
19132 section=4
19133 !! wikitext
19134 start
19135 ==a==
19136 ===aa===
19137 ====aaa====
19138 ==b==
19139 ===ba===
19140 ===bb===
19141 ====bba====
19142 ===bc===
19143 ==c==
19144 ===ca===
19145 !! html/php
19146 ==b==
19147 ===ba===
19148 ===bb===
19149 ====bba====
19150 ===bc===
19151 !! end
19152
19153 !! test
19154 Section extraction test (section 5)
19155 !! options
19156 section=5
19157 !! wikitext
19158 start
19159 ==a==
19160 ===aa===
19161 ====aaa====
19162 ==b==
19163 ===ba===
19164 ===bb===
19165 ====bba====
19166 ===bc===
19167 ==c==
19168 ===ca===
19169 !! html/php
19170 ===ba===
19171 !! end
19172
19173 !! test
19174 Section extraction test (section 6)
19175 !! options
19176 section=6
19177 !! wikitext
19178 start
19179 ==a==
19180 ===aa===
19181 ====aaa====
19182 ==b==
19183 ===ba===
19184 ===bb===
19185 ====bba====
19186 ===bc===
19187 ==c==
19188 ===ca===
19189 !! html/php
19190 ===bb===
19191 ====bba====
19192 !! end
19193
19194 !! test
19195 Section extraction test (section 7)
19196 !! options
19197 section=7
19198 !! wikitext
19199 start
19200 ==a==
19201 ===aa===
19202 ====aaa====
19203 ==b==
19204 ===ba===
19205 ===bb===
19206 ====bba====
19207 ===bc===
19208 ==c==
19209 ===ca===
19210 !! html/php
19211 ====bba====
19212 !! end
19213
19214 !! test
19215 Section extraction test (section 8)
19216 !! options
19217 section=8
19218 !! wikitext
19219 start
19220 ==a==
19221 ===aa===
19222 ====aaa====
19223 ==b==
19224 ===ba===
19225 ===bb===
19226 ====bba====
19227 ===bc===
19228 ==c==
19229 ===ca===
19230 !! html/php
19231 ===bc===
19232 !! end
19233
19234 !! test
19235 Section extraction test (section 9)
19236 !! options
19237 section=9
19238 !! wikitext
19239 start
19240 ==a==
19241 ===aa===
19242 ====aaa====
19243 ==b==
19244 ===ba===
19245 ===bb===
19246 ====bba====
19247 ===bc===
19248 ==c==
19249 ===ca===
19250 !! html/php
19251 ==c==
19252 ===ca===
19253 !! end
19254
19255 !! test
19256 Section extraction test (section 10)
19257 !! options
19258 section=10
19259 !! wikitext
19260 start
19261 ==a==
19262 ===aa===
19263 ====aaa====
19264 ==b==
19265 ===ba===
19266 ===bb===
19267 ====bba====
19268 ===bc===
19269 ==c==
19270 ===ca===
19271 !! html/php
19272 ===ca===
19273 !! end
19274
19275 !! test
19276 Section extraction test (nonexistent section 11)
19277 !! options
19278 section=11
19279 !! wikitext
19280 start
19281 ==a==
19282 ===aa===
19283 ====aaa====
19284 ==b==
19285 ===ba===
19286 ===bb===
19287 ====bba====
19288 ===bc===
19289 ==c==
19290 ===ca===
19291 !! html/php
19292 !! end
19293
19294 !! test
19295 Section extraction test with bogus heading (section 1)
19296 !! options
19297 section=1
19298 !! wikitext
19299 ==a==
19300 ==bogus== not a legal section
19301 ==b==
19302 !! html/php
19303 ==a==
19304 ==bogus== not a legal section
19305 !! end
19306
19307 !! test
19308 Section extraction test with bogus heading (section 2)
19309 !! options
19310 section=2
19311 !! wikitext
19312 ==a==
19313 ==bogus== not a legal section
19314 ==b==
19315 !! html/php
19316 ==b==
19317 !! end
19318
19319 !! test
19320 Section extraction test with comment after heading (section 1)
19321 !! options
19322 section=1
19323 !! wikitext
19324 ==a==
19325 ==b== <!-- -->
19326 ==c==
19327 !! html/php
19328 ==a==
19329 !! end
19330
19331 !! test
19332 Section extraction test with comment after heading (section 2)
19333 !! options
19334 section=2
19335 !! wikitext
19336 ==a==
19337 ==b== <!-- -->
19338 ==c==
19339 !! html/php
19340 ==b== <!-- -->
19341 !! end
19342
19343 !! test
19344 Section extraction test with bogus <nowiki> heading (section 1)
19345 !! options
19346 section=1
19347 !! wikitext
19348 ==a==
19349 ==bogus== <nowiki>not a legal section</nowiki>
19350 ==b==
19351 !! html/php
19352 ==a==
19353 ==bogus== <nowiki>not a legal section</nowiki>
19354 !! end
19355
19356 !! test
19357 Section extraction test with bogus <nowiki> heading (section 2)
19358 !! options
19359 section=2
19360 !! wikitext
19361 ==a==
19362 ==bogus== <nowiki>not a legal section</nowiki>
19363 ==b==
19364 !! html/php
19365 ==b==
19366 !! end
19367
19368 # Formerly testing for T4587, now resolved by the use of unmarked sections
19369 # instead of respecting commented sections
19370 !! test
19371 Section extraction prefixed by comment (section 1)
19372 !! options
19373 section=1
19374 !! wikitext
19375 <!-- -->==sec1==
19376 ==sec2==
19377 !! html/php
19378 ==sec2==
19379 !!end
19380
19381 !! test
19382 Section extraction prefixed by comment (section 2)
19383 !! options
19384 section=2
19385 !! wikitext
19386 <!-- -->==sec1==
19387 ==sec2==
19388 !! html/php
19389
19390 !!end
19391
19392 # Formerly testing for T4607, now resolved by the use of unmarked sections
19393 # instead of respecting HTML-style headings
19394 !! test
19395 Section extraction, mixed wiki and html (section 1)
19396 !! options
19397 section=1
19398 !! wikitext
19399 <h2>unmarked</h2>
19400 unmarked
19401 ==1==
19402 one
19403 ==2==
19404 two
19405 !! html/php
19406 ==1==
19407 one
19408 !! end
19409
19410 !! test
19411 Section extraction, mixed wiki and html (section 2)
19412 !! options
19413 section=2
19414 !! wikitext
19415 <h2>unmarked</h2>
19416 unmarked
19417 ==1==
19418 one
19419 ==2==
19420 two
19421 !! html/php
19422 ==2==
19423 two
19424 !! end
19425
19426
19427 # Formerly testing for T5342
19428 !! test
19429 Section extraction, heading surrounded by <noinclude>
19430 !! options
19431 section=1
19432 !! wikitext
19433 <noinclude>==unmarked==</noinclude>
19434 ==marked==
19435 !! html/php
19436 ==marked==
19437 !!end
19438
19439 # Test behavior of T21910
19440 !! test
19441 Sectiion with all-equals
19442 !! options
19443 section=2
19444 !! wikitext
19445 ===
19446 The line above must have a trailing space
19447 === <!--
19448 --> <!-- -->
19449 But just in case it doesn't...
19450 !! html/php
19451 === <!--
19452 --> <!-- -->
19453 But just in case it doesn't...
19454 !! end
19455
19456 !! test
19457 Section replacement test (section 0)
19458 !! options
19459 replace=0,"xxx"
19460 !! wikitext
19461 start
19462 ==a==
19463 ===aa===
19464 ====aaa====
19465 ==b==
19466 ===ba===
19467 ===bb===
19468 ====bba====
19469 ===bc===
19470 ==c==
19471 ===ca===
19472 !! html/php
19473 xxx
19474
19475 ==a==
19476 ===aa===
19477 ====aaa====
19478 ==b==
19479 ===ba===
19480 ===bb===
19481 ====bba====
19482 ===bc===
19483 ==c==
19484 ===ca===
19485 !! end
19486
19487 !! test
19488 Section replacement test (section 1)
19489 !! options
19490 replace=1,"xxx"
19491 !! wikitext
19492 start
19493 ==a==
19494 ===aa===
19495 ====aaa====
19496 ==b==
19497 ===ba===
19498 ===bb===
19499 ====bba====
19500 ===bc===
19501 ==c==
19502 ===ca===
19503 !! html/php
19504 start
19505 xxx
19506
19507 ==b==
19508 ===ba===
19509 ===bb===
19510 ====bba====
19511 ===bc===
19512 ==c==
19513 ===ca===
19514 !! end
19515
19516 !! test
19517 Section replacement test (section 2)
19518 !! options
19519 replace=2,"xxx"
19520 !! wikitext
19521 start
19522 ==a==
19523 ===aa===
19524 ====aaa====
19525 ==b==
19526 ===ba===
19527 ===bb===
19528 ====bba====
19529 ===bc===
19530 ==c==
19531 ===ca===
19532 !! html/php
19533 start
19534 ==a==
19535 xxx
19536
19537 ==b==
19538 ===ba===
19539 ===bb===
19540 ====bba====
19541 ===bc===
19542 ==c==
19543 ===ca===
19544 !! end
19545
19546 !! test
19547 Section replacement test (section 3)
19548 !! options
19549 replace=3,"xxx"
19550 !! wikitext
19551 start
19552 ==a==
19553 ===aa===
19554 ====aaa====
19555 ==b==
19556 ===ba===
19557 ===bb===
19558 ====bba====
19559 ===bc===
19560 ==c==
19561 ===ca===
19562 !! html/php
19563 start
19564 ==a==
19565 ===aa===
19566 xxx
19567
19568 ==b==
19569 ===ba===
19570 ===bb===
19571 ====bba====
19572 ===bc===
19573 ==c==
19574 ===ca===
19575 !! end
19576
19577 !! test
19578 Section replacement test (section 4)
19579 !! options
19580 replace=4,"xxx"
19581 !! wikitext
19582 start
19583 ==a==
19584 ===aa===
19585 ====aaa====
19586 ==b==
19587 ===ba===
19588 ===bb===
19589 ====bba====
19590 ===bc===
19591 ==c==
19592 ===ca===
19593 !! html/php
19594 start
19595 ==a==
19596 ===aa===
19597 ====aaa====
19598 xxx
19599
19600 ==c==
19601 ===ca===
19602 !! end
19603
19604 !! test
19605 Section replacement test (section 5)
19606 !! options
19607 replace=5,"xxx"
19608 !! wikitext
19609 start
19610 ==a==
19611 ===aa===
19612 ====aaa====
19613 ==b==
19614 ===ba===
19615 ===bb===
19616 ====bba====
19617 ===bc===
19618 ==c==
19619 ===ca===
19620 !! html/php
19621 start
19622 ==a==
19623 ===aa===
19624 ====aaa====
19625 ==b==
19626 xxx
19627
19628 ===bb===
19629 ====bba====
19630 ===bc===
19631 ==c==
19632 ===ca===
19633 !! end
19634
19635 !! test
19636 Section replacement test (section 6)
19637 !! options
19638 replace=6,"xxx"
19639 !! wikitext
19640 start
19641 ==a==
19642 ===aa===
19643 ====aaa====
19644 ==b==
19645 ===ba===
19646 ===bb===
19647 ====bba====
19648 ===bc===
19649 ==c==
19650 ===ca===
19651 !! html/php
19652 start
19653 ==a==
19654 ===aa===
19655 ====aaa====
19656 ==b==
19657 ===ba===
19658 xxx
19659
19660 ===bc===
19661 ==c==
19662 ===ca===
19663 !! end
19664
19665 !! test
19666 Section replacement test (section 7)
19667 !! options
19668 replace=7,"xxx"
19669 !! wikitext
19670 start
19671 ==a==
19672 ===aa===
19673 ====aaa====
19674 ==b==
19675 ===ba===
19676 ===bb===
19677 ====bba====
19678 ===bc===
19679 ==c==
19680 ===ca===
19681 !! html/php
19682 start
19683 ==a==
19684 ===aa===
19685 ====aaa====
19686 ==b==
19687 ===ba===
19688 ===bb===
19689 xxx
19690
19691 ===bc===
19692 ==c==
19693 ===ca===
19694 !! end
19695
19696 !! test
19697 Section replacement test (section 8)
19698 !! options
19699 replace=8,"xxx"
19700 !! wikitext
19701 start
19702 ==a==
19703 ===aa===
19704 ====aaa====
19705 ==b==
19706 ===ba===
19707 ===bb===
19708 ====bba====
19709 ===bc===
19710 ==c==
19711 ===ca===
19712 !! html/php
19713 start
19714 ==a==
19715 ===aa===
19716 ====aaa====
19717 ==b==
19718 ===ba===
19719 ===bb===
19720 ====bba====
19721 xxx
19722
19723 ==c==
19724 ===ca===
19725 !!end
19726
19727 !! test
19728 Section replacement test (section 9)
19729 !! options
19730 replace=9,"xxx"
19731 !! wikitext
19732 start
19733 ==a==
19734 ===aa===
19735 ====aaa====
19736 ==b==
19737 ===ba===
19738 ===bb===
19739 ====bba====
19740 ===bc===
19741 ==c==
19742 ===ca===
19743 !! html/php
19744 start
19745 ==a==
19746 ===aa===
19747 ====aaa====
19748 ==b==
19749 ===ba===
19750 ===bb===
19751 ====bba====
19752 ===bc===
19753 xxx
19754 !! end
19755
19756 !! test
19757 Section replacement test (section 10)
19758 !! options
19759 replace=10,"xxx"
19760 !! wikitext
19761 start
19762 ==a==
19763 ===aa===
19764 ====aaa====
19765 ==b==
19766 ===ba===
19767 ===bb===
19768 ====bba====
19769 ===bc===
19770 ==c==
19771 ===ca===
19772 !! html/php
19773 start
19774 ==a==
19775 ===aa===
19776 ====aaa====
19777 ==b==
19778 ===ba===
19779 ===bb===
19780 ====bba====
19781 ===bc===
19782 ==c==
19783 xxx
19784 !! end
19785
19786 !! test
19787 Section replacement test with initial whitespace (T15728)
19788 !! options
19789 replace=2,"xxx"
19790 !! wikitext
19791 Preformatted initial line
19792 ==a==
19793 ===a===
19794 !! html/php
19795 Preformatted initial line
19796 ==a==
19797 xxx
19798 !! end
19799
19800
19801 !! test
19802 Section extraction, heading followed by pre with 20 spaces (T8398)
19803 !! options
19804 section=1
19805 !! wikitext
19806 ==a==
19807 a
19808 !! html/php
19809 ==a==
19810 a
19811 !! end
19812
19813 !! test
19814 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19815 !! options
19816 section=1
19817 !! wikitext
19818 ==a==
19819 a
19820 !! html/php
19821 ==a==
19822 a
19823 !! end
19824
19825
19826 !! test
19827 Section extraction, <pre> around bogus header (T12309)
19828 !! options
19829 section=2
19830 !! wikitext
19831 == Section One ==
19832 <pre>
19833 =======
19834 </pre>
19835
19836 == Section Two ==
19837 stuff
19838 !! html/php
19839 == Section Two ==
19840 stuff
19841 !! end
19842
19843 !! test
19844 Section replacement, <pre> around bogus header (T12309)
19845 !! options
19846 replace=2,"xxx"
19847 !! wikitext
19848 == Section One ==
19849 <pre>
19850 =======
19851 </pre>
19852
19853 == Section Two ==
19854 stuff
19855 !! html/php
19856 == Section One ==
19857 <pre>
19858 =======
19859 </pre>
19860
19861 xxx
19862 !! end
19863
19864 !! test
19865 Handling of &#x0A; in URLs
19866 !! wikitext
19867 ** irc://&#x0A;a
19868 !! html/php
19869 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19870
19871 !! html/parsoid
19872 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul></li></ul>
19873 !! end
19874
19875 !! test
19876 Handling of %0A in URLs
19877 !! wikitext
19878 ** irc://%0Aa
19879 !! html/php
19880 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19881
19882 !! html/parsoid
19883 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19884 !! end
19885
19886 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19887 !! test
19888 5 quotes, code coverage +1 line
19889 !! options
19890 parsoid=wt2html
19891 !! wikitext
19892 '''''
19893 !! html/php
19894 !! html/parsoid
19895 <p><b><i></i></b></p>
19896 !! end
19897
19898 # same html as previous, but wikitext adjusted to match parsoid html2wt
19899 # note that wt2html and html2html will put the <i> before the <b>
19900 !! test
19901 5 quotes, code coverage +1 line w/ nowiki (1)
19902 !! options
19903 parsoid=wt2wt,html2wt
19904 !! wikitext
19905 '''''<nowiki/>'''''
19906 !! html/php
19907 <p><i></i>
19908 </p>
19909 !! html/parsoid
19910 <p><b><i></i></b></p>
19911 !! end
19912
19913 # same as previous, just swapping the <i> and <b>
19914 !! test
19915 5 quotes, code coverage +1 line w/ nowiki (2)
19916 !! wikitext
19917 '''''<nowiki/>'''''
19918 !! html/php
19919 <p><i></i>
19920 </p>
19921 !! html/parsoid
19922 <p><i><b></b></i></p>
19923 !! end
19924
19925 !! test
19926 Special:Search page linking.
19927 !! wikitext
19928 {{Special:search}}
19929 !! html
19930 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19931 </p>
19932 !! end
19933
19934 !! test
19935 {{!}} is a magic word
19936 !! wikitext
19937 {{!}} is a magic word there and {{!}} is still a magic word here
19938 | is not a magic word here but {{!}} is still a magic word here
19939 !! html/php
19940 <p>| is a magic word there and | is still a magic word here
19941 | is not a magic word here but | is still a magic word here
19942 </p>
19943 !! html/parsoid
19944 <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
19945 | 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>
19946 !! end
19947
19948 !! test
19949 Say the magic word
19950 !! options
19951 title=[[Parser test]]
19952 !! wikitext
19953 * {{PAGENAME}}
19954 * {{PAGENAMEE}}
19955 * {{FULLPAGENAME}}
19956 * {{FULLPAGENAMEE}}
19957 * {{BASEPAGENAME}}
19958 * {{BASEPAGENAMEE}}
19959 * {{SUBPAGENAME}}
19960 * {{SUBPAGENAMEE}}
19961 * {{ROOTPAGENAME}}
19962 * {{ROOTPAGENAMEE}}
19963 * {{TALKPAGENAME}}
19964 * {{TALKPAGENAMEE}}
19965 * {{SUBJECTPAGENAME}}
19966 * {{SUBJECTPAGENAMEE}}
19967 * {{NAMESPACEE}}
19968 * {{NAMESPACE}}
19969 * {{NAMESPACENUMBER}}
19970 * {{TALKSPACE}}
19971 * {{TALKSPACEE}}
19972 * {{SUBJECTSPACE}}
19973 * {{SUBJECTSPACEE}}
19974 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
19975 !! html
19976 <ul><li> Parser test</li>
19977 <li> Parser_test</li>
19978 <li> Parser test</li>
19979 <li> Parser_test</li>
19980 <li> Parser test</li>
19981 <li> Parser_test</li>
19982 <li> Parser test</li>
19983 <li> Parser_test</li>
19984 <li> Parser test</li>
19985 <li> Parser_test</li>
19986 <li> Talk:Parser test</li>
19987 <li> Talk:Parser_test</li>
19988 <li> Parser test</li>
19989 <li> Parser_test</li>
19990 <li> </li>
19991 <li> </li>
19992 <li> 0</li>
19993 <li> Talk</li>
19994 <li> Talk</li>
19995 <li> </li>
19996 <li> </li>
19997 <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>
19998
19999 !! end
20000 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20001
20002 !! test
20003 Gallery with valid attributes
20004 !! wikitext
20005 <gallery type="123" summary="345">
20006 File:File:Foobar.jpg
20007 </gallery>
20008 !! html/php
20009 <ul class="gallery mw-gallery-traditional" type="123">
20010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20011 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20012 <div class="gallerytext">
20013 </div>
20014 </div></li>
20015 </ul>
20016
20017 !! html/parsoid
20018 <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"}}'>
20019 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20020 </ul>
20021 !! end
20022
20023 ## Parsoid thinks the "centre" here is a property, not a caption.
20024 !! test
20025 Gallery
20026 !! options
20027 parsoid={
20028 "modes": ["wt2html"],
20029 "nativeGallery": true
20030 }
20031 !! wikitext
20032 <gallery>
20033 image1.png |
20034 image2.gif|||||
20035
20036 image3|
20037 image4 |300px| centre
20038 image5.svg| http://///////
20039 [[x|xx]]]]
20040 * image6
20041 </gallery>
20042 !! html/php
20043 <ul class="gallery mw-gallery-traditional">
20044 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20045 <div class="thumb" style="height: 150px;">Image1.png</div>
20046 <div class="gallerytext">
20047 </div>
20048 </div></li>
20049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20050 <div class="thumb" style="height: 150px;">Image2.gif</div>
20051 <div class="gallerytext">
20052 </div>
20053 </div></li>
20054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20055 <div class="thumb" style="height: 150px;">Image3</div>
20056 <div class="gallerytext">
20057 </div>
20058 </div></li>
20059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20060 <div class="thumb" style="height: 150px;">Image4</div>
20061 <div class="gallerytext">
20062 <pre>centre
20063 </pre>
20064 </div>
20065 </div></li>
20066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20067 <div class="thumb" style="height: 150px;">Image5.svg</div>
20068 <div class="gallerytext">
20069 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20070 </p>
20071 </div>
20072 </div></li>
20073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20074 <div class="thumb" style="height: 150px;">* image6</div>
20075 <div class="gallerytext">
20076 </div>
20077 </div></li>
20078 </ul>
20079
20080 !! html/parsoid
20081 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20082 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20083 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20084 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></span></div><div class="gallerytext"></div></li>
20085 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></span></div><div class="gallerytext"></div></li>
20086 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////">http://///////</a></div></li>
20087 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></span></div><div class="gallerytext"></div></li>
20088 </ul>
20089 !! end
20090
20091 !! test
20092 Gallery (with options, html)
20093 !! options
20094 parsoid={
20095 "modes": ["wt2html", "html2html"],
20096 "nativeGallery": true
20097 }
20098 !! wikitext
20099 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20100 File:Nonexistent.jpg|caption
20101 File:Nonexistent.jpg
20102 image:foobar.jpg|some '''caption''' [[Main Page]]
20103 image:foobar.jpg
20104 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20105 </gallery>
20106 !! html/php
20107 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20108 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20109 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20110 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20111 <div class="gallerytext">
20112 <p>caption
20113 </p>
20114 </div>
20115 </div></li>
20116 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20117 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20118 <div class="gallerytext">
20119 </div>
20120 </div></li>
20121 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20122 <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>
20123 <div class="gallerytext">
20124 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20125 </p>
20126 </div>
20127 </div></li>
20128 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20129 <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>
20130 <div class="gallerytext">
20131 </div>
20132 </div></li>
20133 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20134 <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>
20135 <div class="gallerytext">
20136 <p>blabla.
20137 </p>
20138 </div>
20139 </div></li>
20140 </ul>
20141
20142 !! html/parsoid
20143 <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":{}}'>
20144 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20145 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">caption</div></li>
20146 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext"></div></li>
20147 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20148 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext"></div></li>
20149 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">blabla.</div></li>
20150 </ul>
20151 !! end
20152
20153 !! test
20154 Gallery (with options, extsrc)
20155 !! options
20156 parsoid={
20157 "nativeGallery": false
20158 }
20159 !! wikitext
20160 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20161 File:Nonexistent.jpg|caption
20162 File:Nonexistent.jpg
20163 image:foobar.jpg|some '''caption''' [[Main Page]]
20164 image:foobar.jpg
20165 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20166 </gallery>
20167 !! html/php
20168 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20169 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20170 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20171 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20172 <div class="gallerytext">
20173 <p>caption
20174 </p>
20175 </div>
20176 </div></li>
20177 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20178 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20179 <div class="gallerytext">
20180 </div>
20181 </div></li>
20182 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20183 <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>
20184 <div class="gallerytext">
20185 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20186 </p>
20187 </div>
20188 </div></li>
20189 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20190 <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>
20191 <div class="gallerytext">
20192 </div>
20193 </div></li>
20194 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20195 <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>
20196 <div class="gallerytext">
20197 <p>blabla.
20198 </p>
20199 </div>
20200 </div></li>
20201 </ul>
20202
20203 !! html/parsoid
20204 <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"}}'>
20205 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20206 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">caption</div></li>
20207 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext"></div></li>
20208 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20209 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext"></div></li>
20210 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span 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></span></div><div class="gallerytext">blabla.</div></li>
20211 </ul>
20212 !! end
20213
20214 !! test
20215 Gallery with link that has fragment
20216 !! options
20217 parsoid={
20218 "modes": ["wt2html", "html2html"],
20219 "nativeGallery": true
20220 }
20221 !! wikitext
20222 <gallery>
20223 image:foobar.jpg|link=Main_Page
20224 image:foobar.jpg|link=Main_Page#section
20225 image:foobar.jpg|link=Main Page#section|caption
20226 </gallery>
20227 !! html/php
20228 <ul class="gallery mw-gallery-traditional">
20229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20230 <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>
20231 <div class="gallerytext">
20232 </div>
20233 </div></li>
20234 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20235 <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>
20236 <div class="gallerytext">
20237 </div>
20238 </div></li>
20239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20240 <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>
20241 <div class="gallerytext">
20242 <p>caption
20243 </p>
20244 </div>
20245 </div></li>
20246 </ul>
20247
20248 !! html/parsoid
20249 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20250 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20251 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20252 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext">caption</div></li>
20253 </ul>
20254 !! end
20255
20256 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20257 !! test
20258 Gallery with template inside caption
20259 !! options
20260 parsoid={
20261 "nativeGallery": true
20262 }
20263 !! wikitext
20264 <gallery caption="{{echo|hi}}">
20265 File:Foobar.jpg|{{echo|ho}}
20266 </gallery>
20267 !! html/php
20268 <ul class="gallery mw-gallery-traditional">
20269 <li class='gallerycaption'>{{echo|hi}}</li>
20270 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20271 <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>
20272 <div class="gallerytext">
20273 <p>ho
20274 </p>
20275 </div>
20276 </div></li>
20277 </ul>
20278
20279 !! html/parsoid
20280 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20281 <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>
20282 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></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>
20283 </ul>
20284 !! end
20285
20286 !! test
20287 Gallery with wikitext inside caption
20288 !! options
20289 parsoid={
20290 "nativeGallery": true
20291 }
20292 !! wikitext
20293 <gallery>
20294 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20295 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20296 </gallery>
20297 !! html/php
20298 <ul class="gallery mw-gallery-traditional">
20299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20300 <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>
20301 <div class="gallerytext">
20302 <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>
20303 </p>
20304 </div>
20305 </div></li>
20306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20307 <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>
20308 <div class="gallerytext">
20309 <p>This is a test template
20310 </p>
20311 </div>
20312 </div></li>
20313 </ul>
20314
20315 !! html/parsoid
20316 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20317 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"><span 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></span></div></li>
20318 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></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>
20319 </ul>
20320 !! end
20321
20322 !! test
20323 Gallery (with showfilename option)
20324 !! options
20325 parsoid={
20326 "nativeGallery": true
20327 }
20328 !! wikitext
20329 <gallery showfilename="">
20330 File:Nonexistent.jpg|caption
20331 File:Nonexistent.jpg
20332 File:Foobar.jpg|some '''caption''' [[Main Page]]
20333 File:Foobar.jpg
20334 </gallery>
20335 !! html/php
20336 <ul class="gallery mw-gallery-traditional">
20337 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20338 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20339 <div class="gallerytext">
20340 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20341 caption
20342 </p>
20343 </div>
20344 </div></li>
20345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20346 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20347 <div class="gallerytext">
20348 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20349 </p>
20350 </div>
20351 </div></li>
20352 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20353 <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>
20354 <div class="gallerytext">
20355 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20356 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20357 </p>
20358 </div>
20359 </div></li>
20360 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20361 <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>
20362 <div class="gallerytext">
20363 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20364 </p>
20365 </div>
20366 </div></li>
20367 </ul>
20368
20369 !! html/parsoid
20370 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20371 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
20372 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
20373 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></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>
20374 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
20375 </ul>
20376 !! end
20377
20378 ## Should Parsoid be preserving these variations? See T151367
20379 !! test
20380 Gallery (with namespace-less filenames)
20381 !! options
20382 parsoid={
20383 "modes": ["wt2html", "html2html"],
20384 "nativeGallery": true
20385 }
20386 !! wikitext
20387 <gallery>
20388 File:Nonexistent.jpg
20389 Nonexistent.jpg
20390 image:foobar.jpg
20391 foobar.jpg
20392 </gallery>
20393 !! html/php
20394 <ul class="gallery mw-gallery-traditional">
20395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20396 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20397 <div class="gallerytext">
20398 </div>
20399 </div></li>
20400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20401 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20402 <div class="gallerytext">
20403 </div>
20404 </div></li>
20405 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20406 <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>
20407 <div class="gallerytext">
20408 </div>
20409 </div></li>
20410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20411 <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>
20412 <div class="gallerytext">
20413 </div>
20414 </div></li>
20415 </ul>
20416
20417 !! html/parsoid
20418 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20419 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20420 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20421 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20422 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20423 </ul>
20424 !! end
20425
20426 !! test
20427 Gallery override link with WikiLink (T36852)
20428 !! options
20429 parsoid={
20430 "nativeGallery": true
20431 }
20432 !! wikitext
20433 <gallery>
20434 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20435 </gallery>
20436 !! html/php
20437 <ul class="gallery mw-gallery-traditional">
20438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20439 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><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>
20440 <div class="gallerytext">
20441 </div>
20442 </div></li>
20443 </ul>
20444
20445 !! html/parsoid
20446 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-parsoid='{"dsr":[0,70,2,2]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20447 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:Image"><a href="./InterWikiLink"><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></span></div><div class="gallerytext"></div></li>
20448 </ul>
20449 !! end
20450
20451 !! test
20452 Gallery override link with absolute external link (T36852)
20453 !! options
20454 parsoid={
20455 "nativeGallery": true
20456 }
20457 !! wikitext
20458 <gallery>
20459 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
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="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>
20465 <div class="gallerytext">
20466 </div>
20467 </div></li>
20468 </ul>
20469
20470 !! html/parsoid
20471 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20472 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20473 </ul>
20474 !! end
20475
20476 !! test
20477 Gallery override link with absolute external link with LanguageConverter
20478 !! options
20479 language=zh
20480 !! input
20481 <gallery>
20482 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20483 </gallery>
20484 !! result
20485 <ul class="gallery mw-gallery-traditional">
20486 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20487 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="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>
20488 <div class="gallerytext">
20489 <p>caption
20490 </p>
20491 </div>
20492 </div></li>
20493 </ul>
20494
20495 !! end
20496
20497 !! test
20498 Gallery override link with malicious javascript (T36852)
20499 !! options
20500 parsoid={
20501 "modes": ["wt2html", "html2html"],
20502 "nativeGallery": true
20503 }
20504 !! wikitext
20505 <gallery>
20506 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20507 </gallery>
20508 !! html/php
20509 <ul class="gallery mw-gallery-traditional">
20510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20511 <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>
20512 <div class="gallerytext">
20513 </div>
20514 </div></li>
20515 </ul>
20516
20517 !! html/parsoid
20518 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20519 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20520 </ul>
20521 !! end
20522
20523 # Note that parsoid uses the invalid link as a caption, PHP does not.
20524 !! test
20525 Gallery with invalid title as link (T45964)
20526 !! options
20527 parsoid={
20528 "modes": ["wt2html", "html2html"],
20529 "nativeGallery": true
20530 }
20531 !! wikitext
20532 <gallery>
20533 File:Foobar.jpg|link=<
20534 </gallery>
20535 !! html/php
20536 <ul class="gallery mw-gallery-traditional">
20537 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20538 <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>
20539 <div class="gallerytext">
20540 </div>
20541 </div></li>
20542 </ul>
20543
20544 !! html/parsoid
20545 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20546 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext">link=&lt;</div></li>
20547 </ul>
20548 !! end
20549
20550 !! test
20551 Serialize gallery without attrs in data-mw
20552 !! options
20553 parsoid={
20554 "modes": ["html2wt"],
20555 "nativeGallery": true
20556 }
20557 !! html/parsoid
20558 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20559 <li class="gallerycaption">123</li>
20560 <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>
20561 </ul>
20562 !! wikitext
20563 <gallery caption="123">
20564 File:Test.png
20565 </gallery>
20566 !! end
20567
20568 !! test
20569 Gallery with class and style attributes
20570 !! options
20571 parsoid={
20572 "nativeGallery": true
20573 }
20574 !! wikitext
20575 <gallery class="center" style="text-align: center;">
20576 File:Foobar.jpg
20577 </gallery>
20578 !! html/php
20579 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20580 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20581 <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>
20582 <div class="gallerytext">
20583 </div>
20584 </div></li>
20585 </ul>
20586
20587 !! html/parsoid
20588 <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":{}}'>
20589 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20590 </ul>
20591 !! end
20592
20593 !! test
20594 Gallery in slideshow mode
20595 !! options
20596 parsoid={
20597 "nativeGallery": true
20598 }
20599 !! wikitext
20600 <gallery mode="slideshow" showthumbnails="">
20601 File:Foobar.jpg
20602 </gallery>
20603 !! html/php
20604 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20606 <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>
20607 <div class="gallerytext">
20608 </div>
20609 </div></li>
20610 </ul>
20611
20612 !! html/parsoid
20613 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20614 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><span 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></span></div><div class="gallerytext"></div></li>
20615 </ul>
20616 !! end
20617
20618 !! test
20619 HTML Hex character encoding (spells the word "JavaScript")
20620 !! options
20621 parsoid=wt2html,wt2wt,html2html
20622 !! wikitext
20623 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20624 !! html/php
20625 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20626 </p>
20627 !! html/php+tidy
20628 <p>JavaScript</p>
20629 !! html/parsoid
20630 <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>
20631 !! end
20632
20633 !! test
20634 HTML Hex character encoding bogus encoding (T28437 regression check)
20635 !! wikitext
20636 &#xsee;&#XSEE;
20637 !! html/php
20638 <p>&amp;#xsee;&amp;#XSEE;
20639 </p>
20640 !! html/parsoid
20641 <p>&amp;#xsee;&amp;#XSEE;</p>
20642 !! end
20643
20644 !! test
20645 HTML Hex character encoding mixed case
20646 !! options
20647 parsoid=wt2html,wt2wt,html2html
20648 !! wikitext
20649 &#xEE;&#Xee;
20650 !! html/php
20651 <p>&#xee;&#xee;
20652 </p>
20653 !! html/php+tidy
20654 <p>îî</p>
20655 !! html/parsoid
20656 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20657 !! end
20658
20659 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20660 # Note that U+000C (form feed) is not a valid XML character, so
20661 # it is banned even though allowed in HTML5.
20662 !! test
20663 Illegal character references (T106578)
20664 !! wikitext
20665 ; Null: &#00;
20666 ; FF: &#xC;
20667 ; CR: &#xD;
20668 ; Control (low): &#8;
20669 ; Control (high): &#x7F; &#x9F;
20670 ; Surrogate: &#xD83D;&#xDCA9;
20671 ; This is an okay astral character: &#x1F4A9;
20672 !! html+tidy
20673 <dl>
20674 <dt>Null</dt>
20675 <dd>&amp;#00;</dd>
20676 <dt>FF</dt>
20677 <dd>&amp;#xC;</dd>
20678 <dt>CR</dt>
20679 <dd>&amp;#xD;</dd>
20680 <dt>Control (low)</dt>
20681 <dd>&amp;#8;</dd>
20682 <dt>Control (high)</dt>
20683 <dd>&amp;#x7F; &amp;#x9F;</dd>
20684 <dt>Surrogate</dt>
20685 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20686 <dt>This is an okay astral character</dt>
20687 <dd>💩</dd>
20688 </dl>
20689 !! end
20690
20691 !! test
20692 __FORCETOC__ override
20693 !! wikitext
20694 __NEWSECTIONLINK__
20695 __FORCETOC__
20696 !! html/php
20697 <p><br />
20698 </p>
20699 !! end
20700
20701 !! test
20702 ISBN code coverage
20703 !! wikitext
20704 ISBN 978-0-1234-56&#x20;789
20705 !! html
20706 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20707 </p>
20708 !! html+tidy
20709 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20710 !! html/parsoid
20711 <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>
20712 !! end
20713
20714 !! test
20715 ISBN followed by 5 spaces
20716 !! wikitext
20717 ISBN
20718 !! html
20719 <p>ISBN
20720 </p>
20721 !! end
20722
20723 !! test
20724 Double ISBN
20725 !! wikitext
20726 ISBN ISBN 1234567890
20727 !! html/php
20728 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20729 </p>
20730 !! html/parsoid
20731 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20732 !! end
20733
20734 # Uppercase X and lowercase x as well
20735 !! test
20736 ISBN with an X
20737 !! wikitext
20738 ISBN 3-462-04561-X
20739 ISBN 3-462-04561-x
20740 ISBN 080442957X
20741 ISBN 080442957x
20742 ISBN 978080442957X
20743 ISBN 978080442957x
20744 !! html/php
20745 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20746 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20747 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20748 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20749 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20750 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20751 </p>
20752 !! html/parsoid
20753 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20754 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20755 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20756 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20757 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20758 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20759 !! end
20760
20761 !! test
20762 ISBN with empty prefix (parsoid test)
20763 !! wikitext
20764 ISBN 1234567890
20765 !! html/php
20766 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20767 </p>
20768 !! html/parsoid
20769 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20770 !! end
20771
20772 !! test
20773 T24905: <abbr> followed by ISBN followed by </a>
20774 !! wikitext
20775 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20776 !! html/php
20777 <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>
20778 </p>
20779 !! html/parsoid
20780 <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" href="http://www.example.com">example.com</a></p>
20781 !! end
20782
20783 !! test
20784 Double RFC
20785 !! wikitext
20786 RFC RFC 1234
20787 !! html
20788 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20789 </p>
20790 !! end
20791
20792 !! test
20793 Double RFC with a wiki link
20794 !! wikitext
20795 RFC [[RFC 1234]]
20796 !! html
20797 <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>
20798 </p>
20799 !! end
20800
20801 !! test
20802 RFC code coverage
20803 !! wikitext
20804 RFC 983&#x20;987
20805 !! html
20806 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20807 </p>
20808 !! html+tidy
20809 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20810 !! end
20811
20812 !! test
20813 Centre-aligned image
20814 !! wikitext
20815 [[Image:foobar.jpg|centre]]
20816 !! html
20817 <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>
20818
20819 !!end
20820
20821 !! test
20822 None-aligned image
20823 !! wikitext
20824 [[Image:foobar.jpg|none]]
20825 !! html
20826 <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>
20827
20828 !!end
20829
20830 !! test
20831 Width + Height sized image (using px) (height is ignored)
20832 !! wikitext
20833 [[Image:foobar.jpg|640x480px]]
20834 !! html
20835 <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>
20836 </p>
20837 !!end
20838
20839 !! test
20840 Width-sized image (using px, no following whitespace)
20841 !! wikitext
20842 [[Image:foobar.jpg|640px]]
20843 !! html
20844 <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>
20845 </p>
20846 !!end
20847
20848 !! test
20849 Width-sized image (using px, with following whitespace - test regression from r39467)
20850 !! wikitext
20851 [[Image:foobar.jpg|640px ]]
20852 !! html
20853 <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>
20854 </p>
20855 !!end
20856
20857 !! test
20858 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20859 !! wikitext
20860 [[Image:foobar.jpg| 640px]]
20861 !! html
20862 <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>
20863 </p>
20864 !!end
20865
20866 !! test
20867 Image with page parameter
20868 !! options
20869 djvu
20870 !! wikitext
20871 [[File:LoremIpsum.djvu|page=2]]
20872 !! html/php
20873 <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>
20874 </p>
20875 !! html/parsoid
20876 <p><span 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></span></p>
20877 !! end
20878
20879 !! test
20880 Another italics / bold test
20881 !! wikitext
20882 ''' ''x'
20883 !! html
20884 <pre>'<i> </i>x'
20885 </pre>
20886 !!end
20887
20888 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20889 !! test
20890 dt/dd/dl test
20891 !! wikitext
20892 :;;;::
20893 !! html/php
20894 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20895
20896 !! html/parsoid
20897 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20898
20899 !!end
20900
20901 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20902 !! test
20903 Images with the "|" character in the comment
20904 !! wikitext
20905 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20906 !! html/php
20907 <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>
20908
20909 !! html/parsoid
20910 <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" 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>
20911 !! end
20912
20913 !! test
20914 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20915 !! wikitext
20916 <html><script>alert(1);</script></html>
20917 !! html
20918 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20919 </p>
20920 !! end
20921
20922 !! test
20923 HTML with raw HTML ($wgRawHtml==true)
20924 !! options
20925 wgRawHtml=1
20926 !! wikitext
20927 <html><script>alert(1);</script></html>
20928 !! html
20929 <p><script>alert(1);</script>
20930 </p>
20931 !! end
20932
20933 !! test
20934 Parents of subpages, one level up
20935 !! options
20936 subpage title=[[Subpage test/L1/L2/L3]]
20937 !! wikitext
20938 [[../|L2]]
20939 !! html
20940 <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>
20941 </p>
20942 !! end
20943
20944
20945 !! test
20946 Parents of subpages, one level up, not named
20947 !! options
20948 subpage title=[[Subpage test/L1/L2/L3]]
20949 !! wikitext
20950 [[../]]
20951 !! html
20952 <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>
20953 </p>
20954 !! end
20955
20956
20957
20958 !! test
20959 Parents of subpages, two levels up
20960 !! options
20961 subpage title=[[Subpage test/L1/L2/L3]]
20962 !! wikitext
20963 [[../../|L1]]2
20964
20965 [[../../|L1]]l
20966 !! html
20967 <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
20968 </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>
20969 </p>
20970 !! end
20971
20972 !! test
20973 Parents of subpages, two levels up, without trailing slash or name.
20974 !! options
20975 subpage title=[[Subpage test/L1/L2/L3]]
20976 !! wikitext
20977 [[../..]]
20978 !! html
20979 <p>[[../..]]
20980 </p>
20981 !! end
20982
20983 !! test
20984 Parents of subpages, two levels up, with lots of extra trailing slashes.
20985 !! options
20986 subpage title=[[Subpage test/L1/L2/L3]]
20987 !! wikitext
20988 [[../../////]]
20989 !! html
20990 <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>
20991 </p>
20992 !! end
20993
20994 !! article
20995 Subpage test/L1/L2/L3Sibling
20996 !! text
20997 Sibling article
20998 !! endarticle
20999
21000 !! test
21001 Transclusion of a sibling page (one level up)
21002 !! options
21003 subpage title=[[Subpage test/L1/L2/L3]]
21004 !! wikitext
21005 {{../L3Sibling}}
21006 !! html
21007 <p>Sibling article
21008 </p>
21009 !! end
21010
21011 !! test
21012 Transclusion of a child page
21013 !! options
21014 subpage title=[[Subpage test/L1/L2]]
21015 !! wikitext
21016 {{/L3Sibling}}
21017 !! html
21018 <p>Sibling article
21019 </p>
21020 !! end
21021
21022 # This is wt2html only in Parsoid because we add <nowiki>
21023 # because of {{..}} and we don't expect to fix that to
21024 # eliminate the nowikis selective for {{..}} markup.
21025 !! test
21026 Non-transclusion because of too many up levels
21027 !! options
21028 subpage title=[[Subpage test/L1/L2/L3]]
21029 parsoid=wt2html
21030 !! wikitext
21031 {{../../../../More than parent}}
21032 !! html/php
21033 <p>{{../../../../More than parent}}
21034 </p>
21035 !! html/parsoid
21036 <p>{{../../../../More than parent}}</p>
21037 !! end
21038
21039 !! test
21040 Definition list code coverage
21041 !! wikitext
21042 ; title : def
21043 ; title : def
21044 ;title: def
21045 !! html/php
21046 <dl><dt> title &#160;</dt>
21047 <dd> def</dd>
21048 <dt> title&#160;</dt>
21049 <dd> def</dd>
21050 <dt>title</dt>
21051 <dd> def</dd></dl>
21052
21053 !! html/parsoid
21054 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21055 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21056 <dt>title</dt><dd> def</dd></dl>
21057 !! end
21058
21059 !! test
21060 Don't fall for the self-closing div
21061 !! wikitext
21062 <div>hello world</div/>
21063 !! html
21064 <div>hello world</div>
21065
21066 !! end
21067
21068 !! test
21069 MSGNW magic word
21070 !! wikitext
21071 {{MSGNW:msg}}
21072 !! html/php
21073 <p>&#91;&#91;:Template:Msg&#93;&#93;
21074 </p>
21075 !! end
21076
21077 !! test
21078 RAW magic word
21079 !! wikitext
21080 {{RAW:QUERTY}}
21081 !! html
21082 <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>
21083 </p>
21084 !! end
21085
21086 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21087 !! test
21088 Always escape literal '>' in output, not just after '<'
21089 !! wikitext
21090 ><>
21091 !! html
21092 <p>&gt;&lt;&gt;
21093 </p>
21094 !! end
21095
21096 !! test
21097 Template caching
21098 !! wikitext
21099 {{Test}}
21100 {{Test}}
21101 !! html
21102 <p>This is a test template
21103 This is a test template
21104 </p>
21105 !! end
21106
21107
21108 !! article
21109 MediaWiki:Fake
21110 !! text
21111 ==header==
21112 !! endarticle
21113
21114 !! test
21115 Inclusion of !userCanEdit() content
21116 !! wikitext
21117 {{MediaWiki:Fake}}
21118 !! html
21119 <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>
21120
21121 !! end
21122
21123
21124 !! test
21125 Out-of-order TOC heading levels
21126 !! wikitext
21127 ==2==
21128 ======6======
21129 ===3===
21130 =1=
21131 =====5=====
21132 ==2==
21133 !! html
21134 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
21135 <ul>
21136 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21137 <ul>
21138 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21139 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21140 </ul>
21141 </li>
21142 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21143 <ul>
21144 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21145 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21146 </ul>
21147 </li>
21148 </ul>
21149 </div>
21150
21151 <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>
21152 <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>
21153 <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>
21154 <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>
21155 <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>
21156 <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>
21157
21158 !! end
21159
21160
21161 !! test
21162 ISBN with a dummy number
21163 !! wikitext
21164 ISBN ---
21165 !! html
21166 <p>ISBN ---
21167 </p>
21168 !! end
21169
21170
21171 !! test
21172 ISBN with space-delimited number
21173 !! wikitext
21174 ISBN 92 9017 032 8
21175 !! html/php
21176 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21177 </p>
21178 !! html/parsoid
21179 <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>
21180 !! end
21181
21182
21183 !! test
21184 ISBN with multiple spaces, no number
21185 !! wikitext
21186 ISBN foo
21187 !! html
21188 <p>ISBN foo
21189 </p>
21190 !! end
21191
21192
21193 !! test
21194 ISBN length
21195 !! wikitext
21196 ISBN 123456789
21197
21198 ISBN 1234567890
21199
21200 ISBN 12345678901
21201 !! html/php
21202 <p>ISBN 123456789
21203 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21204 </p><p>ISBN 12345678901
21205 </p>
21206 !! html/parsoid
21207 <p>ISBN 123456789</p>
21208
21209 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21210
21211 <p>ISBN 12345678901</p>
21212 !! end
21213
21214
21215 !! test
21216 ISBN with trailing year (T9110)
21217 !! wikitext
21218 ISBN 1-234-56789-0 - 2006
21219
21220 ISBN 1 234 56789 0 - 2006
21221 !! html/php
21222 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21223 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21224 </p>
21225 !! html/parsoid
21226 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21227
21228 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21229 !! end
21230
21231
21232 !! test
21233 anchorencode
21234 !! wikitext
21235 {{anchorencode:foo bar©#%n}}
21236 !! html
21237 <p>foo_bar.C2.A9.23.25n
21238 </p>
21239 !! end
21240
21241 !! test
21242 anchorencode trims spaces
21243 !! wikitext
21244 {{anchorencode: __pretty__please__}}
21245 !! html
21246 <p>pretty_please
21247 </p>
21248 !! end
21249
21250 !! test
21251 anchorencode deals with links
21252 !! wikitext
21253 {{anchorencode: [[hello|world]] [[hi]]}}
21254 !! html
21255 <p>world_hi
21256 </p>
21257 !! end
21258
21259 !! test
21260 anchorencode deals with templates
21261 !! wikitext
21262 {{anchorencode: {{Foo}} }}
21263 !! html
21264 <p>FOO
21265 </p>
21266 !! end
21267
21268 !! test
21269 anchorencode encodes like the TOC generator: (T20431)
21270 !! wikitext
21271 === _ +:.3A%3A&&amp;]] ===
21272 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21273 __NOEDITSECTION__
21274 !! html
21275 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21276 <p>.2B:.3A.253A.26.26.5D.5D
21277 </p>
21278 !! end
21279
21280 !! test
21281 T8200: blockquotes and paragraph formatting
21282 !! wikitext
21283 <blockquote>
21284 foo
21285 </blockquote>
21286
21287 bar
21288
21289 baz
21290 !! html
21291 <blockquote>
21292 <p>foo
21293 </p>
21294 </blockquote>
21295 <p>bar
21296 </p>
21297 <pre>baz
21298 </pre>
21299 !! end
21300
21301 !! test
21302 T10293: Use of center tag ruins paragraph formatting
21303 !! wikitext
21304 <center>
21305 foo
21306 </center>
21307
21308 bar
21309
21310 baz
21311 !! html
21312 <center>
21313 <p>foo
21314 </p>
21315 </center>
21316 <p>bar
21317 </p>
21318 <pre>baz
21319 </pre>
21320 !! end
21321
21322 !!test
21323 Parsing of overlapping (improperly nested) inline html tags
21324 !! wikitext
21325 <span><s>x</span></s>
21326 !! html/php
21327 <p><span><s>x&lt;/span&gt;</s></span>
21328 </p>
21329 !! html/parsoid
21330 <p><span><s>x</s></span>
21331 </p>
21332 !!end
21333
21334 ###
21335 ### Language variants related tests
21336 ###
21337
21338 # Parsoid does not mark self-links.
21339 # Parsoid does not convert links; PHP will do any necessary redirects.
21340
21341 !! test
21342 Self-link in language variants
21343 !! options
21344 title=[[Dunav]] language=sr
21345 !! wikitext
21346 Both [[Dunav]] and [[Дунав]] are names for this river.
21347 !! html/php
21348 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21349 </p>
21350 !! html/parsoid
21351 <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>
21352 !! end
21353
21354 !! article
21355 Дуна
21356 !! text
21357 content
21358 !! endarticle
21359
21360 !! test
21361 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21362 !! options
21363 title=[[Duna]] language=sr
21364 !! wikitext
21365 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21366 !! html/php
21367 <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.
21368 </p>
21369 !! html/parsoid
21370 <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>
21371 !! end
21372
21373 !! test
21374 Link to a section of a variant of this title shouldn't be parsed as self-link
21375 !! options
21376 title=[[Duna]] language=sr
21377 !! wikitext
21378 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21379 !! html/php
21380 <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.
21381 </p>
21382 !! html/parsoid
21383 <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>
21384 !! end
21385
21386 !! test
21387 Link to pages in language variants
21388 !! options
21389 language=sr
21390 !! wikitext
21391 Main Page can be written as [[Маин Паге]]
21392 !! html/php
21393 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21394 </p>
21395 !! html/parsoid
21396 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21397 !! end
21398
21399
21400 !! test
21401 Multiple links to pages in language variants
21402 !! options
21403 language=sr
21404 !! wikitext
21405 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21406 !! html/php
21407 <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>.
21408 </p>
21409 !! html/parsoid
21410 <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>
21411 !! end
21412
21413
21414 !! test
21415 Simple template in language variants
21416 !! options
21417 language=sr
21418 !! wikitext
21419 {{тест}}
21420 !! html/php
21421 <p>This is a test template
21422 </p>
21423 !! end
21424
21425
21426 !! test
21427 Template with explicit namespace in language variants
21428 !! options
21429 language=sr
21430 !! wikitext
21431 {{Template:тест}}
21432 !! html/php
21433 <p>This is a test template
21434 </p>
21435 !! end
21436
21437
21438 !! test
21439 Basic test for template parameter in language variants
21440 !! options
21441 language=sr
21442 !! wikitext
21443 {{парамтест|param=foo}}
21444 !! html/php
21445 <p>This is a test template with parameter foo
21446 </p>
21447 !! end
21448
21449 !! test
21450 Simple category in language variants
21451 !! options
21452 language=sr cat
21453 !! wikitext
21454 [[Category:МедиаWики Усер'с Гуиде]]
21455 !! html/php
21456 cat=МедиаWики_Усер'с_Гуиде sort=
21457 !! html/parsoid
21458 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21459 !! end
21460
21461 !! article
21462 Category:分类
21463 !! text
21464 blah
21465 !! endarticle
21466
21467 !! article
21468 Category:分類
21469 !! text
21470 blah
21471 !! endarticle
21472
21473 ## We used to, but no longer wt2wt this test since the default serializer
21474 ## will normalize all categories to serialize on their own line.
21475 ## This wikitext usage is going to be fairly uncommon in production and
21476 ## selser will take care of preserving formatting in those scenarios.
21477 !! test
21478 Don't convert blue categorylinks to another variant (T35210)
21479 !! options
21480 cat
21481 language=zh
21482 parsoid=wt2html
21483 !! wikitext
21484 [[A]][[Category:分类]]
21485 !! html/php
21486 cat=分类 sort=
21487 !! html/parsoid
21488 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21489 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21490 !! end
21491
21492 !! test
21493 Stripping -{}- tags (language variants)
21494 !! options
21495 language=sr
21496 !! wikitext
21497 Latin proverb: -{Ne nuntium necare}-
21498 !! html/php
21499 <p>Latin proverb: Ne nuntium necare
21500 </p>
21501 !! html/parsoid
21502 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21503 !! end
21504
21505
21506 !! test
21507 Prevent conversion with -{}- tags (language variants)
21508 !! options
21509 language=sr variant=sr-ec
21510 !! wikitext
21511 Latinski: -{Ne nuntium necare}-
21512 !! html/php
21513 <p>Латински: Ne nuntium necare
21514 </p>
21515 !! html/parsoid
21516 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21517 !! end
21518
21519
21520 !! test
21521 Prevent conversion of text with -{}- tags (language variants)
21522 !! options
21523 language=sr variant=sr-ec
21524 !! wikitext
21525 Latinski: -{Ne nuntium necare}-
21526 !! html/php
21527 <p>Латински: Ne nuntium necare
21528 </p>
21529 !! html/parsoid
21530 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21531 !! end
21532
21533
21534 !! test
21535 Prevent conversion of links with -{}- tags (language variants)
21536 !! options
21537 language=sr variant=sr-ec
21538 !! wikitext
21539 -{[[Main Page]]}-
21540 !! html/php
21541 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21542 </p>
21543 !! html/parsoid
21544 <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>
21545 !! end
21546
21547
21548 !! test
21549 -{}- tags within headlines (within html for parserConvert())
21550 !! options
21551 language=sr variant=sr-ec
21552 !! wikitext
21553 == -{Naslov}- ==
21554
21555 Note that even an unprotected headline ID is not affected by language
21556 conversion:
21557
21558 == Latinski ==
21559 !! html/php
21560 <h2><span class="mw-headline" id="-.7BNaslov.7D-">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>
21561 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21562 цонверсион:
21563 </p>
21564 <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>
21565
21566 !! html/parsoid
21567 <h2 id="-.7BNaslov.7D-"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21568
21569 <p>Note that even an unprotected headline ID is not affected by language
21570 conversion:</p>
21571
21572 <h2 id="Latinski">Latinski</h2>
21573 !! end
21574
21575 !! test
21576 Explicit definition of language variant alternatives
21577 !! options
21578 language=zh variant=zh-tw
21579 !! wikitext
21580 -{zh:China;zh-tw:Taiwan}-, not China
21581 !! html/php
21582 <p>Taiwan, not China
21583 </p>
21584 !! html/parsoid
21585 <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>
21586 !! end
21587
21588 !! test
21589 Filter syntax for language variants
21590 !! options
21591 language=zh variant=zh-tw
21592 !! wikitext
21593 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21594 !! html/php
21595 <p>fooblog, WEBJOURNAL, WEBLOGquux
21596 </p>
21597 !! html/parsoid
21598 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21599 !! end
21600
21601 # Note that Parsoid post-processing for language variants needs to
21602 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21603 !! test
21604 Conversion around HTML tags
21605 !! options
21606 language=sr variant=sr-ec
21607 !! wikitext
21608 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21609 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21610 !! html/php
21611 <p>
21612 <span title="ЛаCтин">ски</span>
21613 </p>
21614 !! html/parsoid
21615 <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"}]}'/>
21616 <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>
21617 !! end
21618
21619 !! test
21620 Explicit session-wise two-way language variant mapping (A flag and - flag)
21621 !! options
21622 language=zh variant=zh-tw
21623 !! wikitext
21624 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21625
21626 Taiwan is not China.
21627
21628 But -{A|zh:China; zh-tw:Taiwan}- is China,
21629
21630 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21631
21632 and -{China}- is China.
21633 !! html/php
21634 <p>This is Taiwan, but we'll forget that now.
21635 </p><p>Taiwan is not China.
21636 </p><p>But Taiwan is Taiwan,
21637 </p><p>(This should be stripped!)
21638 </p><p>and China is China.
21639 </p>
21640 !! html/parsoid
21641 <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>
21642 <p>Taiwan is not China.</p>
21643 <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>
21644 <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>
21645 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21646 !! end
21647
21648 !! test
21649 Explicit session-wise one-way language variant mapping (A flag and - flag)
21650 !! options
21651 language=zh variant=zh-tw
21652 !! wikitext
21653 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21654
21655 COUNTRY is China or Taiwan.
21656
21657 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21658
21659 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21660
21661 and -{COUNTRY}- is COUNTRY.
21662 !! html/php
21663 <p>This is Taiwan, but we'll forget that now.
21664 </p><p>COUNTRY is China or Taiwan.
21665 </p><p>But Taiwan is Taiwan,
21666 </p><p>(This should be stripped!)
21667 </p><p>and COUNTRY is COUNTRY.
21668 </p>
21669 !! html/parsoid
21670 <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>
21671 <p>COUNTRY is China or Taiwan.</p>
21672 <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>
21673 <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>
21674 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21675 !! end
21676
21677 !! test
21678 Explicit session-wise two-way language variant mapping (H flag for hide)
21679 !! options
21680 language=zh variant=zh-tw
21681 !! wikitext
21682 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21683
21684 Taiwan is China.
21685 !! html/php
21686 <p>(This should be stripped!)
21687 </p><p>Taiwan is Taiwan.
21688 </p>
21689 !! html/parsoid
21690 <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>
21691 <p>Taiwan is China.</p>
21692 !! end
21693
21694 !! test
21695 Explicit session-wise one-way language variant mapping (H flag for hide)
21696 !! options
21697 language=zh variant=zh-tw
21698 !! wikitext
21699 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21700
21701 COUNTRY is Taiwan or China.
21702 !! html/php
21703 <p>(This should be stripped!)
21704 </p><p>Taiwan is Taiwan or China.
21705 </p>
21706 !! html/parsoid
21707 <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>
21708 <p>COUNTRY is Taiwan or China.</p>
21709 !! end
21710
21711 ## Note that parsoid test runner does not support 'showtitle' option.
21712 !! test
21713 Adding explicit conversion rule for title (T flag)
21714 !! options
21715 language=zh variant=zh-tw showtitle
21716 !! wikitext
21717 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21718
21719 Taiwan is China.
21720 !! html/php
21721 Taiwan
21722 <p>Should be stripped!
21723 </p><p>Taiwan is China.
21724 </p>
21725 !! html/parsoid
21726 <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>
21727 <p>Taiwan is China.</p>
21728 !! end
21729
21730 !! test
21731 Code coverage: T combined with H flag
21732 !! options
21733 language=zh variant=zh-tw showtitle
21734 !! wikitext
21735 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
21736
21737 Taiwan is China.
21738 !! html/php
21739 Taiwan
21740 <p>Should be stripped!
21741 </p><p>Taiwan is Taiwan.
21742 </p>
21743 !! html/parsoid
21744 <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>
21745 <p>Taiwan is China.</p>
21746 !! end
21747
21748 !! test
21749 Code coverage: T with no variants
21750 !! options
21751 language=zh variant=zh-tw showtitle
21752 !! wikitext
21753 -{H|zh:China; zh-tw:Taiwan}-
21754 Taiwan is China.-{T|Taiwan is China}-
21755 !! html/php
21756 Taiwan is China
21757 <p>
21758 Taiwan is Taiwan.
21759 </p>
21760 !! html/parsoid
21761 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21762 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
21763 !! end
21764
21765 !! test
21766 Code coverage: rules with no variants
21767 !! options
21768 language=zh variant=zh-tw
21769 !! wikitext
21770 -{H|zh:China; zh-tw:Taiwan}-
21771 Taiwan is China.
21772 -{H|China}-
21773 Taiwan is China.
21774 !! html/php
21775 <p>
21776 Taiwan is Taiwan.
21777
21778 Taiwan is China.
21779 </p>
21780 !! html/parsoid
21781 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21782 Taiwan is China.
21783 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
21784 Taiwan is China.</p>
21785 !! end
21786
21787
21788 !! test
21789 Code coverage: D flag for conversion rule
21790 !! options
21791 language=zh variant=zh-tw
21792 !! wikitext
21793 -{D|zh-cn:XA; zh-tw:YA}-
21794 -{A;D|zh-cn:XB; zh-tw:YB}-
21795 -{D;H|zh-cn:XC; zh-tw:YC}-
21796
21797 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
21798
21799 -{D|0=>zh-tw:1}-
21800 -{A;D|2=>zh-tw:3}-
21801 -{D;H|4=>zh-tw:5}-
21802
21803 XA XB XC YA YB YC FOO BAR BAT 012345
21804 !! html/php
21805 <p>大陆:XA;台灣:YA;
21806
21807 大陆:XC;台灣:YC;
21808 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
21809 </p><p>0⇒台灣:1;
21810
21811 4⇒台灣:5;
21812 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
21813 </p>
21814 !! html/parsoid
21815 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
21816 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
21817 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
21818 <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>
21819 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
21820 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
21821 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
21822 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
21823 !! end
21824
21825 !! test
21826 Code coverage: N flag for conversion rule
21827 !! options
21828 language=zh variant=zh-cn
21829 !! wikitext
21830 -{N|zh-cn}-
21831
21832 -{N|zh-tw}-
21833
21834 -{N|sr-ec}-
21835 !! html/php
21836 <p>大陆
21837 </p><p>台灣
21838 </p><p>српски (ћирилица)‎
21839 </p>
21840 !! html/parsoid
21841 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
21842 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
21843 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
21844 !! end
21845
21846 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
21847 !! test
21848 Code coverage: N flag for conversion rule (wt2html only)
21849 !! options
21850 language=zh variant=zh-cn
21851 parsoid=wt2html,html2html
21852 !! wikitext
21853 -{D;N|en}-
21854 !! html/php
21855 <p>English
21856 </p>
21857 !! html/parsoid
21858 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
21859 !! end
21860
21861 !! test
21862 Testing that changing the language variant here in the tests actually works
21863 !! options
21864 language=zh variant=zh showtitle
21865 !! wikitext
21866 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21867 !! html/php
21868 China
21869 <p>Should be stripped!
21870 </p>
21871 !! html/parsoid
21872 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
21873 !! end
21874
21875 !! test
21876 Recursive conversion of alt and title attrs shouldn't clear converter state
21877 !! options
21878 language=zh variant=zh-cn
21879 showtitle
21880 !! wikitext
21881 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
21882 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
21883 !! html/php
21884 China
21885 <p>
21886 Should be stripped<span title="Exclamation">!</span>
21887 </p>
21888 !! html/parsoid
21889 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
21890 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>
21891 !! end
21892
21893 !! test
21894 T26072: more test on conversion rule for title
21895 !! options
21896 language=zh variant=zh-tw showtitle
21897 !! wikitext
21898 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21899
21900 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
21901 !! html/php
21902 Taiwan
21903 <p>This should be stripped!
21904 </p><p>This won't take interferes with the title rule.
21905 </p>
21906 !! html/parsoid
21907 <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>
21908 <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>
21909 !! end
21910
21911 !! test
21912 Partly disable title conversion if variant == main language code
21913 !! options
21914 language=zh variant=zh title=[[ZH]] showtitle
21915 !! wikitext
21916 -{T|zh-cn:CN;zh-tw:TW}-
21917 !! html/php
21918 ZH
21919 <p>
21920 </p>
21921 !! html/parsoid
21922 <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>
21923 !! end
21924
21925 !! test
21926 Partly disable title conversion if variant == main language code, more
21927 !! options
21928 language=zh variant=zh title=[[ZH]] showtitle
21929 !! wikitext
21930 -{T|TW}-
21931 !! html/php
21932 ZH
21933 <p>
21934 </p>
21935 !! html/parsoid
21936 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
21937 !! end
21938
21939 !! test
21940 Raw output of variant escape tags (R flag)
21941 !! options
21942 language=zh variant=zh-tw
21943 !! wikitext
21944 Raw: -{R|zh:China;zh-tw:Taiwan}-
21945 !! html/php
21946 <p>Raw: zh:China;zh-tw:Taiwan
21947 </p>
21948 !! html/parsoid
21949 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
21950 !! end
21951
21952 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
21953 !! test
21954 Raw output of variant escape tags (R flag) (wt2html only)
21955 !! options
21956 language=zh variant=zh-tw
21957 parsoid=wt2html,html2html
21958 !! wikitext
21959 -{Variant}- -{D|syntax}- -{D;R|options}-
21960 !! html/php
21961 <p>Variant syntax options
21962 </p>
21963 !! html/parsoid
21964 <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>
21965 !! end
21966
21967 !! test
21968 Nested markup inside raw output of variant escape tags (R flag)
21969 !! options
21970 language=zh variant=zh-tw
21971 !! wikitext
21972 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21973 !! html/php
21974 <p>Nested raw: nested Taiwan nested
21975 </p>
21976 !! html/parsoid
21977 <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>
21978 !! end
21979
21980 !! test
21981 Nested markup and spaces inside raw output of variant escape tags (R flag)
21982 !! options
21983 language=zh variant=zh-tw
21984 !! wikitext
21985 X-{ outer -{ inner }- outer }-X
21986 !! html/php
21987 <p>X outer inner outer X
21988 </p>
21989 !! html/parsoid
21990 <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>
21991 !! end
21992
21993 !! test
21994 Templates inside raw output of variant escape tags (R flag)
21995 !! options
21996 language=zh variant=zh-tw
21997 !! wikitext
21998 Nested raw: -{R|nested {{echo|hi}} templates}-
21999 !! html/php
22000 <p>Nested raw: nested hi templates
22001 </p>
22002 !! html/parsoid
22003 <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>
22004 !! end
22005
22006 !! test
22007 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22008 !! options
22009 language=zh variant=zh-cn
22010 !! input
22011 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22012 !! html/php
22013 <p>0
22014 </p>
22015 !! html/parsoid
22016 <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>
22017 !! end
22018
22019 !! test
22020 Conversion rules from [numeric-only string] to [something else] (T48634)
22021 !! options
22022 language=zh variant=zh-cn
22023 !! input
22024 -{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
22025 !! html/php
22026 <p>D12345EE12345
22027 </p>
22028 !! html/parsoid
22029 <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>
22030 !! end
22031
22032 !! test
22033 Two-way converter rule entries with an empty value should be ignored (T53551)
22034 !! options
22035 language=zh variant=zh-cn
22036 !! input
22037 -{H|zh-cn:foo;zh-tw:;}-foobar
22038 !! html/php
22039 <p>foobar
22040 </p>
22041 !! html/parsoid
22042 <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>
22043 !! end
22044
22045 !! test
22046 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22047 !! options
22048 language=zh variant=zh-cn
22049 !! input
22050 -{H|=>zh-cn:foo;}-foobar
22051 !! html/php
22052 <p>foobar
22053 </p>
22054 !! html/parsoid
22055 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22056 !! end
22057
22058 !! test
22059 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22060 !! options
22061 language=zh variant=zh-cn
22062 !! input
22063 -{H|}-foobar
22064 !! html/php
22065 <p>foobar
22066 </p>
22067 !! html/parsoid
22068 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22069 !! end
22070
22071 !! test
22072 Nested using of manual convert syntax
22073 !! options
22074 language=zh variant=zh-hk
22075 !! wikitext
22076 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22077 !! html/php
22078 <p>Nested: Hello Hong Kong!
22079 </p>
22080 !! html/parsoid
22081 <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=&#39;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&#39;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;#39;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;#39;>&amp;lt;/span>ong\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&#39;>&lt;/span>"}]}'></span>!</p>
22082 !! end
22083
22084 !! test
22085 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22086 !! options
22087 language=zh variant=zh-cn
22088 !! wikitext
22089 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22090 !! html/php
22091 <p><span title="X">A</span>
22092 </p>
22093 !! html/parsoid
22094 <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;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&amp;#39;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22095 !! end
22096
22097 !! test
22098 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22099 !! options
22100 language=zh variant=zh-cn
22101 !! wikitext
22102 -{<span title="-{X}-">A</span>}-
22103 !! html/php+disabled
22104 <p><span title="X">A</span>
22105 </p>
22106 !! html/parsoid
22107 <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;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;#39; data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&amp;#39;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
22108 !! end
22109
22110 # Parsoid and PHP disagree on how to parse this example: Parsoid
22111 # insists that the content of a language converter element be a valid
22112 # DOM fragment or attribute string
22113 !! test
22114 Language converter markup with block content
22115 !! options
22116 language=zh variant=zh-cn
22117 !! wikitext
22118 <span>a-{b<div>c}-d
22119
22120 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22121
22122 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22123 !! html/php+tidy
22124 <p><span>ab</span></p>
22125 <div><span>cd <span>ab</span></span>
22126 <div><span>cd <span>ad</span></span></div>
22127 </div>
22128 !! html/parsoid
22129 <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>
22130
22131 <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>
22132
22133 <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>
22134 !! end
22135
22136 !! test
22137 LanguageConverter selser (1)
22138 !! options
22139 language=zh variant=zh-cn
22140 parsoid={
22141 "modes": ["wt2wt", "selser"],
22142 "changes": [
22143 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22144 ]
22145 }
22146 !! wikitext
22147 -{raw}-
22148 !! wikitext/edited
22149 -{edited}-
22150 !! end
22151
22152 !! test
22153 LanguageConverter selser (2)
22154 !! options
22155 language=zh variant=zh-cn
22156 parsoid={
22157 "modes": ["wt2wt", "selser"],
22158 "changes": [
22159 ["span[class='x']", "contents", "text", "-{foo}-"],
22160 ["a", "contents", "text", "-{"],
22161 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22162 ]
22163 }
22164 !! wikitext
22165 <span class="x">TEXT1</span>
22166 [http://example.com TEXT2]
22167 [[Foo|TEXT3]]
22168 {{echo|TEXT4}}
22169 !! wikitext/edited
22170 <span class="x"><nowiki>-{foo}-</nowiki></span>
22171 [http://example.com -{]
22172 [[Foo|<nowiki>-{</nowiki>]]
22173 {{1x|<nowiki>-{</nowiki>}}
22174 !! end
22175
22176 # Tests LanguageVariantText in ConstrainedText
22177 !! test
22178 LanguageConverter selser (3)
22179 !! options
22180 language=zh variant=zh-cn
22181 parsoid={
22182 "modes": ["wt2wt", "selser"],
22183 "changes": [
22184 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22185 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22186 ]
22187 }
22188 !! wikitext
22189 {|
22190 |-
22191 |<span>Foo</span>
22192 |}
22193 !! wikitext/edited
22194 {|
22195 |-
22196 |<nowiki/>-{edited}-
22197 |}
22198 !! end
22199
22200 # Tests LanguageVariantText._fromSelser
22201 !! test
22202 LanguageConverter selser (4)
22203 !! options
22204 language=zh variant=zh-cn
22205 parsoid={
22206 "modes": ["wt2wt", "selser"],
22207 "changes": [
22208 ["td > span.x", "remove"]
22209 ]
22210 }
22211 !! wikitext
22212 {|
22213 |-
22214 |<span class="x">Foo</span>-{Bar}-
22215 ||<span class="x">Foo</span>-{Bar}-
22216 |}
22217 !! wikitext/edited
22218 {|
22219 |-
22220 |<nowiki/>-{Bar}-
22221 ||-{Bar}-
22222 |}
22223 !! end
22224
22225 # Since Parsoid is starting to emit canonical wikitext for links,
22226 # [http://example.com http://example.com] will not RT back to that
22227 # form anymore.
22228 # Parsoid does not language-convert links (it is done in a
22229 # post-processing step)
22230 !! test
22231 Proper conversion of text in external links
22232 !! options
22233 language=sr variant=sr-ec
22234 parsoid=wt2html
22235 !! wikitext
22236 http://www.google.com
22237 gopher://www.google.com
22238 [http://www.google.com http://www.google.com]
22239 [gopher://www.google.com gopher://www.google.com]
22240 [https://www.google.com irc://www.google.com]
22241 [ftp://www.google.com www.google.com/ftp://dir]
22242 [//www.google.com www.google.com]
22243 !! html/php
22244 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22245 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22246 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22247 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22248 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22249 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22250 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22251 </p>
22252 !! html/parsoid
22253 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22254 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22255 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22256 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22257 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
22258 <a rel="mw:ExtLink" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22259 <a rel="mw:ExtLink" href="//www.google.com">www.google.com</a></p>
22260 !! end
22261
22262 !! test
22263 Do not convert roman numbers to language variants
22264 !! options
22265 language=sr variant=sr-ec
22266 !! wikitext
22267 Fridrih IV je car.
22268 !! html/php
22269 <p>Фридрих IV је цар.
22270 </p>
22271 !! html/parsoid
22272 <p>Fridrih IV je car.</p>
22273 !! end
22274
22275 !! test
22276 Unclosed language converter markup "-{"
22277 !! options
22278 language=sr
22279 !! wikitext
22280 -{T|hello
22281 !! html
22282 <p>-{T|hello
22283 </p>
22284 !! end
22285
22286 !! test
22287 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22288 !! options
22289 language=sr
22290 !! wikitext
22291 -{R|=&gt;}-
22292 !! html/php
22293 <p>=&gt;
22294 </p>
22295 !! html/parsoid
22296 <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>
22297 !!end
22298
22299 !! test
22300 Don't break link parsing if language converter markup is in the caption.
22301 !! options
22302 language=sr variant=sr-ec
22303 !! wikitext
22304 [[Main Page|-{R|main page}-]]
22305 !! html/php
22306 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22307 </p>
22308 !! html/parsoid
22309 <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>
22310 !! end
22311
22312 !! test
22313 T146304: Don't break template parsing if language converter markup is in the parameter.
22314 !! options
22315 language=sr variant=sr-ec
22316 !! wikitext
22317 {{echo|-{R|foo}-}}
22318 !! html/php
22319 <p>foo
22320 </p>
22321 !! html/parsoid
22322 <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>
22323 !! end
22324
22325 !! test
22326 T146305: Don't break image parsing if language converter markup is in the caption.
22327 !! options
22328 language=sr
22329 !! wikitext
22330 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22331 !! html/php
22332 <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>
22333
22334 !! html/parsoid
22335 <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>
22336 !! end
22337
22338 !! test
22339 T146305: Don't break image parsing if nested language converter markup is in the caption.
22340 !! options
22341 language=zh variant=zh-cn
22342 !! wikitext
22343 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22344 !! html/php
22345 <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>
22346
22347 !! html/parsoid
22348 <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>
22349 !! end
22350
22351 # XXX html2wt disabled because rich markup in alt is not preserved.
22352 !! test
22353 Don't break gallery if language converter markup is inside.
22354 !! options
22355 language=zh
22356 !! wikitext
22357 <gallery>
22358 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22359 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22360 </gallery>
22361 !! html/php
22362 <ul class="gallery mw-gallery-traditional">
22363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22364 <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>
22365 <div class="gallerytext">
22366 <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>
22367 </p>
22368 </div>
22369 </div></li>
22370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22371 <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>
22372 <div class="gallerytext">
22373 <p>This is a test template
22374 </p>
22375 </div>
22376 </div></li>
22377 </ul>
22378
22379 !! html/parsoid
22380 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" 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"}}'>
22381 <li class="gallerybox">
22382 <div class="thumb"><span 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></span></div>
22383 <div class="gallerytext"><span 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></span></div>
22384 </li>
22385 <li class="gallerybox">
22386 <div class="thumb"><span 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></span></div>
22387 <div class="gallerytext"><span 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>
22388 </li>
22389 </ul>
22390 !! end
22391
22392 !! test
22393 T153135: Don't break list handling if language converter markup is in the item.
22394 !! options
22395 language=zh variant=zh-cn
22396 !! wikitext
22397 ;-{zh-cn:AAA;zh-tw:BBB}-
22398 ;-{R|foo:bar}-
22399 !! html/php
22400 <dl><dt>AAA</dt>
22401 <dt>foo:bar</dt></dl>
22402
22403 !! html/parsoid
22404 <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>
22405 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22406 </dl>
22407 !! end
22408
22409 // Note that parsoid does not protect colons unless language converter
22410 // markup is properly nested, because it is a backtracking parser.
22411 !! test
22412 T153135: Unclosed markup in definition list (code coverage)
22413 !! options
22414 language=zh variant=zh-cn
22415 !! wikitext
22416 ;<b>foo:bar
22417 ;-{zh-cn:AAA
22418 !! html/php+tidy
22419 <dl>
22420 <dt><b>foo:bar</b></dt>
22421 <dt><b>-{zh-cn:AAA</b></dt>
22422 </dl>
22423 !! html/parsoid
22424 <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}'>
22425 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22426 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22427 </b></dl>
22428 !! end
22429
22430 !! test
22431 T153135: Nested language converter markup in definition list (code coverage)
22432 !! options
22433 language=zh variant=zh-cn
22434 !! wikitext
22435 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22436 !! html/php
22437 <dl><dt>AAA foo:bar bat:baz</dt>
22438 <dd>def</dd></dl>
22439
22440 !! html/parsoid
22441 <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>
22442 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22443 </dl>
22444 !! end
22445
22446 # html2wt mode disabled due to <nowiki> insertion.
22447 !! test
22448 T153140: Don't break table handling if language converter markup is in the cell.
22449 !! options
22450 language=sr variant=sr-ec
22451 parsoid=wt2html,wt2wt,html2html
22452 !! wikitext
22453 {|
22454 |-
22455 | -{R|B}-
22456 |}
22457 !! html/php
22458 <table>
22459
22460 <tr>
22461 <td> B
22462 </td></tr></table>
22463
22464 !! html/parsoid
22465 <table>
22466 <tbody>
22467 <tr>
22468 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22469 </tr>
22470 </tbody>
22471 </table>
22472 !! end
22473
22474 !! test
22475 Language converter tricky html2wt cases (1)
22476 !! options
22477 language=sr
22478 parsoid=html2wt,wt2wt
22479 !! html/parsoid
22480 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22481 !! wikitext
22482 -{<nowiki>}-</nowiki>}-
22483 !! html/php
22484 <p>&#125;-
22485 </p>
22486 !! end
22487
22488 !! test
22489 Language converter tricky html2wt cases (2)
22490 !! options
22491 language=sr
22492 parsoid=html2wt,wt2wt
22493 !! html/parsoid
22494 <p>-{foo}-</p>
22495 !! wikitext
22496 <nowiki>-{foo}-</nowiki>
22497 !! html/php
22498 <p>-&#123;foo&#125;-
22499 </p>
22500 !! end
22501
22502 !! test
22503 Language converter tricky html2wt cases (3)
22504 !! options
22505 language=sr
22506 parsoid=html2wt,wt2wt
22507 !! html/parsoid
22508 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22509 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22510 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22511 !! wikitext
22512 -{R||}-
22513
22514 -{R|R|raw}-
22515
22516 -{<nowiki>-{foo}-</nowiki>}-
22517 !! html/php
22518 <p>|
22519 </p><p>R|raw
22520 </p><p>-&#123;foo&#125;-
22521 </p>
22522 !! end
22523
22524 !! test
22525 Language converter tricky html2wt cases (4)
22526 !! options
22527 language=sr
22528 parsoid=html2wt,wt2wt
22529 !! html/parsoid
22530 <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>
22531 !! wikitext
22532 -{R|{{echo|hey}}}-
22533 !! html/php
22534 <p>hey
22535 </p>
22536 !! end
22537
22538 # Note that the <nowiki> escaping added by parsoid for source text,
22539 # destination text, and language names only works on the PHP side
22540 # for *destination text*. (HTML entity escaping wouldn't work
22541 # any better.) This is probably a bug, at least for source texts.
22542 # (For language names PHP uses a precise regexp based on the languages
22543 # it currently knows have variants, which is fragile since this set
22544 # can grow/shrink over time.)
22545 !! test
22546 Language converter tricky html2wt cases (5)
22547 !! options
22548 language=zh variant=zh-cn
22549 !! html/parsoid
22550 <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>
22551 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22552 <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>
22553 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22554 <p>a:b=>c xyz</p>
22555 !! wikitext
22556 -{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
22557
22558 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22559
22560 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22561
22562 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22563
22564 a:b=>c xyz
22565 !! html/php+disabled
22566 <p>foobat;xyz=&gt;zh-cn:abc
22567 </p><p>A
22568 </p><p>0;zh-tw:bar
22569 </p><p>abc
22570 </p><p>a:b=&gt;c 0;zh-tw:bar
22571 </p>
22572 !! end
22573
22574 !! test
22575 T2529: Uncovered bullet
22576 !! wikitext
22577 * Foo {{bullet}}
22578 !! html
22579 <ul><li> Foo </li>
22580 <li> Bar</li></ul>
22581
22582 !! end
22583
22584 # Plain MediaWiki does not remove empty lists, but tidy actually does.
22585 # Templates in Wikipedia rely on this behavior, as tidy has always been
22586 # enabled there. These tests are normally run *without* tidy, so specify the
22587 # full output here.
22588 # To test realistic parsing behavior, apply a tidy-like transformation to both
22589 # the expected output and your parser's output.
22590 !! test
22591 T2529: Uncovered bullet leaving empty list, normally removed by tidy
22592 !! wikitext
22593 ******* Foo {{bullet}}
22594 !! html
22595 <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>
22596 <li> Bar</li></ul>
22597
22598 !! end
22599
22600 !! test
22601 T2529: Uncovered table already at line-start
22602 !! wikitext
22603 x
22604
22605 {{table}}
22606 y
22607 !! html
22608 <p>x
22609 </p>
22610 <table>
22611 <tr>
22612 <td> 1 </td>
22613 <td> 2
22614 </td></tr>
22615 <tr>
22616 <td> 3 </td>
22617 <td> 4
22618 </td></tr></table>
22619 <p>y
22620 </p>
22621 !! end
22622
22623 !! test
22624 T2529: Uncovered bullet in parser function result
22625 !! wikitext
22626 * Foo {{lc:{{bullet}} }}
22627 !! html
22628 <ul><li> Foo </li>
22629 <li> bar</li></ul>
22630
22631 !! end
22632
22633 !! test
22634 T7678: Double-parsed template argument
22635 !! wikitext
22636 {{lc:{{{1}}}|hello}}
22637 !! html
22638 <p>{{{1}}}
22639 </p>
22640 !! end
22641
22642 !! test
22643 T7678: Double-parsed template invocation
22644 !! wikitext
22645 {{lc:{{paramtest {{!}} param = hello }} }}
22646 !! html
22647 <p>{{paramtest | param = hello }}
22648 </p>
22649 !! end
22650
22651 !! test
22652 Case insensitivity of parser functions for non-ASCII characters (T10143)
22653 !! options
22654 language=cs
22655 title=[[Main Page]]
22656 !! wikitext
22657 {{PRVNÍVELKÉ:ěščř}}
22658 {{prvnívelké:ěščř}}
22659 {{PRVNÍMALÉ:ěščř}}
22660 {{prvnímalé:ěščř}}
22661 {{MALÁ:ěščř}}
22662 {{malá:ěščř}}
22663 {{VELKÁ:ěščř}}
22664 {{velká:ěščř}}
22665 !! html
22666 <p>Ěščř
22667 Ěščř
22668 ěščř
22669 ěščř
22670 ěščř
22671 ěščř
22672 ĚŠČŘ
22673 ĚŠČŘ
22674 </p>
22675 !! end
22676
22677 !! test
22678 Morwen/13: Unclosed link followed by heading
22679 !! wikitext
22680 [[link
22681 ==heading==
22682 !! html
22683 <p>[[link
22684 </p>
22685 <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>
22686
22687 !! end
22688
22689 !! test
22690 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22691 !! wikitext
22692 {{foo|
22693 =heading=
22694 !! html
22695 <p>{{foo|
22696 </p>
22697 <h1><span class="mw-headline" id="heading">heading</span></h1>
22698
22699 !! end
22700
22701 !! test
22702 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22703 !! wikitext
22704 {{foo|
22705 ==heading==
22706 !! html
22707 <p>{{foo|
22708 </p>
22709 <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>
22710
22711 !! end
22712
22713 !! test
22714 Tildes in comments
22715 !! options
22716 pst
22717 !! wikitext
22718 <!-- ~~~~ -->
22719 !! html/php
22720 <!-- ~~~~ -->
22721 !! end
22722
22723 !! test
22724 Paragraphs inside divs (no extra line breaks)
22725 !! wikitext
22726 <div>Line one
22727
22728 Line two</div>
22729 !! html
22730 <div>Line one
22731 Line two</div>
22732
22733 !! end
22734
22735 !! test
22736 Paragraphs inside divs (extra line break on open)
22737 !! wikitext
22738 <div>
22739 Line one
22740
22741 Line two</div>
22742 !! html
22743 <div>
22744 <p>Line one
22745 </p>
22746 Line two</div>
22747
22748 !! end
22749
22750 !! test
22751 Paragraphs inside divs (extra line break on close)
22752 !! wikitext
22753 <div>Line one
22754
22755 Line two
22756 </div>
22757 !! html
22758 <div>Line one
22759 <p>Line two
22760 </p>
22761 </div>
22762
22763 !! end
22764
22765 !! test
22766 Paragraphs inside divs (extra line break on open and close)
22767 !! wikitext
22768 <div>
22769 Line one
22770
22771 Line two
22772 </div>
22773 !! html
22774 <div>
22775 <p>Line one
22776 </p><p>Line two
22777 </p>
22778 </div>
22779
22780 !! end
22781
22782 !! test
22783 Nesting tags, paragraphs on lines which begin with <div>
22784 !! wikitext
22785 <div></div><strong>A
22786 B</strong>
22787 !! html/php+tidy
22788 <p><strong>A</strong></p>
22789 <p><strong>B</strong></p>
22790 !! html/parsoid
22791 <div></div>
22792 <p><strong>A
22793 B</strong>
22794 </p>
22795 !! end
22796
22797 # T8200: <blockquote> should behave like <div> with respect to line breaks
22798 !! test
22799 T8200: paragraphs inside blockquotes (no extra line breaks)
22800 !! wikitext
22801 <blockquote>Line one
22802
22803 Line two</blockquote>
22804 !! html
22805 <blockquote>Line one
22806 Line two</blockquote>
22807
22808 !! html+tidy
22809 <blockquote>
22810 <p>Line one Line two</p>
22811 </blockquote>
22812 !! end
22813
22814 !! test
22815 T8200: paragraphs inside blockquotes (extra line break on open)
22816 !! wikitext
22817 <blockquote>
22818 Line one
22819
22820 Line two</blockquote>
22821 !! html
22822 <blockquote>
22823 <p>Line one
22824 </p>
22825 Line two</blockquote>
22826
22827 !! html+tidy
22828 <blockquote>
22829 <p>Line one</p>
22830 Line two</blockquote>
22831 !! end
22832
22833 !! test
22834 T8200: paragraphs inside blockquotes (extra line break on close)
22835 !! wikitext
22836 <blockquote>Line one
22837
22838 Line two
22839 </blockquote>
22840 !! html
22841 <blockquote>Line one
22842 <p>Line two
22843 </p>
22844 </blockquote>
22845
22846 !! html+tidy
22847 <blockquote>
22848 <p>Line one</p>
22849 <p>Line two</p>
22850 </blockquote>
22851 !! end
22852
22853 !! test
22854 T8200: paragraphs inside blockquotes (extra line break on open and close)
22855 !! wikitext
22856 <blockquote>
22857 Line one
22858
22859 Line two
22860 </blockquote>
22861 !! html
22862 <blockquote>
22863 <p>Line one
22864 </p><p>Line two
22865 </p>
22866 </blockquote>
22867
22868 !! html+tidy
22869 <blockquote>
22870 <p>Line one</p>
22871 <p>Line two</p>
22872 </blockquote>
22873 !! end
22874
22875 !! test
22876 Paragraphs inside blockquotes/divs (no extra line breaks)
22877 !! wikitext
22878 <blockquote><div>Line one
22879
22880 Line two</div></blockquote>
22881 !! html
22882 <blockquote><div>Line one
22883 Line two</div></blockquote>
22884
22885 !! end
22886
22887 !! test
22888 Paragraphs inside blockquotes/divs (extra line break on open)
22889 !! wikitext
22890 <blockquote><div>
22891 Line one
22892
22893 Line two</div></blockquote>
22894 !! html
22895 <blockquote><div>
22896 <p>Line one
22897 </p>
22898 Line two</div></blockquote>
22899
22900 !! end
22901
22902 !! test
22903 Paragraphs inside blockquotes/divs (extra line break on close)
22904 !! wikitext
22905 <blockquote><div>Line one
22906
22907 Line two
22908 </div></blockquote>
22909 !! html
22910 <blockquote><div>Line one
22911 <p>Line two
22912 </p>
22913 </div></blockquote>
22914
22915 !! end
22916
22917 !! test
22918 Paragraphs inside blockquotes/divs (extra line break on open and close)
22919 !! wikitext
22920 <blockquote><div>
22921 Line one
22922
22923 Line two
22924 </div></blockquote>
22925 !! html
22926 <blockquote><div>
22927 <p>Line one
22928 </p><p>Line two
22929 </p>
22930 </div></blockquote>
22931
22932 !! end
22933
22934 !! test
22935 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22936 !! options
22937 wgLinkHolderBatchSize=0
22938 !! wikitext
22939 [[meatball:1]]
22940 [[meatball:2]]
22941 [[meatball:3]]
22942 !! html
22943 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22944 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22945 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22946 </p>
22947 !! end
22948
22949 !! test
22950 Free external link invading image caption
22951 !! wikitext
22952 [[Image:Foobar.jpg|thumb|http://x|hello]]
22953 !! html
22954 <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>
22955
22956 !! end
22957
22958 !! test
22959 T17196: localised external link numbers
22960 !! options
22961 language=fa
22962 !! wikitext
22963 [http://en.wikipedia.org/]
22964 !! html/php
22965 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22966 </p>
22967 !! html/parsoid
22968 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22969 !! end
22970
22971 !! test
22972 Multibyte character in padleft
22973 !! wikitext
22974 {{padleft:-Hello|7|Æ}}
22975 !! html
22976 <p>Æ-Hello
22977 </p>
22978 !! end
22979
22980 !! test
22981 Multibyte character in padright
22982 !! wikitext
22983 {{padright:Hello-|7|Æ}}
22984 !! html
22985 <p>Hello-Æ
22986 </p>
22987 !! end
22988
22989 !!test
22990 formatdate parser function
22991 !! wikitext
22992 {{#formatdate:2009-03-24}}
22993 !! html
22994 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
22995 </p>
22996 !! end
22997
22998 !!test
22999 formatdate parser function, with default format
23000 !! wikitext
23001 {{#formatdate:2009-03-24|mdy}}
23002 !! html
23003 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23004 </p>
23005 !! end
23006
23007 !! test
23008 Spacing of numbers in formatted dates
23009 !! wikitext
23010 {{#formatdate:January 15}}
23011 !! html
23012 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23013 </p>
23014 !! end
23015
23016 !! test
23017 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
23018 !! options
23019 language=nl title=[[MediaWiki:Common.css]]
23020 !! wikitext
23021 {{#formatdate:2009-03-24|dmy}}
23022 !! html
23023 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23024 </p>
23025 !! end
23026
23027 #
23028 #
23029 #
23030
23031 #
23032 # Edit comments
23033 #
23034
23035 !! test
23036 Edit comment with link
23037 !! options
23038 comment
23039 !! wikitext
23040 I like the [[Main Page]] a lot
23041 !! html/php
23042 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23043 !!end
23044
23045 !! test
23046 Edit comment with link and link text
23047 !! options
23048 comment
23049 !! wikitext
23050 I like the [[Main Page|best pages]] a lot
23051 !! html/php
23052 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23053 !!end
23054
23055 !! test
23056 Edit comment with link and link text with suffix
23057 !! options
23058 comment
23059 !! wikitext
23060 I like the [[Main Page|best page]]s a lot
23061 !! html/php
23062 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23063 !!end
23064
23065 !! test
23066 Edit comment with section link (non-local, eg in history list)
23067 !! options
23068 comment title=[[Main Page]]
23069 !! wikitext
23070 /* External links */ removed bogus entries
23071 !! html/php
23072 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23073 !!end
23074
23075 !! test
23076 Edit comment with section link and text before it (non-local, eg in history list)
23077 !! options
23078 comment title=[[Main Page]]
23079 !! wikitext
23080 pre-comment text /* External links */ removed bogus entries
23081 !! html/php
23082 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>
23083 !!end
23084
23085 !! test
23086 Edit comment with section link (local, eg in diff view)
23087 !! options
23088 comment local title=[[Main Page]]
23089 !! wikitext
23090 /* External links */ removed bogus entries
23091 !! html/php
23092 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23093 !!end
23094
23095 !! test
23096 Edit comment with subpage link (T16080)
23097 !! options
23098 comment
23099 subpage
23100 title=[[Subpage test]]
23101 !! wikitext
23102 Poked at a [[/subpage]] here...
23103 !! html/php
23104 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23105 !!end
23106
23107 !! test
23108 Edit comment with subpage link and link text (T16080)
23109 !! options
23110 comment
23111 subpage
23112 title=[[Subpage test]]
23113 !! wikitext
23114 Poked at a [[/subpage|neat little page]] here...
23115 !! html/php
23116 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23117 !!end
23118
23119 !! test
23120 Edit comment with bogus subpage link in non-subpage NS (T16080)
23121 !! options
23122 comment
23123 title=[[Subpage test]]
23124 !! wikitext
23125 Poked at a [[/subpage]] here...
23126 !! html/php
23127 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...
23128 !!end
23129
23130 !! test
23131 Edit comment with bare anchor link (local, as on diff)
23132 !! options
23133 comment
23134 local
23135 title=[[Main Page]]
23136 !! wikitext
23137 [[#section]]
23138 !! html/php
23139 <a href="#section">#section</a>
23140 !! end
23141
23142 !! test
23143 Edit comment with bare anchor link (non-local, as on history)
23144 !! options
23145 comment
23146 title=[[Main Page]]
23147 !! wikitext
23148 [[#section]]
23149 !! html/php
23150 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23151 !! end
23152
23153 !! test
23154 Anchor starting with underscore
23155 !! options
23156 title=[[Foo]]
23157 !! wikitext
23158 [[#_ref|One]]
23159 !! html/php
23160 <p><a href="#_ref">One</a>
23161 </p>
23162 !! html/parsoid
23163 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23164 !! end
23165
23166 !! test
23167 Id starting with underscore
23168 !! wikitext
23169 <div id="_ref"></div>
23170 !! html/*
23171 <div id="_ref"></div>
23172
23173 !! end
23174
23175 !! test
23176 Edit comment with link with more than one pipe (T99346)
23177 !! options
23178 comment
23179 !! wikitext
23180 [[Main Page|Many|pipes]]
23181 !! html/php
23182 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23183 !! end
23184
23185 !! test
23186 Complex edit comment with link with more than one pipe (T99346)
23187 !! options
23188 comment
23189 !! wikitext
23190 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23191 !! html/php
23192 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;
23193 !! end
23194
23195 !! test
23196 Space normalisation on autocomment (T24784)
23197 !! options
23198 comment
23199 title=[[Main Page]]
23200 !! wikitext
23201 /* __hello__world__ */
23202 !! html/php
23203 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23204 !! end
23205
23206 !! test
23207 percent-encoding and + signs in comments (T28410)
23208 !! options
23209 comment
23210 !! wikitext
23211 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23212 !! html/php
23213 <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>
23214 !! end
23215
23216 # Parsoid doesn't support this yet: see T75581
23217 # but it *should* omit the 'src' attribute if the image is bad.
23218 # PHP side of tests was disabled in
23219 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23220 # because of issues in the PHP parserTests infrastructure
23221 # (but the output below is indeed what the PHP side emits)
23222 !! test
23223 Bad images - basic functionality
23224 !! wikitext
23225 [[File:Bad.jpg]]
23226 !! DISABLED/html/php
23227 !! html/parsoid
23228 <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>
23229 !! end
23230
23231 !! test
23232 Bad images - T18039: text after bad image disappears
23233 !! wikitext
23234 Foo bar
23235 [[File:Bad.jpg]]
23236 Bar foo
23237 !! DISABLED/html/php
23238 <p>Foo bar
23239 </p><p>Bar foo
23240 </p>
23241 !! html/parsoid
23242 <p>Foo bar
23243 <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>
23244 Bar foo</p>
23245 !! end
23246
23247 !! test
23248 Verify that displaytitle works (T24501) no displaytitle
23249 !! options
23250 showtitle
23251 !! config
23252 wgAllowDisplayTitle=true
23253 wgRestrictDisplayTitle=false
23254 !! wikitext
23255 this is not the the title
23256 !! html/php
23257 Parser test
23258 <p>this is not the the title
23259 </p>
23260 !! end
23261
23262 !! test
23263 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23264 !! options
23265 showtitle
23266 title=[[Screen]]
23267 !! config
23268 wgAllowDisplayTitle=true
23269 wgRestrictDisplayTitle=false
23270 !! wikitext
23271 this is not the the title
23272 {{DISPLAYTITLE:whatever}}
23273 !! html/php
23274 whatever
23275 <p>this is not the the title
23276 </p>
23277 !! end
23278
23279 !! test
23280 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23281 !! options
23282 showtitle
23283 title=[[Screen]]
23284 !! config
23285 wgAllowDisplayTitle=true
23286 wgRestrictDisplayTitle=true
23287 !! wikitext
23288 this is not the the title
23289 {{DISPLAYTITLE:whatever}}
23290 !! html/php
23291 Screen
23292 <p>this is not the the title
23293 </p>
23294 !! end
23295
23296 !! test
23297 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23298 !! options
23299 showtitle
23300 title=[[Screen]]
23301 !! config
23302 wgAllowDisplayTitle=true
23303 wgRestrictDisplayTitle=true
23304 !! wikitext
23305 this is not the the title
23306 {{DISPLAYTITLE:screen}}
23307 !! html/php
23308 screen
23309 <p>this is not the the title
23310 </p>
23311 !! end
23312
23313 !! test
23314 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23315 !! options
23316 showtitle
23317 title=[[Screen]]
23318 !! config
23319 wgAllowDisplayTitle=false
23320 !! wikitext
23321 this is not the the title
23322 {{DISPLAYTITLE:screen}}
23323 !! html/php
23324 Screen
23325 <p>this is not the the title
23326 <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>
23327 </p>
23328 !! end
23329
23330 !! test
23331 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23332 !! options
23333 showtitle
23334 title=[[Screen]]
23335 !! config
23336 wgAllowDisplayTitle=false
23337 !! wikitext
23338 this is not the the title
23339 !! html/php
23340 Screen
23341 <p>this is not the the title
23342 </p>
23343 !! end
23344
23345 !! test
23346 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23347 !! options
23348 showtitle
23349 title=[[Screen]]
23350 !! config
23351 wgAllowDisplayTitle=true
23352 wgRestrictDisplayTitle=true
23353 !! wikitext
23354 this is not the the title
23355 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23356 !! html/php
23357 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23358 <p>this is not the the title
23359 </p>
23360 !! end
23361
23362 !! test
23363 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23364 !! options
23365 showtitle
23366 title=[[Screen]]
23367 !! config
23368 wgAllowDisplayTitle=true
23369 wgRestrictDisplayTitle=true
23370 !! wikitext
23371 this is not the the title
23372 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23373 !! html/php
23374 <span style="color: red;">s</span>creen
23375 <p>this is not the the title
23376 </p>
23377 !! end
23378
23379 !! test
23380 Page status indicators: Empty name is invalid
23381 !! options
23382 showindicators
23383 !! wikitext
23384 <indicator name=" "></indicator>
23385 <indicator></indicator>
23386 !! html/php
23387 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23388 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23389 </p>
23390 !! end
23391
23392 !! test
23393 Page status indicators: Weird syntaxes that are okay
23394 !! options
23395 showindicators
23396 !! wikitext
23397 <indicator name="empty" />
23398 <indicator name="name"></indicator>
23399 !! html/php
23400 empty=
23401 name=
23402 <p><br />
23403 </p>
23404 !! end
23405
23406 !! test
23407 Page status indicators: Torture test
23408 !! options
23409 showindicators
23410 !! wikitext
23411 <indicator name="01">hello world</indicator>
23412 <indicator name="02">[[Main Page]]</indicator>
23413 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23414 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23415 <indicator name="05">* foo
23416 * bar</indicator>
23417 <indicator name="06"><nowiki>foo</nowiki></indicator>
23418 <indicator name="07"> Preformatted</indicator>
23419 <indicator name="08"><div>Broken tag</indicator>
23420 <indicator name="09">{| class=wikitable
23421 | cell
23422 |}</indicator>
23423 <indicator name="10">Two
23424
23425 paragraphs</indicator>
23426 !! html/php
23427 01=hello world
23428 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23429 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" />
23430 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>
23431 05=<ul><li> foo</li>
23432 <li> bar</li></ul>
23433
23434 06=foo
23435 07=<pre>Preformatted
23436 </pre>
23437 08=<div>Broken tag</div>
23438
23439 09=<table class="wikitable">
23440 <tr>
23441 <td> cell
23442 </td></tr></table>
23443
23444 10=<p>Two
23445 </p><p>paragraphs
23446 </p>
23447 <p><br />
23448 </p><p><br />
23449 </p><p><br />
23450 </p><p><br />
23451 </p><p><br />
23452 </p>
23453 !! end
23454
23455 !! test
23456 preload: check <noinclude> and <includeonly>
23457 !! options
23458 preload
23459 !! wikitext
23460 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23461 !! html/php
23462 Hello kind world.
23463 !! end
23464
23465 !! test
23466 preload: check <onlyinclude>
23467 !! options
23468 preload
23469 !! wikitext
23470 Goodbye <onlyinclude>Hello world</onlyinclude>
23471 !! html/php
23472 Hello world
23473 !! end
23474
23475 !! test
23476 preload: can pass tags through if we want to
23477 !! options
23478 preload
23479 !! wikitext
23480 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23481 !! html/php
23482 <includeonly>Hello world</includeonly>
23483 !! end
23484
23485 !! test
23486 preload: check that it doesn't try to do tricks
23487 !! options
23488 preload
23489 !! wikitext
23490 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23491 !! html/php
23492 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23493 !! end
23494
23495 !! test
23496 Play a bit with r67090 and T5158
23497 !! wikitext
23498 <div style="width:50% !important">&nbsp;</div>
23499 <div style="width:50%&nbsp;!important">&nbsp;</div>
23500 <div style="width:50%&#160;!important">&nbsp;</div>
23501 <div style="border : solid;">&nbsp;</div>
23502 !! html/php
23503 <div style="width:50% !important">&#160;</div>
23504 <div style="width:50% !important">&#160;</div>
23505 <div style="width:50% !important">&#160;</div>
23506 <div style="border&#160;: solid;">&#160;</div>
23507
23508 !! html/parsoid
23509 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23510 <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>
23511 <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>
23512 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23513
23514 !! end
23515
23516 !! test
23517 HTML5 data attributes
23518 !! wikitext
23519 <span data-foo="bar">Baz</span>
23520 <p data-abc-def_hij="">Quuz</p>
23521 !! html/php
23522 <p><span data-foo="bar">Baz</span>
23523 </p>
23524 <p data-abc-def_hij="">Quuz</p>
23525
23526 !! html/parsoid
23527 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23528 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23529 !! end
23530
23531 !! test
23532 Strip reserved data attributes
23533 !! wikitext
23534 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23535 !! html/php
23536 <div data-ok="fred">d</div>
23537
23538 !! html/parsoid
23539 <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>
23540 !! end
23541
23542 !! test
23543 percent-encoding and + signs in internal links (T28410)
23544 !! wikitext
23545 [[User:+%]] [[Page+title%]]
23546 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23547 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23548 [[%33%45]] [[%33%45+]]
23549 !! html/php
23550 <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>
23551 <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>
23552 <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>
23553 <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>
23554 </p>
23555 !! html/parsoid
23556 <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>
23557 <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>
23558 <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> <span 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></span>
23559 <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>
23560 !! end
23561
23562 !! test
23563 Special characters in embedded file links (T29679)
23564 !! wikitext
23565 [[File:Contains & ampersand.jpg]]
23566 [[File:Does not exist.jpg|Title with & ampersand]]
23567 !! html/php
23568 <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>
23569 <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>
23570 </p>
23571 !! html/parsoid
23572 <p><span 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></span>
23573 <span 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></span></p>
23574 !! end
23575
23576 !! test
23577 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23578 !! wikitext
23579 Text&apos;s been normalized?
23580 !! html
23581 <p>Text&#39;s been normalized?
23582 </p>
23583 !! end
23584
23585 !! test
23586 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23587 !! wikitext
23588 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23589 !! html
23590 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23591 </p>
23592 !! end
23593
23594 !! test
23595 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23596 !! wikitext
23597 [http://www.example.org/ ideograms]
23598 !! html
23599 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23600 </p>
23601 !! end
23602
23603 !! test
23604 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23605 !! wikitext
23606 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23607 !! html
23608 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23609 </p>
23610 !! end
23611
23612 !! article
23613 Mediawiki:loop1
23614 !! text
23615 {{Identical|A}}
23616 !! endarticle
23617
23618 !! article
23619 Mediawiki:loop2
23620 !! text
23621 {{Identical|B}}
23622 !! endarticle
23623
23624 !! article
23625 Template:Identical
23626 !! text
23627 {{int:loop1}}
23628 {{int:loop2}}
23629 !! endarticle
23630
23631 !! test
23632 T33098 Template which includes system messages which includes the template
23633 !! wikitext
23634 {{Identical}}
23635 !! html
23636 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23637 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23638 </p>
23639 !! end
23640
23641 !! test
23642 T33490 Turkish: ucfirst 'blah'
23643 !! options
23644 language=tr
23645 !! wikitext
23646 {{ucfirst:blah}}
23647 !! html
23648 <p>Blah
23649 </p>
23650 !! end
23651
23652 !! test
23653 T33490 Turkish: ucfirst 'ix'
23654 !! options
23655 language=tr
23656 !! wikitext
23657 {{ucfirst:ix}}
23658 !! html
23659 <p>İx
23660 </p>
23661 !! end
23662
23663 !! test
23664 T33490 Turkish: lcfirst 'BLAH'
23665 !! options
23666 language=tr
23667 !! wikitext
23668 {{lcfirst:BLAH}}
23669 !! html
23670 <p>bLAH
23671 </p>
23672 !! end
23673
23674 !! test
23675 T33490 Turkish: ucfırst (with a dotless i)
23676 !! options
23677 language=tr
23678 !! wikitext
23679 {{ucfırst:blah}}
23680 !! html
23681 <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>
23682 </p>
23683 !! end
23684
23685 !! test
23686 T33490 ucfırst (with a dotless i) with English language
23687 !! options
23688 language=en
23689 !! wikitext
23690 {{ucfırst:blah}}
23691 !! html
23692 <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>
23693 </p>
23694 !! end
23695
23696 # Note that Parsoid doesn't emit an explicit TOC.
23697 # Note also that the html2wt direction tends to emit an extra newline
23698 # between the __TOC__ magicword and the first heading unless *both*
23699 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23700 # it's "{}").
23701
23702 !! test
23703 T28375: TOC with italics
23704 !! options
23705 title=[[Main Page]]
23706 !! wikitext
23707 __TOC__
23708 == ''Lost'' episodes ==
23709 !! html/php
23710 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23711 <ul>
23712 <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>
23713 </ul>
23714 </div>
23715
23716 <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>
23717
23718 !! html/parsoid
23719 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23720 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
23721 !! end
23722
23723 !! test
23724 T28375: TOC with bold
23725 !! options
23726 title=[[Main Page]]
23727 !! wikitext
23728 __TOC__
23729 == '''should be bold''' then normal text ==
23730 !! html/php
23731 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23732 <ul>
23733 <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>
23734 </ul>
23735 </div>
23736
23737 <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>
23738
23739 !! html/parsoid
23740 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23741 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
23742 !! end
23743
23744 !! test
23745 T35845: Headings become cursive in TOC when they contain an image
23746 !! options
23747 title=[[Main Page]]
23748 !! wikitext
23749 __TOC__
23750 == Image [[Image:foobar.jpg]] ==
23751 !! html/php
23752 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23753 <ul>
23754 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
23755 </ul>
23756 </div>
23757
23758 <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>
23759
23760 !! html/parsoid
23761 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23762 <h2 data-parsoid='{}'> Image <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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></span> </h2>
23763 !! end
23764
23765 !! test
23766 T35845 (2): Headings become bold in TOC when they contain a blockquote
23767 !! options
23768 title=[[Main Page]]
23769 !! wikitext
23770 __TOC__
23771 == <blockquote>Quote</blockquote> ==
23772 !! html/php
23773 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23774 <ul>
23775 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23776 </ul>
23777 </div>
23778
23779 <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>
23780
23781 !! html/php+tidy
23782 <p></p>
23783 <div id="toc" class="toc">
23784 <div class="toctitle">
23785 <h2>Contents</h2>
23786 </div>
23787 <ul>
23788 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23789 </ul>
23790 </div>
23791 <p></p>
23792 <h2><span class="mw-headline" id="Quote"></span></h2>
23793 <blockquote>
23794 <p><span class="mw-headline" id="Quote">Quote</span></p>
23795 </blockquote>
23796 <p><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></p>
23797 !! html/parsoid
23798 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23799 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
23800 !! end
23801
23802 !! test
23803 Unclosed tags in TOC
23804 !! options
23805 title=[[Main Page]]
23806 !! wikitext
23807 __TOC__
23808 == Proof: 2 < 3 ==
23809 <small>Hanc marginis exiguitas non caperet.</small>
23810 QED
23811 !! html/php
23812 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23813 <ul>
23814 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
23815 </ul>
23816 </div>
23817
23818 <h2><span class="mw-headline" id="Proof:_2_.3C_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>
23819 <p><small>Hanc marginis exiguitas non caperet.</small>
23820 QED
23821 </p>
23822 !! html/parsoid
23823 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23824 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
23825 <p><small>Hanc marginis exiguitas non caperet.</small>
23826 QED</p>
23827 !! end
23828
23829 !! test
23830 Multiple tags in TOC
23831 !! wikitext
23832 __TOC__
23833 == <i>Foo</i> <b>Bar</b> ==
23834
23835 == <i>Foo</i> <blockquote>Bar</blockquote> ==
23836 !! html/php
23837 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23838 <ul>
23839 <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>
23840 <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>
23841 </ul>
23842 </div>
23843
23844 <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>
23845 <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>
23846
23847 !! html/php+tidy
23848 <p></p>
23849 <div id="toc" class="toc">
23850 <div class="toctitle">
23851 <h2>Contents</h2>
23852 </div>
23853 <ul>
23854 <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>
23855 <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>
23856 </ul>
23857 </div>
23858 <p></p>
23859 <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>
23860 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
23861 <blockquote>
23862 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
23863 </blockquote>
23864 <p><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></p>
23865 !! html/parsoid
23866 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23867 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
23868 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
23869 !! end
23870
23871 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
23872 # html5 tag parsing.
23873 !! test
23874 Tags with parameters in TOC
23875 !! options
23876 parsoid=wt2html
23877 !! wikitext
23878 __TOC__
23879 == <sup class="in-h2">Hello</sup> ==
23880
23881 == <sup class="a > b">Evilbye</sup> ==
23882 !! html/php
23883 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23884 <ul>
23885 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
23886 <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>
23887 </ul>
23888 </div>
23889
23890 <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>
23891 <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>
23892
23893 !! html/parsoid
23894 <meta property="mw:PageProp/toc" />
23895 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23896
23897 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23898 !! end
23899
23900 !! test
23901 span tags with directionality in TOC
23902 !! wikitext
23903 __TOC__
23904 == <span dir="ltr">C++</span> ==
23905
23906 == <span dir="rtl">זבנג!</span> ==
23907
23908 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
23909
23910 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
23911
23912 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23913 !! html/php
23914 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23915 <ul>
23916 <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>
23917 <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>
23918 <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>
23919 <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>
23920 <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>
23921 </ul>
23922 </div>
23923
23924 <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>
23925 <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>
23926 <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>
23927 <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>
23928 <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>
23929
23930 !! html/parsoid
23931 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23932 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23933 <h2> <span dir="rtl">זבנג!</span> </h2>
23934 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23935 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23936 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23937 !! end
23938
23939 !! test
23940 T74884: bdi element in ToC
23941 !! wikitext
23942 __TOC__
23943 == <bdi>test</bdi> ==
23944 !! html/php
23945 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23946 <ul>
23947 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23948 </ul>
23949 </div>
23950
23951 <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>
23952
23953 !! html/parsoid
23954 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23955 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23956 !! end
23957
23958 !! test
23959 T35715: s/strike element in ToC
23960 !! wikitext
23961 __TOC__
23962 == <s>test</s> test <strike>test</strike> ==
23963 !! html/php
23964 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23965 <ul>
23966 <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>
23967 </ul>
23968 </div>
23969
23970 <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>
23971
23972 !! html/parsoid
23973 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23974 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
23975 !! end
23976
23977 # Note that the html output does not have the <p></p>, but the
23978 # html+tidy output *does*. This is because the empty <p></p> is
23979 # removed by the sanitizer, but only when tidy is *not* enabled (!).
23980 !! test
23981 Empty <p> tag in TOC, removed by Sanitizer (T92892)
23982 !! wikitext
23983 __TOC__
23984 == x ==
23985 !! html/php
23986 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23987 <ul>
23988 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
23989 </ul>
23990 </div>
23991
23992 <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>
23993
23994 !! html/php+tidy
23995 <p></p>
23996 <div id="toc" class="toc">
23997 <div class="toctitle">
23998 <h2>Contents</h2>
23999 </div>
24000 <ul>
24001 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24002 </ul>
24003 </div>
24004 <p></p>
24005 <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>
24006 !! html/parsoid
24007 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24008 <h2 data-parsoid='{}'> x </h2>
24009 !! end
24010
24011 !! article
24012 MediaWiki:T34057
24013 !! text
24014 == {{int:headline_sample}} ==
24015 !! endarticle
24016
24017 !! test
24018 T34057: Title needed when expanding <h> nodes.
24019 !! options
24020 title=[[Main Page]]
24021 !! wikitext
24022 {{int:T34057}}
24023 !! html
24024 <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>
24025
24026 !! end
24027
24028 !! test
24029 Strip marker in urlencode
24030 !! wikitext
24031 {{urlencode:x<nowiki/>y}}
24032 {{urlencode:x<nowiki/>y|wiki}}
24033 {{urlencode:x<nowiki/>y|path}}
24034 {{urlencode:x<pre id="one">two</pre>y}}
24035 !! html/php
24036 <p>xy
24037 xy
24038 xy
24039 xy
24040 </p>
24041 !! end
24042
24043 !! test
24044 Strip marker in lc
24045 !! wikitext
24046 {{lc:x<nowiki/>y}}
24047 !! html
24048 <p>xy
24049 </p>
24050 !! end
24051
24052 !! test
24053 Strip marker in uc
24054 !! wikitext
24055 {{uc:x<nowiki/>y}}
24056 !! html
24057 <p>XY
24058 </p>
24059 !! end
24060
24061 !! test
24062 Strip marker in formatNum
24063 !! wikitext
24064 {{formatnum:1<nowiki/>2}}
24065 {{formatnum:1<nowiki/>2|R}}
24066 !! html
24067 <p>12
24068 12
24069 </p>
24070 !! end
24071
24072 !! test
24073 Check noCommafy in formatNum
24074 !! options
24075 language=be-tarask
24076 !! wikitext
24077 {{formatnum:123456.78}}
24078 {{formatnum:123456.78|NOSEP}}
24079 !! html
24080 <p>123 456,78
24081 123456.78
24082 </p>
24083 !! end
24084
24085 !! test
24086 Wrong option for formatNum (T58199)
24087 !! wikitext
24088 {{formatnum:1,234.56|Random}}
24089 {{formatnum:1,234.56|EVERYTHING}}
24090 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24091 !! html
24092 <p>1,234.56
24093 1,234.56
24094 1,234.56
24095 </p>
24096 !! end
24097
24098 !! test
24099 Strip marker in grammar
24100 !! options
24101 language=fi
24102 !! wikitext
24103 {{grammar:elative|foo<nowiki/>bar}}
24104 !! html
24105 <p>foobarista
24106 </p>
24107 !! end
24108
24109 !! test
24110 Strip marker in padleft
24111 !! wikitext
24112 {{padleft:|2|x<nowiki/>y}}
24113 !! html
24114 <p>xy
24115 </p>
24116 !! end
24117
24118 !! test
24119 Strip marker in padright
24120 !! wikitext
24121 {{padright:|2|x<nowiki/>y}}
24122 !! html
24123 <p>xy
24124 </p>
24125 !! end
24126
24127 !! test
24128 Strip marker in anchorencode
24129 !! wikitext
24130 {{anchorencode:x<nowiki/>y}}
24131 !! html
24132 <p>xy
24133 </p>
24134 !! end
24135
24136 !! test
24137 nowiki inside link inside heading (T20295)
24138 !! wikitext
24139 ==[[foo|x<nowiki>y</nowiki>z]]==
24140 !! html
24141 <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>
24142
24143 !! end
24144
24145 !! test
24146 new support for bdi element (T33817)
24147 !! wikitext
24148 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24149 !! html
24150 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24151
24152 !!end
24153
24154 !! test
24155 Ignore pipe between table row attributes
24156 !! wikitext
24157 {|
24158 | quux
24159 |- id=foo | style='color: red'
24160 | bar
24161 |}
24162 !! html
24163 <table>
24164 <tr>
24165 <td> quux
24166 </td></tr>
24167 <tr id="foo" style="color: red">
24168 <td> bar
24169 </td></tr></table>
24170
24171 !! end
24172
24173 !!test
24174 Language parser function
24175 !! wikitext
24176 {{#language:ar}}
24177 !! html
24178 <p>العربية
24179 </p>
24180 !! end
24181
24182 !!test
24183 Padleft and padright as substr
24184 !! wikitext
24185 {{padleft:|3|abcde}}
24186 {{padright:|3|abcde}}
24187 !! html
24188 <p>abc
24189 abc
24190 </p>
24191 !! end
24192
24193 !!test
24194 Special parser function
24195 !! wikitext
24196 {{#special:RandomPage}}
24197 {{#special:BaDtItLe}}
24198 {{#special:Foobar}}
24199 !! html
24200 <p>Special:Random
24201 Special:Badtitle
24202 Special:Foobar
24203 </p>
24204 !! end
24205
24206 !!test
24207 T36939 - Case insensitive link parsing ([HttP://])
24208 !! wikitext
24209 [HttP://MediaWiki.Org/]
24210 !! html/php
24211 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24212 </p>
24213 !! html/parsoid
24214 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
24215 !! end
24216
24217 !!test
24218 T36939 - Case insensitive link parsing ([HttP:// title])
24219 !! wikitext
24220 [HttP://MediaWiki.Org/ MediaWiki]
24221 !! html
24222 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24223 </p>
24224 !! end
24225
24226 !!test
24227 T36939 - Case insensitive link parsing (HttP://)
24228 !! wikitext
24229 HttP://MediaWiki.Org/
24230 !! html/php
24231 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24232 </p>
24233 !! html/parsoid
24234 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24235 !! end
24236
24237 !!test
24238 Disable TOC
24239 !! options
24240 notoc
24241 !! wikitext
24242 Lead
24243 == Section 1 ==
24244 == Section 2 ==
24245 == Section 3 ==
24246 == Section 4 ==
24247 == Section 5 ==
24248 !! html
24249 <p>Lead
24250 </p>
24251
24252 <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>
24253 <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>
24254 <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>
24255 <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>
24256 <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>
24257
24258 !! end
24259
24260
24261 ###
24262 ### Parsoid-specific tests
24263 ### Parsoid-PHP parser incompatibilities
24264 ###
24265 !!test
24266 1. SOL-sensitive wikitext tokens as template-args
24267 !!options
24268 parsoid=wt2html,wt2wt
24269 !! wikitext
24270 {{echo|*a}}
24271 {{echo|#a}}
24272 {{echo|:a}}
24273 !! html
24274 <span about="#mwt1" typeof="mw:Transclusion">
24275 </span><ul about="#mwt1"><li>a</li>
24276 </ul>
24277 <span about="#mwt2" typeof="mw:Transclusion">
24278 </span><ol about="#mwt2"><li>a</li>
24279 </ol>
24280 <span about="#mwt3" typeof="mw:Transclusion">
24281 </span><dl about="#mwt3"><dd>a</dd>
24282 </dl>
24283 !!end
24284
24285 #### -----------------------------------------------------------------
24286 #### Parsoid-specific functionality tests
24287 #### -----------------------------------------------------------------
24288
24289 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24290 # We know wt2wt will fail, but we expect selser to pass.
24291 # Due to the nature of our testing, wt2wt and selser tests will enter the
24292 # blacklist and we'll catch selser regressions based on changes to the
24293 # blacklist entries for selser tests.
24294 !! test
24295 1. Bad treebuilder fixup of formatting elt is cleaned up
24296 !! options
24297 parsoid=wt2html,wt2wt
24298 !! wikitext
24299 {|
24300 |
24301 <small>
24302 [[Image:Foobar.jpg|right|Test]]
24303 </small>
24304 |}
24305 !! html/parsoid
24306 <table>
24307 <tbody><tr><td>
24308 <small>
24309 <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>
24310 </small>
24311 </td></tr>
24312 </tbody></table>
24313 !! end
24314
24315 !! test
24316 2. Bad treebuilder fixup of formatting elt is cleaned up
24317 !! options
24318 parsoid=wt2html,wt2wt
24319 !! wikitext
24320 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24321
24322 <small>[[Image:Foobar.jpg|right|300px]]</small>
24323 !! html/parsoid
24324
24325 <p><b>foo</b></p>
24326 <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>
24327 <p><b>bar</b></p>
24328 <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>
24329 !! end
24330
24331 !! test
24332 3. Bad treebuilder fixup of formatting elt is cleaned up
24333 !! options
24334 parsoid=wt2html,wt2wt
24335 !! wikitext
24336 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24337 !! html/parsoid
24338 <p><small><b>foo</b></small></p>
24339 <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>
24340 <p><small><b>bar</b></small></p>
24341 !! end
24342
24343 !! test
24344 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24345 !! options
24346 parsoid=wt2html,wt2wt
24347 !! wikitext
24348 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24349 !! html/parsoid
24350 <p><b><small></small></b></p>
24351 <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>
24352 <p></p>
24353 !! end
24354
24355 #### ----------------------------------------------------------------
24356 #### Parsoid-only testing of Parsoid's impl of LST
24357 #### Not implemented yet, see
24358 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24359 #### ----------------------------------------------------------------
24360
24361 ## We still need to support serializing the older format while content is stored.
24362 !! test
24363 LST Sections: Backwards compatibility
24364 !! options
24365 parsoid={
24366 "suppressErrors": true,
24367 "modes": ["html2wt"]
24368 }
24369 !! wikitext
24370 <section begin="2011-05-16" />
24371 <section end="2014-04-10 (MW 1.23wmf22)" />
24372 !! html/parsoid
24373 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24374 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24375 !! end
24376
24377 !! test
24378 LST Sections: Newfangled approach
24379 !! wikitext
24380 <section begin="2011-05-16" />
24381 <section end="2014-04-10 (MW 1.23wmf22)" />
24382 !! html/parsoid
24383 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24384 </span>
24385 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24386 </span></p>
24387 !! end
24388
24389 #--------- Test stripping of empty nodes in template content ----------
24390
24391 !! test
24392 Empty LI and TR nodes should be stripped from template content
24393 !! wikitext
24394 {{EmptyLITest}}
24395 {{EmptyTRTest}}
24396 !! html/parsoid
24397 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24398 <li>a</li>
24399 <li>b</li>
24400 </ul>
24401 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24402 <tbody>
24403 <tr>
24404 <td>foo</td>
24405 </tr>
24406 <tr>
24407 <td>bar</td>
24408 </tr>
24409 </tbody>
24410 </table>
24411 !! end
24412
24413 !! test
24414 Empty LI and TR nodes should not be stripped from top-level content
24415 !! wikitext
24416 * a
24417 *
24418 * b
24419 {|
24420 |-
24421 |-
24422 |foo
24423 |}
24424 !! html/parsoid
24425 <ul>
24426 <li> a</li>
24427 <li></li>
24428 <li> b</li>
24429 </ul>
24430 <table>
24431 <tbody>
24432 <tr></tr>
24433 <tr>
24434 <td>foo</td>
24435 </tr>
24436 </tbody>
24437 </table>
24438 !! end
24439
24440 !! test
24441 Empty TR nodes should not be stripped if they have any attributes set
24442 !! wikitext
24443 {{EmptyTRWithHTMLAttrTest}}
24444 !! html/parsoid
24445 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24446 <tr align="center"></tr>
24447 <tr><td>foo</td></tr>
24448 <tr align="center"></tr>
24449 <tr><td>bar</td></tr>
24450 </table>
24451 !! end
24452
24453 #### ----------------------------------------------------------------
24454 #### The following section of tests are primarily to test
24455 #### wikitext escaping capabilities of Parsoid. Given that
24456 #### escaping can be done any number of ways, the wikitext (input)
24457 #### is always adjusted to reflect how Parsoid adds nowiki
24458 #### escape tags.
24459 ####
24460 #### We are marking several tests as parsoid-only since the
24461 #### HTML in the result section is different from what the
24462 #### PHP parser generates for it.
24463 #### ----------------------------------------------------------------
24464
24465
24466 #### --------------- Headings ---------------
24467 #### 0. Unnested
24468 #### 1. Nested inside html <h1>=foo=</h1>
24469 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24470 #### 3. Nested inside html with wikitext split by html tags
24471 #### 4. No escape needed
24472 #### 5. Empty headings <h1></h1>
24473 #### 6. Heading chars in SOL context
24474 #### ----------------------------------------
24475 !! test
24476 Headings: 0. Unnested
24477 !! options
24478 parsoid=html2wt
24479 !! html/parsoid
24480 <p>=foo=</p>
24481
24482 <p> =foo=
24483 <!--cmt-->
24484 =foo=</p>
24485
24486 <p>=foo<i>a</i>=</p>
24487 !! wikitext
24488 <nowiki>=foo=</nowiki>
24489
24490 <nowiki> </nowiki>=foo=
24491 <!--cmt-->
24492 <nowiki>=foo=</nowiki>
24493
24494 =foo''a''<nowiki>=</nowiki>
24495 !!end
24496
24497 # New headings and existing headings are handled differently
24498 !! test
24499 Headings: 1. Nested inside html
24500 !! options
24501 parsoid=html2wt
24502 !! html/parsoid
24503 <h1>=foo=</h1>
24504 <h2>=foo=</h2>
24505 <h3>=foo=</h3>
24506
24507 <h1 data-parsoid=''>=foo=</h1>
24508 <h2 data-parsoid=''>=foo=</h2>
24509 <h3 data-parsoid=''>=foo=</h3>
24510 <h4 data-parsoid=''>=foo=</h4>
24511 <h5 data-parsoid=''>=foo=</h5>
24512 <h6 data-parsoid=''>=foo=</h6>
24513 !! wikitext
24514 = =foo= =
24515
24516 == =foo= ==
24517
24518 === =foo= ===
24519
24520 =<nowiki>=foo=</nowiki>=
24521 ==<nowiki>=foo=</nowiki>==
24522 ===<nowiki>=foo=</nowiki>===
24523 ====<nowiki>=foo=</nowiki>====
24524 =====<nowiki>=foo=</nowiki>=====
24525 ======<nowiki>=foo=</nowiki>======
24526
24527 !!end
24528
24529 !! test
24530 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24531 !! options
24532 parsoid=html2wt
24533 !! html/parsoid
24534 <h1>foo</h1>*bar
24535 <h1>foo</h1>=bar
24536 <h1>foo</h1>=bar=
24537 !! wikitext
24538 = foo =
24539 <nowiki>*</nowiki>bar
24540
24541 = foo =
24542 =bar
24543
24544 = foo =
24545 <nowiki>=bar=</nowiki>
24546 !!end
24547
24548 !! test
24549 Headings: 3. Nested inside html with wikitext split by html tags
24550 !! options
24551 parsoid=html2wt
24552 !! html/parsoid
24553 <h1>=<b>bold</b>foo=</h1>
24554 !! wikitext
24555 = ='''bold'''foo= =
24556 !!end
24557
24558 !! test
24559 Headings: 4a. No escaping needed (testing just h1 and h2)
24560 !! options
24561 parsoid=html2wt
24562 !! html/parsoid
24563 <h1>=foo</h1>
24564 <h1>foo=</h1>
24565 <h1> =foo= </h1>
24566 <h1>=foo= bar</h1>
24567 <h2>=foo</h2>
24568 <h2>foo=</h2>
24569 <h1>=</h1>
24570 <h1><i>=</i>foo=</h1>
24571 !! wikitext
24572 = =foo =
24573
24574 = foo= =
24575
24576 = =foo= =
24577
24578 = =foo= bar =
24579
24580 == =foo ==
24581
24582 == foo= ==
24583
24584 = = =
24585
24586 = ''=''foo= =
24587 !!end
24588
24589 !! test
24590 Headings: 4b. No escaping needed (inside p-tags)
24591 !! options
24592 parsoid=html2wt
24593 !! html/parsoid
24594 <p>===
24595 =foo= x
24596 =foo= <s></s>
24597 </p>
24598 !! wikitext
24599 ===
24600 =foo= x
24601 =foo= <s></s>
24602 !!end
24603
24604 !! test
24605 Headings: 5. Empty headings
24606 !! options
24607 parsoid=html2wt
24608 !! html/parsoid
24609 <h1 data-parsoid='{}'></h1>
24610
24611 <h2 data-parsoid='{}'></h2>
24612
24613 <h3 data-parsoid='{}'></h3>
24614
24615 <h4 data-parsoid='{}'></h4>
24616
24617 <h5 data-parsoid='{}'></h5>
24618
24619 <h6 data-parsoid='{}'></h6>
24620 !! wikitext
24621 =<nowiki/>=
24622
24623 ==<nowiki/>==
24624
24625 ===<nowiki/>===
24626
24627 ====<nowiki/>====
24628
24629 =====<nowiki/>=====
24630
24631 ======<nowiki/>======
24632 !!end
24633
24634 !! test
24635 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24636 !! options
24637 parsoid=html2wt
24638 !! html/parsoid
24639 <p>=a=</p>
24640
24641 <p>=a=</p>
24642
24643 <p>=a=</p>
24644 !! wikitext
24645 <nowiki>=a=</nowiki>
24646
24647 <nowiki>=a=</nowiki>
24648
24649 <nowiki>=a=</nowiki>
24650 !!end
24651
24652 !! test
24653 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24654 !! options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <p>=a=
24658 b</p>
24659
24660 <p>=a=
24661 b</p>
24662
24663 <p>=a=
24664 b</p>
24665 !! wikitext
24666 <nowiki>=a=</nowiki>
24667 b
24668
24669 <nowiki>=a=</nowiki>
24670 b
24671
24672 <nowiki>=a=</nowiki>
24673 b
24674 !!end
24675
24676 !! test
24677 Headings: 6c. Heading chars in SOL context (leading newline break)
24678 !! options
24679 parsoid=html2wt
24680 !! html/parsoid
24681 <p>a
24682 =b=</p>
24683 !! wikitext
24684 a
24685 <nowiki>=b=</nowiki>
24686 !!end
24687
24688 !! test
24689 Headings: 6d. Heading chars in SOL context (with interspersed comments)
24690 !! options
24691 parsoid=html2wt
24692 !! html/parsoid
24693 <!--c0--><p>=a=</p>
24694
24695 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
24696 !! wikitext
24697 <!--c0--><nowiki>=a=</nowiki>
24698
24699 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
24700 !!end
24701
24702 !! test
24703 Headings: 6d. Heading chars in SOL context (No escaping needed)
24704 !! options
24705 parsoid=html2wt
24706 !! html/parsoid
24707 =a=<div>b</div>
24708 !! wikitext
24709 =a=<div>b</div>
24710 !!end
24711
24712 !! test
24713 Headings: 7. Insert a newline between new content and headings
24714 !! options
24715 parsoid=html2wt
24716 !! html/parsoid
24717 <h2>NEW</h2>
24718 <p>new</p>
24719 <h2 data-parsoid='{}'>A</h2>
24720 <p data-parsoid='{}'>a</p>
24721 !! wikitext
24722 == NEW ==
24723 new
24724
24725 ==A==
24726 a
24727
24728 !! end
24729
24730 #### --------------- Lists ---------------
24731 #### 0. Outside nests (*foo, etc.)
24732 #### 1. Nested inside html <ul><li>*foo</li></ul>
24733 #### 2. Inside definition lists
24734 #### 3. Only bullets at start should be escaped
24735 #### 4. No escapes needed
24736 #### 5. No unnecessary escapes
24737 #### 6. Escape bullets in SOL position
24738 #### 7. Escape bullets in a multi-line context
24739 #### ----------------------------------------
24740
24741 !! test
24742 Lists: 0. Outside nests
24743 !! options
24744 parsoid=html2wt
24745 !! html/parsoid
24746 <p>*foo</p>
24747
24748 <p>#foo</p>
24749
24750 <p>;Foo:bar</p>
24751 !! wikitext
24752 <nowiki>*</nowiki>foo
24753
24754 <nowiki>#</nowiki>foo
24755
24756 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
24757 !!end
24758
24759 ## Making these next 3 tests Parsoid-only since they are html2wt tests
24760 ## to test wikitext escaping, and insignificant whitespace diffs
24761 ## cause PHP parser tests to barf
24762 !! test
24763 Lists: 1. Nested inside html (No unnecessary escapes)
24764 !! options
24765 parsoid=html2wt
24766 !! html/parsoid
24767 <ul>
24768 <li>*foo</li>
24769 <li>#foo</li>
24770 <li>:foo</li>
24771 <li>;foo</li>
24772 <li data-parsoid='{}'>*foo</li>
24773 <li data-parsoid='{}'>#foo</li>
24774 <li data-parsoid='{}'>:foo</li>
24775 <li data-parsoid='{}'>;foo</li>
24776 </ul>
24777
24778 <ol>
24779 <li>*foo</li>
24780 <li>#foo</li>
24781 <li>:foo</li>
24782 <li>;foo</li>
24783 <li data-parsoid='{}'>*foo</li>
24784 <li data-parsoid='{}'>#foo</li>
24785 <li data-parsoid='{}'>:foo</li>
24786 <li data-parsoid='{}'>;foo</li>
24787 </ol>
24788 !! wikitext
24789 * *foo
24790 * #foo
24791 * :foo
24792 * ;foo
24793 *<nowiki>*foo</nowiki>
24794 *<nowiki>#foo</nowiki>
24795 *<nowiki>:foo</nowiki>
24796 *<nowiki>;foo</nowiki>
24797
24798 # *foo
24799 # #foo
24800 # :foo
24801 # ;foo
24802 #<nowiki>*foo</nowiki>
24803 #<nowiki>#foo</nowiki>
24804 #<nowiki>:foo</nowiki>
24805 #<nowiki>;foo</nowiki>
24806 !!end
24807
24808 !! test
24809 Lists: 2. Inside definition lists
24810 !! options
24811 parsoid=html2wt
24812 !! html/parsoid
24813 <dl><dt>;foo</dt></dl>
24814 <dl><dt>:foo</dt></dl>
24815 <dl><dt>:foo</dt>
24816 <dd>bar</dd></dl>
24817 <dl><dd>:foo</dd></dl>
24818 !! wikitext
24819 ; ;foo
24820
24821 ; <nowiki>:foo</nowiki>
24822
24823 ; <nowiki>:foo</nowiki>
24824 : bar
24825
24826 : :foo
24827 !!end
24828
24829 !! test
24830 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
24831 !! options
24832 parsoid=html2wt
24833 !! html/parsoid
24834 <ul>
24835 <li>*foo*bar</li>
24836 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
24837 </ul>
24838 !! wikitext
24839 * *foo*bar
24840 *<nowiki>*foo</nowiki>''it''*bar
24841 !!end
24842
24843 !! test
24844 Lists: 4. No escapes needed
24845 !! options
24846 parsoid=html2wt
24847 !! html/parsoid
24848 <ul>
24849 <li>foo*bar
24850 </li>
24851 </ul>
24852 <ul>
24853 <li><i>foo</i>*bar
24854 </li>
24855 </ul>
24856 <ul>
24857 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
24858 </li>
24859 </ul>
24860 <ul>
24861 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
24862 </li>
24863 </ul>
24864 !! wikitext
24865 *foo*bar
24866
24867 *''foo''*bar
24868
24869 *[[Foo]]: bar
24870
24871 *[[Foo]]*bar
24872 !!end
24873
24874 !! test
24875 Lists: 5. No unnecessary escapes
24876 !! options
24877 parsoid=html2wt
24878 !! html/parsoid
24879 <ul><li> bar <span>[[foo]]</span></li></ul>
24880 <ul><li> =bar <span>[[foo]]</span></li></ul>
24881 <ul><li> [[bar <span>[[foo]]</span></li></ul>
24882 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
24883 <ul><li> =bar <span>foo]]</span>=</li></ul>
24884 <ul><li> <s></s>: a</li></ul>
24885 <ul><li> <i>* foo</i></li></ul>
24886
24887 !! wikitext
24888 * bar <span><nowiki>[[foo]]</nowiki></span>
24889
24890 * =bar <span><nowiki>[[foo]]</nowiki></span>
24891
24892 * [[bar <span><nowiki>[[foo]]</nowiki></span>
24893
24894 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24895
24896 * =bar <span>foo]]</span>=
24897
24898 * <s></s>: a
24899
24900 * ''* foo''
24901 !!end
24902
24903 !! test
24904 Lists: 6. Escape bullets in SOL position
24905 !! options
24906 parsoid=html2wt
24907 !! html/parsoid
24908 <p><!--cmt-->*foo</p>
24909 !! wikitext
24910 <!--cmt--><nowiki>*</nowiki>foo
24911 !!end
24912
24913 !! test
24914 Lists: 7. Escape bullets in a multi-line context
24915 !! options
24916 parsoid=html2wt
24917 !! html/parsoid
24918 <p>a
24919 *b
24920 </p>
24921 !! wikitext
24922 a
24923 <nowiki>*</nowiki>b
24924 !!end
24925
24926 !! test
24927 Lists: 8. Escape colons only if not present in tags
24928 !! options
24929 parsoid=html2wt
24930 !! html/parsoid
24931 <dl><dt>a:b<i>c:d</i></dt></dl>
24932 !! wikitext
24933 ; <nowiki>a:b</nowiki>''c:d''
24934 !! end
24935
24936 #### --------------- HRs ---------------
24937 #### 1. Single line
24938 #### -----------------------------------
24939
24940 !! test
24941 HRs: 1. Single line
24942 !! options
24943 parsoid=html2wt
24944 !! html/parsoid
24945 <hr />----
24946 <hr />=foo=
24947 <hr />*foo
24948 !! wikitext
24949 ----<nowiki>----</nowiki>
24950 ----=foo=
24951 ----*foo
24952 !! end
24953
24954 #### --------------- Tables ---------------
24955 #### 1a. Simple example
24956 #### 1b. No escaping needed (!foo)
24957 #### 1c. No escaping needed (|foo)
24958 #### 1d. No escaping needed (|}foo)
24959 ####
24960 #### 2a. Nested in td (<td>foo|bar</td>)
24961 #### 2b. Nested in td (<td>foo||bar</td>)
24962 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24963 ####
24964 #### 3a. Nested in th (<th>foo!bar</th>)
24965 #### 3b. Nested in th (<th>foo!!bar</th>)
24966 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24967 ####
24968 #### 4a. Escape -
24969 #### 4b. Escape +
24970 #### 4c. No escaping needed
24971 #### --------------------------------------
24972
24973 !! test
24974 Tables: 1a. Simple example
24975 !! options
24976 parsoid=html2wt
24977 !! html/parsoid
24978 <p>{|
24979 |}
24980 </p>
24981 !! wikitext
24982 <nowiki>{|</nowiki>
24983 |}
24984 !! end
24985
24986 !! test
24987 Tables: 1b. No escaping needed
24988 !! options
24989 parsoid=html2wt
24990 !! html/parsoid
24991 <p>!foo
24992 </p>
24993 !! wikitext
24994 !foo
24995 !! end
24996
24997 !! test
24998 Tables: 1c. No escaping needed
24999 !! options
25000 parsoid=html2wt
25001 !! html/parsoid
25002 <p>|foo
25003 </p>
25004 !! wikitext
25005 |foo
25006 !! end
25007
25008 !! test
25009 Tables: 1d. No escaping needed
25010 !! options
25011 parsoid=html2wt
25012 !! html/parsoid
25013 <p>|}foo
25014 </p>
25015 !! wikitext
25016 |}foo
25017 !! end
25018
25019 !! test
25020 Tables: 2a. Nested in td
25021 !! options
25022 parsoid=html2wt
25023 !! html/parsoid
25024 <table><tbody><tr>
25025 <td>foo|bar</td></tr>
25026 <tr><td>x<div>a|b</div></td>
25027 </tbody></table>
25028 !! wikitext
25029 {|
25030 |<nowiki>foo|bar</nowiki>
25031 |-
25032 |x<div><nowiki>a|b</nowiki></div>
25033 |}
25034 !! html/php+tidy
25035 <table>
25036 <tr>
25037 <td>foo|bar</td>
25038 </tr>
25039 <tr>
25040 <td>x
25041 <div>a|b</div>
25042 </td>
25043 </tr>
25044 </table>
25045 !! end
25046
25047 !! test
25048 Tables: 2b. Nested in td
25049 !! options
25050 parsoid=html2wt
25051 !! html/parsoid
25052 <table><tbody><tr>
25053 <td>foo||bar</td>
25054 <td>a<i>b||c</i></td>
25055 <td>a<i><div>b||c</div></i></td>
25056 </tr></tbody></table>
25057 !! wikitext
25058 {|
25059 |<nowiki>foo||bar</nowiki>
25060 |a''<nowiki>b||c</nowiki>''
25061 |a''<div><nowiki>b||c</nowiki></div>''
25062 |}
25063 !! html/php
25064 <table>
25065 <tr>
25066 <td>foo||bar
25067 </td>
25068 <td>a<i>b||c</i>
25069 </td>
25070 <td>a<i><div>b||c</div></i>
25071 </td></tr></table>
25072
25073 !! end
25074
25075 !! test
25076 Tables: 2c. Nested in td -- no escaping needed
25077 !! options
25078 parsoid=html2wt
25079 !! html/*
25080 <table>
25081 <tr>
25082 <td>foo!!bar
25083 </td></tr></table>
25084
25085 !! wikitext
25086 {|
25087 |foo!!bar
25088 |}
25089 !! end
25090
25091 !! test
25092 Tables: 3a. Nested in th
25093 !! options
25094 parsoid=html2wt
25095 !! html/*
25096 <table>
25097 <tr>
25098 <th>foo!bar
25099 </th></tr></table>
25100
25101 !! wikitext
25102 {|
25103 !foo!bar
25104 |}
25105 !! end
25106
25107 !! test
25108 Tables: 3b. Nested in th
25109 !! options
25110 parsoid=html2wt
25111 !! html/parsoid
25112 <table><tbody>
25113 <tr><th>foo!!bar</th>
25114 <th><i>foo|bar</i></th>
25115 <th><i>foo!!bar</i></th>
25116 <th><i><span>foo!!bar</span></i></th>
25117 </tr></tbody></table>
25118 !! wikitext
25119 {|
25120 !<nowiki>foo!!bar</nowiki>
25121 !''<nowiki>foo|bar</nowiki>''
25122 !''<nowiki>foo!!bar</nowiki>''
25123 !''<span><nowiki>foo!!bar</nowiki></span>''
25124 |}
25125 !! html/php
25126 <table>
25127 <tr>
25128 <th>foo!!bar
25129 </th>
25130 <th><i>foo|bar</i>
25131 </th>
25132 <th><i>foo!!bar</i>
25133 </th>
25134 <th><i><span>foo!!bar</span></i>
25135 </th></tr></table>
25136
25137 !! end
25138
25139 !! test
25140 Tables: 3c. Nested in th
25141 !! options
25142 parsoid=html2wt
25143 !! html/parsoid
25144 <table><tbody>
25145 <tr><th>foo||bar</th>
25146 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25147 </tr></tbody></table>
25148 !! wikitext
25149 {|
25150 !<nowiki>foo||bar</nowiki>
25151 !<nowiki>foo||bar</nowiki>
25152 |}
25153 !! html/php
25154 <table>
25155 <tr>
25156 <th>foo||bar
25157 </th>
25158 <th>foo||bar
25159 </th></tr></table>
25160
25161 !! end
25162
25163 !! test
25164 Tables: 4a. Escape -
25165 !! options
25166 parsoid=html2wt
25167 !! html/*
25168 <table>
25169 <tr>
25170 <th>-bar
25171 </th></tr>
25172 <tr>
25173 <td>-bar
25174 </td></tr></table>
25175
25176 !! wikitext
25177 {|
25178 !-bar
25179 |-
25180 |<nowiki>-bar</nowiki>
25181 |}
25182 !! end
25183
25184 !! test
25185 Tables: 4b. Escape +
25186 !! options
25187 parsoid=html2wt
25188 !! html/*
25189 <table>
25190 <tr>
25191 <th>+bar
25192 </th></tr>
25193 <tr>
25194 <td>+bar
25195 </td></tr></table>
25196
25197 !! wikitext
25198 {|
25199 !+bar
25200 |-
25201 |<nowiki>+bar</nowiki>
25202 |}
25203 !! end
25204
25205 !! test
25206 Tables: 4c. No escaping needed
25207 !! options
25208 parsoid=html2wt
25209 !! html/parsoid
25210 <table><tbody>
25211 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25212 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25213 <tr><td>foo
25214 <p>bar|baz
25215 +bar
25216 -bar</p></td></tr>
25217 <tr><td>x
25218 <div>a|b</div></td>
25219 </tbody></table>
25220 !! wikitext
25221 {|
25222 |foo-bar
25223 |foo+bar
25224 |-
25225 |''foo''-bar
25226 |''foo''+bar
25227 |-
25228 |foo
25229 bar|baz
25230 +bar
25231 -bar
25232 |-
25233 |x
25234 <div>a|b</div>
25235 |}
25236 !! html/php
25237 <table>
25238 <tr>
25239 <td>foo-bar
25240 </td>
25241 <td>foo+bar
25242 </td></tr>
25243 <tr>
25244 <td><i>foo</i>-bar
25245 </td>
25246 <td><i>foo</i>+bar
25247 </td></tr>
25248 <tr>
25249 <td>foo
25250 <p>bar|baz
25251 +bar
25252 -bar
25253 </p>
25254 </td></tr>
25255 <tr>
25256 <td>x
25257 <div>a|b</div>
25258 </td></tr></table>
25259
25260 !! end
25261
25262 !! test
25263 Tables: 4d. No escaping needed
25264 !! options
25265 parsoid=html2wt
25266 !! html/parsoid
25267 <table>
25268 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25269 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25270 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25271 </tbody></table>
25272 !! wikitext
25273 {|
25274 |[[Foo]]-bar
25275 ||+1
25276 ||-2
25277 |}
25278 !! html/php
25279 <table>
25280 <tr>
25281 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25282 </td>
25283 <td>+1
25284 </td>
25285 <td>-2
25286 </td></tr></table>
25287
25288 !! end
25289
25290 !! test
25291 T97430: Don't emit empty nowiki pairs around marker meta tags
25292 !! options
25293 parsoid=html2wt
25294 !! html/parsoid
25295 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25296 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25297 !! wikitext
25298 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25299 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25300 !! end
25301
25302 !! test
25303 Unclosed xmlish element in table line shouldn't eat end delimiters
25304 !! options
25305 parsoid=html2wt
25306 !! html/parsoid
25307 <table>
25308 <tbody><tr><td> &lt;foo</td>
25309 <td> bar></td></tr>
25310 </tbody></table>
25311 !! wikitext
25312 {|
25313 | <foo
25314 | bar>
25315 |}
25316 !! html/php
25317 <table>
25318 <tr>
25319 <td> &lt;foo
25320 </td>
25321 <td> bar&gt;
25322 </td></tr></table>
25323
25324 !! end
25325
25326 #### --------------- Links ----------------
25327 #### 1. Quote marks in link text
25328 #### 2. Wikilinks: Escapes needed
25329 #### 3. Wikilinks: No escapes needed
25330 #### 4. Extlinks: Escapes needed
25331 #### 5. Extlinks: No escapes needed
25332 #### --------------------------------------
25333 !! test
25334 Links 1. WikiLinks: No escapes needed
25335 !! options
25336 parsoid=html2wt
25337 !! html/parsoid
25338 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25339 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25340 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25341 !! wikitext
25342 [[Foo|Foo''boo'']]
25343 [[Foo|[Foobar]]]
25344 [[Foo|x [Foobar] x]]
25345 !! html/php
25346 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25347 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25348 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25349 </p>
25350 !! end
25351
25352 !! test
25353 Links 2. WikiLinks: Escapes needed
25354 !! options
25355 parsoid=html2wt
25356 !! html/parsoid
25357 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25358 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25359 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25360 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25361 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25362 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25363 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25364 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25365 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25366 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25367 !! wikitext
25368 [[Foo|<nowiki>Foobar]</nowiki>]]
25369 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25370 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25371 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25372 [[Foo|<nowiki>|Bar</nowiki>]]
25373 [[Foo|<nowiki>]]bar</nowiki>]]
25374 [[Foo|<nowiki>[[bar</nowiki>]]
25375 [[Foo|<nowiki>x [[ y</nowiki>]]
25376 [[Foo|<nowiki>x ]] y</nowiki>]]
25377 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25378 !! html/php
25379 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25380 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25381 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25382 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25383 <a href="/wiki/Foo" title="Foo">|Bar</a>
25384 <a href="/wiki/Foo" title="Foo">]]bar</a>
25385 <a href="/wiki/Foo" title="Foo">[[bar</a>
25386 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25387 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25388 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25389 </p>
25390 !! end
25391
25392 !! test
25393 Links 3. WikiLinks: No escapes needed
25394 !! options
25395 parsoid=html2wt
25396 !! html/parsoid
25397 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25398 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25399 !! wikitext
25400 [[Foo|[Foobar]]
25401 [[Foo|foo|bar]]
25402 !! html/php
25403 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25404 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25405 </p>
25406 !! end
25407
25408 !! test
25409 Links 4. ExtLinks: Escapes needed
25410 !! options
25411 parsoid=html2wt
25412 !! html/parsoid
25413 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25414 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25415 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25416 <p>[http://google.com]</p>
25417 <p>[http://google.com google]</p>
25418 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25419 <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>
25420 !! wikitext
25421 [http://google.com <nowiki>[google]</nowiki>]
25422 [http://google.com <nowiki>google]</nowiki>]
25423 [http://google.com <nowiki>goog] le</nowiki>]
25424
25425 <nowiki>[http://google.com]</nowiki>
25426
25427 <nowiki>[http://google.com google]</nowiki>
25428
25429 [http://google.com<nowiki>]</nowiki>
25430
25431 [{{echo|http://google.com}}<nowiki>]</nowiki>
25432 !! html/php
25433 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25434 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25435 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25436 </p><p>[http://google.com]
25437 </p><p>[http://google.com google]
25438 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25439 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25440 </p>
25441 !! end
25442
25443 !! test
25444 Links 5. ExtLinks: No escapes needed
25445 !! options
25446 parsoid=html2wt
25447 !! html/parsoid
25448 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25449 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25450 !! wikitext
25451 [http://google.com [google]
25452
25453 [[http://google.com]]
25454 !! html/php
25455 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25456 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25457 </p>
25458 !! end
25459
25460 !! test
25461 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25462 !! options
25463 parsoid=html2wt
25464 !! html/parsoid
25465 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25466 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25467 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25468 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25469 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25470 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25471 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25472 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25473 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25474 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25475 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25476 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25477 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25478 </p>
25479 !! wikitext
25480 x<nowiki/>http://example.com<nowiki/>y
25481 http://example.com<nowiki/>?x
25482 http://example.com<nowiki/>&x
25483 http://example.com<nowiki/>'x
25484 http://example.com<nowiki/>,x
25485 http://example.com<nowiki/>.x
25486 http://example.com<nowiki/>;x
25487 http://example.com<nowiki/>:x
25488 http://example.com<nowiki/>;x
25489 http://example.com<nowiki/>!x
25490 http://example.com<nowiki/>=x
25491 http://example.com<nowiki/>(x)
25492 http://example.com(x<nowiki/>)
25493 !! end
25494
25495 !! test
25496 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25497 !! options
25498 parsoid=html2wt
25499 !! html/parsoid
25500 <p>x
25501 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25502 y
25503 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25504 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25505 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25506 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25507 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25508 </p>
25509 !! wikitext
25510 x
25511 http://example.com
25512 y
25513 "http://example.com"
25514 (http://example.com)
25515 (http://example.com) foo
25516 http://example.com,
25517 http://example.com, foo
25518 !! html/php
25519 <p>x
25520 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25521 y
25522 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25523 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25524 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25525 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25526 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25527 </p>
25528 !! end
25529
25530 !! test
25531 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25532 !! options
25533 parsoid=html2wt
25534 !! html/parsoid
25535 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25536 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25537 !! wikitext
25538 http://example.com.,;:!?\
25539 -http://example.com:
25540 !! html/php
25541 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25542 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25543 </p>
25544 !! end
25545
25546 !! test
25547 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25548 !! options
25549 parsoid=html2wt
25550 !! html/parsoid
25551 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25552 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25553 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25554 !! wikitext
25555 RFC 123<nowiki/>4
25556 RFC 123<nowiki/>y
25557 X<nowiki/>RFC 123<nowiki/>y
25558 !! end
25559
25560 !! test
25561 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25562 !! options
25563 parsoid=html2wt
25564 !! html/parsoid
25565 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25566 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25567 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25568 </p>
25569 !! wikitext
25570 RFC 123?foo
25571 RFC 123&foo
25572 -RFC 123-
25573 !! html/php
25574 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
25575 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25576 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
25577 </p>
25578 !! end
25579
25580 !! test
25581 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25582 !! options
25583 parsoid=html2wt
25584 !! html/parsoid
25585 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25586 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25587 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25588 !! wikitext
25589 PMID 123<nowiki/>4
25590 PMID 123<nowiki/>y
25591 X<nowiki/>PMID 123<nowiki/>y
25592 !! end
25593
25594 !! test
25595 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25596 !! options
25597 parsoid=html2wt
25598 !! html/parsoid
25599 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25600 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25601 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25602 </p>
25603 !! wikitext
25604 PMID 123?foo
25605 PMID 123&foo
25606 -PMID 123-
25607 !! html/php
25608 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25609 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25610 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25611 </p>
25612 !! end
25613
25614 !! test
25615 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25616 !! options
25617 parsoid=html2wt
25618 !! html/parsoid
25619 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25620 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25621 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25622 </p>
25623 !! wikitext
25624 ISBN 1234567890<nowiki/>1
25625 ISBN 1234567890<nowiki/>x
25626 a<nowiki/>ISBN 1234567890<nowiki/>b
25627 !! end
25628
25629 !! test
25630 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25635 !! wikitext
25636 -ISBN 1234567890's
25637 !! html/php
25638 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25639 </p>
25640 !! end
25641
25642 !! test
25643 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25644 !! options
25645 parsoid=html2wt
25646 !! html/*
25647 <p>this is not a link: http://example.com
25648 </p>
25649 !! wikitext
25650 this is not a link: <nowiki>http://example.com</nowiki>
25651 !! end
25652
25653 !! test
25654 Links 15. Link trails can't become link prefixes.
25655 !! options
25656 language=is
25657 parsoid=html2wt
25658 !! html/parsoid
25659 <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>
25660 !! wikitext
25661 [[Söfnuður]]-[[00]]
25662 !! html/php
25663 <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>
25664 </p>
25665 !! end
25666
25667 #### --------------- Quotes ---------------
25668 #### 1. Quotes inside <b> and <i>
25669 #### 2. Link fragments separated by <i> and <b> tags
25670 #### 3. Link fragments inside <i> and <b>
25671 #### 4. No escaping needed
25672 #### --------------------------------------
25673 !! test
25674 1a. Quotes inside <b> and <i>
25675 !! options
25676 parsoid=html2wt
25677 !! html/*
25678 <p><i>'foo'</i>
25679 <i>''foo''</i>
25680 <i>'''foo'''</i>
25681 <i>foo</i>'s
25682 <b>'foo'</b>
25683 <b>''foo''</b>
25684 <b>'''foo'''</b>
25685 <b>foo'<i>bar'</i>baz</b>
25686 <b>foo</b>'s
25687 '<i>foo</i>
25688 <i>foo</i>'
25689 <i>foo'</i>'
25690 '<i>foo</i>'
25691 '<b>foo</b>
25692 <b>foo</b>'
25693 '<b>foo</b>'
25694 <i>fools'<span> errand</span></i>
25695 <i><span>fool</span>'s errand</i>
25696 '<i>foo</i> bar '<i>baz</i>
25697 a|!*#-:;+-~[]{}b'<i>x</i>
25698 </p>
25699 !! wikitext
25700 ''<nowiki/>'foo'''
25701 ''<nowiki>''foo''</nowiki>''
25702 ''<nowiki>'''foo'''</nowiki>''
25703 ''foo''<nowiki/>'s
25704 '''<nowiki/>'foo''''
25705 '''<nowiki>''foo''</nowiki>'''
25706 '''<nowiki>'''foo'''</nowiki>'''
25707 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
25708 '''foo'''<nowiki/>'s
25709 '''foo''
25710 ''foo''<nowiki/>'
25711 ''foo'''<nowiki/>'
25712 '''foo''<nowiki/>'
25713 ''''foo'''
25714 '''foo'''<nowiki/>'
25715 ''''foo'''<nowiki/>'
25716 ''fools'<span> errand</span>''
25717 ''<span>fool</span>'s errand''
25718 '<nowiki/>''foo'' bar '''baz''
25719 a|!*#-:;+-~[]{}b'''x''
25720 !! end
25721
25722 !! test
25723 1b. Quotes inside <b> and <i> with other tags on same line
25724 !! options
25725 parsoid=html2wt
25726 !! html/parsoid
25727 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25728 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25729 <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>
25730 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
25731 '<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>
25732 '<i>foo</i> <div title="name">test</div>
25733 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
25734 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
25735 <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>
25736 </ol>
25737 !! wikitext
25738 '''a'' foo ''[[bar]]''
25739 ''a''' foo ''[[bar]]''
25740 ''a''' foo '''{{echo|[[bar]]}}'''
25741 [[foo]] x'''[[bar]]''
25742 '''foo'' <ref>test</ref>
25743 '''foo'' <div title="name">test</div>
25744 '''foo'' and <br> bar
25745 <references />
25746 !! end
25747
25748 !! test
25749 2. Link fragments separated by <i> and <b> tags
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <p>[[<i>foo</i>hello]]</p>
25754 <p>[[<b>foo</b>hello]]</p>
25755 !! wikitext
25756 [[''foo''<nowiki>hello]]</nowiki>
25757
25758 [['''foo'''<nowiki>hello]]</nowiki>
25759 !! end
25760
25761 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
25762 # this is one of the shortcomings of this format
25763 !! test
25764 3. Link fragments inside <i> and <b>
25765 !! options
25766 parsoid=html2wt
25767 !! html/parsoid
25768 <p><i>[[foo</i>]]</p>
25769 <p><b>[[foo</b>]]</p>
25770 !! wikitext
25771 ''[[foo''<nowiki>]]</nowiki>
25772
25773 '''[[foo'''<nowiki>]]</nowiki>
25774 !! end
25775
25776 !! test
25777 4. No escaping needed
25778 !! options
25779 parsoid=html2wt
25780 !! html/parsoid
25781 <p>'<span><i>bar</i></span>'
25782 '<span><b>bar</b></span>'
25783 'a:b'foo
25784 </p>
25785 !! wikitext
25786 '<span>''bar''</span>'
25787 '<span>'''bar'''</span>'
25788 'a:b'foo
25789 !! end
25790
25791 #### ----------- Paragraphs ---------------
25792 #### 1. No unnecessary escapes
25793 #### --------------------------------------
25794
25795 !! test
25796 1. No unnecessary escapes
25797 !! options
25798 parsoid=html2wt
25799 !! html/parsoid
25800 <p>bar <span>[[foo]]</span>
25801 </p><p>=bar <span>[[foo]]</span>
25802 </p><p>[[bar <span>[[foo]]</span>
25803 </p><p>]]bar <span>[[foo]]</span>
25804 </p><p>=bar <span>foo]]</span>=
25805 </p>
25806 !! wikitext
25807 bar <span><nowiki>[[foo]]</nowiki></span>
25808
25809 =bar <span><nowiki>[[foo]]</nowiki></span>
25810
25811 [[bar <span><nowiki>[[foo]]</nowiki></span>
25812
25813 ]]bar <span><nowiki>[[foo]]</nowiki></span>
25814
25815 =bar <span>foo]]</span><nowiki>=</nowiki>
25816 !!end
25817
25818 #### ----------------------- PRE --------------------------
25819 #### 1. Leading whitespace in SOL context should be escaped
25820 #### ------------------------------------------------------
25821 !! test
25822 1. Leading whitespace in SOL context should be escaped
25823 !! options
25824 parsoid=html2wt
25825 !! html/parsoid
25826 <p> a</p>
25827
25828 <p> a</p>
25829
25830 <p> a(tab)</p>
25831
25832 <p> a
25833 <!--cmt-->
25834 a</p>
25835
25836 <p>a
25837 b</p>
25838
25839 <p>a
25840 b</p>
25841
25842 <p>a
25843 b</p>
25844 !! wikitext
25845 <nowiki> </nowiki>a
25846
25847 <nowiki> </nowiki> a
25848
25849 a(tab)
25850
25851 <nowiki> </nowiki> a
25852 <!--cmt-->
25853 <nowiki> </nowiki>a
25854
25855 a
25856 <nowiki> </nowiki>b
25857
25858 a
25859 b
25860
25861 a
25862 b
25863 !! html/php
25864 <p> a
25865 </p><p> a
25866 </p><p> a(tab)
25867 </p><p> a
25868 a
25869 </p><p>a
25870 b
25871 </p><p>a
25872 b
25873 </p><p>a
25874 b
25875 </p>
25876 !! end
25877
25878 !! test
25879 2. Leading whitespace in non-indent-pre contexts should not be escaped
25880 !! options
25881 parsoid=html2wt
25882 !! html/parsoid
25883 <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>
25884 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
25885 <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>
25886 b</span></li>
25887 </ol>
25888 !! wikitext
25889 foo <ref>''a''
25890 b</ref>
25891 <references />
25892 !! end
25893
25894 !! test
25895 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25896 !! options
25897 parsoid=html2wt
25898 !! html/parsoid
25899 <blockquote>
25900 <p>
25901 a
25902 <span>b</span>
25903 c</p>
25904 </blockquote>
25905 !! wikitext
25906 <blockquote>
25907 a
25908 <span>b</span>
25909 c
25910 </blockquote>
25911 !! end
25912
25913 !! test
25914 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25915 !! options
25916 parsoid=html2wt
25917 !! html/parsoid
25918 <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>
25919 !! wikitext
25920 [[File:Foobar.jpg|thumb|caption]]
25921 !! end
25922
25923 !! test
25924 5. Nowiki escaping should account for indent-pres
25925 !! options
25926 parsoid=html2wt
25927 !! html/parsoid
25928 <pre>==foo==</pre>
25929 !! wikitext
25930 ==foo==
25931 !! end
25932
25933 !!test
25934 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25935 !! options
25936 parsoid=html2wt
25937 !! html/parsoid
25938 <pre>
25939 * foo
25940 * bar
25941 </pre>
25942 !! wikitext
25943 * foo
25944 * bar
25945 !! end
25946
25947 #### --------------- Behavior Switches --------------------
25948
25949 !! test
25950 1. Valid behavior switches should be escaped
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 __TOC__
25955 <i>__TOC__</i>
25956 !! wikitext
25957 <nowiki>__TOC__</nowiki>
25958 ''<nowiki>__TOC__</nowiki>''
25959 !! end
25960
25961 !! test
25962 2. Invalid behavior switches should not be escaped
25963 !! options
25964 parsoid=html2wt
25965 !! html/parsoid
25966 __TOO__
25967 __|__
25968 !! wikitext
25969 __TOO__
25970 __|__
25971 !! end
25972
25973 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25974 !! test
25975 Behavior switches should be SOL-transparent
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <meta property="mw:PageProp/toc" />
25980
25981 <!-- this one's bogus -->
25982 <pre>__TOO__</pre>
25983
25984 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
25985
25986 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
25987 !! wikitext
25988 __TOC__
25989
25990 <!-- this one's bogus -->
25991 __TOO__
25992
25993 __TOC__ foo
25994
25995 __TOC__
25996 bar
25997 !! end
25998
25999 #### --------------- HTML tags ---------------
26000 #### 1. a tags
26001 #### 2. other tags
26002 #### 3. multi-line html tag
26003 #### 4. extension tags
26004 #### -----------------------------------------
26005 !! test
26006 1. a tags
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26011 !! wikitext
26012 <a href="http://google.com">google</a>
26013 !! end
26014
26015 !! test
26016 2. other tags
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26021 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26022 <li> &lt;td&gt;</li></ul>
26023
26024 !! wikitext
26025 * <nowiki><div>foo</div></nowiki>
26026 * <nowiki><div style="color:red">foo</div></nowiki>
26027 * <nowiki><td></nowiki>
26028 !! end
26029
26030 !! test
26031 3. multi-line html tag
26032 !! options
26033 parsoid=html2wt
26034 !! html/parsoid
26035 <p>&lt;div
26036 &gt;foo&lt;/div
26037 &gt;
26038 </p>
26039 !! wikitext
26040 <nowiki><div
26041 >foo</div
26042 ></nowiki>
26043 !! end
26044
26045 !! test
26046 4. extension tags
26047 !! options
26048 parsoid=html2wt
26049 !! html/parsoid
26050 <p>&lt;ref&gt;foo&lt;/ref&gt;
26051 </p><p>&lt;ref&gt;bar
26052 </p><p>baz&lt;/ref&gt;
26053 </p>
26054 !! wikitext
26055 <nowiki><ref>foo</ref></nowiki>
26056
26057 <nowiki><ref>bar</nowiki>
26058
26059 baz<nowiki></ref></nowiki>
26060 !! end
26061
26062 #### --------------- Others ---------------
26063 !! test
26064 Escaping nowikis
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26069 </p>
26070 !! wikitext
26071 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26072 !! end
26073
26074 ## The quote-char in the input is necessary for triggering the bug
26075 !! test
26076 (T54035) Nowiki-escaping should not get tripped by " :" in text
26077 !! options
26078 parsoid=html2wt
26079 !! html/parsoid
26080 <p>foo's bar :</p>
26081 !! wikitext
26082 foo's bar :
26083 !! end
26084
26085 #----------- End of wikitext escaping tests --------------
26086
26087 !! test
26088
26089 Tag-like HTML structures are passed through as text
26090 !! wikitext
26091 <x y>
26092
26093 <x.y>
26094
26095 <x-y>
26096
26097 1>2
26098
26099 x<y
26100
26101 a>b
26102
26103 1<d e>f
26104 !! html
26105 <p>&lt;x y&gt;
26106 </p><p>&lt;x.y&gt;
26107 </p><p>&lt;x-y&gt;
26108 </p><p>1&gt;2
26109 </p><p>x&lt;y
26110 </p><p>a&gt;b
26111 </p><p>1&lt;d e&gt;f
26112 </p>
26113 !! end
26114
26115 !! test
26116 HTML tag with necessary entities in attributes
26117 !! wikitext
26118 <span title="&amp;amp;">foo</span>
26119 !! html
26120 <p><span title="&amp;amp;">foo</span>
26121 </p>
26122 !! end
26123
26124 !! test
26125 HTML tag with 'unnecessary' entity encoding in attributes
26126 !! wikitext
26127 <span title="&amp;">foo</span>
26128 !! html
26129 <p><span title="&amp;">foo</span>
26130 </p>
26131 !! end
26132
26133 !! test
26134 HTML tag with broken attribute value quoting
26135 !! options
26136 parsoid=wt2html,html2html
26137 !! wikitext
26138 <span title="Hello world>Foo</span>
26139 !! html/php
26140 <p><span title="Hello world">Foo</span>
26141 </p>
26142 !! html/parsoid
26143 <p><span title="Hello world">Foo</span></p>
26144 !! end
26145
26146 !! test
26147 Self-closed tag with broken attribute value quoting
26148 !! options
26149 parsoid=wt2html,html2html
26150 !! wikitext
26151 <div title="Hello world />Foo
26152 !! html/php+tidy
26153 <div title="Hello world"></div>
26154 <p>Foo</p>
26155 !! html/parsoid
26156 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26157 !! end
26158
26159 !! test
26160 Table with broken attribute value quoting
26161 !! options
26162 parsoid=wt2html,html2html
26163 !! wikitext
26164 {|
26165 | title="Hello world|Foo
26166 |}
26167 !! html/php
26168 <table>
26169 <tr>
26170 <td title="Hello world">Foo
26171 </td></tr></table>
26172
26173 !! html/parsoid
26174 <table>
26175 <tr>
26176 <td title="Hello world">Foo
26177 </td></tr></table>
26178
26179 !! end
26180
26181 !! test
26182 Table with broken attribute value quoting on consecutive lines
26183 !! options
26184 parsoid=wt2html,html2html
26185 !! wikitext
26186 {|
26187 | title="Hello world|Foo
26188 | style="color:red|Bar
26189 |}
26190 !! html/php
26191 <table>
26192 <tr>
26193 <td title="Hello world">Foo
26194 </td>
26195 <td style="color:red">Bar
26196 </td></tr></table>
26197
26198 !! html/parsoid
26199 <table><tbody>
26200 <tr>
26201 <td title="Hello world">Foo
26202 </td><td style="color: red">Bar
26203 </td></tr></tbody></table>
26204
26205 !! end
26206
26207 !!test
26208 Accept empty td cell attribute
26209 !! wikitext
26210 {|
26211 | align="center" | foo || |
26212 |}
26213 !! html
26214 <table>
26215 <tr>
26216 <td align="center"> foo </td>
26217 <td>
26218 </td></tr></table>
26219
26220 !!end
26221
26222 !!test
26223 Non-empty attributes in th-cells
26224 !! wikitext
26225 {|
26226 ! Foo !! style="color: red" | Bar
26227 |}
26228 !! html
26229 <table>
26230 <tr>
26231 <th> Foo </th>
26232 <th style="color: red"> Bar
26233 </th></tr></table>
26234
26235 !!end
26236
26237 !!test
26238 Accept empty attributes in th-cells
26239 !! wikitext
26240 {|
26241 !| foo !!| bar
26242 |}
26243 !! html
26244 <table>
26245 <tr>
26246 <th> foo </th>
26247 <th> bar
26248 </th></tr></table>
26249
26250 !!end
26251
26252 !!test
26253 Empty table rows go away
26254 !! wikitext
26255 {|
26256 | Hello
26257 | there
26258 |- class="foo"
26259 |-
26260 |}
26261 !! html
26262 <table>
26263 <tr>
26264 <td> Hello
26265 </td>
26266 <td> there
26267 </td></tr>
26268
26269 </table>
26270
26271 !! end
26272
26273 ###
26274 ### Parsoid-centric tests for testing RTing of inter-element separators
26275 ### Edge cases not tested by existing parser tests and specific to
26276 ### Parsoid-specific serialization strategies.
26277 ###
26278
26279 !!test
26280 RT-ed inter-element separators should be valid separators
26281 !! wikitext
26282 {|
26283 |- [[foo]]
26284 |}
26285 !! html/php
26286 <table>
26287
26288 </table>
26289
26290 !! html/parsoid
26291 <table>
26292 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26293 </tbody></table>
26294 !!end
26295
26296 # Parsoid-only since PHP parser relies on Tidy for correct output
26297 !!test
26298 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26299 !!options
26300 parsoid
26301 !! wikitext
26302 {|
26303 |<small>foo
26304 bar
26305 |}
26306
26307 {|
26308 |<small>foo<small>
26309 |}
26310 !! html
26311 <table>
26312 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26313 <p>bar</p></small></td></tr>
26314 </tbody></table>
26315
26316 <table>
26317 <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>
26318 </tbody></table>
26319 !!end
26320
26321 # Note that the "style" attribute is really a template parameter here.
26322 # The = would have to be {{=}} if you wanted the literal.
26323 !!test
26324 Empty TD followed by TD with tpl-generated attribute
26325 !! wikitext
26326 {|
26327 |-
26328 |
26329 |{{echo|style='color:red'}}|foo
26330 |}
26331 !! html
26332 <table>
26333
26334 <tr>
26335 <td>
26336 </td>
26337 <td>foo
26338 </td></tr></table>
26339
26340 !!end
26341
26342 !!test
26343 Indented table with an empty td
26344 !! wikitext
26345 {|
26346 |-
26347 |
26348 |foo
26349 |}
26350 !! html
26351 <table>
26352
26353 <tr>
26354 <td>
26355 </td>
26356 <td>foo
26357 </td></tr></table>
26358
26359 !!end
26360
26361 ## We have some newline diffs RT-ing this edge case
26362 ## and it is not important enough -- we seem to be emitting
26363 ## at most 2 newlines after a </tr> and this is unrelated to
26364 ## the issue from T85627 that this is testing.
26365 !!test
26366 Indented table with blank lines in between (T85627)
26367 !! options
26368 parsoid=wt2html
26369 !! wikitext
26370 {|
26371 |foo
26372
26373
26374 |}
26375 !! html
26376 <table>
26377
26378 <tr>
26379 <td>foo
26380 </td></tr></table>
26381
26382 !!end
26383
26384 !!test
26385 Indented block & table
26386 !! wikitext
26387 <div>foo</div>
26388 {|
26389 |foo
26390 |}
26391 !! html/php
26392 <div>foo</div>
26393 <table>
26394 <tr>
26395 <td>foo
26396 </td></tr></table>
26397
26398 !! html/parsoid
26399 <div data-parsoid='{"stx":"html"}'>foo</div>
26400 <table><tbody>
26401 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26402 </tbody></table>
26403 !!end
26404
26405 !! test
26406 Indent and comment before table row
26407 !! wikitext
26408 {|
26409 <!--hi-->|-
26410 | there
26411 |}
26412 !! html/php
26413 <table>
26414
26415 <tr>
26416 <td> there
26417 </td></tr></table>
26418
26419 !! html/parsoid
26420 <table>
26421 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26422 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26423 </tbody></table>
26424 !! end
26425
26426 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26427 !!test
26428 Empty TR followed by a template-generated TR
26429 !!options
26430 parsoid
26431 !! wikitext
26432 {|
26433 |-
26434 {{echo|<tr><td>foo</td></tr>}}
26435 |}
26436 !! html
26437 <table>
26438 <tbody>
26439 <tr></tr>
26440 <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}}]}'>
26441 <td>foo</td></tr>
26442 </tbody></table>
26443 !!end
26444
26445 ## PHP and parsoid output differ for this, and since this is primarily
26446 ## for testing Parsoid's serializer, marking this Parsoid only
26447 !!test
26448 Empty TR followed by mixed-ws-comment line should RT correctly
26449 !!options
26450 parsoid
26451 !! wikitext
26452 {|
26453 |-
26454 <!--c-->
26455 |-
26456 <!--c--> <!--d-->
26457 |}
26458 !! html
26459 <table>
26460 <tbody>
26461 <tr></tr>
26462 <!--c-->
26463 <tr>
26464 <!--c--> </tr><!--d-->
26465 </tbody></table>
26466
26467 !!end
26468
26469 !!test
26470 Multi-line image caption generated by templates with/without trailing newlines
26471 !! wikitext
26472 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26473 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26474 !! html/parsoid
26475 <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>
26476 <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>
26477 !!end
26478
26479 !! test
26480 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26481 !! options
26482 parsoid=html2wt
26483 !! html/parsoid
26484 <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>
26485
26486 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26487 !! wikitext
26488 <includeonly>foo</includeonly>
26489 new para
26490
26491 [[Category:Foo]]
26492
26493 = new heading =
26494 !! end
26495
26496 ## PHP emits broken html for this, and since this is primarily
26497 ## a Parsoid serializer test, marking this Parsoid only
26498 !!test
26499 Improperly nested inline or quotes tags with whitespace in between
26500 !! wikitext
26501 <span> <s>x</span> </s>
26502 ''' ''x''' ''
26503 !! html/parsoid
26504 <p><span> <s>x</s></span><s> </s>
26505 <b> <i>x</i></b><i> </i>
26506 </p>
26507 !!end
26508
26509 !!test
26510 Encapsulate protected attributes from wt
26511 !! wikitext
26512 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26513
26514 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26515 | ok
26516 |}
26517 !! html/parsoid
26518 <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>
26519
26520 <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">
26521 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26522 </tbody></table>
26523 !!end
26524
26525 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26526 ## Having nested or stray pre tags results in the attempt to add duplicates,
26527 ## causing an assertion fail. This test tries to prevent that situation.
26528 !!test
26529 Ensure ParagraphWrapper can deal with stray closing pre tags
26530 !!options
26531 parsoid=wt2html
26532 !! wikitext
26533 plain text</pre>
26534 !! html/parsoid
26535 plain text
26536 !!end
26537
26538 !!test
26539 1. Ensure fostered text content is wrapped in element nodes
26540 !!options
26541 parsoid=wt2html
26542 !! wikitext
26543 <table>hi</table><table>ho</table>
26544 !! html/parsoid
26545 <p>hi</p>
26546 <table></table>
26547 <p>ho</p>
26548 <table></table>
26549 !!end
26550
26551 !!test
26552 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26553 !!options
26554 parsoid=wt2html,wt2wt
26555 !! wikitext
26556 <table>
26557 <tr> || ||
26558 <td> a
26559 </table>
26560 !! html/parsoid
26561 <p> || ||
26562 </p><table>
26563 <tbody><tr><td> a</td></tr>
26564 </tbody></table>
26565 !!end
26566
26567 !!test
26568 Encapsulation properly handles null DSR information from foster box
26569 !!options
26570 parsoid=wt2html,wt2wt
26571 !! wikitext
26572 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26573 !! html/parsoid
26574 <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>
26575 !!end
26576
26577 !!test
26578 1. Encapsulate foster-parented transclusion content
26579 !!options
26580 parsoid=wt2wt,wt2html
26581 !! wikitext
26582 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26583 !! html/parsoid
26584 <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>
26585 <tbody>
26586 <tr>
26587 <td>bar</td>
26588 </tr>
26589 </tbody>
26590 </table>
26591 !!end
26592
26593 !!test
26594 2. Encapsulate foster-parented transclusion content
26595 !!options
26596 parsoid=wt2wt,wt2html
26597 !! wikitext
26598 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26599 !! html/parsoid
26600 <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>
26601 <table>
26602 <tbody>
26603 <tr>
26604 <td>bar</td>
26605 </tr>
26606 </tbody>
26607 </table>
26608 !!end
26609
26610 !!test
26611 3. Encapsulate foster-parented transclusion content
26612 !!options
26613 parsoid=wt2wt,wt2html
26614 !! wikitext
26615 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26616 !! html/parsoid
26617 <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;]}">
26618 <p>foo</p>
26619 </div>
26620 <table>
26621 <tbody>
26622 <tr>
26623 <td>bar</td>
26624 </tr>
26625 </tbody>
26626 </table>
26627 !!end
26628
26629 !!test
26630 4. Encapsulate foster-parented transclusion content
26631 !!options
26632 parsoid=wt2wt,wt2html
26633 !! wikitext
26634 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26635 !! html/parsoid
26636 <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;]}">
26637 <p>foo</p>
26638 </div>
26639 <table>
26640 <tbody>
26641 <tr>
26642 <td>bar</td>
26643 </tr>
26644 </tbody>
26645 </table>
26646 !!end
26647
26648 !!test
26649 5. Encapsulate foster-parented transclusion content
26650 !!options
26651 parsoid=wt2wt,wt2html
26652 !! wikitext
26653 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
26654 !! html/parsoid
26655 <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>
26656 <table>
26657 <tbody>
26658 <tr>
26659 <td>
26660 <div>
26661 <p>foo</p>
26662 </div>
26663 </td>
26664 </tr>
26665 </tbody>
26666 </table>
26667 !!end
26668
26669 !!test
26670 6. Encapsulate foster-parented transclusion content
26671 !!options
26672 parsoid=wt2wt,wt2html
26673 !! wikitext
26674 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
26675 !! html/parsoid
26676 <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>
26677 <table>
26678 <tbody>
26679 <tr>
26680 <td>
26681 <div>
26682 <p>foo</p>
26683 </div>
26684 </td>
26685 </tr>
26686 </tbody>
26687 </table>
26688 <p>ok</p>
26689 !!end
26690
26691 !!test
26692 7. Encapsulate foster-parented transclusion content
26693 !!options
26694 parsoid=wt2wt,wt2html
26695 !! wikitext
26696 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
26697 !! html/parsoid
26698 <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>
26699 <table>
26700 <tbody>
26701 <tr>
26702 <td>bar</td>
26703 </tr>
26704 </tbody>
26705 </table>
26706 !!end
26707
26708 # Note that the wt is broken on purpose: the = should be {{=}} if you
26709 # don't want it to be a template parameter key.
26710 !!test
26711 8. Encapsulate foster-parented transclusion content
26712 !!options
26713 parsoid=wt2wt,wt2html
26714 !! wikitext
26715 {{echo|a
26716 }}{|{{echo|style='color:red'}}
26717 |-
26718 |b
26719 |}
26720 !! html/parsoid
26721 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
26722 <span> </span>
26723 <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>
26724 <table>
26725 <tbody>
26726 <tr>
26727 <td>b</td>
26728 </tr>
26729 </tbody>
26730 </table>
26731 !!end
26732
26733 !!test
26734 9. Encapsulate foster-parented transclusion content
26735 !!options
26736 parsoid=wt2wt,wt2html
26737 !! wikitext
26738 <table>{{echo|hi</table>hello}}
26739 !! html/parsoid
26740 <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>
26741 !!end
26742
26743 !!test
26744 Table in fosterable position
26745 !!options
26746 parsoid=wt2html
26747 !! wikitext
26748 {{OpenTable}}
26749 <div>
26750 {|
26751 |}
26752 </div>
26753 |}
26754 !! html/parsoid
26755 <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">
26756 </span>
26757 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
26758
26759 <table>
26760 </table>
26761 !!end
26762
26763 # Parsoid only for T66747
26764 !! test
26765 Properly encapsulate empty-content transclusions in fosterable positions
26766 !! wikitext
26767 <table>
26768 {{#if:|
26769 <td>foo</td>
26770 }}
26771 </table>
26772 !! html/parsoid
26773 <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"}]]}'>
26774
26775 </table>
26776 !! end
26777
26778 !! test
26779 Always encapsulate foster box when template range is expanded to table
26780 !! options
26781 parsoid=wt2wt
26782 !! wikitext
26783 {|
26784 hello
26785 {{OpenTable}}
26786 |}
26787 !! html/parsoid
26788
26789 !! end
26790
26791 !! test
26792 T115289: Unclosed table
26793 !! wikitext
26794 {{echo|<table>}}<!--c-->[[Category:Two]]
26795 !! html/parsoid
26796 <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>
26797 !! end
26798
26799 !! test
26800 T115289: Don't migrate newlines out of tables with fostered content
26801 !! wikitext
26802 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
26803 !! html/parsoid
26804 <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>
26805 !! end
26806
26807 !! test
26808 T73074: More fostering fun
26809 !! wikitext
26810 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
26811 !! html/parsoid
26812 <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>
26813 !! end
26814
26815 !!test
26816 Support <object> element with .data attribute
26817 !!options
26818 parsoid=html2wt
26819 !! html/parsoid
26820 <object data="test.swf"></object>
26821 !! wikitext
26822 <object data="test.swf"></object>
26823 !!end
26824
26825 !! test
26826 Don't block XML namespace declaration
26827 !! wikitext
26828 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26829 !! html/php
26830 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26831 </p>
26832 !! html/parsoid
26833 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
26834 !! end
26835
26836 # -----------------------------------------------------------------
26837 # The following section of tests are primarily to spec requirements
26838 # around Parsoid's serialization (old, new, edited content)
26839 #
26840 # All these tests are marked Parsoid html2wt and html2html only
26841 # ----------------------------------------------------------------
26842
26843 !! test
26844 Ignore rel attribute in a-tags during serialization to url-links
26845 !! options
26846 parsoid=html2wt
26847 !! html/parsoid
26848 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
26849 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
26850 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
26851 !! wikitext
26852 http://en.wikipedia.org/wiki/Foobar
26853 http://en.wikipedia.org/wiki/Foobar
26854 http://en.wikipedia.org/wiki/Foobar
26855 !! end
26856
26857 # 'mi' is a localinterwiki prefix as well as a language
26858 !! test
26859 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
26860 !! options
26861 parsoid=html2wt
26862 !! html/parsoid
26863 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
26864 !! wikitext
26865 [[Foo]]
26866 !! end
26867
26868 !! test
26869 Parsoid should accept interwiki shortcuts
26870 !! options
26871 parsoid=html2wt
26872 !! html/parsoid
26873 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
26874 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
26875 <a href='./fr:Foo'>Foo</a></p>
26876 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
26877 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
26878 <a href='fr%3AFoo'>Foo</a></p>
26879 <p><a href='FR%3AFoo'>Foo</a>
26880 <a href='./FR:Foo'>Foo</a></p>
26881 !! wikitext
26882 [[:fr:Foo|Foo]]
26883 [[:fr:Foo|Foo]]
26884 [[:fr:Foo|Foo]]
26885
26886 [[:fr:Foo|Foo]]
26887 [[:fr:Foo|Foo]]
26888 [[:fr:Foo|Foo]]
26889
26890 [[:fr:Foo|Foo]]
26891 [[:fr:Foo|Foo]]
26892 !! end
26893
26894 !! test
26895 Parsoid should not accept invalid interwiki shortcuts
26896 !! options
26897 parsoid=html2wt
26898 !! html/parsoid
26899 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
26900 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
26901 <a href='news:Foo'>Foo</a></p>
26902 !! wikitext
26903 [news:Foo Foo]
26904 [news:Foo Foo]
26905 [news:Foo Foo]
26906 !! end
26907
26908 # See T93839
26909 !! test
26910 New wikilinks should be serialized properly
26911 !! options
26912 parsoid=html2wt
26913 !! html/parsoid
26914 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
26915 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
26916 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
26917 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26918 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26919 !! wikitext
26920 [[Foo]]
26921 [[Foo]]
26922 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26923 http://en.wikipedia.org/wiki/Foo
26924 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26925 !! end
26926
26927 !! test
26928 New wiki links (href variations)
26929 !! options
26930 parsoid=html2wt
26931 !! html/parsoid
26932 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26933 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26934 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26935 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26936 !! wikitext
26937 [[Foo_bar]]
26938 [[Foo_bar]]
26939 [[Foo_bar]]
26940 [[Toxine bactérienne]]
26941 !! end
26942
26943 !! test
26944 New wiki links (content string variations)
26945 !! options
26946 parsoid=html2wt
26947 !! html/parsoid
26948 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26949 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26950 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26951 !! wikitext
26952 [[Foo_bar]]
26953 [[Foo bar]]
26954 [[Foo_bar|./Foo_bar]]
26955 !! end
26956
26957 !! test
26958 New category links (href variations)
26959 !! options
26960 parsoid=html2wt
26961 !! html/parsoid
26962 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26963 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26964 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26965 !! wikitext
26966 [[Category:Toxine bactérienne]]
26967 [[Category:Toxine bactérienne]]
26968 [[Category:Toxine bactérienne]]
26969 !! end
26970
26971 !! test
26972 New sol transparent links don't need indent-pre nowiki protection
26973 !! options
26974 parsoid=html2wt
26975 language=de
26976 !! html/parsoid
26977 <link rel="mw:PageProp/redirect" href="./Main_Page">
26978 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
26979 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
26980 !! wikitext
26981 #WEITERLEITUNG [[Main Page]]
26982 <!-- this is good --> [[Category:Good]]
26983 <!-- this is great --> [[Kategorie:Great]]
26984 !! end
26985
26986 !! test
26987 New interlanguage links (href variations)
26988 !! options
26989 parsoid=html2wt
26990 !! html/parsoid
26991 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
26992 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
26993 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
26994 !! wikitext
26995 [[es:Toxine bactérienne]]
26996 [[es:Toxine_bactérienne]]
26997 [[es:Toxine_bactérienne]]
26998 !! end
26999
27000 !! test
27001 Image: Modifying size of an image (1)
27002 !! options
27003 parsoid={
27004 "modes": ["wt2wt"],
27005 "changes": [
27006 ["img[height]", "attr", "height", "22"],
27007 ["img[width]", "attr", "width", "200"]
27008 ]
27009 }
27010 !! wikitext
27011 [[Image:Foobar.jpg|230x230px]]
27012 !! wikitext/edited
27013 [[Image:Foobar.jpg|200x200px]]
27014 !!end
27015
27016 !! test
27017 Image: Modifying size of an image (2)
27018 !! options
27019 parsoid={
27020 "modes": ["wt2wt"],
27021 "changes": [
27022 ["img[height]", "attr", "height", "100"],
27023 ["img[width]", "attr", "width", "500"]
27024 ]
27025 }
27026 !! wikitext
27027 [[Image:Foobar.jpg|230x230px]]
27028 !! wikitext/edited
27029 [[Image:Foobar.jpg|500x500px]]
27030 !!end
27031
27032 # Change in size is ignored so long as class='mw-default-size'
27033 !! test
27034 Image: Modifying size of an image (3)
27035 !! options
27036 parsoid={
27037 "modes": ["wt2wt"],
27038 "changes": [
27039 ["figure[class]", "removeClass", "mw-default-size"],
27040 ["figure img", "attr", "height", "19"],
27041 ["figure img", "attr", "width", "170"]
27042 ]
27043 }
27044 !! wikitext
27045 [[Image:Foobar.jpg|thumb]]
27046 !! wikitext/edited
27047 [[Image:Foobar.jpg|thumb|170x170px]]
27048 !!end
27049
27050 !! test
27051 Image: Modifying alignment of an image (T50665)
27052 !! options
27053 parsoid={
27054 "modes": ["wt2wt"],
27055 "changes": [
27056 ["figure[class]", "removeClass", "mw-halign-right"],
27057 ["figure[class]", "addClass", "mw-halign-left"]
27058 ]
27059 }
27060 !! wikitext
27061 [[Image:Foobar.jpg|thumb|caption|right]]
27062 !! wikitext/edited
27063 [[Image:Foobar.jpg|thumb|caption|left]]
27064 !! end
27065
27066 !! test
27067 Image: Modifying mw-default-size of an frameless image (T64805)
27068 !! options
27069 parsoid={
27070 "modes": ["wt2wt"],
27071 "changes": [
27072 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27073 ]
27074 }
27075 !! wikitext
27076 [[Image:Foobar.jpg|frameless|right]]
27077 !! wikitext/edited
27078 [[Image:Foobar.jpg|frameless|right|220x220px]]
27079 !! end
27080
27081 !! test
27082 Image: Modifying valign of an image (T51221)
27083 !! options
27084 parsoid={
27085 "modes": ["wt2wt"],
27086 "changes": [
27087 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27088 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27089 ]
27090 }
27091 !! wikitext
27092 [[File:Foobar.jpg|20px|middle]]
27093 !! wikitext/edited
27094 [[File:Foobar.jpg|20px|text-top]]
27095 !! end
27096
27097 !! test
27098 Image: Modifying alt attribute of an image (T58400)
27099 !! options
27100 parsoid={
27101 "modes": ["wt2wt"],
27102 "changes": [
27103 ["img[alt]", "attr", "alt", "some alternate edited text"]
27104 ]
27105 }
27106 !! wikitext
27107 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27108 !! wikitext/edited
27109 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27110 !!end
27111
27112 !! test
27113 Image: Modifying caption of an image
27114 !! options
27115 parsoid={
27116 "modes": ["wt2wt"],
27117 "changes": [
27118 ["figcaption", "text", "new caption"]
27119 ]
27120 }
27121 !! wikitext
27122 [[Image:Foobar.jpg|thumb|original caption]]
27123 !! wikitext/edited
27124 [[Image:Foobar.jpg|thumb|new caption]]
27125 !!end
27126
27127 !! test
27128 Image: empty alt attribute (T50924)
27129 !! options
27130 parsoid
27131 !! wikitext
27132 [[File:Foobar.jpg|thumb|alt=|bar]]
27133 !! html
27134 <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>
27135 !! end
27136
27137 !! test
27138 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27139 !! options
27140 parsoid=html2wt
27141 language=ar
27142 disabled
27143 !! html/parsoid
27144 <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>
27145 !! wikitext
27146 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27147 !! end
27148
27149 !! test
27150 Image: Block level image should have \n before and after
27151 !! wikitext
27152 123
27153 [[File:Foobar.jpg|right|thumb|150x150px]]
27154 456
27155 !! html/parsoid
27156 <p>123</p>
27157 <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>
27158 <p>456</p>
27159 !! end
27160
27161 !! test
27162 Image: New block level image should have \n before and after (existing content)
27163 !! wikitext
27164 123
27165 [[File:Foobar.jpg|right|thumb|150x150px]]
27166 456
27167 !! html/parsoid
27168 <p>123</p>
27169 <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>
27170 <p>456</p>
27171 !! end
27172
27173 !! test
27174 Image: upright option (parsoid)
27175 !! wikitext
27176 [[File:Foobar.jpg|thumb|upright|caption]]
27177 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27178 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27179 !! html/parsoid
27180 <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>
27181 <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>
27182 <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>
27183 !! end
27184
27185 !! test
27186 Image: upright option is ignored on inline and frame images (parsoid)
27187 !! wikitext
27188 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27189 !! html/parsoid
27190 <p><span 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></span></p>
27191 !! end
27192
27193 !! test
27194 Image: in template parameter with empty parameter
27195 !! wikitext
27196 {{echo|[[File:Foobar.jpg|link=]]}}
27197 !! html/parsoid
27198 <p><span 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></span></p>
27199 !! end
27200
27201 !! test
27202 Image: from basic HTML (1)
27203 !! options
27204 parsoid=html2wt
27205 !! html/parsoid
27206 <span typeof="mw:Image">
27207 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27208 </span>
27209 !! wikitext
27210 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27211 !! end
27212
27213 !! test
27214 Image: from basic HTML (2)
27215 !! options
27216 parsoid=html2wt
27217 !! html/parsoid
27218 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27219 !! wikitext
27220 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27221 !! end
27222
27223 !! test
27224 Image: from basic HTML (3)
27225 !! options
27226 parsoid=html2wt
27227 !! html/parsoid
27228 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27229 !! wikitext
27230 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27231 !! end
27232
27233 !! test
27234 Image: from basic HTML (4)
27235 !! options
27236 parsoid=html2wt
27237 !! html/parsoid
27238 <img src="./File:Foobar.jpg">
27239 !! wikitext
27240 [[File:Foobar.jpg|link=]]
27241 !! end
27242
27243 !! test
27244 Image: Invalid title as link
27245 !! wikitext
27246 [[File:Foobar.jpg|link=<]]
27247 !! html/php
27248 <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>
27249 </p>
27250 !! html/parsoid
27251 <p><span 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></span></p>
27252 !! end
27253
27254 !! test
27255 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27256 !! options
27257 parsoid=html2wt
27258 !! html/parsoid
27259 <ul>
27260 <li><p>foo</p></li>
27261 </ul>
27262 !! wikitext
27263 * foo
27264 !! end
27265
27266 !! test
27267 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27268 !! options
27269 parsoid=html2wt
27270 !! html/parsoid
27271 <ul> <li>foo</li></ul>
27272 !! wikitext
27273 * foo
27274 !! end
27275
27276 !! test
27277 Don't strip leading whitespace when handling indent-pre suppressing tags
27278 !! options
27279 parsoid=html2wt
27280 !! html/parsoid
27281 <table>
27282 <tr><td> indented row</td></tr>
27283 </table>
27284 <blockquote><p>
27285 <b>This is very bold of you!</b>
27286 </p>
27287 <table><tr><td>
27288 indented cell (no pre-wrapping!)
27289 </td></tr></table>
27290 </blockquote>
27291 <p>foo</p>
27292 <div>bar</div>
27293 !! wikitext
27294 {|
27295 | indented row
27296 |}
27297 <blockquote>
27298 '''This is very bold of you!'''
27299
27300 {|
27301 |
27302 indented cell (no pre-wrapping!)
27303 |}
27304 </blockquote>
27305 foo
27306 <div>bar</div>
27307 !! end
27308
27309 !! test
27310 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27311 !! options
27312 parsoid=html2wt
27313 !! html/parsoid
27314 <p>foo</p>
27315 <span>bar</span>
27316
27317 <span>foo2
27318 </span>bar2
27319
27320 <div>foo</div>
27321 <span>bar</span>
27322
27323 <div>
27324 <span>foo</span>
27325 </div>
27326 !! wikitext
27327 foo
27328
27329 <span>bar</span>
27330
27331 <span>foo2
27332 <nowiki> </nowiki></span>bar2
27333
27334 <div>foo</div>
27335 <nowiki> </nowiki><span>bar</span>
27336
27337 <div>
27338 <nowiki> </nowiki><span>foo</span>
27339 </div>
27340 !! end
27341
27342 !! test
27343 Lists: Dont insert newlines in a serialized list item.
27344 !! options
27345 parsoid=html2wt
27346 !! html/parsoid
27347 <ul><li>a<br>b</li><li>c</li></ul>
27348 !! wikitext
27349 * a<br>b
27350 * c
27351 !! end
27352
27353 !! test
27354 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27355 !! options
27356 parsoid={
27357 "modes": ["html2wt"],
27358 "scrubWikitext": false
27359 }
27360 !! html/parsoid
27361 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27362 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27363
27364 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27365 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27366
27367 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27368
27369 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27370 !! wikitext
27371 == hello there [[Category:A1]] ==
27372
27373 == [[Category:A2]] hi pal ==
27374
27375 == <!--foo--> [[Category:A3]] how goes it ==
27376
27377 == it goes well [[Category:A4]] <!--bar--> ==
27378
27379 ==howdy [[Category:A5]]==
27380
27381 == __TOC__ ok ==
27382 !! end
27383
27384 !! test
27385 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27386 !! options
27387 parsoid={
27388 "modes": ["html2wt"],
27389 "scrubWikitext": true
27390 }
27391 !! html/parsoid
27392 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27393 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27394
27395 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27396 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27397
27398 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27399 !! wikitext
27400 == hello there ==
27401 [[Category:A1]]
27402 [[Category:A2]]
27403
27404 == hi pal ==
27405
27406 <!--foo--> [[Category:A3]]
27407
27408 == how goes it ==
27409
27410 == it goes well ==
27411 [[Category:A4]] <!--bar-->
27412
27413 __TOC__
27414
27415 == ok ==
27416 !! end
27417
27418 !! test
27419 Headings: Don't hoist metas that come from templates
27420 !! options
27421 parsoid={
27422 "modes": ["html2wt"],
27423 "scrubWikitext": true
27424 }
27425 !! html/parsoid
27426 <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>
27427 !! wikitext
27428 == {{echo|foo [[Category:Foo]]}} ==
27429 !! end
27430
27431 !! test
27432 Headings: Category in ref isn't hoisted
27433 !! options
27434 parsoid={
27435 "modes": ["html2wt"],
27436 "scrubWikitext": true
27437 }
27438 !! html/parsoid
27439 <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>
27440
27441 <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>
27442 !! wikitext
27443 == foo <ref>bar
27444 [[Category:Baz]] </ref> ==
27445
27446 <references />
27447 !! end
27448
27449 !! test
27450 Parsoid: Serialize positional parameters with = in them as named parameter
27451 !! options
27452 parsoid=html2wt
27453 !! html/parsoid
27454 <p about="#mwt1" typeof="mw:Transclusion"
27455 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27456
27457 <p about="#mwt1" typeof="mw:Transclusion"
27458 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27459
27460 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27461 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27462 <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>
27463 !! wikitext
27464 {{echo|1=f=oo}}
27465
27466 {{echo|1=f=oo|2=bar}}
27467
27468 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27469 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27470 {{echo|<nowiki>f=oo</nowiki>|bar}}
27471 !! end
27472
27473 !! test
27474 Parsoid: Serialize positional parameters with = in extlink as named parameter
27475 !! options
27476 parsoid=html2wt
27477 !! html/parsoid
27478 <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>
27479 !! wikitext
27480 {{echo|1=http://stuff?is=ok}}
27481 !! end
27482
27483 !! test
27484 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27485 !! options
27486 parsoid=html2wt
27487 !! html/parsoid
27488 <div>a<p>b</p></div>
27489 <div>a
27490 <p>b</p></div>
27491 <div>
27492 a
27493 <p>b</p></div>
27494 !! wikitext
27495 <div>a
27496 b
27497 </div>
27498 <div>a
27499 b
27500 </div>
27501 <div>
27502 a
27503
27504 b
27505 </div>
27506 !! end
27507
27508 !! test
27509 Substrings resembling wikitext in hrefs should not get nowiki escapes
27510 !! options
27511 parsoid=html2wt
27512 !! html/parsoid
27513 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27514 !! wikitext
27515 [[Foo''bar''baz]]
27516 !! end
27517
27518 !! test
27519 Enforce single-line context in the serializer
27520 !! options
27521 parsoid=html2wt
27522 !! html/parsoid
27523 <h2>testing
27524 123</h2>
27525
27526 <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">
27527 </span><span about="#mwt1">you</span> </h2>
27528
27529 <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>
27530
27531 <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
27532 there</span></li></ol>
27533
27534 <ul><li>asd
27535 sdf</li></ul>
27536
27537 <ul><li>foo
27538 bar
27539 baz</li>
27540 <li>foo <b>bar</b>
27541 baz</li></ul>
27542
27543 <dl><dt>hi
27544 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27545 ho</dd></dl>
27546
27547 <dl><dd> <table>
27548 <tbody><tr><td> ha
27549 ha
27550 ha</td></tr>
27551 </tbody></table></dd></dl>
27552 !! wikitext
27553 == testing 123 ==
27554
27555 == hi {{bogus|there
27556 you}} ==
27557
27558 == foo <ref>hello
27559 there</ref> ==
27560
27561 <references />
27562
27563 * asd sdf
27564
27565 * foo bar baz
27566 * foo '''bar''' baz
27567
27568 ; hi ho : hi ho
27569
27570 : {|
27571 | ha
27572 ha
27573 ha
27574 |}
27575 !! end
27576
27577 !! test
27578 Serialize new placeholder space without spans
27579 !! options
27580 parsoid=html2wt
27581 !! html/parsoid
27582 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27583
27584 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27585
27586 <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>
27587 !! wikitext
27588 foo : bar
27589
27590 foo : bar
27591
27592 <ref>foo : bar</ref>ok
27593 !! end
27594
27595
27596 #-----------------------
27597 # Tag minimization tests
27598 #-----------------------
27599
27600 !! test
27601 1. I/B quote minimization: wikitext-only tags should be combined
27602 !! options
27603 parsoid=html2wt
27604 !! html/parsoid
27605 <p><i>A</i><i>B</i></p>
27606 <p><b>A</b><b>B</b></p>
27607 <p><i>A</i><b><i>B</i></b></p>
27608 <p><b>A</b><i><b>B</b></i></p>
27609 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27610 <p><i><b>A</b></i><i><b>B</b></i></p>
27611 <p><i><b>A</b></i><b><i>B</i></b></p>
27612 <p><b><i>A</i></b><i><b>B</b></i></p>
27613 !! wikitext
27614 ''AB''
27615
27616 '''AB'''
27617
27618 ''A'''B'''''
27619
27620 '''A''B'''''
27621
27622 '''A''BC''D'''
27623
27624 '''''AB'''''
27625
27626 '''''AB'''''
27627
27628 '''''AB'''''
27629 !! end
27630
27631 !! test
27632 2. I/B quote minimization: wikitext and html tags should not be combined
27633 !! options
27634 parsoid=html2wt
27635 !! html/parsoid
27636 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27637 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27638 !! wikitext
27639 ''A''<i>B</i>
27640
27641 ''A''<nowiki/>'''<i>B</i>'''
27642 !! end
27643
27644 !! test
27645 3. I/B quote minimization: templated content stops minimization
27646 !! options
27647 parsoid=html2wt
27648 !! html/parsoid
27649 <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>
27650 <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>
27651 !! wikitext
27652 ''A''{{echo|''B''}}
27653
27654 ''A''{{echo|'''''B'''''}}
27655 !! end
27656
27657 !! test
27658 4. I/B quote minimization: new content should be mimimized with adjacent old content
27659 !! options
27660 parsoid=html2wt
27661 !! html/parsoid
27662 <p><i>A</i><i>B</i></p>
27663 <p><b>A</b><b>B</b></p>
27664 <p><i>A</i><b><i>B</i></b></p>
27665 !! wikitext
27666 ''AB''
27667
27668 '''AB'''
27669
27670 ''A'''B'''''
27671 !! end
27672
27673 !! test
27674 5a. Merge adjacent quote nodes if they've been edited
27675 !! options
27676 parsoid={
27677 "modes": ["wt2wt", "selser"],
27678 "changes": [
27679 ["p", "contents", "remove", ":contains('b')"]
27680 ]
27681 }
27682 !! wikitext
27683 ''a''b''c''
27684 !! wikitext/edited
27685 ''ac''
27686 !! end
27687
27688 !! test
27689 5b. Merge adjacent quote nodes if they've been edited
27690 !! options
27691 parsoid={
27692 "modes": ["wt2wt", "selser"],
27693 "changes": [
27694 ["#x", "remove"]
27695 ]
27696 }
27697 !! wikitext
27698 ''a''<span id="x">b</span>''c''
27699 !! wikitext/edited
27700 ''ac''
27701 !! end
27702
27703 !! test
27704 1. Merge adjacent link nodes as long as at least one element is new
27705 !! options
27706 parsoid={
27707 "modes": ["html2wt"],
27708 "scrubWikitext": true
27709 }
27710 !! html/parsoid
27711 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27712 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27713 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
27714 !! wikitext
27715 [[Football]]
27716 [[Football]]
27717 [[Football|Foot]][[Football|ball]]
27718 !! end
27719
27720 !! test
27721 2. Merge adjacent link nodes and enable additional normalizations
27722 !! options
27723 parsoid={
27724 "modes": ["html2wt"],
27725 "scrubWikitext": true
27726 }
27727 !! html/parsoid
27728 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
27729 !! wikitext
27730 [[Football|''Football'']]
27731 !! end
27732
27733 !! test
27734 3. Don't merge adjacent link nodes if scrubWikitext is false
27735 !! options
27736 parsoid={
27737 "modes": ["html2wt"],
27738 "scrubWikitext": false
27739 }
27740 !! html/parsoid
27741 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27742 !! wikitext
27743 [[Football|Foot]][[Football|ball]]
27744 !! end
27745
27746 #------------------------------
27747 # End of tag minimization tests
27748 #------------------------------
27749
27750 !!test
27751 T56262: New entities
27752 !! options
27753 parsoid=html2wt
27754 !! html/parsoid
27755 <span typeof="mw:Entity">&nbsp;</span>
27756 !! wikitext
27757 &nbsp;
27758 !! end
27759
27760 ## Note that there is no wikitext output for 'unknownproperty' ##
27761 ## Unknown magic words are silently dropped ##
27762
27763 !! test
27764 Magic words
27765 !! options
27766 parsoid=html2wt
27767 !! html/parsoid
27768 <meta property='mw:PageProp/toc' />
27769 <meta property='mw:PageProp/notoc' />
27770 <meta property='mw:PageProp/forcetoc' />
27771 <meta property='mw:PageProp/index' />
27772 <meta property='mw:PageProp/noindex' />
27773 <meta property='mw:PageProp/nogallery' />
27774 <meta property='mw:PageProp/noeditsection' />
27775 <meta property='mw:PageProp/notitleconvert' />
27776 <meta property='mw:PageProp/nocontentconvert' />
27777 <meta property='mw:PageProp/unknownproperty' />
27778 !! wikitext
27779 __TOC__
27780 __NOTOC__
27781 __FORCETOC__
27782 __INDEX__
27783 __NOINDEX__
27784 __NOGALLERY__
27785 __NOEDITSECTION__
27786 __NOTITLECONVERT__
27787 __NOCONTENTCONVERT__
27788 !! end
27789
27790 !! test
27791 Consecutive <pre>s should not get merged
27792 !! options
27793 parsoid=html2wt,html2html
27794 !! html/parsoid
27795 <pre>a</pre><pre>b</pre>
27796
27797 <pre>c
27798 </pre><pre>
27799 d</pre>
27800
27801 <pre>e
27802
27803 </pre><pre>
27804
27805 f</pre>
27806 !! wikitext
27807 a
27808
27809 b
27810
27811 c
27812
27813 d
27814
27815 e
27816
27817
27818
27819 f
27820 !! end
27821
27822 !! test
27823 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
27824 !! options
27825 parsoid=html2wt
27826 !! html/parsoid
27827 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
27828 !! wikitext
27829 [[Special:BookSources/1234567890|ISBN 1234567895]]
27830 !! end
27831
27832 !! test
27833 Edited RFC links not serializable as RFC links should serialize as extlinks
27834 !! options
27835 parsoid=html2wt
27836 !! html/parsoid
27837 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
27838 !! wikitext
27839 [//tools.ietf.org/html/rfc123 New RFC]
27840 !! end
27841
27842 !! test
27843 Edited PMID links not serializable as PMID links should serialize as extlinks
27844 !! options
27845 parsoid=html2wt
27846 !! html/parsoid
27847 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
27848 !! wikitext
27849 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
27850 !! end
27851
27852 !! test
27853 WTS of autolinks with trailing/surrounding context
27854 !! options
27855 parsoid=html2wt
27856 !! html/parsoid
27857 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
27858 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
27859 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
27860 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
27861 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
27862 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
27863 !! wikitext
27864 http://cscott.net'''foo'''
27865
27866 http://cscott.net<b>foo</b>
27867
27868 '''http://cscott.net'''
27869
27870 '''http://cscott.net '''
27871
27872 '''http://cscott.net<nowiki/>x'''
27873
27874 http://cscott.net<nowiki/>x
27875 !! end
27876
27877 !! test
27878 WTS of autolinks with nowikis (round-trip)
27879 !! wikitext
27880 x<nowiki/>http://cscott.net<nowiki/>x
27881 !! html/parsoid
27882 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
27883 !! end
27884
27885 # this is the "easy" test because it leaves in place all the
27886 # data-parsoid information indicating this is an autolink
27887 !! test
27888 WTS of autolinks with escapes (editing)
27889 !! options
27890 parsoid={
27891 "modes": ["wt2wt"],
27892 "changes": [
27893 [ "span", "remove" ]
27894 ]
27895 }
27896 !! wikitext
27897 x<nowiki/>http://cscott.net<nowiki/>x
27898 !! wikitext/edited
27899 x<nowiki/>http://cscott.net<nowiki/>x
27900 !! end
27901
27902 !! test
27903 WTS of edited autolink-like text (T103364)
27904 !! options
27905 parsoid={
27906 "modes": ["wt2wt"],
27907 "changes": [
27908 [ "span[typeof]", "removeAttr", "typeof" ]
27909 ]
27910 }
27911 !! wikitext
27912 Not a link: <nowiki>http://example.com</nowiki>.
27913 !! wikitext/edited
27914 Not a link: <span><nowiki>http://example.com</nowiki></span>.
27915 !! end
27916
27917 !! test
27918 WTS of newly-authored autolink-like text (T103364)
27919 !! options
27920 parsoid=html2wt
27921 !! html/parsoid
27922 <p>http://example.com is not a link.</p>
27923 !! wikitext
27924 <nowiki>http://example.com</nowiki> is not a link.
27925 !! end
27926
27927 !! test
27928 WTS of autolink-like text after an autolink (T108563)
27929 !! options
27930 parsoid=html2wt
27931 !! html/parsoid
27932 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27933 !! wikitext
27934 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27935 !! end
27936
27937 !! test
27938 Magic links inside links (not autolinked)
27939 !! wikitext
27940 [[Foo|http://example.com]]
27941 [[Foo|RFC 1234]]
27942 [[Foo|PMID 1234]]
27943 [[Foo|ISBN 123456789x]]
27944
27945 [http://foo.com http://example.com]
27946 [http://foo.com RFC 1234]
27947 [http://foo.com PMID 1234]
27948 [http://foo.com ISBN 123456789x]
27949 !! html+tidy
27950 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
27951 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
27952 !! html/parsoid
27953 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27954 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27955 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27956 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27957
27958 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27959 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27960 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27961 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27962 !! end
27963
27964 !! test
27965 Magic links inside image captions (autolinked)
27966 !! wikitext
27967 [[File:Foobar.jpg|thumb|http://example.com]]
27968 [[File:Foobar.jpg|thumb|RFC 1234]]
27969 [[File:Foobar.jpg|thumb|PMID 1234]]
27970 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27971 !! html+tidy
27972 <div class="thumb tright">
27973 <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>
27974 <div class="thumbcaption">
27975 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27976 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
27977 </div>
27978 </div>
27979 <div class="thumb tright">
27980 <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>
27981 <div class="thumbcaption">
27982 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27983 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
27984 </div>
27985 </div>
27986 <div class="thumb tright">
27987 <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>
27988 <div class="thumbcaption">
27989 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27990 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
27991 </div>
27992 </div>
27993 <div class="thumb tright">
27994 <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>
27995 <div class="thumbcaption">
27996 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
27997 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
27998 </div>
27999 </div>
28000 !! html/parsoid
28001 <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" href="http://example.com">http://example.com</a></figcaption></figure>
28002 <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="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
28003 <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">PMID 1234</a></figcaption></figure>
28004 <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>
28005 !! end
28006
28007 !! test
28008 WTS of magic word text (T109371)
28009 !! options
28010 parsoid=html2wt
28011 !! html/parsoid
28012 <p>RFC 1234</p>
28013 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28014 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28015 !! wikitext
28016 <nowiki>RFC 1234</nowiki>
28017
28018 [http://foo.com RFC 1234]
28019
28020 [[Foo|RFC 1234]]
28021 !! end
28022
28023 !! test
28024 Edited Redirect link should emit a non-piped wikitext link
28025 !! options
28026 parsoid=html2wt
28027 !! html/parsoid
28028 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28029 !! wikitext
28030 #REDIRECT [[Bar]]
28031 !! end
28032
28033 !! test
28034 T75121: Infer extension name from typeOf if data-mw is not present
28035 !! options
28036 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28037 !! html/parsoid
28038 <div typeOf="mw:Extension/foo"></div>
28039 !! wikitext
28040 <foo />
28041 !! end
28042
28043 # Note that the <p> wrapping isn't present in PHP parser output
28044 # The important thing for this test is that P-wrapping doesn't
28045 # interfere with the <nowiki> protection for leading - in <td>
28046 # (which isn't necessary for <th>).
28047 !! test
28048 T88318: p-wrapped dash in table.
28049 !! options
28050 parsoid=html2wt,wt2wt
28051 !! html/parsoid
28052 <table><tbody>
28053 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28054 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28055 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28056 </tbody></table>
28057 !! wikitext
28058 {|
28059 !-
28060 !-
28061 |-
28062 |<nowiki>-</nowiki>
28063 |<nowiki>- </nowiki>
28064 |-
28065 |<small>-</small>
28066 |<br>
28067 -
28068 |<br>
28069 -
28070 |}
28071 !! html/php+tidy
28072 <table>
28073 <tr>
28074 <th>-</th>
28075 <th>-</th>
28076 </tr>
28077 <tr>
28078 <td>-</td>
28079 <td>-</td>
28080 </tr>
28081 <tr>
28082 <td><small>-</small></td>
28083 <td><br />
28084 <p>-</p>
28085 </td>
28086 <td><br />
28087 <p>-</p>
28088 </td>
28089 </tr>
28090 </table>
28091 !! end
28092
28093 !! test
28094 T149209: WTS: Handle newlines in table cells properly
28095 !! options
28096 parsoid=html2wt
28097 !! html/parsoid
28098 <table>
28099 <tbody>
28100 <tr><td>a
28101 b
28102 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
28103 <tr><td><p>x</p>
28104 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28105 </tbody></table>
28106 <table>
28107 <tbody>
28108 <tr><th>a
28109 b
28110 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
28111 <tr><th><p>x</h>
28112 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
28113 </tbody></table>
28114 !! wikitext
28115 {|
28116 |a
28117 b
28118 |c
28119 |-
28120 |x
28121 {{!}}y
28122 |}
28123 {|
28124 !a
28125 b
28126 !c
28127 |-
28128 !x
28129 !y
28130 |}
28131 !! end
28132
28133 !! test
28134 T149209: Selser: Handle newlines in table cells properly
28135 !! options
28136 parsoid={
28137 "modes": ["selser"],
28138 "changes": [
28139 [ "#h1", "html", "a\nb\n" ],
28140 [ "#h2", "html", "a\nb\n" ],
28141 [ "#c1", "html", "a\nb\n" ],
28142 [ "#c2", "html", "<p>a</p>" ],
28143 [ "#c3", "html", "<p>a</p>" ],
28144 [ "#c4", "html", "edit-me<p>a</p>" ]
28145 ]
28146 }
28147 !! wikitext
28148 {|
28149 ! id="h1" |edit-me!!1
28150 |-
28151 ! id="h2" |edit-me||2
28152 |-
28153 | id="c1" |edit-me||3
28154 |-
28155 | id="c2" |edit-me||4
28156 |-
28157 | id="c3" |edit-me||p||q||r
28158 |-
28159 | id="c4" |edit-me||p||q||r
28160 |}
28161 !! wikitext/edited
28162 {|
28163 ! id="h1" |a
28164 b
28165 !1
28166 |-
28167 ! id="h2" |a
28168 b
28169 !2
28170 |-
28171 | id="c1" |a
28172 b
28173 |3
28174 |-
28175 | id="c2" |a
28176 |4
28177 |-
28178 | id="c3" |a
28179 |p||q||r
28180 |-
28181 | id="c4" |edit-me
28182 a
28183 |p||q||r
28184 |}
28185 !! end
28186
28187 !! test
28188 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28189 !! options
28190 parsoid=html2wt
28191 !! html/parsoid
28192 <table id='mwAb'>
28193 <td id='mwAc'>foo</td>
28194 <td id='serialize-this'>bar</td>
28195 </table>
28196 !! wikitext
28197 {|
28198 |foo
28199 | id="serialize-this" |bar
28200 |}
28201 !! end
28202
28203 !! test
28204 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28205 !! options
28206 parsoid=html2wt
28207 !! html/parsoid
28208 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28209 !! wikitext
28210 <div id="hello">ok</div>
28211 !! end
28212
28213 !! test
28214 WTS change modes
28215 !! options
28216 parsoid={
28217 "modes": ["wt2wt"],
28218 "changes": [
28219 [ "#xyz", "before", "<b>before</b> stuff " ],
28220 [ "#xyz", "after", " stuff <i>after</i>" ],
28221 [ "#xyz", "html", "x <b>y</b> z" ]
28222 ]
28223 }
28224 !! wikitext
28225 <span id="xyz">hello</span>
28226 !! wikitext/edited
28227 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28228 !! end
28229
28230 !! test
28231 Never serialize a-tag as html, regardless of what data-parsoid has to say
28232 !! options
28233 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28234 !! html/parsoid
28235 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28236 !! wikitext
28237 [[Foo]]
28238 !! end
28239
28240 ## SSS FIXME: This is broken output nevertheless.
28241 ## What might be a reasonable non-broken output for this?
28242 ## This is an edge case unlikely to be seen in production
28243 ## that I am not wasting more time on this right now.
28244 !! test
28245 Never serialize a-tag as html, no matter what attributes it has
28246 !! options
28247 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28248 !! html/parsoid
28249 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28250 !! wikitext
28251 [http://boo.org http://boohoo.org]
28252 !! end
28253
28254 # Misnested is an indication that selser can reuse the source but these have
28255 # shown to sneak through on occasion. See T101768.
28256 # The original wikitext here is: [http://test.com [[one]] two three]
28257 !! test
28258 Strip span tags added to mark misnested links
28259 !! options
28260 parsoid=html2wt
28261 !! html/parsoid
28262 <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>
28263 !! wikitext
28264 [http://test.com][[one]] two three
28265 !! end
28266
28267 !! test
28268 Catch regression when unpacking misnested links
28269 !! options
28270 parsoid=wt2html
28271 !! wikitext
28272 {{echo|hi}}[http://example.com [[ho]]]
28273 !! html/parsoid
28274 <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" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
28275 !! end
28276
28277 !! test
28278 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28279 !! options
28280 parsoid=html2wt
28281 !! html/parsoid
28282 <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|}"]}'>
28283 <tbody><tr><td>d
28284 </td></tr>
28285 </tbody></table>
28286 !! wikitext
28287 {{echo|a}}
28288 {|{{echo|c
28289 {{!}}d
28290 }}
28291 |}
28292 !! end
28293
28294 ## This test verifies the presence and computation of this attribute indirectly
28295 ## by making an edit and ensuring that the serialization is correct (which it would be
28296 ## only if firstWikitextNode is properly set).
28297 !! test
28298 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28299 !! options
28300 parsoid= {
28301 "modes": ["wt2wt"],
28302 "changes": [
28303 [ "div#x", "remove" ],
28304 [ "div", "before", "<div>new</div>" ]
28305 ]
28306 }
28307 !! wikitext
28308 <div id="x">foo</div>
28309 {|
28310 {{echo|<div>boo</div>
28311 {{!}}b}}
28312 |c
28313 |}
28314 !! wikitext/edited
28315
28316 <div>new</div>
28317 {|
28318 {{echo|<div>boo</div>
28319 {{!}}b}}
28320 |c
28321 |}
28322 !! end
28323
28324 # --------------------------------------------
28325 # Tests spec'ing wikitext serialization norms |
28326 # --------------------------------------------
28327
28328 !! test
28329 Serialize multi-line indent-pre starting with wikitext syntax
28330 !! options
28331 parsoid=html2wt
28332 !! html/parsoid
28333 <pre>* 1
28334 ** 2
28335 * 3</pre>
28336 !! wikitext
28337 * 1
28338 ** 2
28339 * 3
28340 !! end
28341
28342 !! test
28343 1. Categories should always be serialized on their own line
28344 !! options
28345 parsoid=html2wt
28346 !! html/parsoid
28347 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28348 !! wikitext
28349 foo
28350 [[Category:Foo]]
28351 bar
28352 !! end
28353
28354 !! test
28355 2. Categories that are part of templates should not introduce a line break
28356 !! wikitext
28357 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28358 !! html/parsoid
28359 <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>
28360 !! end
28361
28362 # Careful while editing these next 2 tests. There are \u200f characters
28363 # before and after the <link> tags in the HTML and following some
28364 # of the categories in wikitext
28365 # Do not remove these characters in edits.
28366 #
28367 # As part of the serialization, these bidi characters will get stripped.
28368 !! test
28369 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28370 !! options
28371 parsoid={
28372 "modes": ["html2wt"],
28373 "scrubWikitext": true
28374 }
28375 !! html/parsoid
28376 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28377 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28378 !! wikitext
28379 [[קטגוריה:טקסים]]
28380 [[קטגוריה: שיטות משפט]]
28381 !! end
28382
28383 !! test
28384 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28385 !! options
28386 parsoid={
28387 "modes": ["html2wt"],
28388 "scrubWikitext": true
28389 }
28390 !! html/parsoid
28391 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28392 !! wikitext
28393 [[קטגוריה:טקסים]]
28394 ‏y
28395 !! end
28396
28397 !! test
28398 Lists: Add space after bullets
28399 !! options
28400 parsoid=html2wt
28401 !! html/parsoid
28402 <ul>
28403 <li>foo</li>
28404 <li> bar</li>
28405 <li><span> baz</span></li>
28406 </ul>
28407 !! wikitext
28408 * foo
28409 * bar
28410 * <span> baz</span>
28411 !! end
28412
28413 !! test
28414 1. Headings: Add space before/after == (T53744)
28415 !! options
28416 parsoid=html2wt
28417 !! html/parsoid
28418 <h2>foo</h2>
28419 <h2> bar</h2>
28420 <h2>baz </h2>
28421 <h2><span> baz</span></h2>
28422 !! wikitext
28423 == foo ==
28424
28425 == bar ==
28426
28427 == baz ==
28428
28429 == <span> baz</span> ==
28430 !! end
28431
28432 !! test
28433 2. Headings: Add space before/after == even after hoisted content
28434 !! options
28435 parsoid={
28436 "modes": ["html2wt"],
28437 "scrubWikitext": true
28438 }
28439 !! html/parsoid
28440 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28441 !! wikitext
28442 [[Category:A2]]
28443
28444 == ok ==
28445 !! end
28446
28447 !! test
28448 1. Headings: suppress newly created empty headings
28449 !! options
28450 parsoid={
28451 "modes": ["html2wt"],
28452 "scrubWikitext": true
28453 }
28454 !! html/parsoid
28455 <h2></h2>
28456 !! wikitext
28457 !! end
28458
28459 !! test
28460 2. Headings: don't suppress empty headings if scrubWikitext is false
28461 !! options
28462 parsoid=html2wt
28463 !! html/parsoid
28464 <h2></h2>
28465 !! wikitext
28466 ==<nowiki/>==
28467 !! end
28468
28469 !! test
28470 3. Headings: suppress empty headings on edits
28471 !! options
28472 parsoid={
28473 "modes": ["selser"],
28474 "scrubWikitext": true,
28475 "changes": [
28476 [ "#x", "remove"]
28477 ]
28478 }
28479 !! wikitext
28480 ==<span id="x">foo</span>==
28481 !! wikitext/edited
28482 !! end
28483
28484 !! test
28485 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28486 !! options
28487 parsoid={
28488 "modes": ["html2wt"],
28489 "scrubWikitext": true
28490 }
28491 !! html/parsoid
28492 <h2>foo<br/>bar</h2>
28493 <h2>foo <span><br/>bar</span> baz</h2>
28494 !! wikitext
28495 == foo bar ==
28496
28497 == foo <span> bar</span> baz ==
28498 !! end
28499
28500 !! test
28501 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28502 !! options
28503 parsoid={
28504 "modes": ["html2wt"],
28505 "scrubWikitext": false
28506 }
28507 !! html/parsoid
28508 <h2>foo<br/>bar</h2>
28509 !! wikitext
28510 == foo<br> bar ==
28511 !! end
28512
28513 !! test
28514 1. WT Quote Tags: suppress newly created empty style tags
28515 !! options
28516 parsoid={
28517 "modes": ["html2wt"],
28518 "scrubWikitext": true
28519 }
28520 !! html/parsoid
28521 <i></i><b></b>
28522 !! wikitext
28523 !! end
28524
28525 !! test
28526 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28527 !! options
28528 parsoid=html2wt
28529 !! html/parsoid
28530 <i></i><b></b>
28531 !! wikitext
28532 ''<nowiki/>'''''<nowiki/>'''
28533 !! end
28534
28535 !! test
28536 3. WT Quote Tags: suppress empty style tags on edits
28537 !! options
28538 parsoid={
28539 "modes": ["selser"],
28540 "scrubWikitext": true,
28541 "changes": [
28542 [ "#x", "remove"]
28543 ]
28544 }
28545 !! wikitext
28546 '''<span id="x">foo</span>'''
28547 !! wikitext/edited
28548 !! end
28549
28550 !! test
28551 1. Anchors: suppress newly created empty anchors
28552 !! options
28553 parsoid={
28554 "modes": ["html2wt"],
28555 "scrubWikitext": true
28556 }
28557 !! html/parsoid
28558 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28559 !! wikitext
28560 !! end
28561
28562 !! test
28563 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28564 !! options
28565 parsoid={
28566 "modes": ["html2wt"],
28567 "scrubWikitext": false
28568 }
28569 !! html/parsoid
28570 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28571 !! wikitext
28572 [[Test|<nowiki/>]]
28573 !! end
28574
28575 !! test
28576 3. Anchors: suppress empty anchors on edits
28577 !! options
28578 parsoid={
28579 "modes": ["selser"],
28580 "scrubWikitext": true,
28581 "changes": [
28582 [ "#x", "remove"]
28583 ]
28584 }
28585 !! wikitext
28586 [[Test|<span id="x">foo</span>]]
28587 !! wikitext/edited
28588 !! end
28589
28590 !! test
28591 3a. Anchors: do not suppress numbered extlinks
28592 !! options
28593 parsoid={
28594 "modes": ["wt2wt"],
28595 "scrubWikitext": true
28596 }
28597 !! wikitext
28598 [http://foo.com]
28599 !! html/parsoid
28600 <a rel="mw:ExtLink" href="http://foo.com"></a>
28601 !! end
28602
28603 !! test
28604 3b. Anchors: do not suppress numbered extlinks
28605 !! options
28606 parsoid={
28607 "modes": ["wt2wt"],
28608 "scrubWikitext": true,
28609 "changes": [
28610 [ "#x", "remove"]
28611 ]
28612 }
28613 !! wikitext
28614 [http://foo.com <span id="x">foo</span>]
28615 !! wikitext/edited
28616 [http://foo.com]
28617 !! end
28618
28619 !!test
28620 Normalizations should be restricted to edited content
28621 !!options
28622 parsoid={
28623 "modes": ["selser"],
28624 "scrubWikitext": true,
28625 "changes": [
28626 [ "h1", "before", "<i></i>"]
28627 ]
28628 }
28629 !!wikitext
28630 a
28631 = =
28632 b
28633 !!wikitext/edited
28634 a
28635 = =
28636 b
28637 !!end
28638
28639 !! test
28640 1. Multiple normalizations (html2wt)
28641 !! options
28642 parsoid={
28643 "modes": ["html2wt"],
28644 "scrubWikitext": true
28645 }
28646 !! html
28647 <h2><i></i></h2>
28648 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28649 </a><b><i></i></b>x</p>
28650 !! wikitext
28651
28652 [[foo]]
28653 x
28654
28655 !! end
28656
28657 !! test
28658 2. Multiple normalizations (selser)
28659 !! options
28660 parsoid={
28661 "modes": ["selser"],
28662 "scrubWikitext": true,
28663 "changes": [
28664 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
28665 ]
28666 }
28667 !! wikitext
28668 <span id="x">foo</span>
28669 !! wikitext/edited
28670 <span id="x">foo</span>
28671
28672 x
28673 !! end
28674
28675 !! test
28676 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
28677 !! options
28678 parsoid={
28679 "modes": ["html2wt"],
28680 "scrubWikitext": true
28681 }
28682 !! html/parsoid
28683 <p> hi</p>
28684 <p> hello</p>
28685 !! wikitext
28686 hi
28687
28688 hello
28689 !! end
28690
28691 !! test
28692 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
28693 !! options
28694 parsoid=html2wt
28695 !! html/parsoid
28696 <p> hi</p>
28697 <p> hello</p>
28698 !! wikitext
28699 <nowiki> </nowiki>hi
28700
28701 <nowiki> </nowiki> hello
28702 !! end
28703
28704 !! test
28705 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
28706 !! options
28707 parsoid={
28708 "modes": ["html2wt"],
28709 "scrubWikitext": true
28710 }
28711 !! html/parsoid
28712 <p>Foo
28713 bar
28714 baz</p>
28715
28716 <table><tr><td>Foo
28717 bar
28718 baz bang</td></tr></table>
28719
28720 <p><!--boo--> foo
28721 bar</p>
28722
28723 <p> foo
28724 bar<span>boo</span></p>
28725 !! wikitext
28726 Foo
28727 bar
28728 baz
28729
28730 {|
28731 |Foo
28732 bar
28733 baz bang
28734 |}
28735
28736 <!--boo-->foo
28737 bar
28738
28739 foo
28740 bar<span>boo</span>
28741 !! end
28742
28743 !! test
28744 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
28745 !! options
28746 parsoid={
28747 "modes": ["selser"],
28748 "scrubWikitext": true,
28749 "changes": [
28750 [ "p", "html", " a\n b" ]
28751 ]
28752 }
28753 !! wikitext
28754 xyz
28755 !! wikitext/edited
28756 a
28757 b
28758 !! end
28759
28760 !! test
28761 1. New links that end in spaces
28762 !! options
28763 parsoid={
28764 "modes": ["html2wt"],
28765 "scrubWikitext": false
28766 }
28767 !! html/parsoid
28768 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28769 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28770 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28771 !! wikitext
28772 [[Berlin ]]<nowiki/>is the capital of Germany.
28773
28774 [[Foo ]]'''bar'''
28775
28776 [[Boston ]] is a city.
28777 !! end
28778
28779 !! test
28780 2. New links that end in spaces
28781 !! options
28782 parsoid={
28783 "modes": ["html2wt"],
28784 "scrubWikitext": true
28785 }
28786 !! html/parsoid
28787 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28788 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28789 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28790 !! wikitext
28791 [[Berlin]] is the capital of Germany.
28792
28793 [[Foo]] '''bar'''
28794
28795 [[Boston]] is a city.
28796 !! end
28797
28798 !! test
28799 1. Table cells with escapable prefixes
28800 !! options
28801 parsoid={
28802 "modes": ["html2wt"],
28803 "scrubWikitext": false
28804 }
28805 !! html
28806 <table>
28807 <tr><td>a</td></tr>
28808 <tr><td>-</td></tr>
28809 <tr><td>+</td></tr>
28810 </table>
28811 !! wikitext
28812 {|
28813 |a
28814 |-
28815 |<nowiki>-</nowiki>
28816 |-
28817 |<nowiki>+</nowiki>
28818 |}
28819 !! end
28820
28821 !! test
28822 2. Table cells with escapable prefixes
28823 !! options
28824 parsoid={
28825 "modes": ["html2wt"],
28826 "scrubWikitext": true
28827 }
28828 !! html
28829 <table>
28830 <tr><td>a</td></tr>
28831 <tr><td>-</td></tr>
28832 <tr><td>+</td></tr>
28833 </table>
28834 !! wikitext
28835 {|
28836 |a
28837 |-
28838 | -
28839 |-
28840 | +
28841 |}
28842 !! end
28843
28844 !! test
28845 3a. Table cells with escapable prefixes after edits
28846 !! options
28847 parsoid={
28848 "modes": ["selser"],
28849 "scrubWikitext": true,
28850 "changes": [
28851 [ "table tbody tr:first-child td:first-child", "remove"]
28852 ]
28853 }
28854 !! wikitext
28855 {|
28856 |a||-
28857 |}
28858 !! wikitext/edited
28859 {|
28860 | -
28861 |}
28862 !! end
28863
28864 !! test
28865 3b. Table cells with escapable prefixes after edits
28866 !! options
28867 parsoid={
28868 "modes": ["selser"],
28869 "scrubWikitext": true,
28870 "changes": [
28871 [ "table tbody tr:first-child td:first-child", "html", "-" ],
28872 [ "#x", "remove" ]
28873 ]
28874 }
28875 !! wikitext
28876 {|
28877 |pqr
28878 |<span id="x">foo</span>+
28879 |}
28880 !! wikitext/edited
28881 {|
28882 | -
28883 | +
28884 |}
28885 !! end
28886
28887 # FIXME: This test will fail because
28888 # normalization doesn't realize that the id attribute
28889 # will eliminate the escapable scenario
28890 !! test
28891 4a. Table cells without escapable prefixes after edits
28892 !! options
28893 parsoid={
28894 "modes": ["selser"],
28895 "scrubWikitext": true,
28896 "changes": [
28897 [ "#x", "html", "-" ]
28898 ]
28899 }
28900 !! wikitext
28901 {|
28902 | id="x" |abcd
28903 |}
28904 !! wikitext/edited
28905 {|
28906 | id="x" |-
28907 |}
28908 !! end
28909
28910 ## This tests normalizer's ability to discriminate between
28911 ## cells having identical content.
28912 !! test
28913 4b. Table cells without escapable prefixes after edits
28914 !! options
28915 parsoid={
28916 "modes": ["selser"],
28917 "scrubWikitext": true,
28918 "changes": [
28919 [ "td", "html", "-" ]
28920 ]
28921 }
28922 !! wikitext
28923 {|
28924 |a||b
28925 |}
28926 !! wikitext/edited
28927 {|
28928 | -||-
28929 |}
28930 !! end
28931
28932 ## This tests normalizer's ability to not be tripped by
28933 ## comments (and whitespace)
28934 !! test
28935 4c. Table cells without escapable prefixes after edits
28936 !! options
28937 parsoid={
28938 "modes": ["selser"],
28939 "scrubWikitext": true,
28940 "changes": [
28941 [ "table tbody tr td:first-child", "remove" ]
28942 ]
28943 }
28944 !! wikitext
28945 {|
28946 |-
28947 <!--foo--> |a||-
28948 |}
28949 !! wikitext/edited
28950 {|
28951 |-
28952 <!--foo--> | -
28953 |}
28954 !! end
28955
28956 ## This tests normalizer's ability to handle HTML cells
28957 !! test
28958 4d. Table cells without escapable prefixes after edits
28959 !! options
28960 parsoid={
28961 "modes": ["selser"],
28962 "scrubWikitext": true,
28963 "changes": [
28964 [ "td", "html", "-" ]
28965 ]
28966 }
28967 !! wikitext
28968 <table>
28969 <tr><td>a</td></tr>
28970 </table>
28971 !! wikitext/edited
28972 <table>
28973 <tr><td>-</td></tr>
28974 </table>
28975 !! end
28976
28977 ## T111151 Remove font elements without attributes
28978 !! test
28979 5a. font tags without attributes should be dropped in scrubWikitext mode
28980 !! options
28981 parsoid={
28982 "modes": ["html2wt"],
28983 "scrubWikitext": true
28984 }
28985 !! html
28986 <font>foo</font>
28987 <font><font>bar</font></font>
28988 <font class="x">boo</font>
28989 !! wikitext
28990 foo
28991 bar
28992 <font class="x">boo</font>
28993 !! end
28994
28995 !! test
28996 5b. font tags should not be dropped without scrubWikitext being enabled
28997 !! options
28998 parsoid={
28999 "modes": ["html2wt"],
29000 "scrubWikitext": false
29001 }
29002 !! html
29003 <font>foo</font>
29004 !! wikitext
29005 <font>foo</font>
29006 !! end
29007
29008 !! test
29009 Escape nowiki DOM elements
29010 !! options
29011 parsoid=html2wt
29012 !! html/parsoid
29013 <nowiki><i>foo</i></nowiki>
29014 !! wikitext
29015 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29016 !! end
29017
29018 # This is meant to be an interim fix while we go about figuring out
29019 # how to not introduce these trailing <nowiki/>s in the first place.
29020 !! test
29021 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29022 !! options
29023 parsoid=html2wt
29024 !! html/parsoid
29025 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29026 y</p>
29027 <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>
29028 <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>
29029 !! wikitext
29030 x
29031 y
29032
29033 {{echo|
29034 1 = <nowiki/>}}
29035
29036 {{echo|
29037 1 = <nowiki/>
29038 }}
29039 !! end
29040
29041 # ---------------------------------------------------
29042 # End of tests spec'ing wikitext serialization norms |
29043 # ---------------------------------------------------
29044
29045 # T104032
29046 !! test
29047 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29048 !! options
29049 parsoid=html2wt
29050 !! html/parsoid
29051 a<p>b</p>
29052 <b>c</b><p>d</p>
29053 <table><tr>
29054 <td>a<p>b</p></td>
29055 <td><b>c</b><p>d</p></td>
29056 </tr></table>
29057 !! wikitext
29058 a
29059
29060 b
29061
29062 '''c'''
29063
29064 d
29065 {|
29066 |a
29067 b
29068 |'''c'''
29069 d
29070 |}
29071 !! end
29072
29073 !! test
29074 Anchor without href scenarios
29075 !! options
29076 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29077 !! html/parsoid
29078 <a class="bc"></a>
29079 <a class="no">dice</a>
29080 <a name="foo"></a>
29081 !! wikitext
29082
29083 dice
29084 <span name="foo"></span>
29085 !! end
29086
29087 !! test
29088 New transclusion added after a list should be serialized after the list
29089 !! options
29090 parsoid=html2wt
29091 !! html/parsoid
29092 <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>
29093 !! wikitext
29094 * a
29095 {{echo|foo}}
29096 !! end
29097
29098 # -----------------------------------------------------------------
29099 # End of section for Parsoid-only html2wt tests for serialization
29100 # of new content
29101 # -----------------------------------------------------------------
29102
29103 # -----------------------------------------------------------------
29104 # The following section of tests are primarily to spec behavior of
29105 # the selective serializer. All these tests have manual selser
29106 # changes. The automated selser changes for all tests handle the
29107 # wide variation of changes, but these tests here capture specs
29108 # deterministically.
29109 # ----------------------------------------------------------------
29110
29111 ## T90517
29112 !! test
29113 Selser: New comments should not be lost
29114 !! options
29115 parsoid={
29116 "modes": ["selser"],
29117 "changes": [
29118 [ "#a", "after", "<!--c1-->" ],
29119 [ "#b", "before", "<!--c2-->" ]
29120 ]
29121 }
29122 !! wikitext
29123 <span id="a">a</span>
29124
29125 <span id="b">b</span>
29126 !! wikitext/edited
29127 <span id="a">a</span><!--c1-->
29128
29129 <!--c2--><span id="b">b</span>
29130 !! end
29131
29132 ## T89383
29133 !! test
29134 Selser: Check for validity of DSR before using it
29135 !! options
29136 parsoid={
29137 "modes": ["selser"],
29138 "changes": [
29139 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29140 ]
29141 }
29142 !! wikitext
29143 <span id="a">a</span>
29144 !! wikitext/edited
29145 {{DISPLAYTITLE:foo}}
29146 <span id="a">a</span>
29147 !! end
29148
29149 !! test
29150 1. DOMDiff: Changes to <ref> content should be looked up using id
29151 !! options
29152 parsoid={
29153 "modes": ["selser"],
29154 "changes": [
29155 ["#X", "after", "bar"],
29156 ["#Y", "after", "baz"]
29157 ]
29158 }
29159 !! wikitext
29160 X <ref><span id="X">foo</span></ref>
29161 Y <ref name="a" />
29162 <references>
29163 <ref name="a"><span id="Y">foo</span></ref>
29164 </references>
29165 !! wikitext/edited
29166 X <ref><span id="X">foo</span>bar</ref>
29167 Y <ref name="a" />
29168 <references>
29169 <ref name="a"><span id="Y">foo</span>baz</ref>
29170 </references>
29171 !! end
29172
29173 !! test
29174 2. DOMDiff: Changes to <ref> content should be looked up using id
29175 !! options
29176 parsoid={
29177 "modes": ["selser"],
29178 "changes": [
29179 ["#Z", "after", "bar"]
29180 ]
29181 }
29182 !! wikitext
29183 A <ref>foo bar for a</ref>
29184 B <ref group="X" name="b" />
29185
29186 <references />
29187
29188 <references group="X">
29189 <ref name="b"><span id="Z">foo</span></ref>
29190 </references>
29191 !! wikitext/edited
29192 A <ref>foo bar for a</ref>
29193 B <ref group="X" name="b" />
29194
29195 <references />
29196
29197 <references group="X">
29198 <ref name="b"><span id="Z">foo</span>bar</ref>
29199 </references>
29200 !! end
29201
29202 !! test
29203 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29204 !! options
29205 parsoid={
29206 "modes": ["selser"],
29207 "changes": [
29208 [ "div:first-child", "text", "bar" ]
29209 ]
29210 }
29211 !! wikitext
29212 <div style="{{1x|color:red;}}%">foo</div>
29213 !! wikitext/edited
29214 <div style="{{1x|color:red;}}%">bar</div>
29215 !! end
29216
29217 !! test
29218 Empty LI (T49673)
29219 !! wikitext
29220 * a
29221 *
29222 *
29223 * b
29224 !! html/php+tidy
29225 <ul>
29226 <li>a</li>
29227 <li class="mw-empty-elt"></li>
29228 <li class="mw-empty-elt"></li>
29229 <li>b</li>
29230 </ul>
29231 !! end
29232
29233 !! test
29234 Thumbnail output
29235 !! wikitext
29236 [[File:Thumb.png|thumb]]
29237 !! html/php+tidy
29238 <div class="thumb tright">
29239 <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>
29240 <div class="thumbcaption">
29241 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
29242 </div>
29243 </div>
29244 </div>
29245 !! end
29246
29247 !! test
29248 unclosed internal link XSS (T137264)
29249 !! wikitext
29250 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29251 !! html/php
29252 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29253 </p>
29254 !! html/parsoid
29255 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29256 !! end
29257
29258 !! test
29259 Validating that <style> isn't eaten by tidy (T167349)
29260 !! options
29261 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
29262 wgRawHtml=1
29263 !! wikitext
29264 <div class="foo">
29265 <html><style>.foo::before { content: "<foo>"; }</style></html>
29266 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
29267 </div>
29268 !! html+tidy
29269 <div class="foo">
29270 <style>.foo::before { content: "<foo>"; }</style>
29271 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29272 </div>
29273 !! end
29274
29275 !! test
29276 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29277 !! wikitext
29278 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29279 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29280 !! html/php
29281 <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>
29282 <p><a href="#A.26B.26C.26D.26amp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29283 </p>
29284 !! end
29285
29286 !! test
29287 Decoding of HTML entities in indicator names for IDs (T104196)
29288 !! options
29289 showindicators
29290 !! wikitext
29291 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29292 !! html/php
29293 1&2&3&amp;4&amp;amp;5=Indicator
29294
29295 !! end
29296
29297 !! test
29298 HTML5 ids: fallback to legacy
29299 !! config
29300 wgFragmentMode=[ 'html5', 'legacy' ]
29301 !! wikitext
29302 == Foo bar ==
29303
29304 == foo Bar ==
29305
29306 == Тест ==
29307
29308 == Тест ==
29309
29310 == тест ==
29311
29312 == Hey < # " > % : ' ==
29313 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29314
29315 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29316
29317 <!-- These two links should produce identical HTML -->
29318 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29319
29320 !! html/php
29321 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29322 <ul>
29323 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29324 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29325 <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>
29326 <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>
29327 <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>
29328 <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>
29329 </ul>
29330 </div>
29331
29332 <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>
29333 <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>
29334 <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>
29335 <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>
29336 <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>
29337 <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; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29338 <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>
29339 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
29340 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
29341 </p>
29342 !! end
29343
29344 !! test
29345 HTML5 ids: legacy with a fallback to modern
29346 !! config
29347 wgFragmentMode=[ 'legacy', 'html5' ]
29348 !! wikitext
29349 == Foo bar ==
29350
29351 == foo Bar ==
29352
29353 == Тест ==
29354
29355 == Тест ==
29356
29357 == тест ==
29358
29359 == Hey < # " > % : ' ==
29360 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29361
29362 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29363
29364 <!-- These two links should produce identical HTML -->
29365 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29366
29367 !! html/php
29368 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29369 <ul>
29370 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29371 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29372 <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>
29373 <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>
29374 <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>
29375 <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>
29376 </ul>
29377 </div>
29378
29379 <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>
29380 <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>
29381 <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>
29382 <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>
29383 <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>
29384 <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; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29385 <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>
29386 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29387 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29388 </p>
29389 !! end
29390
29391 !! test
29392 HTML5 ids: no legacy
29393 !! config
29394 wgFragmentMode=[ 'html5' ]
29395 !! wikitext
29396 == Foo bar ==
29397
29398 == foo Bar ==
29399
29400 == Тест ==
29401
29402 == Тест ==
29403
29404 == тест ==
29405
29406 == Hey < # " > % : ' ==
29407 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29408
29409 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29410
29411 <!-- These two links should produce identical HTML -->
29412 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29413
29414 !! html/php
29415 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29416 <ul>
29417 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29418 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29419 <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>
29420 <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>
29421 <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>
29422 <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>
29423 </ul>
29424 </div>
29425
29426 <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>
29427 <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>
29428 <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>
29429 <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>
29430 <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>
29431 <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; % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
29432 <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>
29433 </p><p>%F0%9F%92%A9 <span id="%F0%9F%92%A9"></span>
29434 </p><p><a href="#%E5%95%A4%E9%85%92">#啤酒</a> <a href="#%E5%95%A4%E9%85%92">#啤酒</a>
29435 </p>
29436 !! end