Merge "phpunit.php: omit --quiet in help"
[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 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 class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
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 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 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 class='mw-empty-elt'></tr>
7326 <tr class='mw-empty-elt'></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 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 !! html/parsoid
9880 <ul><li> foo</li>
9881 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"* "}'>li-hack</li>
9882 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["* ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
9883 <li data-parsoid='{"autoInsertedEnd":true}'> <!--foo--> </li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'> unsupported li-hack with preceding comments</li></ul>
9884
9885 <ul data-parsoid='{"stx":"html"}'>
9886 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9887 </li>
9888 </ul>
9889
9890 !!end
9891
9892 !! test
9893 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9894 !! options
9895 parsoid
9896 !! wikitext
9897 # foo
9898 ## bar
9899 * foo
9900 ** bar
9901 : foo
9902 :: bar
9903 !! html
9904 <ol>
9905 <li> foo<ol>
9906 <li> bar</li>
9907 </ol></li>
9908 </ol><ul>
9909 <li> foo<ul>
9910 <li> bar</li>
9911 </ul></li>
9912 </ul><dl>
9913 <dd> foo<dl>
9914 <dd> bar</dd>
9915 </dl></dd>
9916 </dl>
9917 !! end
9918
9919 !! test
9920 Parsoid: Test of whitespace serialization with Templated bullets
9921 !! options
9922 parsoid
9923 !! wikitext
9924 * {{bullet}}
9925 !! html/parsoid
9926 <ul>
9927 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9928 </ul>
9929 !! end
9930
9931 # ------------------------------------------------------------------------
9932 # The next set of tests are about Parsoid's ability to handle badly nested
9933 # tags (parse, minimize scope of fixup, and roundtrip back)
9934 # ------------------------------------------------------------------------
9935
9936 !! test
9937 Unbalanced closing block tags break a list
9938 (php parser relies on Tidy to fix up)
9939 !! wikitext
9940 <div>
9941 *a</div><div>
9942 *b</div>
9943 !! html+tidy
9944 <div>
9945 <ul>
9946 <li>a</li>
9947 </ul>
9948 </div>
9949 <div>
9950 <ul>
9951 <li>b</li>
9952 </ul>
9953 </div>
9954 !! end
9955
9956 # Parsoid fails this test, but it might be tricky to support properly.
9957 # See T70395.
9958 !! test
9959 Unbalanced closing non-block tags don't break a list
9960 (php parser relies on Tidy to fix up)
9961 !! wikitext
9962 <span>
9963 *a</span><span>
9964 *b</span>
9965 !! html/php+tidy
9966 <ul>
9967 <li><span>a</span></li>
9968 <li><span>b</span></li>
9969 </ul>
9970 !! html/parsoid
9971 <span>
9972 <ul>
9973 <li>a<span></span>
9974 </li>
9975 <li>b
9976 </li>
9977 </ul>
9978 </span>
9979 !! end
9980
9981 !! test
9982 Unclosed formatting tags that straddle lists are closed and reopened
9983 (php parser relies on Tidy to fix up)
9984 !! options
9985 parsoid=wt2html,wt2wt,html2html
9986 !! wikitext
9987 # <s> a
9988 # b </s>
9989 !! html/php+tidy
9990 <ol>
9991 <li><s>a</s></li>
9992 <li><s>b</s></li>
9993 </ol>
9994 !! html/parsoid
9995 <ol><li> <s> a</s></li>
9996 <li><s> b </s></li></ol>
9997 !! end
9998
9999 # See T70395.
10000 !!test
10001 1. List embedded in a formatting tag
10002 !! wikitext
10003 <small>
10004 * foo
10005 </small>
10006 !! html/php+tidy
10007 <ul>
10008 <li><small>foo</small></li>
10009 </ul>
10010 !! html/parsoid
10011 <small>
10012 <ul>
10013 <li> foo</li>
10014 </ul>
10015 </small>
10016 !!end
10017
10018 ## Ugly Parsoid output here
10019 ## Not sure what the right output is.
10020 !!test
10021 2. List embedded in a formatting tag
10022 !! wikitext
10023 <small>
10024 *a
10025 *b</small>
10026 !! html/php+tidy
10027 <ul>
10028 <li><small>a</small></li>
10029 <li><small>b</small></li>
10030 </ul>
10031 !! html/parsoid
10032 <small></small>
10033 <ul><small>
10034 <li>a</li>
10035 </small>
10036 <li><small>b</small></li>
10037 </ul>
10038 !!end
10039
10040 # Ugly Parsoid and PHP parser output here
10041 # Not sure if we want to make this a test!
10042 #
10043 ## !!test
10044 ## 3. Unclosed formatting tags in list elements
10045 ## !! wikitext
10046 ## *<small>a
10047 ## *<small>b
10048 ## !! html/php+tidy
10049 ## <ul>
10050 ## <li><small>a</small></li>
10051 ## <li><small><small>b</small></small></li>
10052 ## </ul>
10053 ## !! html/parsoid
10054 ## <ul>
10055 ## <li><small>a</small></li>
10056 ## <small>
10057 ## <li><small>b</small></li>
10058 ## </small></ul>
10059 ## !!end
10060
10061 # This is a bug in the PHP parser + tidy combination.
10062 # (The </tr> tag gets parsed as text and html-escaped by PHP,
10063 # and then fostered out of the table by tidy.)
10064 # We believe the Parsoid output to be correct.
10065 !! test
10066 Table with missing opening <tr> tag
10067 !! options
10068 parsoid=wt2html,wt2wt
10069 !! wikitext
10070 <table>
10071 <td>foo</td>
10072 </tr>
10073 </table>
10074 !! html+tidy
10075 <table>
10076 <tr>
10077 <td>foo</td>
10078 </tr>
10079 </table>
10080 !! end
10081
10082 ###
10083 ### Magic Words
10084 ###
10085
10086 # Note that the current date is hard-coded as
10087 # 1970-01-01T00:02:03Z (a Thursday)
10088 # when running parser tests. The timezone is also fixed to GMT, so
10089 # local date will be identical to current date.
10090
10091 !! test
10092 Magic Word: {{CURRENTDAY}}
10093 !! wikitext
10094 {{CURRENTDAY}}
10095 !! html
10096 <p>1
10097 </p>
10098 !! end
10099
10100 !! test
10101 Magic Word: {{CURRENTDAY2}}
10102 !! wikitext
10103 {{CURRENTDAY2}}
10104 !! html
10105 <p>01
10106 </p>
10107 !! end
10108
10109 !! test
10110 Magic Word: {{CURRENTDAYNAME}}
10111 !! wikitext
10112 {{CURRENTDAYNAME}}
10113 !! html
10114 <p>Thursday
10115 </p>
10116 !! end
10117
10118 !! test
10119 Magic Word: {{CURRENTDOW}}
10120 !! wikitext
10121 {{CURRENTDOW}}
10122 !! html
10123 <p>4
10124 </p>
10125 !! end
10126
10127 !! test
10128 Magic Word: {{CURRENTMONTH}}
10129 !! wikitext
10130 {{CURRENTMONTH}}
10131 !! html
10132 <p>01
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{CURRENTMONTH1}}
10138 !! wikitext
10139 {{CURRENTMONTH1}}
10140 !! html
10141 <p>1
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{CURRENTMONTHABBREV}}
10147 !! wikitext
10148 {{CURRENTMONTHABBREV}}
10149 !! html
10150 <p>Jan
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{CURRENTMONTHNAME}}
10156 !! wikitext
10157 {{CURRENTMONTHNAME}}
10158 !! html
10159 <p>January
10160 </p>
10161 !! end
10162
10163 !! test
10164 Magic Word: {{CURRENTMONTHNAMEGEN}}
10165 !! wikitext
10166 {{CURRENTMONTHNAMEGEN}}
10167 !! html
10168 <p>January
10169 </p>
10170 !! end
10171
10172 !! test
10173 Magic Word: {{CURRENTTIME}}
10174 !! wikitext
10175 {{CURRENTTIME}}
10176 !! html
10177 <p>00:02
10178 </p>
10179 !! end
10180
10181 !! test
10182 Magic Word: {{CURRENTHOUR}}
10183 !! wikitext
10184 {{CURRENTHOUR}}
10185 !! html
10186 <p>00
10187 </p>
10188 !! end
10189
10190 !! test
10191 Magic Word: {{CURRENTWEEK}} (T6594)
10192 !! wikitext
10193 {{CURRENTWEEK}}
10194 !! html
10195 <p>1
10196 </p>
10197 !! end
10198
10199 !! test
10200 Magic Word: {{CURRENTYEAR}}
10201 !! wikitext
10202 {{CURRENTYEAR}}
10203 !! html
10204 <p>1970
10205 </p>
10206 !! end
10207
10208 !! test
10209 Magic Word: {{CURRENTTIMESTAMP}}
10210 !! wikitext
10211 {{CURRENTTIMESTAMP}}
10212 !! html
10213 <p>19700101000203
10214 </p>
10215 !! end
10216
10217 !! test
10218 Magic Words LOCAL (UTC)
10219 !! wikitext
10220 * {{LOCALMONTH}}
10221 * {{LOCALMONTH1}}
10222 * {{LOCALMONTHNAME}}
10223 * {{LOCALMONTHNAMEGEN}}
10224 * {{LOCALMONTHABBREV}}
10225 * {{LOCALDAY}}
10226 * {{LOCALDAY2}}
10227 * {{LOCALDAYNAME}}
10228 * {{LOCALYEAR}}
10229 * {{LOCALTIME}}
10230 * {{LOCALHOUR}}
10231 * {{LOCALWEEK}}
10232 * {{LOCALDOW}}
10233 * {{LOCALTIMESTAMP}}
10234 !! html
10235 <ul><li> 01</li>
10236 <li> 1</li>
10237 <li> January</li>
10238 <li> January</li>
10239 <li> Jan</li>
10240 <li> 1</li>
10241 <li> 01</li>
10242 <li> Thursday</li>
10243 <li> 1970</li>
10244 <li> 00:02</li>
10245 <li> 00</li>
10246 <li> 1</li>
10247 <li> 4</li>
10248 <li> 19700101000203</li></ul>
10249
10250 !! end
10251
10252 !! test
10253 Magic Word: {{FULLPAGENAME}}
10254 !! options
10255 title=[[User:Ævar Arnfjörð Bjarmason]]
10256 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10257 !! wikitext
10258 {{FULLPAGENAME}}
10259 !! html/*
10260 <p>User:Ævar Arnfjörð Bjarmason
10261 </p>
10262 !! end
10263
10264 !! test
10265 Magic Word: {{FULLPAGENAMEE}}
10266 !! options
10267 title=[[User:Ævar Arnfjörð Bjarmason]]
10268 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10269 !! wikitext
10270 {{FULLPAGENAMEE}}
10271 !! html/*
10272 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10273 </p>
10274 !! end
10275
10276 !! test
10277 Magic Word: {{TALKSPACE}}
10278 !! options
10279 title=[[User:Ævar Arnfjörð Bjarmason]]
10280 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10281 !! wikitext
10282 {{TALKSPACE}}
10283 !! html/*
10284 <p>User talk
10285 </p>
10286 !! end
10287
10288 !! test
10289 Magic Word: {{TALKSPACE}}, same namespace
10290 !! options
10291 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10292 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10293 !! wikitext
10294 {{TALKSPACE}}
10295 !! html/*
10296 <p>User talk
10297 </p>
10298 !! end
10299
10300 !! test
10301 Magic Word: {{TALKSPACE}}, main namespace
10302 !! options
10303 title=[[Parser Test]]
10304 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10305 !! wikitext
10306 {{TALKSPACE}}
10307 !! html/*
10308 <p>Talk
10309 </p>
10310 !! end
10311
10312 !! test
10313 Magic Word: {{TALKSPACEE}}
10314 !! options
10315 title=[[User:Ævar Arnfjörð Bjarmason]]
10316 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10317 !! wikitext
10318 {{TALKSPACEE}}
10319 !! html/*
10320 <p>User_talk
10321 </p>
10322 !! end
10323
10324 !! test
10325 Magic Word: {{SUBJECTSPACE}}
10326 !! options
10327 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10328 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10329 !! wikitext
10330 {{SUBJECTSPACE}}
10331 !! html/*
10332 <p>User
10333 </p>
10334 !! end
10335
10336 !! test
10337 Magic Word: {{SUBJECTSPACE}}, same namespace
10338 !! options
10339 title=[[User:Ævar Arnfjörð Bjarmason]]
10340 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10341 !! wikitext
10342 {{SUBJECTSPACE}}
10343 !! html/*
10344 <p>User
10345 </p>
10346 !! end
10347
10348 !! test
10349 Magic Word: {{SUBJECTSPACE}}, main namespace
10350 !! options
10351 title=[[Parser Test]]
10352 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10353 !! wikitext
10354 {{SUBJECTSPACE}}
10355 !! html/*
10356
10357 !! end
10358
10359 !! test
10360 Magic Word: {{SUBJECTSPACEE}}
10361 !! options
10362 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10363 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10364 !! wikitext
10365 {{SUBJECTSPACEE}}
10366 !! html/*
10367 <p>User
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Word: {{NAMESPACE}}
10373 !! options
10374 title=[[User:Ævar Arnfjörð Bjarmason]]
10375 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10376 !! wikitext
10377 {{NAMESPACE}}
10378 !! html/*
10379 <p>User
10380 </p>
10381 !! end
10382
10383 !! test
10384 Magic Word: {{NAMESPACEE}}
10385 !! options
10386 title=[[User:Ævar Arnfjörð Bjarmason]]
10387 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10388 !! wikitext
10389 {{NAMESPACEE}}
10390 !! html/*
10391 <p>User
10392 </p>
10393 !! end
10394
10395 !! test
10396 Magic Word: {{NAMESPACENUMBER}}
10397 !! options
10398 title=[[User:Ævar Arnfjörð Bjarmason]]
10399 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10400 !! wikitext
10401 {{NAMESPACENUMBER}}
10402 !! html/*
10403 <p>2
10404 </p>
10405 !! end
10406
10407 !! test
10408 Magic Word: {{SUBPAGENAME}}
10409 !! options
10410 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10411 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10412 !! wikitext
10413 {{SUBPAGENAME}}
10414 !! html/*
10415 <p>sub ö
10416 </p>
10417 !! end
10418
10419 !! test
10420 Magic Word: {{SUBPAGENAMEE}}
10421 !! options
10422 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10423 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10424 !! wikitext
10425 {{SUBPAGENAMEE}}
10426 !! html/*
10427 <p>sub_%C3%B6
10428 </p>
10429 !! end
10430
10431 !! test
10432 Magic Word: {{ROOTPAGENAME}}
10433 !! options
10434 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10435 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10436 !! wikitext
10437 {{ROOTPAGENAME}}
10438 !! html/*
10439 <p>Ævar Arnfjörð Bjarmason
10440 </p>
10441 !! end
10442
10443 !! test
10444 Magic Word: {{ROOTPAGENAMEE}}
10445 !! options
10446 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10447 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10448 !! wikitext
10449 {{ROOTPAGENAMEE}}
10450 !! html/*
10451 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10452 </p>
10453 !! end
10454
10455 !! test
10456 Magic Word: {{BASEPAGENAME}}
10457 !! options
10458 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10459 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10460 !! wikitext
10461 {{BASEPAGENAME}}
10462 !! html/*
10463 <p>Ævar Arnfjörð Bjarmason
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{BASEPAGENAMEE}}
10469 !! options
10470 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10471 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10472 !! wikitext
10473 {{BASEPAGENAMEE}}
10474 !! html/*
10475 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10476 </p>
10477 !! end
10478
10479 !! test
10480 Magic Word: {{TALKPAGENAME}}
10481 !! options
10482 title=[[User:Ævar Arnfjörð Bjarmason]]
10483 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10484 !! wikitext
10485 {{TALKPAGENAME}}
10486 !! html/*
10487 <p>User talk:Ævar Arnfjörð Bjarmason
10488 </p>
10489 !! end
10490
10491 !! test
10492 Magic Word: {{TALKPAGENAMEE}}
10493 !! options
10494 title=[[User:Ævar Arnfjörð Bjarmason]]
10495 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10496 !! wikitext
10497 {{TALKPAGENAMEE}}
10498 !! html/*
10499 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10500 </p>
10501 !! end
10502
10503 !! test
10504 Magic Word: {{SUBJECTPAGENAME}}
10505 !! options
10506 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10507 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10508 !! wikitext
10509 {{SUBJECTPAGENAME}}
10510 !! html/*
10511 <p>User:Ævar Arnfjörð Bjarmason
10512 </p>
10513 !! end
10514
10515 !! test
10516 Magic Word: {{SUBJECTPAGENAMEE}}
10517 !! options
10518 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10519 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10520 !! wikitext
10521 {{SUBJECTPAGENAMEE}}
10522 !! html/*
10523 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10524 </p>
10525 !! end
10526
10527 !! test
10528 Magic Word: {{NUMBEROFFILES}}
10529 !! options
10530 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10531 !! wikitext
10532 {{NUMBEROFFILES}}
10533 !! html/*
10534 <p>7
10535 </p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{PAGENAME}}
10540 !! options
10541 title=[[User:Ævar Arnfjörð Bjarmason]]
10542 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10543 !! wikitext
10544 {{PAGENAME}}
10545 !! html/*
10546 <p>Ævar Arnfjörð Bjarmason
10547 </p>
10548 !! end
10549
10550 !! test
10551 Magic Word: {{PAGENAME}} with metacharacters
10552 !! options
10553 title=[['foo & bar = baz']]
10554 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10555 !! wikitext
10556 ''{{PAGENAME}}''
10557 !! html/php
10558 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10559 </p>
10560 !! html+tidy
10561 <p><i>'foo &amp; bar = baz'</i></p>
10562 !! end
10563
10564 !! test
10565 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10566 !! options
10567 title=[[*RFC 1234 http://example.com/]]
10568 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10569 !! wikitext
10570 {{PAGENAME}}
10571 !! html/php
10572 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10573 </p>
10574 !! html+tidy
10575 <p>*RFC 1234 http://example.com/</p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{PAGENAMEE}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{PAGENAMEE}}
10585 !! html/*
10586 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10592 !! options
10593 title=[[*RFC 1234 http://example.com/]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{PAGENAMEE}}
10597 !! html/php
10598 <p>&#42;RFC_1234_http&#58;//example.com/
10599 </p>
10600 !! html+tidy
10601 <p>*RFC_1234_http://example.com/</p>
10602 !! end
10603
10604 !! test
10605 Magic Word: {{REVISIONID}}
10606 !! options
10607 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10608 showflags
10609 !! wikitext
10610 {{REVISIONID}}
10611 !! html/*
10612 <p>1337
10613 </p>
10614 flags=vary-revision-id
10615 !! end
10616
10617 !! test
10618 Magic Word: {{SCRIPTPATH}}
10619 !! options
10620 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10621 !! wikitext
10622 {{SCRIPTPATH}}
10623 !! html/*
10624
10625 !! end
10626
10627 !! test
10628 Magic Word: {{STYLEPATH}}
10629 !! options
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{STYLEPATH}}
10633 !! html/*
10634 <p>/skins
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{SERVER}}
10640 !! options
10641 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10642 !! wikitext
10643 {{SERVER}}
10644 !! html/*
10645 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10646 </p>
10647 !! end
10648
10649 !! test
10650 Magic Word: {{SERVERNAME}}
10651 !! options
10652 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10653 !! wikitext
10654 {{SERVERNAME}}
10655 !! html/*
10656 <p>example.org
10657 </p>
10658 !! end
10659
10660 !! test
10661 Magic Word: {{SITENAME}}
10662 !! options
10663 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10664 !! wikitext
10665 {{SITENAME}}
10666 !! html/*
10667 <p>MediaWiki
10668 </p>
10669 !! end
10670
10671 !! test
10672 Magic Word: {{PAGELANGUAGE}}
10673 !! options
10674 language=fr
10675 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10676 !! wikitext
10677 {{PAGELANGUAGE}}
10678 !! html/*
10679 <p>fr
10680 </p>
10681 !! end
10682
10683 !! test
10684 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10685 !! options
10686 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10687 !! wikitext
10688 {{PAGELANGUAGE}}
10689 !! html/*
10690 <p>en
10691 </p>
10692 !! end
10693
10694 !! test
10695 Case-sensitive magic words, when cased differently, should just be template transclusions
10696 !! wikitext
10697 {{CurrentMonth}}
10698 {{currentday}}
10699 {{cURreNTweEK}}
10700 {{currentHour}}
10701 !! html
10702 <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>
10703 <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>
10704 <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>
10705 <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>
10706 </p>
10707 !! end
10708
10709 !! test
10710 Case-insensitive magic words should still work with weird casing.
10711 !! wikitext
10712 {{sErVeRNaMe}}
10713 {{LCFirst:AOEU}}
10714 {{ucFIRST:aoeu}}
10715 {{SERver}}
10716 !! html
10717 <p>example.org
10718 aOEU
10719 Aoeu
10720 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10721 </p>
10722 !! end
10723
10724 # From plwiki:PLOS_ONE
10725 !! test
10726 Parsoid: Page property magic word with magic word contents
10727 !! wikitext
10728 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10729 !! html/parsoid
10730 <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>"}]]}'/>
10731 !! end
10732
10733 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10734 # But, this is a limitation of our representation and is documented in
10735 # TemplateHandler.js in processSpecialMagicWord
10736 !! test
10737 Parsoid: Template-generated DISPLAYTITLE
10738 !! wikitext
10739 {{{{echo|DISPLAYTITLE}}:Foo}}
10740 !! options
10741 showtitle
10742 !! config
10743 wgAllowDisplayTitle=true
10744 wgRestrictDisplayTitle=false
10745 !! html/php
10746 Foo
10747
10748 !! html/parsoid
10749 <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"}]]}'/>
10750 !! end
10751
10752 !! test
10753 Namespace 1 {{ns:1}}
10754 !! wikitext
10755 {{ns:1}}
10756 !! html
10757 <p>Talk
10758 </p>
10759 !! end
10760
10761 !! test
10762 Namespace 1 {{ns:01}}
10763 !! wikitext
10764 {{ns:01}}
10765 !! html
10766 <p>Talk
10767 </p>
10768 !! end
10769
10770 !! test
10771 Namespace 0 {{ns:0}} (T6783)
10772 !! wikitext
10773 {{ns:0}}
10774 !! html
10775
10776 !! end
10777
10778 !! test
10779 Namespace 0 {{ns:00}} (T6783)
10780 !! wikitext
10781 {{ns:00}}
10782 !! html
10783
10784 !! end
10785
10786 !! test
10787 Namespace -1 {{ns:-1}}
10788 !! wikitext
10789 {{ns:-1}}
10790 !! html
10791 <p>Special
10792 </p>
10793 !! end
10794
10795 !! test
10796 Namespace User {{ns:User}}
10797 !! wikitext
10798 {{ns:User}}
10799 !! html
10800 <p>User
10801 </p>
10802 !! end
10803
10804 !! test
10805 Namespace User talk {{ns:User_talk}}
10806 !! wikitext
10807 {{ns:User_talk}}
10808 !! html
10809 <p>User talk
10810 </p>
10811 !! end
10812
10813 !! test
10814 Namespace User talk {{ns:uSeR tAlK}}
10815 !! wikitext
10816 {{ns:uSeR tAlK}}
10817 !! html
10818 <p>User talk
10819 </p>
10820 !! end
10821
10822 !! test
10823 Namespace File {{ns:File}}
10824 !! wikitext
10825 {{ns:File}}
10826 !! html
10827 <p>File
10828 </p>
10829 !! end
10830
10831 !! test
10832 Namespace File {{ns:Image}}
10833 !! wikitext
10834 {{ns:Image}}
10835 !! html
10836 <p>File
10837 </p>
10838 !! end
10839
10840 !! test
10841 Namespace (lang=de) Benutzer {{ns:User}}
10842 !! options
10843 language=de
10844 !! wikitext
10845 {{ns:User}}
10846 !! html
10847 <p>Benutzer
10848 </p>
10849 !! end
10850
10851 !! test
10852 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10853 !! options
10854 language=de
10855 !! wikitext
10856 {{ns:3}}
10857 !! html
10858 <p>Benutzer Diskussion
10859 </p>
10860 !! end
10861
10862 !! test
10863 Urlencode
10864 !! wikitext
10865 {{urlencode:hi world?!}}
10866 {{urlencode:hi world?!|WIKI}}
10867 {{urlencode:hi world?!|PATH}}
10868 {{urlencode:hi world?!|QUERY}}
10869 !! html/php
10870 <p>hi+world%3F%21
10871 hi_world%3F!
10872 hi%20world%3F%21
10873 hi+world%3F%21
10874 </p>
10875 !! end
10876
10877 !! test
10878 Magic Word: prioritize type info over data-parsoid
10879 !! options
10880 parsoid=html2wt
10881 !! html/parsoid
10882 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10883 !! wikitext
10884 __FORCETOC__
10885 !! end
10886
10887 !! test
10888 Magic Word: serialize on separate line (parsoid)
10889 !! options
10890 parsoid=wt2wt,html2wt
10891 !! wikitext
10892 foo
10893 __NOTOC__
10894 bar
10895 !! html/parsoid
10896 foo<meta property="mw:PageProp/notoc"/>bar
10897 !! end
10898
10899 !! test
10900 Magic Word: rt non-english wikis
10901 !! options
10902 parsoid=wt2wt
10903 language=de
10904 !! wikitext
10905 __NOEDITSECTION__
10906 !! html/parsoid
10907 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10908 !! end
10909
10910 !!test
10911 __proto__ is treated as normal wikitext (T105997)
10912 !!wikitext
10913 __proto__
10914 !!html
10915 <p>__proto__
10916 </p>
10917 !!end
10918
10919 ###
10920 ### Magic links
10921 ###
10922 !! test
10923 Magic links: internal link to RFC (T2479)
10924 !! wikitext
10925 [[RFC 123]]
10926 !! html/php
10927 <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>
10928 </p>
10929 !! html/parsoid
10930 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10931 !! end
10932
10933 !! test
10934 Magic links: RFC (T2479)
10935 !! wikitext
10936 RFC 822
10937 !! html/php
10938 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10939 </p>
10940 !! html/parsoid
10941 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10942 !! end
10943
10944 !! test
10945 Magic links: RFC (T67278)
10946 !! wikitext
10947 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10948 !! html/php
10949 <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.
10950 </p>
10951 !! html/parsoid
10952 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10953 !! end
10954
10955 !! test
10956 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10957 !! wikitext
10958 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10959 RFC
10960 822
10961 !! html/php
10962 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10963 RFC
10964 822
10965 </p>
10966 !! html/parsoid
10967 <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>
10968 RFC
10969 822</p>
10970 !! end
10971
10972 !! test
10973 Magic links: ISBN (T3937)
10974 !! wikitext
10975 ISBN 0-306-40615-2
10976 !! html/php
10977 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10978 </p>
10979 !! html/parsoid
10980 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10981 !! end
10982
10983 !! test
10984 Magic links: ISBN (T67278)
10985 !! wikitext
10986 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10987 !! html/php
10988 <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.
10989 </p>
10990 !! html/parsoid
10991 <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>
10992 !! end
10993
10994 !! test
10995 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10996 !! wikitext
10997 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10998 ISBN
10999 9780316098113
11000 ISBN 978
11001 0316098113
11002 !! html/php
11003 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11004 ISBN
11005 9780316098113
11006 ISBN 978
11007 0316098113
11008 </p>
11009 !! html/parsoid
11010 <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>
11011 ISBN
11012 9780316098113
11013 ISBN 978
11014 0316098113</p>
11015 !! end
11016
11017 !! test
11018 Magic links: PMID incorrectly converts space to underscore
11019 !! wikitext
11020 PMID 1234
11021 !! html/php
11022 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11023 </p>
11024 !! html/parsoid
11025 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
11026 !! end
11027
11028 !! test
11029 Magic links: PMID (T67278)
11030 !! wikitext
11031 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11032 !! html/php
11033 <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.
11034 </p>
11035 !! html/parsoid
11036 <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>
11037 !! end
11038
11039 !! test
11040 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11041 !! wikitext
11042 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11043 PMID
11044 1234
11045 !! html/php
11046 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11047 PMID
11048 1234
11049 </p>
11050 !! html/parsoid
11051 <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>
11052 PMID
11053 1234</p>
11054 !! end
11055
11056 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11057 # since these are ExtLinkText, not MagicLinkText
11058 !! test
11059 Magic links: use appropriate serialization for "almost" magic links.
11060 !! wikitext
11061 X[[Special:BookSources/0978739256|foo]]
11062
11063 X[//tools.ietf.org/html/rfc1234 foo]
11064 !! html/php
11065 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11066 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
11067 </p>
11068 !! html/parsoid
11069 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11070 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
11071 !! end
11072
11073 !! test
11074 Magic links: All disabled (T47942)
11075 !! options
11076 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11077 !! wikitext
11078 ISBN 0-306-40615-2
11079 PMID 1234
11080 RFC 4321
11081 !! html/php
11082 <p>ISBN 0-306-40615-2
11083 PMID 1234
11084 RFC 4321
11085 </p>
11086 !! end
11087
11088 ###
11089 ### Templates
11090 ####
11091
11092 !! test
11093 Nonexistent template
11094 !! wikitext
11095 {{thistemplatedoesnotexist}}
11096 !! html
11097 <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>
11098 </p>
11099 !! end
11100
11101 !! test
11102 Template with invalid target containing tags
11103 !! wikitext
11104 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11105 !! html
11106 <p>{{a<b>b</b>|foo|a=b|a = b}}
11107 </p>
11108 !! end
11109
11110 !! test
11111 Template with invalid target containing unclosed tag
11112 !! wikitext
11113 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11114 !! html
11115 <p>{{a<b>|foo|a=b|a = b}}</b>
11116 </p>
11117 !! end
11118
11119 !! test
11120 Template with invalid target containing wikilink
11121 !! wikitext
11122 {{[[Main Page]]}}
11123 !! html/php
11124 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11125 </p>
11126 !! html/parsoid
11127 <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>
11128 !! end
11129
11130 !! test
11131 Template with just whitespace in it, T70421
11132 !! wikitext
11133 {{echo|{{ }}}}
11134 !! html/parsoid
11135 <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>
11136 !! end
11137
11138 !! article
11139 Template:test
11140 !! text
11141 This is a test template
11142 !! endarticle
11143
11144 !! test
11145 Simple template
11146 !! wikitext
11147 {{test}}
11148 !! html
11149 <p>This is a test template
11150 </p>
11151 !! end
11152
11153 !! test
11154 Template with explicit namespace
11155 !! wikitext
11156 {{Template:test}}
11157 !! html
11158 <p>This is a test template
11159 </p>
11160 !! end
11161
11162
11163 !! article
11164 Template:paramtest
11165 !! text
11166 This is a test template with parameter {{{param}}}
11167 !! endarticle
11168
11169 !! test
11170 Template parameter
11171 !! wikitext
11172 {{paramtest|param=foo}}
11173 !! html
11174 <p>This is a test template with parameter foo
11175 </p>
11176 !! end
11177
11178 !! article
11179 Template:paramtestnum
11180 !! text
11181 [[{{{1}}}|{{{2}}}]]
11182 !! endarticle
11183
11184 !! test
11185 Template unnamed parameter
11186 !! wikitext
11187 {{paramtestnum|Main Page|the main page}}
11188 !! html
11189 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11190 </p>
11191 !! end
11192
11193 !! article
11194 Template:templatesimple
11195 !! text
11196 (test)
11197 !! endarticle
11198
11199 !! article
11200 Template:templateredirect
11201 !! text
11202 #redirect [[Template:templatesimple]]
11203 !! endarticle
11204
11205 !! article
11206 Template:templateasargtestnum
11207 !! text
11208 {{{{{1}}}}}
11209 !! endarticle
11210
11211 !! article
11212 Template:templateasargtest
11213 !! text
11214 {{template{{{templ}}}}}
11215 !! endarticle
11216
11217 !! article
11218 Template:templateasargtest2
11219 !! text
11220 {{{{{templ}}}}}
11221 !! endarticle
11222
11223 !! test
11224 Template with template name as unnamed argument
11225 !! wikitext
11226 {{templateasargtestnum|templatesimple}}
11227 !! html
11228 <p>(test)
11229 </p>
11230 !! end
11231
11232 !! test
11233 Template with template name as argument
11234 !! wikitext
11235 {{templateasargtest|templ=simple}}
11236 !! html
11237 <p>(test)
11238 </p>
11239 !! end
11240
11241 !! test
11242 Template with template name as argument (2)
11243 !! wikitext
11244 {{templateasargtest2|templ=templatesimple}}
11245 !! html
11246 <p>(test)
11247 </p>
11248 !! end
11249
11250 !! article
11251 Template:templateasargtestdefault
11252 !! text
11253 {{{{{templ|templatesimple}}}}}
11254 !! endarticle
11255
11256 !! article
11257 Template:templa
11258 !! text
11259 '''templ'''
11260 !! endarticle
11261
11262 !! test
11263 Template with default value
11264 !! wikitext
11265 {{templateasargtestdefault}}
11266 !! html
11267 <p>(test)
11268 </p>
11269 !! end
11270
11271 !! test
11272 Template with default value (value set)
11273 !! wikitext
11274 {{templateasargtestdefault|templ=templa}}
11275 !! html
11276 <p><b>templ</b>
11277 </p>
11278 !! end
11279
11280 !! test
11281 Template redirect
11282 !! wikitext
11283 {{templateredirect}}
11284 !! html/php
11285 <p>(test)
11286 </p>
11287 !! html/parsoid
11288 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11289 !! end
11290
11291 !! test
11292 Template with argument in separate line
11293 !! wikitext
11294 {{ templateasargtest |
11295 templ = simple }}
11296 !! html
11297 <p>(test)
11298 </p>
11299 !! end
11300
11301 !! test
11302 Template with complex template as argument
11303 !! wikitext
11304 {{paramtest|
11305 param ={{ templateasargtest |
11306 templ = simple }}}}
11307 !! html
11308 <p>This is a test template with parameter (test)
11309 </p>
11310 !! end
11311
11312 !! test
11313 Templates with templated name
11314 !! wikitext
11315 {{{{echo|echo}}|foo}}
11316 {{{{echo|inner list}} }}
11317 !! html
11318 <p>foo
11319 </p>
11320 <ul><li> item 1</li></ul>
11321
11322 !! html/parsoid
11323 <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>
11324 <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>
11325 !! end
11326
11327 # Parsoid markup is deliberate "broken". This is an edge case.
11328 # See long comment in TemplateHandler.js:convertAttribsToString.
11329 !! test
11330 Templates with invalid templated targets
11331 !! wikitext
11332 {{echo
11333 {{echo|foo}}
11334 }}
11335 !! html/php
11336 <p>{{echo
11337 foo
11338 }}
11339 </p>
11340 !! html/parsoid
11341 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11342 foo }}</p>
11343 !! end
11344
11345 !! test
11346 Template with thumb image (with link in description)
11347 !! wikitext
11348 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11349 !! html/php
11350 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>
11351
11352 !! html+tidy
11353 <p>This is a test template with parameter</p>
11354 <div class="thumb tright">
11355 <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>
11356 <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>
11357 </div>
11358 </div>
11359 !! html/parsoid
11360 <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>
11361 !! end
11362
11363 !! article
11364 Template:complextemplate
11365 !! text
11366 {{{1}}} {{paramtest|
11367 param ={{{param}}}}}
11368 !! endarticle
11369
11370 !! test
11371 Template with complex arguments
11372 !! wikitext
11373 {{complextemplate|
11374 param ={{ templateasargtest |
11375 templ = simple }}|[[Template:complextemplate|link]]}}
11376 !! html
11377 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11378 </p>
11379 !! end
11380
11381 !! test
11382 T2553: link with two variables in a piped link
11383 !! wikitext
11384 {|
11385 |[[{{{1}}}|{{{2}}}]]
11386 |}
11387 !! html/php
11388 <table>
11389 <tr>
11390 <td>[[{{{1}}}|{{{2}}}]]
11391 </td></tr></table>
11392
11393 !! html/parsoid
11394 <table>
11395 <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>
11396 </tbody></table>
11397 !! end
11398
11399 # See: T2553
11400 !! test
11401 Abort table cell attribute parsing on wikilink
11402 !! wikitext
11403 {|
11404 | testing [[one|two]] | three || four
11405 | testing one two | three || four
11406 | testing="[[one|two]]" | three || four
11407 |}
11408 !! html/php
11409 <table>
11410 <tr>
11411 <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>
11412 <td> four
11413 </td>
11414 <td> three </td>
11415 <td> four
11416 </td>
11417 <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>
11418 <td> four
11419 </td></tr></table>
11420
11421 !! html/parsoid
11422 <table>
11423 <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>
11424 <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>
11425 <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>
11426 </tbody></table>
11427 !! end
11428
11429 !! test
11430 Don't abort table cell attribute parsing if wikilink is found in template arg
11431 !! wikitext
11432 {|
11433 | Test {{#tag:ref|One two "[[three]]" four}}
11434 |}
11435 !! html/parsoid
11436 <table>
11437 <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>
11438 </tbody></table>
11439 !! end
11440
11441 !! test
11442 Magic variable as template parameter
11443 !! wikitext
11444 {{paramtest|param={{SITENAME}}}}
11445 !! html
11446 <p>This is a test template with parameter MediaWiki
11447 </p>
11448 !! end
11449
11450 !! article
11451 Template:linktest
11452 !! text
11453 [[{{{param}}}|link]]
11454 !! endarticle
11455
11456 !! test
11457 Template parameter as link source
11458 !! wikitext
11459 {{linktest|param=Main Page}}
11460 !! html
11461 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11462 </p>
11463 !! end
11464
11465 !!article
11466 Template:paramtest2
11467 !! text
11468 including another template, {{paramtest|param={{{arg}}}}}
11469 !! endarticle
11470
11471 !! test
11472 Template passing argument to another template
11473 !! wikitext
11474 {{paramtest2|arg='hmm'}}
11475 !! html
11476 <p>including another template, This is a test template with parameter 'hmm'
11477 </p>
11478 !! end
11479
11480 !! article
11481 Template:Linktest2
11482 !! text
11483 Main Page
11484 !! endarticle
11485
11486 !! test
11487 Template as link source
11488 !! wikitext
11489 [[{{linktest2}}]]
11490
11491 [[{{linktest2}}|Main Page]]
11492
11493 [[{{linktest2}}]]Page
11494 !! html
11495 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11496 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11497 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11498 </p>
11499 !! end
11500
11501
11502 !! article
11503 Template:loop1
11504 !! text
11505 {{loop2}}
11506 !! endarticle
11507
11508 !! article
11509 Template:loop2
11510 !! text
11511 {{loop1}}
11512 !! endarticle
11513
11514 !! test
11515 Template infinite loop
11516 !! wikitext
11517 {{loop1}}
11518 !! html
11519 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11520 </p>
11521 !! end
11522
11523 !! test
11524 Template from main namespace
11525 !! wikitext
11526 {{:Main Page}}
11527 !! html
11528 <p>blah blah
11529 </p>
11530 !! end
11531
11532 !! article
11533 Template:table
11534 !! text
11535 {|
11536 | 1 || 2
11537 |-
11538 | 3 || 4
11539 |}
11540 !! endarticle
11541
11542 !! test
11543 T2529: Template with table, not included at beginning of line
11544 !! wikitext
11545 foo {{table}}
11546 !! html
11547 <p>foo
11548 </p>
11549 <table>
11550 <tr>
11551 <td> 1 </td>
11552 <td> 2
11553 </td></tr>
11554 <tr>
11555 <td> 3 </td>
11556 <td> 4
11557 </td></tr></table>
11558
11559 !! end
11560
11561 !! test
11562 T2523: Template shouldn't eat newline (or add an extra one before table)
11563 !! wikitext
11564 foo
11565 {{table}}
11566 !! html
11567 <p>foo
11568 </p>
11569 <table>
11570 <tr>
11571 <td> 1 </td>
11572 <td> 2
11573 </td></tr>
11574 <tr>
11575 <td> 3 </td>
11576 <td> 4
11577 </td></tr></table>
11578
11579 !! end
11580
11581 !! test
11582 T2041: Template parameters shown as broken links
11583 !! wikitext
11584 {{{parameter}}}
11585 !! html
11586 <p>{{{parameter}}}
11587 </p>
11588 !! end
11589
11590 !! test
11591 Template with targets containing wikilinks
11592 !! options
11593 parsoid=wt2html
11594 !! wikitext
11595 {{[[foo]]}}
11596
11597 {{[[{{echo|foo}}]]}}
11598
11599 {{{{echo|[[foo}}]]}}
11600 !! html/php
11601 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11602 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11603 </p><p>{{[[foo}}]]
11604 </p>
11605 !! html/parsoid
11606 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11607 <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>
11608 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11609 !! end
11610
11611 !! article
11612 Template:''
11613 !! text
11614 bar
11615 !! endarticle
11616
11617 !! test
11618 Templates: Double quotes as template target
11619 !! wikitext
11620 foo {{''}} baz
11621 !! html/php
11622 <p>foo bar baz
11623 </p>
11624 !! html/parsoid
11625 <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
11626 </p>
11627 !! end
11628
11629 ## This test is about making sure Parsoid's data-mw is well formed in the
11630 ## face of multiple templates with intersecting and overlapping ranges. The
11631 ## wikitext itself is wretched.
11632 !! test
11633 Templates with intersecting and overlapping ranges
11634 !! wikitext
11635 {|{{echo|
11636 <p>ha</p>}}
11637 {|{{echo|
11638 <p>ho</p>}}
11639 {{echo|{{!}}hi}}
11640 |}
11641 !! html/php+tidy
11642 <p>ha</p>
11643 <p>ho</p>
11644 <table>
11645 <tr>
11646 <td></td>
11647 </tr>
11648 <tr>
11649 <td>hi</td>
11650 </tr>
11651 </table>
11652 <table>
11653 <tr>
11654 <td></td>
11655 </tr>
11656 </table>
11657 !! html/parsoid
11658 <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":""}]]}'>
11659
11660 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11661
11662 <tbody><tr><td>hi</td></tr>
11663 </tbody></table>
11664 !! end
11665
11666 !! article
11667 Template:MSGNW test
11668 !! text
11669 ''None'' of '''this''' should be
11670 * interpreted
11671 but rather passed unmodified
11672 {{test}}
11673 <gallery>
11674 File:Foobar.jpg
11675 </gallery>
11676 <!-- comment -->
11677 !! endarticle
11678
11679 # hmm, fix this or just deprecate msgnw and document its behavior?
11680 !! test
11681 msgnw keyword
11682 !! wikitext
11683 {{msgnw:MSGNW test}}
11684 !! html/php
11685 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11686 &#42; interpreted
11687 &#32;but rather passed unmodified
11688 &#123;&#123;test&#125;&#125;
11689 &#60;gallery&#62;
11690 File:Foobar.jpg
11691 &#60;/gallery&#62;
11692 &#60;!-- comment --&#62;
11693 </p>
11694 !! end
11695
11696 !! test
11697 int keyword
11698 !! wikitext
11699 {{int:youhavenewmessages|lots of money|not!}}
11700 !! html
11701 <p>You have lots of money (not!).
11702 </p>
11703 !! end
11704
11705 !! test
11706 int keyword - non-existing message
11707 !! wikitext
11708 {{int:var}}
11709 !! html
11710 <p>⧼var⧽
11711 </p>
11712 !! end
11713
11714 !! article
11715 Template:Includes
11716 !! text
11717 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11718 !! endarticle
11719
11720 !! test
11721 <includeonly> and <noinclude> being included
11722 !! wikitext
11723 {{Includes}}
11724 !! html
11725 <p>Foobar
11726 </p>
11727 !! end
11728
11729 !! article
11730 Template:Includes2
11731 !! text
11732 <onlyinclude>Foo</onlyinclude>bar
11733 !! endarticle
11734
11735 !! test
11736 <onlyinclude> being included
11737 !! wikitext
11738 {{Includes2}}
11739 !! html
11740 <p>Foo
11741 </p>
11742 !! end
11743
11744
11745 !! article
11746 Template:Includes3
11747 !! text
11748 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11749 !! endarticle
11750
11751 !! test
11752 <onlyinclude> and <includeonly> being included
11753 !! wikitext
11754 {{Includes3}}
11755 !! html
11756 <p>Foo
11757 </p>
11758 !! end
11759
11760 !! test
11761 <includeonly> and <noinclude> on a page
11762 !! wikitext
11763 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11764 !! html
11765 <p>Foozar
11766 </p>
11767 !! end
11768
11769 !! test
11770 Un-closed <noinclude>
11771 !! wikitext
11772 <noinclude>
11773 !! html
11774 !! end
11775
11776 !! test
11777 <onlyinclude> on a page
11778 !! wikitext
11779 <onlyinclude>Foo</onlyinclude>bar
11780 !! html
11781 <p>Foobar
11782 </p>
11783 !! end
11784
11785 !! test
11786 Un-closed <onlyinclude>
11787 !! wikitext
11788 <onlyinclude>
11789 !! html
11790 !! end
11791
11792 !!test
11793 Self-closed noinclude, includeonly, onlyinclude tags
11794 !! wikitext
11795 <noinclude />
11796 <includeonly />
11797 <onlyinclude />
11798 !! html
11799 <p><br />
11800 </p>
11801 !!end
11802
11803 !!test
11804 Unbalanced includeonly and noinclude tags
11805 !! wikitext
11806 {|
11807 |a</noinclude>
11808 |b</noinclude></noinclude>
11809 |c</noinclude></includeonly>
11810 |d</includeonly></includeonly>
11811 |}
11812 !! html
11813 <table>
11814 <tr>
11815 <td>a
11816 </td>
11817 <td>b
11818 </td>
11819 <td>c&lt;/includeonly&gt;
11820 </td>
11821 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11822 </td></tr></table>
11823
11824 !!end
11825
11826 !! article
11827 Template:Includeonly section
11828 !! text
11829 <includeonly>
11830 ==Includeonly section==
11831 </includeonly>
11832 ==Section T-1==
11833 !!endarticle
11834
11835 !! test
11836 T8563: Edit link generation for section shown by <includeonly>
11837 !! wikitext
11838 {{includeonly section}}
11839 !! html
11840 <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>
11841 <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>
11842
11843 !! end
11844
11845 # Uses same input as the contents of [[Template:Includeonly section]]
11846 !! test
11847 T8563: Section extraction for section shown by <includeonly>
11848 !! options
11849 section=T-2
11850 !! wikitext
11851 <includeonly>
11852 ==Includeonly section==
11853 </includeonly>
11854 ==Section T-2==
11855 !! html
11856 ==Section T-2==
11857 !! end
11858
11859 !! test
11860 T8563: Edit link generation for section suppressed by <includeonly>
11861 !! wikitext
11862 <includeonly>
11863 ==Includeonly section==
11864 </includeonly>
11865 ==Section 1==
11866 !! html
11867 <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>
11868
11869 !! end
11870
11871 !! test
11872 T8563: Section extraction for section suppressed by <includeonly>
11873 !! options
11874 section=1
11875 !! wikitext
11876 <includeonly>
11877 ==Includeonly section==
11878 </includeonly>
11879 ==Section 1==
11880 !! html
11881 ==Section 1==
11882 !! end
11883
11884 !! test
11885 Un-closed <includeonly>
11886 !! wikitext
11887 <includeonly>
11888 !! html/php
11889 !! html/parsoid
11890 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11891 !! end
11892
11893 ## We used to, but no longer wt2wt this test since the default serializer
11894 ## will normalize the include directives to serialize on their own line.
11895 ## Selser will take care of preserving formatting in scenarios where they
11896 ## intermingled with other wikitext.
11897 !! test
11898 Includes and comments at SOL
11899 !! options
11900 parsoid=wt2html,html2html
11901 !! wikitext
11902 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11903
11904 <noinclude>
11905 some
11906 </noinclude>* stuff
11907 * here
11908
11909 <includeonly>can have stuff</includeonly>=== here ===
11910
11911 !! html/php
11912 <h2><span class="mw-headline" id="hu">hu</span></h2>
11913 <p>some
11914 </p>
11915 <ul><li> stuff</li>
11916 <li> here</li></ul>
11917 <h3><span class="mw-headline" id="here">here</span></h3>
11918
11919 !! html/parsoid
11920 <!-- 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>
11921
11922 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11923 <p>some</p>
11924 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11925 <li> here</li></ul>
11926
11927 <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>
11928
11929 !! end
11930
11931 # TODO: test with DOM fragment reuse!
11932 !! test
11933 Parsoid: DOM fragment reuse
11934 !! options
11935 parsoid=wt2wt,wt2html
11936 !! wikitext
11937 a{{echo|b<table></table>c}}d
11938
11939 a{{echo|b
11940 <table></table>
11941 c}}d
11942
11943 {{echo|a
11944
11945 <table></table>
11946
11947 b}}
11948 !! html
11949 <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>
11950
11951 <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">
11952 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11953 </span><p about="#mwt2">cd</p>
11954
11955 <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">
11956
11957 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11958
11959 </span><p about="#mwt3">b</p>
11960 !! end
11961
11962 !! test
11963 Parsoid: Merge double tds (T52603)
11964 !! options
11965 parsoid
11966 !! wikitext
11967 {|
11968 |{{echo|{{!}} foo}}
11969 |}
11970 !! html
11971 <table><tbody>
11972 <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>
11973 </tbody></table>
11974 !! end
11975
11976 !! test
11977 Parsoid: Merge double tds in nested transclusion content (T52603)
11978 !! options
11979 parsoid
11980 !! wikitext
11981 {{echo|<div>}}
11982 {|
11983 |{{echo|{{!}} foo}}
11984 |}
11985 {{echo|</div>}}
11986 !! html
11987 <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}}]}'>
11988 <table><tbody>
11989 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11990 </tbody></table>
11991 </div>
11992 !! end
11993
11994 ###
11995 ### <includeonly> and <noinclude> in attributes
11996 ###
11997 !!test
11998 0. includeonly around the entire attribute
11999 !! wikitext
12000 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12001 !! html
12002 <p><span id="v2">bar</span>
12003 </p>
12004 !!end
12005
12006 !!test
12007 1. includeonly in html attr key
12008 !! wikitext
12009 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12010 !! html
12011 <p><span id="foo">bar</span>
12012 </p>
12013 !!end
12014
12015 !!test
12016 2. includeonly in html attr value
12017 !! wikitext
12018 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12019 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12020 !! html
12021 <p><span id="v1">bar</span>
12022 <span id="v1">bar</span>
12023 </p>
12024 !!end
12025
12026 !!test
12027 3. includeonly in part of an attr value
12028 !! wikitext
12029 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12030 !! html
12031 <p><span style="color:red;">bar</span>
12032 </p>
12033 !!end
12034
12035 !!test
12036 4. includeonly in table attributes
12037 !! wikitext
12038 {|
12039 |- <noinclude>
12040 |-
12041 |a
12042 </noinclude>
12043 |- <includeonly>
12044 |-
12045 |b
12046 </includeonly>
12047 |}
12048 !! html
12049 <table>
12050
12051
12052 <tr>
12053 <td>a
12054 </td></tr>
12055 </table>
12056
12057 !!end
12058
12059 ###
12060 ### Preprocessor precedence tests
12061 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12062 ###
12063 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12064 !! test
12065 Preprocessor precedence 1: link is rightmost opening
12066 !! options
12067 parsoid=wt2html
12068 !! wikitext
12069 {{[[Foo|bar}}]]
12070
12071 But close-brace is not a valid character in a link title:
12072 {{[[Foo}}|bar]]
12073
12074 However, we can still tell this was handled as a link in the preprocessor:
12075 {{echo|[[Foo}}|bar]]|bat}}
12076 !! html/php
12077 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12078 </p><p>But close-brace is not a valid character in a link title:
12079 {{[[Foo}}|bar]]
12080 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12081 [[Foo}}|bar]]
12082 </p>
12083 !! html/parsoid
12084 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12085 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12086 <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>
12087 !! end
12088
12089 !! test
12090 Preprocessor precedence 2: template is rightmost opening
12091 !! options
12092 language=zh
12093 !! wikitext
12094 -{{echo|foo}-}}-
12095 !! html/php
12096 <p>-foo}--
12097 </p>
12098 !! html/parsoid
12099 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12100 !! end
12101
12102 !! test
12103 Preprocessor precedence 3: language converter is rightmost opening
12104 !! options
12105 language=zh
12106 parsoid=wt2html
12107 !! wikitext
12108 {{echo|hi}}
12109
12110 {{-{R|echo|hi}}}-
12111
12112 [[-{R|raw]]}-
12113 !! html/php
12114 <p>hi
12115 </p><p>{{echo|hi}}
12116 </p><p>[[raw]]
12117 </p>
12118 !! html/parsoid
12119 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12120 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12121 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12122 !! end
12123
12124 !! test
12125 Preprocessor precedence 4: left-most angle bracket
12126 !! options
12127 language=zh
12128 !! wikitext
12129 <!--{raw}-->
12130 !! html/php
12131 !! html/parsoid
12132 <!--{raw}-->
12133 !! end
12134
12135 !! article
12136 Template:Precedence5
12137 !! text
12138 {{{{{1}}}}}
12139 !! endarticle
12140
12141 !! test
12142 Preprocessor precedence 5: tplarg takes precedence over template
12143 !! wikitext
12144 {{Precedence5|Bullet}}
12145 !! html/php
12146 <ul><li> Bar</li></ul>
12147
12148 !! html/parsoid
12149 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li> Bar</li></ul>
12150 !! end
12151
12152 !! test
12153 Preprocessor precedence 6: broken link is rightmost opening
12154 !! options
12155 parsoid=wt2html
12156 !! wikitext
12157 {{echo|[[Foo}}
12158
12159 {{echo|[[Foo|bar|bat=baz}}
12160 !! html/php
12161 <p>{{echo|[[Foo}}
12162 </p><p>{{echo|[[Foo|bar|bat=baz}}
12163 </p>
12164 !! html/parsoid
12165 <p>{{echo|[[Foo}}</p>
12166 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12167 !! end
12168
12169 # This next test exposes a difference between PHP and Parsoid:
12170 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12171 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12172 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12173 # outer `[[Foo` extends until the `y]]`
12174 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12175 # intermediate result (after template expansion), and link processing
12176 # happens on this intermediate result, which moves the wikilink
12177 # boundary leftward to `[[Foo|Bar]]`
12178 # 2b) Parsoid works in a single step, so it's going to keep the
12179 # wikilink as extending to the `y]]`
12180 # 3a) Then PHP does linktrail processing which slurps up the trailing
12181 # `xy` inside the link.
12182 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12183 # `z` inside the link.
12184 # This is "correct" behavior. Parsoid's basic worldview is that the
12185 # `]]` inside the template shouldn't be allowed to leak out to affect
12186 # the surrounding wikilink. PHP may match Parsoid (in the future)
12187 # if you use {{#balance}} (T114445).
12188
12189 !! test
12190 Preprocessor precedence 7: broken template is rightmost opening
12191 !! options
12192 parsoid=wt2html
12193 !! wikitext
12194 [[Foo|{{echo|Bar]]
12195
12196 [[Foo|{{echo|Bar]]-x}}-y]]-z
12197
12198 Careful: linktrails can move the end of the wikilink:
12199 [[Foo|{{echo|y']]a}}l]]l
12200 !! html/php
12201 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12202 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12203 </p><p>Careful: linktrails can move the end of the wikilink:
12204 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12205 </p>
12206 !! html/parsoid
12207 <p>[[Foo|{{echo|Bar]]</p>
12208 <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>
12209 <p>Careful: linktrails can move the end of the wikilink:
12210 <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>
12211 !! end
12212
12213 !! test
12214 Preprocessor precedence 8: broken language converter is rightmost opening
12215 !! options
12216 language=zh
12217 !! wikitext
12218 [[Foo-{R|raw]]
12219 !! html
12220 <p>[[Foo-{R|raw]]
12221 </p>
12222 !! end
12223
12224 !! article
12225 Template:Preprocessor_precedence_9
12226 !! text
12227 ;4: {{{{1}}}}
12228 ;5: {{{{{2}}}}}
12229 ;6: {{{{{{3}}}}}}
12230 ;7: {{{{{{{4}}}}}}}
12231 !! endarticle
12232
12233 !! test
12234 Preprocessor precedence 9: groups of braces
12235 !! wikitext
12236 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12237 !! html/php
12238 <dl><dt>4</dt>
12239 <dd> {Four}</dd>
12240 <dt>5</dt>
12241 <dd> </dd></dl>
12242 <ul><li> Bar</li></ul>
12243 <dl><dt>6</dt>
12244 <dd> Four</dd>
12245 <dt>7</dt>
12246 <dd> {Bullet}</dd></dl>
12247
12248 !! html/parsoid
12249 <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}}]}'>
12250 <dt>4</dt>
12251 <dd>{Four}</dd>
12252 <dt>5</dt>
12253 <dd></dd>
12254 </dl><ul about="#mwt1">
12255 <li>Bar</li>
12256 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12257 <dt>6</dt>
12258 <dd>Four</dd>
12259 <dt>7</dt>
12260 <dd>{Bullet}</dd>
12261 </dl>
12262 !! end
12263
12264 !! article
12265 Template:Preprocessor_precedence_10
12266 !! text
12267 ;1: -{R|raw}-
12268 ;2: -{{Bullet}}-
12269 ;3: -{{{1}}}-
12270 ;4: -{{{{2}}}}-
12271 ;5: -{{{{{3}}}}}-
12272 ;6: -{{{{{{4}}}}}}-
12273 ;7: -{{{{{{{5}}}}}}}-
12274 !! endarticle
12275
12276 !! test
12277 Preprocessor precedence 10: groups of braces with leading dash
12278 !! options
12279 language=zh
12280 !! wikitext
12281 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12282 !! html/php
12283 <dl><dt>1</dt>
12284 <dd> raw</dd>
12285 <dt>2</dt>
12286 <dd> -</dd></dl>
12287 <ul><li> Bar-</li></ul>
12288 <dl><dt>3</dt>
12289 <dd> -Three-</dd>
12290 <dt>4</dt>
12291 <dd> raw2</dd>
12292 <dt>5</dt>
12293 <dd> -</dd></dl>
12294 <ul><li> Bar-</li></ul>
12295 <dl><dt>6</dt>
12296 <dd> -Three-</dd>
12297 <dt>7</dt>
12298 <dd> raw2</dd></dl>
12299
12300 !! html/parsoid
12301 <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}}]}'>
12302 <dt>1</dt>
12303 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12304 <dt>2</dt>
12305 <dd>-</dd>
12306 </dl><ul about="#mwt1">
12307 <li>Bar-</li>
12308 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12309 <dt>3</dt>
12310 <dd>-Three-</dd>
12311 <dt>4</dt>
12312 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12313 <dt>5</dt>
12314 <dd>-</dd>
12315 </dl><ul about="#mwt1">
12316 <li>Bar-</li>
12317 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12318 <dt>6</dt>
12319 <dd>-Three-</dd>
12320 <dt>7</dt>
12321 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12322 </dl>
12323 !! end
12324
12325 !! test
12326 Preprocessor precedence 11: found during visual diff testing
12327 !! wikitext
12328 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12329
12330 {{echo|-{{echo|-{{echo|x}}}}}}
12331
12332 {{echo|-{{echo|x}}}}
12333 !! html/php
12334 <p><span>-<span>-x</span></span>
12335 </p><p>--x
12336 </p><p>-x
12337 </p>
12338 !! html/parsoid
12339 <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>
12340
12341 <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>
12342
12343 <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>
12344 !! end
12345
12346 !! test
12347 Preprocessor precedence 12: broken language converter closed by brace.
12348 !! options
12349 parsoid=wt2html
12350 !! wikitext
12351 This form breaks the template, which is unfortunate:
12352 * {{echo|foo-{bar}bat}}
12353
12354 But if the broken language converter markup is inside an extension
12355 tag, nothing bad happens:
12356 * <nowiki>foo-{bar}bat</nowiki>
12357 * {{echo|<nowiki>foo-{bar}bat</nowiki>}}
12358 * <pre>foo-{bar}bat</pre>
12359 * {{echo|<pre>foo-{bar}bat</pre>}}
12360
12361 <tag>foo-{bar}bat</tag>
12362 {{echo|<tag>foo-{bar}bat</tag>}}
12363
12364 !! html/php+tidy
12365 <p>This form breaks the template, which is unfortunate:</p>
12366 <ul>
12367 <li>{{echo|foo-{bar}bat}}</li>
12368 </ul>
12369 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12370 <ul>
12371 <li>foo-{bar}bat</li>
12372 <li>foo-{bar}bat</li>
12373 <li>
12374 <pre>
12375 foo-{bar}bat
12376 </pre></li>
12377 <li>
12378 <pre>
12379 foo-{bar}bat
12380 </pre></li>
12381 </ul>
12382 <pre>
12383 'foo-{bar}bat'
12384 array (
12385 )
12386 </pre>
12387 <pre>
12388 'foo-{bar}bat'
12389 array (
12390 )
12391 </pre>
12392 !! html/parsoid
12393 <p>This form breaks the template, which is unfortunate:</p>
12394 <ul>
12395 <li>{{echo|foo-{bar}bat}}</li>
12396 </ul>
12397 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12398 <ul>
12399 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12400 <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>
12401 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12402 <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>
12403 </ul>
12404 <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>
12405 !! end
12406
12407 !! test
12408 Preprocessor precedence 13: broken language converter in external link
12409 !! options
12410 parsoid=wt2html
12411 !! wikitext
12412 * [http://example.com/-{foo Example in URL]
12413 * [http://example.com Example in -{link} description]
12414 * {{echo|[http://example.com/-{foo Breaks template, however]}}
12415 !! html/php+tidy
12416 <ul>
12417 <li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12418 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12419 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12420 </ul>
12421 !! html/parsoid
12422 <ul>
12423 <li><a rel="mw:ExtLink" href="http://example.com/-{foo">Example in URL</a></li>
12424 <li><a rel="mw:ExtLink" href="http://example.com">Example in -{link} description</a></li>
12425 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12426 </ul>
12427 !! end
12428
12429 !! test
12430 Preprocessor precedence 14: broken language converter in comment
12431 !! wikitext
12432 * <!--{{foo}}--> ...should be ok
12433 * <!---{{foo}}--> ...extra dashes
12434 * {{echo|foo<!-- -{bar} -->bat}} ...should be ok
12435 !! html/php+tidy
12436 <ul>
12437 <li>...should be ok</li>
12438 <li>...extra dashes</li>
12439 <li>foobat ...should be ok</li>
12440 </ul>
12441 !! html/parsoid
12442 <ul>
12443 <li><!--{{foo}}--> ...should be ok</li>
12444 <li><!--&#x2D;{{foo}}--> ...extra dashes</li>
12445 <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>
12446 </ul>
12447 !! end
12448
12449 !! test
12450 Preprocessor precedence 15: broken brace markup in headings
12451 !! options
12452 parsoid=wt2html
12453 !! wikitext
12454 __NOTOC__ __NOEDITSECTION__
12455 ===1 foo[bar 1===
12456 1
12457 ===2 foo[[bar 2===
12458 2
12459 ===3 foo{bar 3===
12460 3
12461 ===4 foo{{bar 4===
12462 4
12463 ===5 foo{{{bar 5===
12464 5
12465 ===6 foo-{bar 6===
12466 6
12467 !! html/php+tidy
12468 <h3><span class="mw-headline" id="1_foo.5Bbar_1">1 foo[bar 1</span></h3>
12469 <p>1</p>
12470 <h3><span class="mw-headline" id="2_foo.5B.5Bbar_2">2 foo[[bar 2</span></h3>
12471 <p>2</p>
12472 <h3><span class="mw-headline" id="3_foo.7Bbar_3">3 foo{bar 3</span></h3>
12473 <p>3</p>
12474 <h3><span class="mw-headline" id="4_foo.7B.7Bbar_4">4 foo{{bar 4</span></h3>
12475 <p>4</p>
12476 <h3><span class="mw-headline" id="5_foo.7B.7B.7Bbar_5">5 foo{{{bar 5</span></h3>
12477 <p>5</p>
12478 <h3><span class="mw-headline" id="6_foo-.7Bbar_6">6 foo-{bar 6</span></h3>
12479 <p>6</p>
12480 !! html/parsoid
12481 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/
12482 >
12483 <h3>1 foo[bar 1</h3>
12484 <p>1</p>
12485 <h3>2 foo[[bar 2</h3>
12486 <p>2</p>
12487 <h3>3 foo{bar 3</h3>
12488 <p>3</p>
12489 <h3>4 foo{{bar 4</h3>
12490 <p>4</p>
12491 <h3>5 foo{{{bar 5</h3>
12492 <p>5</p>
12493 <h3>6 foo-{bar 6</h3>
12494 <p>6</p>
12495 !! end
12496
12497 !! test
12498 Preprocessor precedence 16: matching closing braces to opening braces
12499 !! options
12500 language=zh
12501 parsoid=wt2html
12502 !! wikitext
12503 -{{{echo|foo}}bar}-
12504 !! html/php
12505 <p>foobar
12506 </p>
12507 !! html/parsoid
12508 <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>
12509 !! end
12510
12511 ###
12512 ### Token Stream Patcher tests
12513 ###
12514 ### These tests won't always pass wt2wt and other modes because
12515 ### on serialization, the table will be output on a new line.
12516 ### For now, we are blacklisting them, and using this to test selser.
12517 ###
12518
12519 !!test
12520 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12521 !!options
12522 parsoid=wt2html,wt2wt
12523 !!wikitext
12524 {{echo|}}{| width = '100%'
12525 |foo
12526 |}
12527 !!html/parsoid
12528 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12529 <tbody><tr><td>foo</td></tr>
12530 </tbody></table>
12531 !!end
12532
12533 ## We used to, but no longer wt2wt this test since the default serializer
12534 ## will normalize the include directives to serialize on their own line.
12535 ## Selser will take care of preserving formatting in scenarios where they
12536 ## intermingled with other wikitext.
12537 !!test
12538 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12539 !!options
12540 parsoid=wt2html
12541 !!wikitext
12542 <includeonly>a</includeonly>{| {{{b}}}
12543 |c
12544 |}
12545 !!html/parsoid
12546 <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":""}]]}'>
12547 <tbody><tr><td>c</td></tr>
12548 </tbody></table>
12549 !!end
12550
12551 !! test
12552 Table wikitext syntax outside wiki-tables
12553 !! wikitext
12554 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 !! html
12565 <p>a
12566 |+ not a caption
12567 ! not a table heading
12568 |- not a table row
12569 | not a table cell
12570 | class="foo bar" | baz
12571 b
12572 |}
12573 |-
12574 c
12575 </p>
12576 !! end
12577
12578 ###
12579 ### Testing parsing of templates where a template arg
12580 ### has the same name as the template itself.
12581 ###
12582
12583 !! article
12584 Template:quote
12585 !! text
12586 {{{quote|{{{1}}}}}}
12587 !! endarticle
12588
12589 !!test
12590 Templates: Template Name/Arg clash: 1. Use of positional param
12591 !! wikitext
12592 {{quote|foo}}
12593 !! html
12594 <p>foo
12595 </p>
12596 !!end
12597
12598 !!test
12599 Templates: Template Name/Arg clash: 2. Use of named param
12600 !! wikitext
12601 {{quote|quote=foo}}
12602 !! html
12603 <p>foo
12604 </p>
12605 !!end
12606
12607 !!test
12608 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12609 !! wikitext
12610 {{quote|quote}}
12611 !! html
12612 <p>quote
12613 </p>
12614 !!end
12615
12616 ###
12617 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12618 ###
12619
12620 !!test
12621 Templates: 1. Simple use
12622 !! wikitext
12623 {{echo|Foo}}
12624 !! html
12625 <p>Foo
12626 </p>
12627 !!end
12628
12629 !!test
12630 Templates: 2. Inside a block tag
12631 !! wikitext
12632 <div>{{echo|Foo}}</div>
12633 <blockquote>{{echo|Foo}}</blockquote>
12634 !! html
12635 <div>Foo</div>
12636 <blockquote>Foo</blockquote>
12637
12638 !! html+tidy
12639 <div>Foo</div>
12640 <blockquote>
12641 <p>Foo</p>
12642 </blockquote>
12643 !!end
12644
12645 !!test
12646 Templates: P-wrapping: 1a. Templates on consecutive lines
12647 !! wikitext
12648 {{echo|Foo}}
12649 {{echo|bar}}
12650 !! html
12651 <p>Foo
12652 bar
12653 </p>
12654 !!end
12655
12656 !!test
12657 Templates: P-wrapping: 1b. Templates on consecutive lines
12658 !! wikitext
12659 Foo
12660
12661 {{echo|bar}}
12662 {{echo|baz}}
12663 !! html
12664 <p>Foo
12665 </p><p>bar
12666 baz
12667 </p>
12668 !!end
12669
12670 !!test
12671 Templates: P-wrapping: 1c. Templates on consecutive lines
12672 !! wikitext
12673 {{echo|Foo}}
12674 {{echo|bar}} <div>baz</div>
12675 !! html
12676 <p>Foo
12677 </p>
12678 bar <div>baz</div>
12679
12680 !! html+tidy
12681 <p>Foo</p>
12682 <p>bar</p>
12683 <div>baz</div>
12684 !! end
12685
12686 !!test
12687 Templates: P-wrapping: 1d. Template preceded by comment-only line
12688 !!options
12689 parsoid
12690 !! wikitext
12691 <!-- foo -->
12692 {{echo|Bar}}
12693 !! html
12694 <!-- foo -->
12695
12696 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12697 !!end
12698
12699 !!test
12700 Templates: Inline Text: 1. Multiple template uses
12701 !! wikitext
12702 {{echo|Foo}}bar{{echo|baz}}
12703 !! html
12704 <p>Foobarbaz
12705 </p>
12706 !!end
12707
12708 !!test
12709 Templates: Inline Text: 2. Back-to-back template uses
12710 !! wikitext
12711 {{echo|Foo}}{{echo|bar}}
12712 !! html
12713 <p>Foobar
12714 </p>
12715 !!end
12716
12717 !!test
12718 Templates: Block Tags: 1. Multiple template uses
12719 !! wikitext
12720 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12721 !! html
12722 <div>Foo</div><div>bar</div><div>baz</div>
12723
12724 !!end
12725
12726 !!test
12727 Templates: Block Tags: 2. Back-to-back template uses
12728 !! wikitext
12729 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12730 !! html
12731 <div>Foo</div><div>bar</div>
12732
12733 !!end
12734
12735 # This is an edge case relating to paragraph wrapping.
12736 !!test
12737 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12738 !! wikitext
12739 {{echo|a
12740 b</p>}}
12741 !! html/parsoid
12742 <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
12743 b</p>
12744 !!end
12745
12746 !!test
12747 Templates: Links: 1. Simple example
12748 !! wikitext
12749 {{echo|[[Foo|bar]]}}
12750 !! html
12751 <p><a href="/wiki/Foo" title="Foo">bar</a>
12752 </p>
12753 !!end
12754
12755 !!test
12756 Templates: Links: 2. Generation of link href
12757 !! wikitext
12758 [[{{echo|Foo}}|bar]]
12759 !! html
12760 <p><a href="/wiki/Foo" title="Foo">bar</a>
12761 </p>
12762 !!end
12763
12764 !!test
12765 Templates: Links: 3. Generation of part of a link href
12766 !! wikitext
12767 [[Fo{{echo|o}}|bar]]
12768
12769 [[Foo{{echo|bar}}]]
12770
12771 [[Foo{{echo|bar}}baz]]
12772
12773 [[Foo{{echo|bar}}|bar]]
12774
12775 [[:Foo{{echo|bar}}]]
12776
12777 [[:Foo{{echo|bar}}|bar]]
12778 !! html
12779 <p><a href="/wiki/Foo" title="Foo">bar</a>
12780 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12781 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12782 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12783 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12784 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12785 </p>
12786 !!end
12787
12788 !!test
12789 Templates: Links: 4. Multiple templates generating link href
12790 !! wikitext
12791 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12792 !! html
12793 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12794 </p>
12795 !!end
12796
12797 !!test
12798 Templates: Links: 5. Generation of link text
12799 !! wikitext
12800 [[Foo|{{echo|bar}}]]
12801 !! html
12802 <p><a href="/wiki/Foo" title="Foo">bar</a>
12803 </p>
12804 !!end
12805
12806 !!test
12807 Templates: Links: 5. Nested templates (only outermost template should be marked)
12808 !! wikitext
12809 {{echo|[[{{echo|Foo}}|bar]]}}
12810 !! html
12811 <p><a href="/wiki/Foo" title="Foo">bar</a>
12812 </p>
12813 !!end
12814
12815 !!test
12816 Templates: HTML Tag: 1. Generation of HTML attr. key
12817 !! wikitext
12818 <div {{echo|style}}="color:red;">foo</div>
12819 !! html
12820 <div style="color:red;">foo</div>
12821
12822 !!end
12823
12824 !!test
12825 Templates: HTML Tag: 2. Generation of HTML attr. value
12826 !! wikitext
12827 <div style={{echo|'color:red;'}}>foo</div>
12828 !! html
12829 <div style="color:red;">foo</div>
12830
12831 !!end
12832
12833 !!test
12834 Templates: HTML Tag: 3. Generation of HTML attr key and value
12835 !! wikitext
12836 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12837 !! html
12838 <div style="color:red;">foo</div>
12839
12840 !!end
12841
12842 !!test
12843 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12844 !! wikitext
12845 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12846 !! html
12847 <div title="This is a long title with just one piece templated">foo</div>
12848
12849 !!end
12850
12851 !!test
12852 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12853 !! wikitext
12854 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12855 !! html
12856 <div title="This is a long title with just one piece templated">foo</div>
12857
12858 !!end
12859
12860 !!test
12861 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12862 !! wikitext
12863 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12864 !! html
12865 <div title="This is a long title with just one piece templated">foo</div>
12866
12867 !!end
12868
12869 # SSS FIXME: While it is great we added support for all this,
12870 # do we want to make this part of the spec? Maybe we want to
12871 # deprecate this kind of usage in the future?
12872 !!test
12873 Templates: HTML Tag: 7. Generation of partial attribute key string
12874 !! wikitext
12875 <div st{{echo|yle}}="color:red;">foo</div>
12876 !! html
12877 <div style="color:red;">foo</div>
12878
12879 !!end
12880
12881 !! test
12882 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12883 !! wikitext
12884 <div {{echo|1=id="v1"}}>bar</div>
12885 !! html
12886 <div id="v1">bar</div>
12887
12888 !!end
12889
12890 !! test
12891 Templates: HTML Tag: 9. Multiple template-generated attributes
12892 !! wikitext
12893 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12894 !! html
12895 <div id="v1" title="foo">bar</div>
12896
12897 !!end
12898
12899 !! test
12900 Templates: Support for templates generating attributes and content
12901 !! wikitext
12902 {| {{mixed_attr_content_template}}
12903 |-
12904 |bar
12905 |}
12906 !! html/php
12907 <table style="color:red;" title="T48811">
12908
12909 <tr>
12910 <td>foo
12911 </td></tr>
12912 <tr>
12913 <td>bar
12914 </td></tr></table>
12915
12916 !! html/parsoid
12917 <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|}"]}'>
12918 <tbody><tr>
12919 <td>foo</td></tr>
12920 <tr>
12921 <td>bar</td></tr>
12922 </tbody></table>
12923 !!end
12924
12925 !! test
12926 1. Entities and nowikis inside templated attributes should be handled correctly
12927 !! wikitext
12928 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12929 !! html/php
12930 <div style="background:#f9f9f9;">foo</div>
12931
12932 !! html/parsoid
12933 <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>
12934 !! end
12935
12936 !! test
12937 2. Entities and nowikis inside templated attributes should be handled correctly
12938 !! wikitext
12939 {|
12940 |{{table_attribs_3}}
12941 |}
12942 !! html/php
12943 <table>
12944 <tr>
12945 <td style="background:#f9f9f9;">Foo
12946 </td></tr></table>
12947
12948 !! html/parsoid
12949 <table>
12950 <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>
12951 </tbody></table>
12952 !! end
12953
12954 !! test
12955 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12956 !! wikitext
12957 {{tbl-start}}
12958 |{{table_attribs_3}}
12959 {{tbl-end}}
12960 !! html/php
12961 <table>
12962 <tr>
12963 <td style="background:#f9f9f9;">Foo
12964 </td></tr></table>
12965
12966 !! html/parsoid
12967 <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}}]}'>
12968 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12969 </tbody></table>
12970 !! end
12971
12972 # T107622
12973 !! test
12974 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12975 !! wikitext
12976 {|
12977 | {{table_attribs_6}} hi
12978 |}
12979 !! html/php
12980 <table>
12981 <tr>
12982 <td style="background: red;"> hi
12983 </td></tr></table>
12984
12985 !! html/parsoid
12986 <table>
12987 <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>
12988 </tbody></table>
12989 !! end
12990
12991 !!test
12992 Templates: HTML Tables: 1. Generating start of a HTML table
12993 !! wikitext
12994 {{echo|<table><tr><td>foo</td>}}</tr></table>
12995 !! html
12996 <table><tr><td>foo</td></tr></table>
12997
12998 !!end
12999
13000 !!test
13001 Templates: HTML Tables: 2a. Generating middle of a HTML table
13002 !! wikitext
13003 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13004 !! html
13005 <table><tr><td>foo</td></tr></table>
13006
13007 !!end
13008
13009 !!test
13010 Templates: HTML Tables: 2b. Generating middle of a HTML table
13011 !! wikitext
13012 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13013 !! html
13014 <table><tr><td>foo</td></tr></table>
13015
13016 !!end
13017
13018 !!test
13019 Templates: HTML Tables: 3. Generating end of a HTML table
13020 !! wikitext
13021 <table><tr>{{echo|<td>foo</td></tr></table>}}
13022 !! html
13023 <table><tr><td>foo</td></tr></table>
13024
13025 !!end
13026
13027 !!test
13028 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13029 !! wikitext
13030 {{echo|<table>}}<tr><td>foo</td></tr></table>
13031 !! html
13032 <table><tr><td>foo</td></tr></table>
13033
13034 !!end
13035
13036 !!test
13037 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13038 !! wikitext
13039 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13040 !! html
13041 <table><tr><td>foo</td></tr></table>
13042
13043 !!end
13044
13045 !!test
13046 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13047 !! wikitext
13048 <table><tr>{{echo|<td>}}foo</td></tr></table>
13049 !! html
13050 <table><tr><td>foo</td></tr></table>
13051
13052 !!end
13053
13054 !!test
13055 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13056 !! wikitext
13057 <table><tr><td>foo{{echo|</td>}}</tr></table>
13058 !! html
13059 <table><tr><td>foo</td></tr></table>
13060
13061 !!end
13062
13063 !!test
13064 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13065 !! wikitext
13066 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13067 !! html
13068 <table><tr><td>foo</td></tr></table>
13069
13070 !!end
13071
13072 !!test
13073 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13074 !! wikitext
13075 <table><tr><td>foo</td></tr>{{echo|</table>}}
13076 !! html
13077 <table><tr><td>foo</td></tr></table>
13078
13079 !!end
13080
13081 !!test
13082 Templates: HTML Tables: 5. Proper fostering of categories from inside
13083 !!options
13084 parsoid=wt2html,wt2wt
13085 !! wikitext
13086 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13087 <!--Two categories (T52330)-->
13088 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13089 !! html
13090 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13091 <!--Two categories (T52330)-->
13092 <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>
13093 !!end
13094
13095 !!test
13096 Templates: Wiki Tables: 1a. Fostering of entire template content
13097 !! wikitext
13098 {|
13099 {{echo|a}}
13100 |}
13101 !! html
13102 <table>
13103 a
13104 <tr><td></td></tr></table>
13105
13106 !! html+tidy
13107 <p>a</p>
13108 <table>
13109 <tr>
13110 <td></td>
13111 </tr>
13112 </table>
13113 !! end
13114
13115 !!test
13116 Templates: Wiki Tables: 1b. Fostering of entire template content
13117 !! wikitext
13118 {|
13119 {{echo|<div>}}
13120 foo
13121 {{echo|</div>}}
13122 |}
13123 !! html
13124 <table>
13125 <div>
13126 <p>foo
13127 </p>
13128 </div>
13129 <tr><td></td></tr></table>
13130
13131 !! html+tidy
13132 <div>
13133 <p>foo</p>
13134 </div>
13135 <table>
13136 <tr>
13137 <td></td>
13138 </tr>
13139 </table>
13140 !! end
13141
13142 !!test
13143 Templates: Wiki Tables: 2. Fostering of partial template content
13144 !! wikitext
13145 {|
13146 {{echo|a
13147 <div>b</div>}}
13148 |}
13149 !! html
13150 <table>
13151 a
13152 <div>b</div>
13153 <tr><td></td></tr></table>
13154
13155 !! html+tidy
13156 <p>a</p>
13157 <div>b</div>
13158 <table>
13159 <tr>
13160 <td></td>
13161 </tr>
13162 </table>
13163 !! end
13164
13165 !!test
13166 Templates: Wiki Tables: 3. td-content via multiple templates
13167 !! wikitext
13168 {|
13169 {{echo|{{pipe}}a}}{{echo|b}}
13170 |}
13171 !! html
13172 <table>
13173 <tr>
13174 <td>ab
13175 </td></tr></table>
13176
13177 !!end
13178
13179 !!test
13180 Templates: Wiki Tables: 4. Templated tags, no content
13181 !! wikitext
13182 {{tbl-start}}
13183 {{tbl-end}}
13184 !! html
13185 <table>
13186 <tr><td></td></tr></table>
13187
13188 !!end
13189
13190 !!test
13191 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13192 !! wikitext
13193 {{tbl-start}}
13194 |foo
13195 {{tbl-end}}
13196 !! html
13197 <table>
13198 <tr>
13199 <td>foo
13200 </td></tr></table>
13201
13202 !!end
13203
13204 !!test
13205 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13206 !! wikitext
13207 {{tbl-start}}
13208 {{!}}foo
13209 {{tbl-end}}
13210 !! html
13211 <table>
13212 <tr>
13213 <td>foo
13214 </td></tr></table>
13215
13216 !!end
13217
13218 ## This test case is very specific to Parsoid's internals
13219 ## and is hence only tested for Parsoid's code. Parsoid uses
13220 ## a <meta> marker tag for <ref> tags and they are expanded
13221 ## much later. We are verifying that this <meta> tag usage
13222 ## doesn't prevent foster parenting.
13223 !!test
13224 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13225 !!wikitext
13226 {{PartialTable}}<ref>foo</ref>
13227 |}
13228
13229 <references />
13230 !!html/parsoid
13231 <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">
13232 <tbody>
13233 </tbody></table>
13234
13235 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13236 !!end
13237
13238 !! test
13239 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13240 !! wikitext
13241 {{echo|
13242 {{{!}}
13243 {{!}}-}}
13244 <onlyinclude>
13245 |foo
13246 </onlyinclude>
13247 {{!}}}
13248 !! html/parsoid
13249 <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{{!}}}"]}'>
13250 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13251 <tbody><tr>
13252
13253 <td>foo
13254 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13255 </tbody></table>
13256 !! end
13257
13258 !!test
13259 Templates: Lists: Multi-line list-items via templates
13260 !! wikitext
13261 *{{echo|a {{nonexistent|
13262 unused}}}}
13263 *{{echo|b {{nonexistent|
13264 unused}}}}
13265 !! html
13266 <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>
13267 <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>
13268
13269 !!end
13270
13271 !!test
13272 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13273 !! wikitext
13274 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13275 !! html
13276 <p><i>ab</i>c<i>d</i>e
13277 </p>
13278 !!end
13279
13280 !!test
13281 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13282 (PHP parser generates misnested html)
13283 !! wikitext
13284 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13285 !! html/parsoid
13286 <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>
13287 !!end
13288
13289 !!test
13290 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13291 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13292 !! options
13293 parsoid=wt2html,wt2wt
13294 !! wikitext
13295 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13296 !! html
13297 <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>
13298 <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>
13299 <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>
13300 !!end
13301
13302 !!test
13303 Templates: Ugly nesting: 4. Divs opened/closed across templates
13304 !! wikitext
13305 a<div>b{{echo|c</div>d}}e
13306 !! html
13307 a<div>bc</div>de
13308
13309 !! html+tidy
13310 <p>a</p>
13311 <div>bc</div>
13312 <p>de</p>
13313 !! end
13314
13315 !!test
13316 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
13317 (Parsoid-centric)
13318 !! options
13319 parsoid
13320 !! wikitext
13321 {|
13322 |{{echo|foo</table>}}
13323 |bar
13324 |}
13325 !! html
13326 <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|}"]}'>
13327
13328 <tbody>
13329 <tr>
13330 <td>foo</td></tr></tbody></table><span about="#mwt1">
13331 </span><span about="#mwt1">|bar</span><span about="#mwt1">
13332 |}</span>
13333 !!end
13334
13335 !!test
13336 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
13337 (Parsoid-centric)
13338 !! options
13339 parsoid
13340 !! wikitext
13341 <table>
13342 <tr>
13343 <td>
13344 <table>
13345 <tr>
13346 <td>1. {{echo|foo </table>}}</td>
13347 <td> bar </td>
13348 <td>2. {{echo|baz </table>}}</td>
13349 </tr>
13350 <tr>
13351 <td>abc</td>
13352 </tr>
13353 </table>
13354 </td>
13355 </tr>
13356 <tr>
13357 <td>xyz</td>
13358 </tr>
13359 </table>
13360 !! html
13361 <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>"]}'>
13362 <tbody><tr>
13363 <td>
13364 <table>
13365 <tbody><tr>
13366 <td>1. foo </td></tr></tbody></table></td>
13367 <td> bar </td>
13368 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
13369 </span><span about="#mwt2">
13370 </span><span about="#mwt2">
13371 </span><span about="#mwt2">abc</span><span about="#mwt2">
13372 </span><span about="#mwt2">
13373 </span><span about="#mwt2">
13374 </span><span about="#mwt2">
13375 </span><span about="#mwt2">
13376 </span><span about="#mwt2">
13377 </span><span about="#mwt2">xyz</span><span about="#mwt2">
13378 </span><span about="#mwt2">
13379 </span>
13380 !!end
13381
13382 !! test
13383 Templates: Ugly templates: 3. newline-only template parameter
13384 !! wikitext
13385 foo {{echo|
13386 }}
13387 !! html
13388 <p>foo
13389 </p>
13390 !! end
13391
13392 # This looks like a bug: a single newline triggers p/br for some reason.
13393 !! test
13394 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13395 !! wikitext
13396 {{echo|
13397 }}
13398 !! html
13399 <p><br />
13400 </p>
13401 !! end
13402
13403 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13404 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13405 !! test
13406 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13407 !! wikitext
13408 {{echo|<table>}}
13409 {{echo|<div>foo}}
13410 {{echo|</table>}}
13411 !! html/parsoid
13412 <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
13413 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13414 </table>
13415 !! end
13416
13417 # T66017 -- ugly wikitext with fostered content generates two template ranges
13418 # that are "identical" and generate nesting cycles in the algorithm
13419 !! test
13420 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13421 !! wikitext
13422 {{echo|<table><tr><td><table>}}
13423 {{echo|<div>}}
13424 {{echo|</div>}}
13425 !! html/parsoid
13426 <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"}'>
13427 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13428 </table></td></tr></tbody></table>
13429 !! end
13430
13431 !! test
13432 Templates: Parameters substituted at the top-level
13433 !! wikitext
13434 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13435
13436 {{{foo|bar|baz}}}
13437 !! html/php
13438 <p><i>who</i> me? <b>never!</b>
13439 </p><p>bar
13440 </p>
13441 !! html/parsoid
13442 <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>
13443
13444 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13445 !! end
13446
13447 !! test
13448 Templates: Param with empty arg in the final position
13449 !! wikitext
13450 {{{hi|}}}
13451 !! html/parsoid
13452 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13453 !! end
13454
13455 !!test
13456 Parser Functions: 1. Simple example
13457 !! wikitext
13458 {{uc:foo}}
13459 !! html
13460 <p>FOO
13461 </p>
13462 !!end
13463
13464 !!test
13465 Parser Functions: 2. Nested use (only outermost should be marked up)
13466 !! wikitext
13467 {{uc:{{lc:FOO}}}}
13468 !! html
13469 <p>FOO
13470 </p>
13471 !!end
13472
13473 ###
13474 ### Pre-save transform tests
13475 ###
13476 !! test
13477 pre-save transform: subst:
13478 !! options
13479 pst
13480 !! wikitext
13481 {{subst:test}}
13482 !! html/php
13483 This is a test template
13484 !! end
13485
13486 !! test
13487 pre-save transform: normal template
13488 !! options
13489 pst
13490 !! wikitext
13491 {{test}}
13492 !! html/php
13493 {{test}}
13494 !! end
13495
13496 !! test
13497 pre-save transform: nonexistent template
13498 !! options
13499 pst
13500 !! wikitext
13501 {{thistemplatedoesnotexist}}
13502 !! html/php
13503 {{thistemplatedoesnotexist}}
13504 !! end
13505
13506 !! test
13507 pre-save transform: subst magic variables
13508 !! options
13509 pst
13510 !! wikitext
13511 {{subst:SITENAME}}
13512 !! html/php
13513 MediaWiki
13514 !! end
13515
13516 # This is T2089, which I fixed. -- wtm
13517 !! test
13518 pre-save transform: subst: templates with parameters
13519 !! options
13520 pst
13521 !! wikitext
13522 {{subst:paramtest|param="something else"}}
13523 !! html/php
13524 This is a test template with parameter "something else"
13525 !! end
13526
13527 !! article
13528 Template:nowikitest
13529 !! text
13530 <nowiki>'''not wiki'''</nowiki>
13531 !! endarticle
13532
13533 !! test
13534 pre-save transform: nowiki in subst (T3188)
13535 !! options
13536 pst
13537 !! wikitext
13538 {{subst:nowikitest}}
13539 !! html/php
13540 <nowiki>'''not wiki'''</nowiki>
13541 !! end
13542
13543 !! article
13544 Template:commenttest
13545 !! text
13546 This template has <!-- a comment --> in it.
13547 !! endarticle
13548
13549 !! test
13550 pre-save transform: comment in subst (T3936)
13551 !! options
13552 pst
13553 !! wikitext
13554 {{subst:commenttest}}
13555 !! html/php
13556 This template has <!-- a comment --> in it.
13557 !! end
13558
13559 !! test
13560 pre-save transform: unclosed tag
13561 !! options
13562 pst
13563 !! wikitext
13564 <nowiki>'''not wiki'''
13565 !! html/php
13566 <nowiki>'''not wiki'''
13567 !! end
13568
13569 !! test
13570 pre-save transform: mixed tag case
13571 !! options
13572 pst
13573 !! wikitext
13574 <NOwiki>'''not wiki'''</noWIKI>
13575 !! html/php
13576 <NOwiki>'''not wiki'''</noWIKI>
13577 !! end
13578
13579 !! test
13580 pre-save transform: unclosed comment in <nowiki>
13581 !! options
13582 pst
13583 !! wikitext
13584 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13585 !! html/php
13586 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13587 !!end
13588
13589 # Leading @ in this template definition works around a limitation
13590 # in parsoid's parserTests which otherwise strips the <span> from the
13591 # result (confusing it for a template wrapper)
13592 !! article
13593 Template:dangerous
13594 !!text
13595 @<span onmouseover="alert('crap')">Oh no</span>
13596 !!endarticle
13597
13598 !!test
13599 (confirming safety of fix for subst T3936)
13600 !! wikitext
13601 {{Template:dangerous}}
13602 !! html
13603 <p>@<span>Oh no</span>
13604 </p>
13605 !! end
13606
13607 !! test
13608 pre-save transform: comment containing gallery (T7024)
13609 !! options
13610 pst
13611 !! wikitext
13612 <!-- <gallery>data</gallery> -->
13613 !! html/php
13614 <!-- <gallery>data</gallery> -->
13615 !!end
13616
13617 !! test
13618 pre-save transform: comment containing extension
13619 !! options
13620 pst
13621 !! wikitext
13622 <!-- <tag>data</tag> -->
13623 !! html/php
13624 <!-- <tag>data</tag> -->
13625 !!end
13626
13627 !! test
13628 pre-save transform: comment containing nowiki
13629 !! options
13630 pst
13631 !! wikitext
13632 <!-- <nowiki>data</nowiki> -->
13633 !! html/php
13634 <!-- <nowiki>data</nowiki> -->
13635 !!end
13636
13637 !! test
13638 pre-save transform: <noinclude> in subst (T5298)
13639 !! options
13640 pst
13641 !! wikitext
13642 {{subst:Includes}}
13643 !! html/php
13644 Foobar
13645 !! end
13646
13647 !! test
13648 pre-save transform: <onlyinclude> in subst (T5298)
13649 !! options
13650 pst
13651 !! wikitext
13652 {{subst:Includes2}}
13653 !! html/php
13654 Foo
13655 !! end
13656
13657 !! article
13658 Template:SubstTest
13659 !!text
13660 {{<includeonly>subst:</includeonly>Includes}}
13661 !! endarticle
13662
13663 !! article
13664 Template:SafeSubstTest
13665 !! text
13666 {{<includeonly>safesubst:</includeonly>Includes}}
13667 !! endarticle
13668
13669 !! test
13670 T24297: safesubst: works during PST
13671 !! options
13672 pst
13673 !! wikitext
13674 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13675 !! html/php
13676 FoobarFoobar
13677 !! end
13678
13679 !! test
13680 T24297: safesubst: works during normal parse
13681 !! wikitext
13682 {{SafeSubstTest}}
13683 !! html
13684 <p>Foobar
13685 </p>
13686 !! end
13687
13688 !! test
13689 subst: does not work during normal parse
13690 !! wikitext
13691 {{SubstTest}}
13692 !! html
13693 <p>{{subst:Includes}}
13694 </p>
13695 !! end
13696
13697 !! test
13698 pre-save transform: context links ("pipe trick")
13699 !! options
13700 pst
13701 !! wikitext
13702 [[Article (context)|]]
13703 [[Bar:Article|]]
13704 [[:Bar:Article|]]
13705 [[Bar:Article (context)|]]
13706 [[:Bar:Article (context)|]]
13707 [[|Article]]
13708 [[|Article (context)]]
13709 [[Bar:X (Y) Z|]]
13710 [[:Bar:X (Y) Z|]]
13711 !! html/php
13712 [[Article (context)|Article]]
13713 [[Bar:Article|Article]]
13714 [[:Bar:Article|Article]]
13715 [[Bar:Article (context)|Article]]
13716 [[:Bar:Article (context)|Article]]
13717 [[Article]]
13718 [[Article (context)]]
13719 [[Bar:X (Y) Z|X (Y) Z]]
13720 [[:Bar:X (Y) Z|X (Y) Z]]
13721 !! end
13722
13723 !! test
13724 pre-save transform: context links ("pipe trick") with interwiki prefix
13725 !! options
13726 pst
13727 !! wikitext
13728 [[interwiki:Article|]]
13729 [[:interwiki:Article|]]
13730 [[interwiki:Bar:Article|]]
13731 [[:interwiki:Bar:Article|]]
13732 !! html/php
13733 [[interwiki:Article|Article]]
13734 [[:interwiki:Article|Article]]
13735 [[interwiki:Bar:Article|Bar:Article]]
13736 [[:interwiki:Bar:Article|Bar:Article]]
13737 !! end
13738
13739 !! test
13740 pre-save transform: context links ("pipe trick") with parens in title
13741 !! options
13742 pst title=[[Somearticle (context)]]
13743 !! wikitext
13744 [[|Article]]
13745 !! html/php
13746 [[Article (context)|Article]]
13747 !! end
13748
13749 !! test
13750 pre-save transform: context links ("pipe trick") with comma in title
13751 !! options
13752 pst title=[[Someplace, Somewhere]]
13753 !! wikitext
13754 [[|Otherplace]]
13755 [[Otherplace, Elsewhere|]]
13756 [[Otherplace, Elsewhere, Anywhere|]]
13757 !! html/php
13758 [[Otherplace, Somewhere|Otherplace]]
13759 [[Otherplace, Elsewhere|Otherplace]]
13760 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13761 !! end
13762
13763 !! test
13764 pre-save transform: context links ("pipe trick") with parens and comma
13765 !! options
13766 pst title=[[Someplace (IGNORED), Somewhere]]
13767 !! wikitext
13768 [[|Otherplace]]
13769 [[Otherplace (place), Elsewhere|]]
13770 !! html/php
13771 [[Otherplace, Somewhere|Otherplace]]
13772 [[Otherplace (place), Elsewhere|Otherplace]]
13773 !! end
13774
13775 !! test
13776 pre-save transform: context links ("pipe trick") with comma and parens
13777 !! options
13778 pst title=[[Who, me? (context)]]
13779 !! wikitext
13780 [[|Yes, you.]]
13781 [[Me, Myself, and I (1937 song)|]]
13782 !! html/php
13783 [[Yes, you. (context)|Yes, you.]]
13784 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13785 !! end
13786
13787 !! test
13788 pre-save transform: context links ("pipe trick") with namespace
13789 !! options
13790 pst title=[[Ns:Somearticle]]
13791 !! wikitext
13792 [[|Article]]
13793 !! html/php
13794 [[Ns:Article|Article]]
13795 !! end
13796
13797 !! test
13798 pre-save transform: context links ("pipe trick") with namespace and parens
13799 !! options
13800 pst title=[[Ns:Somearticle (context)]]
13801 !! wikitext
13802 [[|Article]]
13803 !! html/php
13804 [[Ns:Article (context)|Article]]
13805 !! end
13806
13807 !! test
13808 pre-save transform: context links ("pipe trick") with namespace and comma
13809 !! options
13810 pst title=[[Ns:Somearticle, Context, Whatever]]
13811 !! wikitext
13812 [[|Article]]
13813 !! html/php
13814 [[Ns:Article, Context, Whatever|Article]]
13815 !! end
13816
13817 !! test
13818 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13819 !! options
13820 pst title=[[Ns:Somearticle, Context (context)]]
13821 !! wikitext
13822 [[|Article]]
13823 !! html/php
13824 [[Ns:Article (context)|Article]]
13825 !! end
13826
13827 !! test
13828 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13829 !! options
13830 pst title=[[Ns:Somearticle (IGNORED), Context]]
13831 !! wikitext
13832 [[|Article]]
13833 !! html/php
13834 [[Ns:Article, Context|Article]]
13835 !! end
13836
13837 !! test
13838 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13839 !! options
13840 pst
13841 !! wikitext
13842 [[Article(context)|]]
13843 [[Bar:Article(context)|]]
13844 [[:Bar:Article(context)|]]
13845 [[|Article(context)]]
13846 [[Bar:X(Y)Z|]]
13847 [[:Bar:X(Y)Z|]]
13848 !! html/php
13849 [[Article(context)|Article]]
13850 [[Bar:Article(context)|Article]]
13851 [[:Bar:Article(context)|Article]]
13852 [[Article(context)]]
13853 [[Bar:X(Y)Z|X(Y)Z]]
13854 [[:Bar:X(Y)Z|X(Y)Z]]
13855 !! end
13856
13857 !! test
13858 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13859 !! options
13860 pst
13861 !! wikitext
13862 [[Article (context)|]]
13863 [[Bar:Article (context)|]]
13864 [[:Bar:Article (context)|]]
13865 [[|Article (context)]]
13866 [[Bar:X (Y) Z|]]
13867 [[:Bar:X (Y) Z|]]
13868 !! html/php
13869 [[Article (context)|Article]]
13870 [[Bar:Article (context)|Article]]
13871 [[:Bar:Article (context)|Article]]
13872 [[Article (context)]]
13873 [[Bar:X (Y) Z|X (Y) Z]]
13874 [[:Bar:X (Y) Z|X (Y) Z]]
13875 !! end
13876
13877 !! test
13878 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13879 !! options
13880 pst
13881 !! wikitext
13882 [[Article(context)|]]
13883 [[Bar:Article(context)|]]
13884 [[:Bar:Article(context)|]]
13885 [[|Article(context)]]
13886 [[Bar:X(Y)Z|]]
13887 [[:Bar:X(Y)Z|]]
13888 !! html/php
13889 [[Article(context)|Article]]
13890 [[Bar:Article(context)|Article]]
13891 [[:Bar:Article(context)|Article]]
13892 [[Article(context)]]
13893 [[Bar:X(Y)Z|X(Y)Z]]
13894 [[:Bar:X(Y)Z|X(Y)Z]]
13895 !! end
13896
13897 !! test
13898 pre-save transform: context links ("pipe trick") with commas (T23660)
13899 !! options
13900 pst
13901 !! wikitext
13902 [[Article (context), context|]]
13903 [[Article (context),context|]]
13904 [[Bar:Article (context), context|]]
13905 [[Bar:Article (context),context|]]
13906 [[:Bar:Article (context), context|]]
13907 [[:Bar:Article (context),context|]]
13908 !! html/php
13909 [[Article (context), context|Article]]
13910 [[Article (context),context|Article]]
13911 [[Bar:Article (context), context|Article]]
13912 [[Bar:Article (context),context|Article]]
13913 [[:Bar:Article (context), context|Article]]
13914 [[:Bar:Article (context),context|Article]]
13915 !! end
13916
13917 !! test
13918 Parsoid: backwards pipe trick
13919 !! wikitext
13920 [[|'''bar''']]
13921 !! html/php
13922 <p>[[|<b>bar</b>]]
13923 </p>
13924 !! html/parsoid
13925 <p>[[|<b>bar</b>]]</p>
13926 !! end
13927
13928 !! test
13929 pre-save transform: trim trailing empty lines
13930 !! options
13931 pst
13932 !! wikitext
13933 Empty lines are trimmed
13934
13935
13936
13937
13938 !! html/php
13939 Empty lines are trimmed
13940 !! end
13941
13942 !! test
13943 pre-save transform: Signature expansion
13944 !! options
13945 pst
13946 !! wikitext
13947 * ~~~
13948 * ~~~~
13949 * ~~~~~
13950 * <noinclude>~~~</noinclude>
13951 * <includeonly>~~~</includeonly>
13952 * <onlyinclude>~~~</onlyinclude>
13953 !! html/php
13954 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13955 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13956 * 00:02, 1 January 1970 (UTC)
13957 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13958 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13959 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13960 !! end
13961
13962
13963 !! test
13964 ParserOutput flags from signature expansion (T84843)
13965 !! options
13966 pst
13967 showflags
13968 !! wikitext
13969 ~~~~
13970 !! html/php
13971 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13972 flags=user-signature
13973 !! end
13974
13975
13976 !! test
13977 pre-save transform: Signature expansion in nowiki tags (T2093)
13978 !! options
13979 pst disabled
13980 !! wikitext
13981 Shall not expand:
13982
13983 <nowiki>~~~~</nowiki>
13984
13985 <includeonly><nowiki>~~~~</nowiki></includeonly>
13986
13987 <noinclude><nowiki>~~~~</nowiki></noinclude>
13988
13989 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13990
13991 {{subst:Foo}} shall be converted to FOO
13992
13993 As well as inside noinclude/onlyinclude
13994 <noinclude>{{subst:Foo}}</noinclude>
13995 <onlyinclude>{{subst:Foo}}</onlyinclude>
13996
13997 But not inside includeonly
13998 <includeonly>{{subst:Foo}}</includeonly>
13999 !! html/php
14000 Shall not expand:
14001
14002 <nowiki>~~~~</nowiki>
14003
14004 <includeonly><nowiki>~~~~</nowiki></includeonly>
14005
14006 <noinclude><nowiki>~~~~</nowiki></noinclude>
14007
14008 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14009
14010 FOO shall be converted to FOO
14011
14012 As well as inside noinclude/onlyinclude
14013 <noinclude>FOO</noinclude>
14014 <onlyinclude>FOO</onlyinclude>
14015
14016 But not inside includeonly
14017 <includeonly>{{subst:Foo}}</includeonly>
14018 !! end
14019
14020 !! test
14021 Parsoid: Recognize nowiki with trailing space in tags
14022 !! options
14023 parsoid=wt2html
14024 !! wikitext
14025 <nowiki ><div>[[foo]]</nowiki >
14026
14027 a<nowiki / >b
14028
14029 c<nowiki />d
14030
14031 e<nowiki/ >f
14032 !! html
14033 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14034 <p>ab</p>
14035 <p>cd</p>
14036 <p>ef</p>
14037 !! end
14038
14039 !! test
14040 Parsoid: Recognize nowiki with odd capitalization
14041 !! options
14042 parsoid=wt2html
14043 !! wikitext
14044 <noWikI ><div>[[foo]]</Nowiki >
14045 !! html
14046 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14047 !! end
14048
14049
14050 !! test
14051 Parsoid: Escape nowiki with trailing space in tags
14052 !! options
14053 parsoid=html2wt
14054 !! html/parsoid
14055 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14056 <p>a&lt;nowiki /&gt;b</p>
14057 <p>c&lt;nowiki/ &gt;d</p>
14058 !! wikitext
14059 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14060
14061 a&lt;nowiki /&gt;b
14062
14063 c&lt;nowiki/ &gt;d
14064 !! end
14065
14066 !! test
14067 Parsoid: Escape weird noWikI capitalizations
14068 !! options
14069 parsoid=html2wt
14070 !! html/parsoid
14071 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14072 !! wikitext
14073 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14074 !! end
14075
14076 ###
14077 ### Message transform tests
14078 ###
14079 !! test
14080 message transform: magic variables
14081 !! options
14082 msg
14083 !! wikitext
14084 {{SITENAME}}
14085 !! html
14086 MediaWiki
14087 !! end
14088
14089 !! test
14090 message transform: should not transform wiki markup
14091 !! options
14092 msg
14093 !! wikitext
14094 ''test''
14095 !! html
14096 ''test''
14097 !! end
14098
14099 !! test
14100 message transform: <noinclude> in transcluded template (T6926)
14101 !! options
14102 msg
14103 !! wikitext
14104 {{Includes}}
14105 !! html
14106 Foobar
14107 !! end
14108
14109 !! test
14110 message transform: <onlyinclude> in transcluded template (T6926)
14111 !! options
14112 msg
14113 !! wikitext
14114 {{Includes2}}
14115 !! html
14116 Foo
14117 !! end
14118
14119 !! test
14120 {{#special:}} page name, known
14121 !! options
14122 msg
14123 !! wikitext
14124 {{#special:Recentchanges}}
14125 !! html
14126 Special:RecentChanges
14127 !! end
14128
14129 !! test
14130 {{#special:}} page name with subpage, known
14131 !! options
14132 msg
14133 !! wikitext
14134 {{#special:Recentchanges/param}}
14135 !! html
14136 Special:RecentChanges/param
14137 !! end
14138
14139 !! test
14140 {{#special:}} page name, unknown
14141 !! options
14142 msg
14143 !! wikitext
14144 {{#special:foobar nonexistent}}
14145 !! html
14146 Special:Foobar nonexistent
14147 !! end
14148
14149 !! test
14150 {{#speciale:}} page name, known
14151 !! options
14152 msg
14153 !! wikitext
14154 {{#speciale:Recentchanges}}
14155 !! html
14156 Special:RecentChanges
14157 !! end
14158
14159 !! test
14160 {{#speciale:}} page name with subpage, known
14161 !! options
14162 msg
14163 !! wikitext
14164 {{#speciale:Recentchanges/param}}
14165 !! html
14166 Special:RecentChanges/param
14167 !! end
14168
14169 !! test
14170 {{#speciale:}} page name, unknown
14171 !! options
14172 msg
14173 !! wikitext
14174 {{#speciale:foobar nonexistent}}
14175 !! html
14176 Special:Foobar_nonexistent
14177 !! end
14178
14179 ###
14180 ### Images
14181 ###
14182 ### For Parsoid-specific tests, see
14183 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14184
14185 !! test
14186 Simple image
14187 !! options
14188 parsoid=wt2html,wt2wt,html2html
14189 !! wikitext
14190 [[Image:foobar.jpg]]
14191 !! html/php
14192 <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>
14193 </p>
14194 !! html/parsoid
14195 <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>
14196 !! end
14197
14198 !! test
14199 Serialize simple image with figure-inline wrapper
14200 !! options
14201 parsoid=html2wt
14202 !! html/parsoid
14203 <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>
14204 !! wikitext
14205 [[File:Foobar.jpg]]
14206 !! end
14207
14208 !! test
14209 Simple image (using File: namespace, now canonical)
14210 !! wikitext
14211 [[File:Foobar.jpg]]
14212 !! html/php
14213 <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>
14214 </p>
14215 !! html/parsoid
14216 <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>
14217 !! end
14218
14219 !! test
14220 Right-aligned image
14221 !! wikitext
14222 [[File:Foobar.jpg|right]]
14223 !! html/php
14224 <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>
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></figure>
14228 !! end
14229
14230 !! test
14231 Image with caption
14232 !! wikitext
14233 [[File:Foobar.jpg|right|Caption text]]
14234 !! html/php
14235 <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>
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 text</figcaption></figure>
14239 !! end
14240
14241 !! test
14242 Image with caption, T55312 #1
14243 !! wikitext
14244 [[File:Foobar.jpg|right|Caption page stuff]]
14245 !! html/php
14246 <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>
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 stuff</figcaption></figure>
14250 !! end
14251
14252 !! test
14253 Image with caption, T55312 #2
14254 !! wikitext
14255 [[File:Foobar.jpg|right|Caption page=]]
14256 !! html/php
14257 <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>
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=</figcaption></figure>
14261 !! end
14262
14263 !! test
14264 Image with caption, T55312 #3
14265 !! wikitext
14266 [[File:Foobar.jpg|right|Caption page=stuff]]
14267 !! html/php
14268 <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>
14269
14270 !! html/parsoid
14271 <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>
14272 !! end
14273
14274 !! test
14275 Image caption with pipe entity
14276 !! wikitext
14277 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14278 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14279 !! html/php
14280 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one &#x7c; two</div></div></div>
14281 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14282
14283 !! html/parsoid
14284 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14285 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14286 !! end
14287
14288 !! test
14289 Allow empty links in image captions (T62753)
14290 !! options
14291 thumbsize=220
14292 !! wikitext
14293 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14294 [[]]
14295 [[Link2]]
14296 ]]
14297 !! html/php
14298 <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>
14299
14300 !! html/parsoid
14301 <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>
14302 [[]]
14303 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14304 </figcaption></figure>
14305 !! end
14306
14307 !! test
14308 Titles in unlinked images (T23454)
14309 !! wikitext
14310 [[File:Foobar.jpg|link=|stuff]]
14311 !! html/php
14312 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14313 </p>
14314 !! end
14315
14316 !! test
14317 Link with empty target
14318 !! wikitext
14319 [[]]
14320 !! html
14321 <p>[[]]
14322 </p>
14323 !! end
14324
14325 !! test
14326 Image with link trail
14327 !! wikitext
14328 Linktrails should not work for images: [[File:Foobar.jpg]]s
14329 !! html/php
14330 <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
14331 </p>
14332 !! html/parsoid
14333 <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>
14334 !! end
14335
14336 !! test
14337 Image with empty attribute
14338 !! options
14339 parsoid=wt2html,wt2wt,html2html
14340 !! wikitext
14341 [[File:Foobar.jpg|right||Caption text]]
14342 !! html/php
14343 <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>
14344
14345 !! html/parsoid
14346 <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>
14347 !! end
14348
14349 !! test
14350 1. Block image with individual attributes from templates
14351 !! wikitext
14352 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14353 !! html/php
14354 <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>
14355
14356 !! html/parsoid
14357 <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>
14358 !! end
14359
14360 !! test
14361 2. Block Image with individual attributes from templates
14362 !! wikitext
14363 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14364 !! html/php
14365 <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>
14366
14367 !! html/parsoid
14368 <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>
14369 !! end
14370
14371 !! test
14372 3. Inline image with individual attributes from templates
14373 !! wikitext
14374 [[File:Foobar.jpg|{{echo|50px}}]]
14375 !! html/php
14376 <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>
14377 </p>
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14383 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14384 !! test
14385 Image with multiple attributes from the same template
14386 !! wikitext
14387 [[File:Foobar.jpg|{{image_attribs}}]]
14388 !! html/php
14389 <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>
14390
14391 !! html/parsoid
14392 <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>
14393 !! end
14394
14395 !! test
14396 Image with link tails
14397 !! options
14398 thumbsize=220
14399 !! wikitext
14400 123[[File:Foobar.jpg]]456
14401 123[[File:Foobar.jpg|right]]456
14402 123[[File:Foobar.jpg|thumb]]456
14403 !! html/php
14404 <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
14405 </p>
14406 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
14407 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
14408
14409 !! html/php+tidy
14410 <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>
14411 <p>123</p>
14412 <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>
14413 <p>456 123</p>
14414 <div class="thumb tright">
14415 <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>
14416 <div class="thumbcaption">
14417 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
14418 </div>
14419 </div>
14420 </div>
14421 <p>456</p>
14422 !! html/parsoid
14423 <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>
14424 <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>
14425 <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>
14426 !! end
14427
14428 !! test
14429 Image with multiple captions -- only last one is accepted
14430 !! wikitext
14431 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14432 !! html/php
14433 <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>
14434
14435 !! html/parsoid
14436 <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>
14437 !! end
14438
14439 !! test
14440 Image with multiple widths -- use last
14441 !! wikitext
14442 [[File:Foobar.jpg|200px|300px|caption]]
14443 !! html/php
14444 <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>
14445 </p>
14446 !! html/parsoid
14447 <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>
14448 !! end
14449
14450 !! test
14451 Image with multiple alignments -- use first (T50664)
14452 !! options
14453 thumbsize=220
14454 !! wikitext
14455 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14456
14457 [[File:Foobar.jpg|middle|text-top|caption]]
14458 !! html/php
14459 <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>
14460 <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>
14461 </p>
14462 !! html/parsoid
14463 <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>
14464 <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>
14465 !! end
14466
14467 !! test
14468 Image with width attribute at different positions
14469 !! wikitext
14470 [[File:Foobar.jpg|200px|right|Caption]]
14471 [[File:Foobar.jpg|right|200px|Caption]]
14472 [[File:Foobar.jpg|right|Caption|200px]]
14473 !! html/php
14474 <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>
14475 <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>
14476 <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>
14477
14478 !! html/parsoid
14479 <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>
14480 <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>
14481 <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>
14482 !! end
14483
14484 # a sad bit of backward-compatibility
14485 !! test
14486 Image with size specified with pxpx (T15500, T53628)
14487 !! options
14488 parsoid=wt2html,wt2wt,html2html
14489 !! wikitext
14490 [[File:Foobar.jpg|20pxpx]]
14491 [[File:Foobar.jpg|200x20pxpx]]
14492 !! html/php
14493 <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>
14494 <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>
14495 </p>
14496 !! html/parsoid
14497 <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>
14498 !! end
14499
14500 !! test
14501 Image with link parameter, wiki target
14502 !! wikitext
14503 [[File:Foobar.jpg|link=Main Page]]
14504 !! html/php
14505 <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>
14506 </p>
14507 !! html/parsoid
14508 <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>
14509 !! end
14510
14511 # parsoid T51293 (part 1)
14512 !! test
14513 Image with link parameter, URL target
14514 !! wikitext
14515 [[File:Foobar.jpg|link=http://example.com/]]
14516 !! html/php
14517 <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>
14518 </p>
14519 !! html/parsoid
14520 <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>
14521 !! end
14522
14523 # parsoid T51293 (part 2)
14524 !! test
14525 Image with link parameter, protocol-less URL target
14526 !! wikitext
14527 [[File:Foobar.jpg|link=//example.com/]]
14528 !! html/php
14529 <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>
14530 </p>
14531 !! html/parsoid
14532 <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>
14533 !! end
14534
14535 !! test
14536 Escaping non-block captions (T107435)
14537 !! options
14538 parsoid={
14539 "modes": ["wt2wt"],
14540 "changes": [
14541 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14542 ]
14543 }
14544 !! wikitext
14545 [[Image:Foobar.jpg|caption]]
14546 !! wikitext/edited
14547 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14548 !! end
14549
14550 # wgExternalLinkTarget not supported by Parsoid
14551 !! test
14552 Image with link parameter, wgExternalLinkTarget
14553 !! wikitext
14554 [[Image:foobar.jpg|link=http://example.com/]]
14555 !! config
14556 wgExternalLinkTarget='foobar'
14557 !! html/php
14558 <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>
14559 </p>
14560 !! end
14561
14562 !! test
14563 Image with link parameter, wgNoFollowLinks set to false
14564 !! wikitext
14565 [[Image:foobar.jpg|link=http://example.com/]]
14566 !! config
14567 wgNoFollowLinks=false
14568 !! html
14569 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14570 </p>
14571 !! end
14572
14573 !! test
14574 Image with link parameter, wgNoFollowDomainExceptions
14575 !! wikitext
14576 [[Image:foobar.jpg|link=http://example.com/]]
14577 !! config
14578 wgNoFollowDomainExceptions='example.com'
14579 !! html
14580 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14581 </p>
14582 !! end
14583
14584 # wgExternalLinkTarget not supported by Parsoid
14585 !! test
14586 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14587 !! wikitext
14588 [[Image:foobar.jpg|link=http://example.com/|Title]]
14589 !! config
14590 wgExternalLinkTarget='foobar'
14591 !! html/php
14592 <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>
14593 </p>
14594 !! end
14595
14596 !! test
14597 Image with empty link parameter
14598 !! wikitext
14599 [[File:Foobar.jpg|link=]]
14600 !! html/php
14601 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14602 </p>
14603 !! html/parsoid
14604 <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>
14605 !! end
14606
14607 !! test
14608 Image with link parameter (wiki target) and unnamed parameter
14609 !! wikitext
14610 [[File:Foobar.jpg|link=Main_Page|Title]]
14611 !! html/php
14612 <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>
14613 </p>
14614 !! html/parsoid
14615 <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>
14616 !! end
14617
14618 !! test
14619 Image with link parameter (URL target) and unnamed parameter
14620 !! wikitext
14621 [[File:Foobar.jpg|link=http://example.com/|Title]]
14622 !! html/php
14623 <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>
14624 </p>
14625 !! html/parsoid
14626 <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>
14627 !! end
14628
14629 !! test
14630 Thumbnail image with link parameter
14631 !! options
14632 thumbsize=220
14633 parsoid=wt2html,wt2wt,html2html
14634 !! wikitext
14635 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14636 !! html/php
14637 <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>
14638
14639 !! html/parsoid
14640 <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>
14641 !! end
14642
14643 !! test
14644 Manually-specified thumbnail image
14645 !! options
14646 thumbsize=220
14647 !! wikitext
14648 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14649 !! html/php
14650 <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>
14651
14652 !! html/parsoid
14653 <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>
14654 !! end
14655
14656 !! test
14657 Manually-specified thumbnail image with explicit link to wiki page
14658 !! options
14659 thumbsize=220
14660 parsoid=wt2html,wt2wt,html2html
14661 !! wikitext
14662 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14663 !! html/php
14664 <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>
14665
14666 !! html/parsoid
14667 <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>
14668 !! end
14669
14670 !! test
14671 Manually-specified thumbnail image with explicit link to url
14672 !! options
14673 thumbsize=220
14674 parsoid=wt2html,wt2wt,html2html
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14677 !! html/php
14678 <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>
14679
14680 !! html/parsoid
14681 <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>
14682 !! end
14683
14684 !! test
14685 Manually-specified thumbnail image with explicit no link
14686 !! options
14687 thumbsize=220
14688 parsoid=wt2html,wt2wt,html2html
14689 !! wikitext
14690 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14691 !! html/php
14692 <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>
14693
14694 !! html/parsoid
14695 <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>
14696 !! end
14697
14698 !! test
14699 Manually-specified thumbnail image with explicit link and alt text
14700 !! options
14701 thumbsize=220
14702 parsoid=wt2html,wt2wt,html2html
14703 !! wikitext
14704 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14705 !! html/php
14706 <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>
14707
14708 !! html/parsoid
14709 <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>
14710 !! end
14711
14712 !! test
14713 Image with frame and link
14714 !! options
14715 parsoid=wt2html,wt2wt,html2html
14716 !! wikitext
14717 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14718 !! html/php
14719 <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>
14720
14721 !! html/parsoid
14722 <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>
14723 !! end
14724
14725 !! test
14726 Image with frame and link and explicit alt
14727 !! options
14728 parsoid=wt2html,wt2wt,html2html
14729 !! wikitext
14730 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14731 !! html/php
14732 <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>
14733
14734 !! html/parsoid
14735 <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>
14736 !! end
14737
14738 !! test
14739 Image with wiki markup in implicit alt
14740 !! wikitext
14741 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14742
14743 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14744 !! html/php
14745 <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>
14746 </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>
14747 </p>
14748 !! html/parsoid
14749 <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>
14750
14751 <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>
14752 !! end
14753
14754 !! test
14755 Alt image option should handle most kinds of wikitext without barfing
14756 !! wikitext
14757 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14758 !! html/php
14759 <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>
14760
14761 !! html/parsoid
14762 <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>
14763 !! end
14764
14765 ###################
14766 # Conflicting image format options.
14767 # First option specified should 'win'.
14768 # All three cases in each test should be identical.
14769
14770 !! test
14771 Image with 'frameless' first.
14772 !! options
14773 parsoid=wt2html,wt2wt,html2html
14774 !! wikitext
14775 [[File:Foobar.jpg|frameless|caption]]
14776
14777 [[File:Foobar.jpg|frameless|frame|caption]]
14778
14779 [[File:Foobar.jpg|frameless|thumb|caption]]
14780 !! html/php
14781 <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>
14782 </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>
14783 </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>
14784 </p>
14785 !! html/parsoid
14786 <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>
14787 <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>
14788 <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>
14789 !! end
14790
14791 !! test
14792 Image with 'frame' first.
14793 !! options
14794 parsoid=wt2html,wt2wt,html2html
14795 !! wikitext
14796 [[File:Foobar.jpg|frame|caption]]
14797 [[File:Foobar.jpg|frame|frameless|caption]]
14798 [[File:Foobar.jpg|frame|thumb|caption]]
14799 !! html/php
14800 <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>
14801 <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>
14802 <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>
14803
14804 !! html/parsoid
14805 <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>
14806 <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>
14807 <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>
14808 !! end
14809
14810 !! test
14811 Image with 'thumb' first.
14812 !! options
14813 parsoid=wt2html,wt2wt,html2html
14814 !! wikitext
14815 [[File:Foobar.jpg|thumb|caption]]
14816 [[File:Foobar.jpg|thumb|frameless|caption]]
14817 [[File:Foobar.jpg|thumb|frame|caption]]
14818 !! html/php
14819 <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>
14820 <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>
14821 <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>
14822
14823 !! html/parsoid
14824 <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>
14825 <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>
14826 <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>
14827 !! end
14828
14829 ###################
14830 # Image sizing.
14831 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14832 # and https://phabricator.wikimedia.org/T64258
14833 # Foobar has actual size of 1941x220
14834 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14835 # a scalable format.
14836 # 2. Framed images always ignore size options; always render at default size.
14837 # 3. "Unspecified format" and border are the only types which can be
14838 # enlarged.
14839
14840 !! test
14841 Image: unspecified format and border enlarge
14842 !! options
14843 parsoid=wt2html,wt2wt,html2html
14844 !! wikitext
14845 [[File:Foobar.jpg|2000px]]
14846
14847 [[File:Foobar.jpg|border|2000px]]
14848 !! html/php
14849 <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>
14850 </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>
14851 </p>
14852 !! html/parsoid
14853 <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>
14854 <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>
14855 !! end
14856
14857 !! test
14858 Image: "unspecified format" and border reduce
14859 !! options
14860 parsoid=wt2html,wt2wt,html2html
14861 !! wikitext
14862 [[File:Foobar.jpg|1000px]]
14863
14864 [[File:Foobar.jpg|border|1000px]]
14865 !! html/php
14866 <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>
14867 </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>
14868 </p>
14869 !! html/parsoid
14870 <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>
14871 <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>
14872 !! end
14873
14874 !! test
14875 Image: thumbs reduce
14876 !! options
14877 parsoid=wt2html,wt2wt,html2html
14878 !! wikitext
14879 [[File:Foobar.jpg|thumb|50px]]
14880 !! html/php
14881 <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>
14882
14883 !! html/parsoid
14884 <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>
14885 !! end
14886
14887 !! test
14888 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14889 !! options
14890 parsoid=wt2html,wt2wt,html2html
14891 !! wikitext
14892 [[File:Foobar.jpg|thumb|2000px]]
14893
14894 [[File:Foobar.svg|thumb|2000px]]
14895 !! html/php
14896 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
14897 <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>
14898
14899 !! html/parsoid
14900 <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>
14901 <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>
14902 !! end
14903
14904 !! test
14905 Image: frameless can reduce in size
14906 !! options
14907 parsoid=wt2html,wt2wt,html2html
14908 !! wikitext
14909 [[File:Foobar.jpg|frameless|50px]]
14910 !! html/php
14911 <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>
14912 </p>
14913 !! html/parsoid
14914 <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>
14915 !! end
14916
14917 !! test
14918 Image: bitmap frameless can't be enlarged past original size, but vector can
14919 !! options
14920 parsoid=wt2html,wt2wt,html2html
14921 !! wikitext
14922 [[File:Foobar.jpg|frameless|2000px]]
14923
14924 [[File:Foobar.svg|frameless|2000px]]
14925 !! html/php
14926 <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>
14927 </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>
14928 </p>
14929 !! html/parsoid
14930 <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>
14931 <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>
14932 !! end
14933
14934 !! test
14935 Image: framed images are always unscaled.
14936 !! options
14937 parsoid=wt2html,wt2wt,html2html
14938 !! wikitext
14939 [[File:Foobar.jpg|frame]]
14940
14941 [[File:Foobar.jpg|frame|50px]]
14942
14943 [[File:Foobar.jpg|frame|50x50px]]
14944
14945 [[File:Foobar.jpg|frame|2000px]]
14946 !! html/php
14947 <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>
14948 <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>
14949 <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>
14950 <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>
14951
14952 !! html/parsoid
14953 <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>
14954 <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>
14955 <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>
14956 <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>
14957 !! end
14958
14959 ###################
14960
14961 !! test
14962 Link to image page- image page normally doesn't exists, hence edit link
14963 Add test with existing image page
14964 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14965 !! wikitext
14966 [[:Image:test]]
14967 !! html
14968 <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>
14969 </p>
14970 !! end
14971
14972 !! test
14973 T20784 Link to non-existent image page with caption should use caption as link text
14974 !! wikitext
14975 [[:Image:test|caption]]
14976 !! html
14977 <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>
14978 </p>
14979 !! end
14980
14981 !! test
14982 Frameless image caption with a free URL
14983 !! wikitext
14984 [[File:Foobar.jpg|http://example.com]]
14985 !! html/php
14986 <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>
14987 </p>
14988 !! html/parsoid
14989 <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>
14990 !! end
14991
14992 !! test
14993 Thumbnail image caption with a free URL
14994 !! options
14995 thumbsize=220
14996 !! wikitext
14997 [[File:Foobar.jpg|thumb|http://example.com]]
14998 !! html/php
14999 <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>
15000
15001 !! html/parsoid
15002 <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>
15003 !! end
15004
15005 !! test
15006 Thumbnail image caption with a free URL and explicit alt
15007 !! options
15008 thumbsize=220
15009 parsoid=wt2html,wt2wt,html2html
15010 !! wikitext
15011 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15012 !! html/php
15013 <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>
15014
15015 !! html/parsoid
15016 <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>
15017 !! end
15018
15019 !! test
15020 SVG thumbnails with no language set
15021 !! options
15022 !! wikitext
15023 [[File:Foobar.svg|thumb|caption]]
15024 !! html/php
15025 <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>
15026
15027 !! html/parsoid
15028 <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>
15029 !! end
15030
15031 !! test
15032 SVG thumbnails with language de
15033 !! options
15034 parsoid=wt2html,wt2wt,html2html
15035 !! wikitext
15036 [[File:Foobar.svg|thumb|caption|lang=de]]
15037 !! html/php
15038 <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>
15039
15040 !! html/parsoid
15041 <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>
15042 !! end
15043
15044 !! test
15045 SVG thumbnails with invalid language code
15046 !! options
15047 parsoid=wt2html,wt2wt,html2html
15048 !! wikitext
15049 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
15050 !! html/php
15051 <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>
15052
15053 !! html/parsoid
15054 <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>
15055 !! end
15056
15057 !! test
15058 T3887: A ISBN with a thumbnail
15059 !! wikitext
15060 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15061 !! html/php
15062 <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>
15063
15064 !! html/parsoid
15065 <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>
15066 !! end
15067
15068 !! test
15069 T3887: A RFC with a thumbnail
15070 !! wikitext
15071 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15072 !! html/php
15073 <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>
15074
15075 !! html/parsoid
15076 <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>
15077 !! end
15078
15079 !! test
15080 T3887: A mailto link with a thumbnail
15081 !! wikitext
15082 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15083 !! html/php
15084 <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>
15085
15086 !! html/parsoid
15087 <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>
15088 !! end
15089
15090 # Pending resolution to T2368
15091 !! test
15092 T2648: Frameless image caption with a link
15093 !! wikitext
15094 [[File:Foobar.jpg|text with a [[link]] in it]]
15095 !! html/php
15096 <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>
15097 </p>
15098 !! html/parsoid
15099 <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>
15100 !! end
15101
15102 !! test
15103 T2648: Frameless image caption with a link (suffix)
15104 !! wikitext
15105 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15106 !! html/php
15107 <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>
15108 </p>
15109 !! html/parsoid
15110 <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>
15111 !! end
15112
15113 !! test
15114 T2648: Frameless image caption with an interwiki link
15115 !! wikitext
15116 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15117 !! html/php
15118 <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>
15119 </p>
15120 !! html/parsoid
15121 <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>
15122 !! end
15123
15124 !! test
15125 T2648: Frameless image caption with a piped interwiki link
15126 !! wikitext
15127 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15128 !! html/php
15129 <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>
15130 </p>
15131 !! html/parsoid
15132 <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>
15133 !! end
15134
15135 !! test
15136 T107474: Frameless image caption with <nowiki>
15137 !! wikitext
15138 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15139 !! html/parsoid
15140 <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>
15141 !! end
15142
15143 !! test
15144 Escape HTML special chars in image alt text
15145 !! wikitext
15146 [[File:Foobar.jpg|& < > "]]
15147 !! html/php
15148 <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>
15149 </p>
15150 !! html/parsoid
15151 <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>
15152 !! end
15153
15154 !! test
15155 Escape HTML special chars in image alt text with LanguageConverter
15156 !! options
15157 language=zh
15158 !! wikitext
15159 [[File:Foobar.jpg|& < > "]]
15160 !! html/php
15161 <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>
15162 </p>
15163 !! html/parsoid
15164 <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>
15165 !! end
15166
15167 !! test
15168 Entities in file name and attributes
15169 !! wikitext
15170 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15171 !! html/php
15172 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15173 </p>
15174 !! html/parsoid
15175 <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>
15176 !! end
15177
15178 !! test
15179 T2499: Alt text should have &#1234;, not &amp;1234;
15180 !! wikitext
15181 [[File:Foobar.jpg|&#9792;]]
15182 !! html/php
15183 <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>
15184 </p>
15185 !! html/parsoid
15186 <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>
15187 !! end
15188
15189 !! test
15190 Broken image caption with link
15191 !! options
15192 parsoid=wt2html,wt2wt,html2html
15193 !! wikitext
15194 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15195 !! html/php
15196 <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.
15197 </p>
15198 !! html/parsoid
15199 <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>
15200 !! end
15201
15202 !! test
15203 Image caption containing another image
15204 !! wikitext
15205 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15206 !! html/php
15207 <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>
15208
15209 !! html/parsoid
15210 <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>
15211 !! end
15212
15213 !! test
15214 Image: caption containing a newline
15215 !! wikitext
15216 [[File:Foobar.jpg|This
15217 *is some text]]
15218 !! html/php
15219 <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>
15220 </p>
15221 !! html/parsoid
15222 <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>
15223 !!end
15224
15225 !!test
15226 Image: caption containing leading space
15227 (The leading space should not trigger nowiki escaping in wt2wt mode)
15228 !! wikitext
15229 [[File:Foobar.jpg|thumb| bar]]
15230 !! html/php
15231 <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>
15232
15233 !! html/parsoid
15234 <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>
15235 !!end
15236
15237 !! test
15238 Image: caption containing a table
15239 !! options
15240 parsoid=wt2html,wt2wt,html2html
15241 !! wikitext
15242 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15243 {|
15244 ! Foo !! Bar
15245 |-
15246 | Foo1 || Bar1
15247 |}
15248 and some more text.]]
15249 !! html/php
15250 <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>
15251
15252 !! html/parsoid
15253 <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
15254 <table>
15255 <tbody>
15256 <tr><th>Foo </th><th>Bar</th></tr>
15257 <tr>
15258 <td>Foo1 </td>
15259 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15260 !! end
15261
15262 !! test
15263 T5090: External links other than http: in image captions
15264 !! wikitext
15265 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15266 !! html/php
15267 <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>
15268
15269 !! html/parsoid
15270 <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>
15271 !! end
15272
15273 !! test
15274 Custom class
15275 !! options
15276 parsoid=wt2html,wt2wt,html2html
15277 !! wikitext
15278 [[Image:foobar.jpg|a|class=b]]
15279 !! html/php
15280 <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>
15281 </p>
15282 !! html/parsoid
15283 <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>
15284 !! end
15285
15286 !! test
15287 Localized image handling (1).
15288 !! options
15289 parsoid=wt2html,wt2wt,html2html
15290 language=es
15291 !! wikitext
15292 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15293 !! html/php
15294 <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>
15295
15296 !! html/parsoid
15297 <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>
15298 !! end
15299
15300 !! test
15301 Localized image handling (2).
15302 !! options
15303 thumbsize=220
15304 parsoid=wt2html,wt2wt,html2html
15305 language=es
15306 !! wikitext
15307 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15308 !! html/php
15309 <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>
15310
15311 !! html/parsoid
15312 <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>
15313 !! end
15314
15315 !! test
15316 Localized image handling (3).
15317 !! options
15318 language=fa
15319 parsoid=html2wt
15320 !! html/parsoid
15321 <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>
15322 !! wikitext
15323 [[File:Foobar.jpg|بندانگشتی]]
15324 !! end
15325
15326 !! test
15327 "border", "frameless" and "class" attributes on an image.
15328 !! options
15329 thumbsize=220
15330 parsoid=wt2html,wt2wt,html2html
15331 !! wikitext
15332 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15333 !! html/php
15334 <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>
15335 </p>
15336 !! html/parsoid
15337 <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>
15338 !! end
15339
15340 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15341 !! test
15342 Invalid image attributes (T64500)
15343 !! options
15344 thumbsize=220
15345 parsoid=wt2html,wt2wt,html2html
15346 !! wikitext
15347 [[File:Foobar.jpg|thumb|float|left|caption]]
15348
15349 [[File:Foobar.jpg|thumb|righ|caption]]
15350
15351 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15352 !! html/php
15353 <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>
15354 <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>
15355 <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>
15356
15357 !! html/parsoid
15358 <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>
15359 <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>
15360 <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>
15361 !! end
15362
15363 !! article
15364 File:Barfoo.jpg
15365 !! text
15366 #REDIRECT [[File:Barfoo.jpg]]
15367 !! endarticle
15368
15369 # FIXME: Parsoid should run this test -- but we'd need to teach the
15370 # mockAPI about the redirected Barfoo.jpg image.
15371 !! test
15372 Redirected image
15373 !! wikitext
15374 [[Image:Barfoo.jpg]]
15375 !! html/php
15376 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15377 </p>
15378 !! end
15379
15380 !! test
15381 Missing image with uploads disabled
15382 !! options
15383 wgEnableUploads=0
15384 !! wikitext
15385 [[File:Foobaz.jpg]]
15386 !! html/php
15387 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15388 </p>
15389 !! html/parsoid
15390 <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>
15391 !! end
15392
15393 # Parsoid-specific testing for images
15394 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15395 # Currently imperfect due to a flaw in the Parsoid testrunner
15396 # Work in progress
15397 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15398 # image tests.
15399
15400 !! test
15401 Parsoid-specific image handling - simple image with size and middle alignment
15402 !! wikitext
15403 [[File:Foobar.jpg|middle|50px]]
15404 !! html/parsoid
15405 <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>
15406 !! end
15407
15408 !! test
15409 Parsoid-specific image handling - simple image with size, middle alignment,
15410 non-standard namespace alias
15411 !! options
15412 parsoid=wt2wt,wt2html,html2html
15413 !! wikitext
15414 [[Image:Foobar.jpg|middle|50px]]
15415 !! html/parsoid
15416 <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>
15417 !! end
15418
15419 !! test
15420 Parsoid-specific image handling - simple image with size and middle alignment
15421 (existing content)
15422 !! wikitext
15423 [[File:Foobar.jpg|50px|middle]]
15424 !! html/parsoid
15425 <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>
15426 !! end
15427
15428 !! test
15429 Parsoid-specific image handling - simple image with size and middle alignment
15430 and non-standard namespace name
15431 !! options
15432 parsoid=wt2html,wt2wt,html2html
15433 !! wikitext
15434 [[Image:Foobar.jpg|50px|middle]]
15435 !! html/parsoid
15436 <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>
15437 !! end
15438
15439 !! test
15440 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15441 !! wikitext
15442 [[File:Foobar.jpg|500x10px|baseline|caption]]
15443 !! html/parsoid
15444 <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>
15445 !! end
15446
15447 !! test
15448 Parsoid-specific image handling - simple image with border and size spec
15449 !! wikitext
15450 [[File:Foobar.jpg|50px|border|caption]]
15451 !! html/parsoid
15452 <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>
15453 !! end
15454
15455 !! test
15456 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15457 !! wikitext
15458 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15459 !! html/parsoid
15460 <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>
15461 !! end
15462
15463 !! test
15464 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15465 (existing content)
15466 !! wikitext
15467 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15468 !! html/parsoid
15469 <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>
15470 !! end
15471
15472 !! test
15473 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15474 !! wikitext
15475 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15476 !! html/parsoid
15477 <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>
15478 !! end
15479
15480 !! test
15481 Parsoid-specific image handling - thumbnail with specific size, halign,
15482 valign, and caption (existing content)
15483 !! wikitext
15484 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15485 !! html/parsoid
15486 <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>
15487 !! end
15488
15489 !! test
15490 Parsoid-specific image handling - framed image with specific size and caption
15491 (size is ignored)
15492 !! options
15493 parsoid=wt2html,wt2wt,html2html
15494 !! wikitext
15495 [[File:Foobar.jpg|frame|500x50px|caption]]
15496 !! html/parsoid
15497 <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>
15498 !! end
15499
15500 !! test
15501 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15502 (size is ignored)
15503 !! options
15504 parsoid=wt2html,wt2wt,html2html
15505 !! wikitext
15506 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15507 !! html/parsoid
15508 <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>
15509 !! end
15510
15511 !! test
15512 Parsoid-specific image handling - frameless image with specific size, border, and caption
15513 !! wikitext
15514 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15515 !! html/parsoid
15516 <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>
15517 !! end
15518
15519 !! test
15520 Parsoid-specific image handling - simple image with a formatted caption
15521 !! wikitext
15522 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15523 !! html/parsoid
15524 <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>
15525 !! end
15526
15527 !! test
15528 Parsoid-specific image handling - caption with a template in it
15529 !! wikitext
15530 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15531 !! html/parsoid
15532 <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>
15533 !! end
15534
15535 !! test
15536 Parsoid-specific image handling - caption with unbalanced tags in it
15537 !! options
15538 parsoid=wt2html,wt2wt,html2html
15539 !! wikitext
15540 foo
15541 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15542 bar
15543 !! html/parsoid
15544 <p>foo</p>
15545 <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>
15546 <p>bar</p>
15547 !! end
15548
15549 !! test
15550 Parsoid-specific image handling - empty caption (1)
15551 !! options
15552 parsoid=wt2html,wt2wt
15553 !! wikitext
15554 [[File:Foobar.jpg|thumb|]]
15555 !! html/parsoid
15556 <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>
15557 !! end
15558
15559 # empty captions don't get serialized unless we're in the "round trip" case
15560 !! test
15561 Parsoid-specific image handling - empty caption (2)
15562 !! options
15563 parsoid=html2wt
15564 !! html/parsoid
15565 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15566 <a href="./File:Foobar.jpg">
15567 <img resource="./File:Foobar.jpg"
15568 src="//example.com/images/3/3a/Foobar.jpg"
15569 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15570 height="25" width="220"/>
15571 </a>
15572 <figcaption></figcaption>
15573 </figure>
15574 !! wikitext
15575 [[File:Foobar.jpg|thumb]]
15576 !! end
15577
15578 !! test
15579 Parsoid-specific image handling - whitespace caption
15580 !! wikitext
15581 [[File:Foobar.jpg|thumb| ]]
15582 !! html/parsoid
15583 <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>
15584 !! end
15585
15586 !! test
15587 Parsoid-specific image handling - lang option
15588 !! wikitext
15589 foo
15590 [[File:Foobar.svg|lang=de|caption]]
15591 bar
15592 !! html/parsoid
15593 <p>foo
15594 <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>
15595 bar</p>
15596 !! end
15597
15598 ## Edge case bugs in Parsoid from T93580
15599 !! test
15600 T93580: 1. Templated <ref> inside block images
15601 !! wikitext
15602 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15603
15604 <references />
15605 !! html/parsoid
15606 <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>
15607
15608 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15609 !! end
15610
15611 !! test
15612 T93580: 2. <ref> inside inline images
15613 !! wikitext
15614 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15615
15616 <references />
15617 !! html/parsoid
15618 <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>
15619
15620 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15621 !! end
15622
15623 !! test
15624 T93580: 3. Templated <ref> inside inline images
15625 !! wikitext
15626 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15627
15628 <references />
15629 !! html/parsoid
15630 <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>
15631
15632 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15633 !! end
15634
15635 ###
15636 ### Subpages
15637 ###
15638 !! article
15639 Subpage test/subpage
15640 !! text
15641 foo
15642 !! endarticle
15643
15644 !! test
15645 Subpage link
15646 !! options
15647 subpage title=[[Subpage test]]
15648 !! wikitext
15649 [[/subpage]]
15650 !! html
15651 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15652 </p>
15653 !! end
15654
15655 !! test
15656 Subpage noslash link
15657 !! options
15658 subpage title=[[Subpage test]]
15659 !! wikitext
15660 [[/subpage/]]
15661 !! html
15662 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15663 </p>
15664 !! end
15665
15666 !! article
15667 Subpage test/1/2/subpage
15668 !! text
15669 blah
15670 !! endarticle
15671
15672 !! test
15673 Relative subpage noslash link
15674 !! options
15675 parsoid=wt2wt,wt2html,html2html
15676 subpage title=[[Subpage test/1/2/3/4]]
15677 !! wikitext
15678 [[../../subpage/]]
15679
15680 [[../../subpage]]
15681 !! html/php
15682 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15683 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15684 </p>
15685 !! html/parsoid
15686 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15687 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15688 !! end
15689
15690 !! test
15691 Parsoid: dot-slash prefixed wikilinks
15692 !! wikitext
15693 [[./foo]]
15694
15695 [[././bar]]
15696
15697 [[././baz/]]
15698 !! html/php
15699 <p>[[./foo]]
15700 </p><p>[[././bar]]
15701 </p><p>[[././baz/]]
15702 </p>
15703 !! html/parsoid
15704 <p>[[./foo]]
15705 </p><p>[[././bar]]
15706 </p><p>[[././baz/]]
15707 </p>
15708 !! end
15709
15710 !! test
15711 Render invalid page names as plain text (T53090)
15712 !! wikitext
15713 [[./../foo|bar]]
15714 [[foo�|bar]]
15715 [[foo/.|bar]]
15716 [[foo/..|bar]]
15717 [[foo~~~bar]]
15718 [[foo>bar]]
15719 [[foo[bar]]
15720 [[.]]
15721 [[..]]
15722 [[foo././bar]]
15723 [[foo[http://example.com]xyz]]
15724
15725 [[{{echo|./../foo}}|bar]]
15726 [[{{echo|foo/.}}|bar]]
15727 [[{{echo|foo/..}}|bar]]
15728 [[{{echo|foo~~~~bar}}]]
15729 [[{{echo|foo>bar}}]]
15730 [[{{echo|foo././bar}}]]
15731 [[{{echo|foo{bar}}]]
15732 [[{{echo|foo}bar}}]]
15733 [[{{echo|foo[bar}}]]
15734 [[{{echo|foo]bar}}]]
15735 [[{{echo|foo<bar}}]]
15736 !!html/php
15737 <p>[[./../foo|bar]]
15738 [[foo�|bar]]
15739 [[foo/.|bar]]
15740 [[foo/..|bar]]
15741 [[foo~~~bar]]
15742 [[foo&gt;bar]]
15743 [[foo[bar]]
15744 [[.]]
15745 [[..]]
15746 [[foo././bar]]
15747 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15748 </p><p>[[./../foo|bar]]
15749 [[foo/.|bar]]
15750 [[foo/..|bar]]
15751 [[foo~~~~bar]]
15752 [[foo&gt;bar]]
15753 [[foo././bar]]
15754 [[foo{bar]]
15755 [[foo}bar]]
15756 [[foo[bar]]
15757 [[foo]bar]]
15758 [[foo&lt;bar]]
15759 </p>
15760 !!html/parsoid
15761 <p>[[./../foo|bar]]
15762 [[foo�|bar]]
15763 [[foo/.|bar]]
15764 [[foo/..|bar]]
15765 [[foo~~~bar]]
15766 [[foo>bar]]
15767 [[foo[bar]]
15768 [[.]]
15769 [[..]]
15770 [[foo././bar]]
15771 [[foo<a rel="mw:ExtLink" href="http://example.com"></a>xyz]]</p>
15772
15773 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15774 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15775 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15776 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15777 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15778 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15779 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15780 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15781 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15782 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15783 [[<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>
15784 !!end
15785
15786 !! test
15787 Disabled subpages
15788 !! wikitext
15789 [[/subpage]]
15790 !! html
15791 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15792 </p>
15793 !! end
15794
15795 !! test
15796 T2561: {{/Subpage}}
15797 !! options
15798 subpage title=[[Page]]
15799 !! wikitext
15800 {{/Subpage}}
15801 !! html
15802 <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>
15803 </p>
15804 !! end
15805
15806 ###
15807 ### Categories
15808 ###
15809 !! article
15810 Category:MediaWiki User's Guide
15811 !! text
15812 blah
15813 !! endarticle
15814
15815 !! test
15816 Link to category
15817 !! wikitext
15818 [[:Category:MediaWiki User's Guide]]
15819 !! html
15820 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
15821 </p>
15822 !! end
15823
15824 !! test
15825 Simple category
15826 !! options
15827 cat
15828 !! wikitext
15829 [[Category:MediaWiki User's Guide]]
15830 !! html/php
15831 cat=MediaWiki_User's_Guide sort=
15832 !! html/parsoid
15833 <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"}}'/>
15834 !! end
15835
15836 !! test
15837 PAGESINCATEGORY invalid title fatal (r33546 fix)
15838 !! wikitext
15839 {{PAGESINCATEGORY:<bogus>}}
15840 !! html
15841 <p>0
15842 </p>
15843 !! end
15844
15845 !! test
15846 Category with different sort key
15847 !! options
15848 cat
15849 !! wikitext
15850 [[Category:MediaWiki User's Guide|Foo]]
15851 !! html/php
15852 cat=MediaWiki_User's_Guide sort=Foo
15853 !! html/parsoid
15854 <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"}}'/>
15855 !! end
15856
15857 !! test
15858 Category with identical sort key
15859 !! options
15860 cat
15861 !! wikitext
15862 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15863 !! html/php
15864 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15865 !! html/parsoid
15866 <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"}}'/>
15867 !! end
15868
15869 !! test
15870 Category with empty sort key
15871 !! options
15872 cat
15873 pst
15874 !! wikitext
15875 [[Category:MediaWiki User's Guide|]]
15876 !! html/php
15877 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15878 !! end
15879
15880 !! test
15881 Category with empty sort key and parentheses
15882 !! options
15883 cat
15884 pst
15885 !! wikitext
15886 [[Category:Foo (bar)|]]
15887 !! html/php
15888 [[Category:Foo (bar)|Foo]]
15889 !! end
15890
15891 !! test
15892 Category with link tail
15893 !! options
15894 cat
15895 pst
15896 !! wikitext
15897 123[[Category:Foo]]456
15898 !! html/php
15899 123[[Category:Foo]]456
15900 !! end
15901
15902 !! test
15903 Category with template
15904 !! options
15905 cat
15906 pst
15907 !! wikitext
15908 [[Category:{{echo|Foo}}]]
15909 !! html/php
15910 [[Category:{{echo|Foo}}]]
15911 !! end
15912
15913 !! test
15914 Category with template in sort key
15915 !! options
15916 cat
15917 pst
15918 !! wikitext
15919 [[Category:Foo|{{echo|Bar}}]]
15920 !! html/php
15921 [[Category:Foo|{{echo|Bar}}]]
15922 !! end
15923
15924 !! test
15925 Category with template in sort key and title
15926 !! options
15927 cat
15928 pst
15929 !! wikitext
15930 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15931 !! html/php
15932 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15933 !! end
15934
15935 ## We used to, but no longer wt2wt this test since the default serializer
15936 ## will normalize all categories to serialize on their own line.
15937 ## This wikitext usage is going to be fairly uncommon in production and
15938 ## selser will take care of preserving formatting in those scenarios.
15939 !! test
15940 Category / paragraph interactions
15941 !! options
15942 parsoid=wt2html
15943 !! wikitext
15944 Foo [[Category:Baz]] Bar
15945
15946 Foo [[Category:Baz]]
15947 Bar
15948
15949 Foo
15950 [[Category:Baz]]
15951 Bar
15952
15953 Foo
15954 [[Category:Baz]] Bar
15955
15956 Foo
15957 [[Category:Baz]]
15958 [[Category:Baz]]
15959 [[Category:Baz]]
15960 Bar
15961
15962 [[Category:Baz]]
15963 [[Category:Baz]]
15964 [[Category:Baz]]
15965
15966 [[Category:Baz]]
15967 {{echo|[[Category:Baz]]}}
15968 [[Category:Baz]]
15969 !! html/php
15970 <p>Foo Bar
15971 </p><p>Foo
15972 Bar
15973 </p><p>Foo
15974 Bar
15975 </p><p>Foo Bar
15976 </p><p>Foo
15977 Bar
15978 </p>
15979 !! html/parsoid
15980 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15981 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15982 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15983 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15984 <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>
15985 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15986 !! end
15987
15988 ## We used to, but no longer wt2wt this test since the default serializer
15989 ## will normalize all categories to serialize on their own line.
15990 ## This wikitext usage is going to be fairly uncommon in production and
15991 ## selser will take care of preserving formatting in those scenarios.
15992 ##
15993 ## The whitespace on the empty line is part of the test. Please do not delete
15994 !! test
15995 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15996 !! options
15997 parsoid=wt2html
15998 !! wikitext
15999 This
16000
16001 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16002
16003 {{echo|[[Category:Foo]] and so should this!}}
16004 !! html/php
16005 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16006 </p>
16007 !! html/parsoid
16008 <p>This
16009
16010 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16011
16012 <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>
16013 !! end
16014
16015 ## Parsoid will not try to wt2wt this while preserving newlines because
16016 ## it suppresses excess newlines within list items -- and we don't want to
16017 ## introduce a special case just for categories, which is, in reality somewhat
16018 ## odd behavior -- categories are unlikely to be used in list items like this
16019 ## in top-level pages and are only likely to show up in template-generated
16020 ## list items where this RT-ing is a non-issue.
16021 ##
16022 ## The whitespace on the empty line is part of the test. Please do not delete
16023 !! test
16024 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16025 !! options
16026 parsoid=wt2html
16027 !! wikitext
16028 * This
16029
16030 [[Category:Foo]] and this should be part of the same list item
16031 * So should this
16032
16033 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16034 !! html
16035 <ul><li>This and this should be part of the same list item</li>
16036 <li>So should this and this should be part of the same list item</li></ul>
16037 !! html/parsoid
16038 <ul>
16039 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16040 <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>
16041 </ul>
16042 !! end
16043
16044 ## Newlines and categories that follow the last item of a list
16045 ## are treated differently because this (list followed by categories)
16046 ## is an extremely common pattern on wikis.
16047 !! test
16048 3. Categories and newlines: newline suppression for last list item should RT properly
16049 !! wikitext
16050 * a
16051 * b
16052
16053 [[Category:Foo]]
16054
16055 [[Category:Bar]]
16056 [[Category:Baz]]
16057 !! html/parsoid
16058 <ul><li> a</li>
16059 <li> b</li></ul>
16060
16061 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16062
16063 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16064 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16065 !! end
16066
16067 !! test
16068 4. Categories and newlines: newline suppression for last list item should RT properly
16069 !! wikitext
16070 * a
16071 **** b
16072
16073 [[Category:Foo]]
16074 !! html/parsoid
16075 <ul><li> a
16076 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16077
16078 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16079 !! end
16080
16081 ## only wt2html for this to make sure the algo only applies to the rightmost path
16082 !! test
16083 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16084 !! options
16085 parsoid=wt2html
16086 !! wikitext
16087 * a
16088 ** b
16089 [[Category:Foo]]
16090 * c
16091 ** d
16092 [[Category:Foo]]
16093 !! html/parsoid
16094 <ul><li> a
16095 <ul><li> b
16096 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16097 <li> c
16098 <ul><li> d</li></ul></li></ul>
16099 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16100 !! end
16101
16102 ## We used to, but no longer wt2wt this test since the default serializer
16103 ## will normalize all categories to serialize on their own line.
16104 ## This wikitext usage is going to be fairly uncommon in production and
16105 ## selser will take care of preserving formatting in those scenarios.
16106 !! test
16107 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16108 !! options
16109 parsoid=wt2html
16110 !! wikitext
16111 * a [[Category:Foo]]
16112 !! html/parsoid
16113 <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>
16114 !! end
16115
16116 # This test also demonstrates because of newline+category tunneling
16117 # through the list hander, template wrapping doesn't expand to the
16118 # containing list when the list item swallows the category.
16119 !! test
16120 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16121 !! wikitext
16122 * {{echo|a
16123 [[Category:Foo]]}}
16124 !! html/parsoid
16125 <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
16126 </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>
16127 !! end
16128
16129 !! test
16130 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16131 !! wikitext
16132 * a
16133
16134 {{echo|[[Category:Foo]]
16135 [[Category:Bar]]}}
16136 [[Category:Baz]]
16137 !! html/parsoid
16138 <ul><li> a</li></ul>
16139
16140 <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">
16141 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16142 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16143 !! end
16144
16145 !! test
16146 Category links with multiple namespaces
16147 !! wikitext
16148 [[Category:Project:Foo]]
16149 !! html/parsoid
16150 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16151 !! end
16152
16153 !! test
16154 Parsoid: Serialize link to category page with colon escape
16155 !! options
16156 parsoid
16157 !! wikitext
16158
16159 [[:Category:Foo]]
16160 [[:Category:Foo|Bar]]
16161 !! html
16162 <p>
16163 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16164 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16165 </p>
16166 !! end
16167
16168 # We used to, but no longer wt2wt this test since the default serializer
16169 # will normalize all categories to serialize on their own line.
16170 # This wikitext usage is going to be fairly uncommon in production and
16171 # selser will take care of preventing whitespace insertion if this
16172 # occurs in an article.
16173 #
16174 # html2html disabled for the same reason (whitespace insertion between
16175 # x and y).
16176 #
16177 # html2wt disabled because it localizes the "Category" namespace.
16178 !! test
16179 Link prefix/suffixes aren't applied to category links
16180 !! options
16181 parsoid=wt2html
16182 language=is
16183 !! wikitext
16184 x[[Category:Foo]]y
16185 !! html/php
16186 <p>xy
16187 </p>
16188 !! html/parsoid
16189 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16190 !! end
16191
16192 !! test
16193 Parsoid: Serialize link to file page with colon escape
16194 !! options
16195 parsoid
16196 !! wikitext
16197
16198 [[:File:Foo.png]]
16199 [[:File:Foo.png|Bar]]
16200 !! html
16201 <p>
16202 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16203 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16204 </p>
16205 !! end
16206
16207 !! test
16208 Parsoid: Serialize a genuine category link without colon escape
16209 !! options
16210 parsoid
16211 !! wikitext
16212 [[Category:Foo]]
16213 [[Category:Foo|Bar]]
16214 !! html
16215 <link rel="mw:PageProp/Category" href="./Category:Foo">
16216 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16217 !! end
16218
16219 !! test
16220 Normalize hrefs properly before testing for invalid link targets (T72894)
16221 !! options
16222 parsoid=html2wt
16223 !! html/parsoid
16224 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16225 !! wikitext
16226 [[Category:Toxine bactérienne]]
16227 !! end
16228
16229 !! test
16230 Parsoid: Defaultsort
16231 !! wikitext
16232 {{DEFAULTSORT:Foo}}
16233 !! html/parsoid
16234 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16235 !! end
16236
16237 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16238 # But, this is a limitation of our representation and is documented in
16239 # TemplateHandler.js in processSpecialMagicWord
16240 !! test
16241 Parsoid: Defaultsort (template-generated)
16242 !! wikitext
16243 {{{{echo|DEFAULTSORT}}:Foo}}
16244 !! html/parsoid
16245 <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"}]]}'/>
16246 !! end
16247
16248 ###
16249 ### Inter-language links
16250 ###
16251 !! test
16252 Interlanguage links
16253 !! options
16254 ill
16255 !! wikitext
16256 [[es:Alimento]]
16257 [[fr:Nourriture]]
16258 [[zh:食品]]
16259 !! html/php
16260 es:Alimento fr:Nourriture zh:食品
16261 !! html/parsoid
16262 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16263 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16264 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16265 !! end
16266
16267 !! test
16268 Duplicate interlanguage links (T26502)
16269 !! options
16270 ill
16271 !! wikitext
16272 [[es:1]]
16273 [[es:2]]
16274 [[fr:1]]
16275 [[fr:2]]
16276 !! html/php
16277 es:1 fr:1
16278 !! html/parsoid
16279 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16280 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16281 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16282 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16283 !! end
16284
16285 ###
16286 ### Sections
16287 ###
16288 !! test
16289 Basic section headings
16290 !! wikitext
16291 == Headline 1 ==
16292 Some text
16293
16294 ==Headline 2==
16295 More
16296 ===Smaller headline===
16297 Blah blah
16298 !! html
16299 <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>
16300 <p>Some text
16301 </p>
16302 <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>
16303 <p>More
16304 </p>
16305 <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>
16306 <p>Blah blah
16307 </p>
16308 !! end
16309
16310 !! test
16311 Section headings with TOC
16312 !! wikitext
16313 == Headline 1 ==
16314 === Subheadline 1 ===
16315 ===== Skipping a level =====
16316 ====== Skipping a level ======
16317
16318 == Headline 2 ==
16319 Some text
16320 ===Another headline===
16321 !! html
16322 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16323 <ul>
16324 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16325 <ul>
16326 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16327 <ul>
16328 <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>
16329 <ul>
16330 <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>
16331 </ul>
16332 </li>
16333 </ul>
16334 </li>
16335 </ul>
16336 </li>
16337 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16338 <ul>
16339 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16340 </ul>
16341 </li>
16342 </ul>
16343 </div>
16344
16345 <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>
16346 <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>
16347 <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>
16348 <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>
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=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16350 <p>Some text
16351 </p>
16352 <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>
16353
16354 !! end
16355
16356 !! test
16357 TOC anchors don't collide
16358 !! wikitext
16359 __FORCETOC__
16360 == Headline 2 ==
16361 == Headline ==
16362 == Headline 2 ==
16363 == Headline ==
16364 !! html/php
16365 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16366 <ul>
16367 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16368 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16369 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16370 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16371 </ul>
16372 </div>
16373
16374 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16375 <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>
16376 <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>
16377 <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>
16378
16379 !! end
16380
16381 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16382 !! test
16383 Handling of sections up to level 6 and beyond
16384 !! wikitext
16385 = Level 1 Heading=
16386 == Level 2 Heading==
16387 === Level 3 Heading===
16388 ==== Level 4 Heading====
16389 ===== Level 5 Heading=====
16390 ====== Level 6 Heading======
16391 ======= Level 7 Heading=======
16392 ======== Level 8 Heading========
16393 ========= Level 9 Heading=========
16394 ========== Level 10 Heading==========
16395 !! html
16396 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16397 <ul>
16398 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16399 <ul>
16400 <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>
16401 <ul>
16402 <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>
16403 <ul>
16404 <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>
16405 <ul>
16406 <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>
16407 <ul>
16408 <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>
16409 <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>
16410 <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>
16411 <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>
16412 <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>
16413 </ul>
16414 </li>
16415 </ul>
16416 </li>
16417 </ul>
16418 </li>
16419 </ul>
16420 </li>
16421 </ul>
16422 </li>
16423 </ul>
16424 </div>
16425
16426 <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>
16427 <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>
16428 <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>
16429 <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>
16430 <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>
16431 <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>
16432 <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>
16433 <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>
16434 <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>
16435 <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>
16436
16437 !! end
16438
16439 !! test
16440 TOC regression (T11764)
16441 !! wikitext
16442 == title 1 ==
16443 === title 1.1 ===
16444 ==== title 1.1.1 ====
16445 === title 1.2 ===
16446 == title 2 ==
16447 === title 2.1 ===
16448 !! html
16449 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16450 <ul>
16451 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16452 <ul>
16453 <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>
16454 <ul>
16455 <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>
16456 </ul>
16457 </li>
16458 <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>
16459 </ul>
16460 </li>
16461 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16462 <ul>
16463 <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>
16464 </ul>
16465 </li>
16466 </ul>
16467 </div>
16468
16469 <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>
16470 <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>
16471 <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>
16472 <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>
16473 <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>
16474 <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>
16475
16476 !! end
16477
16478 !! test
16479 TOC for heading containing <span id="..."></span> (T96153)
16480 !! wikitext
16481 __FORCETOC__
16482 ==<span id="old-anchor"></span>New title==
16483 !! html/php
16484 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16485 <ul>
16486 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16487 </ul>
16488 </div>
16489
16490 <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>
16491
16492 !! end
16493
16494 !! test
16495 TOC with wgMaxTocLevel=3 (T8204)
16496 !! options
16497 wgMaxTocLevel=3
16498 !! wikitext
16499 == title 1 ==
16500 === title 1.1 ===
16501 ==== title 1.1.1 ====
16502 === title 1.2 ===
16503 == title 2 ==
16504 === title 2.1 ===
16505 !! html
16506 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16507 <ul>
16508 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16509 <ul>
16510 <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>
16511 <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>
16512 </ul>
16513 </li>
16514 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16515 <ul>
16516 <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>
16517 </ul>
16518 </li>
16519 </ul>
16520 </div>
16521
16522 <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>
16523 <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>
16524 <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>
16525 <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>
16526 <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>
16527 <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>
16528
16529 !! end
16530
16531 !! test
16532 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16533 !! options
16534 wgMaxTocLevel=3
16535 !! wikitext
16536 ==Section 1==
16537 ===Section 1.1===
16538 ====Section 1.1.1====
16539 ====Section 1.1.1.1====
16540 ==Section 2==
16541 !! html
16542 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16543 <ul>
16544 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16545 <ul>
16546 <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>
16547 </ul>
16548 </li>
16549 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16550 </ul>
16551 </div>
16552
16553 <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>
16554 <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>
16555 <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>
16556 <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>
16557 <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>
16558
16559 !! end
16560
16561
16562 !! test
16563 Resolving duplicate section names
16564 !! wikitext
16565 == Foo bar ==
16566 == Foo bar ==
16567 !! html
16568 <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>
16569 <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>
16570
16571 !! end
16572
16573 !! test
16574 Resolving duplicate section names with differing case (T12721)
16575 !! wikitext
16576 == Foo bar ==
16577 == Foo Bar ==
16578 !! html
16579 <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>
16580 <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>
16581
16582 !! end
16583
16584 !! article
16585 Template:sections
16586 !! text
16587 ===Section 1===
16588 ==Section 2==
16589 !! endarticle
16590
16591 !! test
16592 Template with sections, __NOTOC__
16593 !! wikitext
16594 __NOTOC__
16595 ==Section 0==
16596 {{sections}}
16597 ==Section 4==
16598 !! html
16599 <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>
16600 <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>
16601 <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>
16602 <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>
16603
16604 !! end
16605
16606 !! test
16607 __NOEDITSECTION__ keyword
16608 !! wikitext
16609 __NOEDITSECTION__
16610 ==Section 1==
16611 ==Section 2==
16612 !! html
16613 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16614 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16615
16616 !! end
16617
16618 !! test
16619 Link inside a section heading
16620 !! wikitext
16621 ==Section with a [[Main Page|link]] in it==
16622 !! html
16623 <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>
16624
16625 !! end
16626
16627 !! test
16628 TOC regression (T14077)
16629 !! wikitext
16630 __TOC__
16631 == title 1 ==
16632 === title 1.1 ===
16633 == title 2 ==
16634 !! html
16635 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16636 <ul>
16637 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16638 <ul>
16639 <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>
16640 </ul>
16641 </li>
16642 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16643 </ul>
16644 </div>
16645
16646 <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>
16647 <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>
16648 <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>
16649
16650 !! end
16651
16652 !! test
16653 T3219 URL next to image (good)
16654 !! wikitext
16655 http://example.com [[File:Foobar.jpg]]
16656 !! html/php
16657 <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>
16658 </p>
16659 !! html/parsoid
16660 <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>
16661 !!end
16662
16663 !! test
16664 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16665 !! wikitext
16666 ===
16667 The line above must have a trailing space!
16668 === <!--
16669 --> <!-- -->
16670 But just in case it doesn't...
16671 !! html
16672 <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>
16673 <p>The line above must have a trailing space!
16674 </p>
16675 <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>
16676 <p>But just in case it doesn't...
16677 </p>
16678 !! end
16679
16680 !! test
16681 Header with special characters (T27462)
16682 !! wikitext
16683 The tooltips shall not show entities to the user (ie. be double escaped)
16684
16685 == text > text ==
16686 section 1
16687
16688 == text < text ==
16689 section 2
16690
16691 == text & text ==
16692 section 3
16693
16694 == text ' text ==
16695 section 4
16696
16697 == text " text ==
16698 section 5
16699 !! html
16700 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16701 </p>
16702 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16703 <ul>
16704 <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>
16705 <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>
16706 <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>
16707 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16708 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16709 </ul>
16710 </div>
16711
16712 <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>
16713 <p>section 1
16714 </p>
16715 <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>
16716 <p>section 2
16717 </p>
16718 <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>
16719 <p>section 3
16720 </p>
16721 <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>
16722 <p>section 4
16723 </p>
16724 <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>
16725 <p>section 5
16726 </p>
16727 !! end
16728
16729 !! test
16730 Header with space, plus and underscore as entity
16731 !! wikitext
16732 Id should not contain + for spaces
16733
16734 == Space between Text ==
16735 section 1
16736
16737 == Space-Entity&#32;between&#32;Text ==
16738 section 2
16739
16740 == Plus+between+Text ==
16741 section 3
16742
16743 == Plus-Entity&#43;between&#43;Text ==
16744 section 4
16745
16746 == Underscore_between_Text ==
16747 section 5
16748
16749 == Underscore-Entity&#95;between&#95;Text ==
16750 section 6
16751
16752 [[#Space between Text]]
16753 [[#Space-Entity&#32;between&#32;Text]]
16754 [[#Plus+between+Text]]
16755 [[#Plus-Entity&#43;between&#43;Text]]
16756 [[#Underscore_between_Text]]
16757 [[#Underscore-Entity&#95;between&#95;Text]]
16758 !! html
16759 <p>Id should not contain + for spaces
16760 </p>
16761 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16762 <ul>
16763 <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>
16764 <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>
16765 <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>
16766 <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>
16767 <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>
16768 <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>
16769 </ul>
16770 </div>
16771
16772 <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>
16773 <p>section 1
16774 </p>
16775 <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>
16776 <p>section 2
16777 </p>
16778 <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>
16779 <p>section 3
16780 </p>
16781 <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>
16782 <p>section 4
16783 </p>
16784 <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>
16785 <p>section 5
16786 </p>
16787 <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>
16788 <p>section 6
16789 </p><p><a href="#Space_between_Text">#Space between Text</a>
16790 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16791 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16792 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16793 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16794 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16795 </p>
16796 !! end
16797
16798 !! test
16799 Headers with excess '=' characters
16800 (Are similar tests necessary beyond the 1st level?)
16801 !! wikitext
16802 =foo==
16803 ==foo=
16804 =''italic'' heading==
16805 ==''italic'' heading=
16806 !! html
16807 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16808 <ul>
16809 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16810 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16811 <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>
16812 <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>
16813 </ul>
16814 </div>
16815
16816 <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>
16817 <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>
16818 <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>
16819 <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>
16820
16821 !! end
16822
16823 !! test
16824 HTML headers vs TOC (T25393)
16825 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16826 !! wikitext
16827 <h1>Header 1</h1>
16828 == Header 1.1 ==
16829 == Header 1.2 ==
16830
16831 <h1>Header 2
16832 </h1>
16833 == Header 2.1 ==
16834 == Header 2.2 ==
16835 __NOEDITSECTION__
16836 !! html
16837 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
16838 <ul>
16839 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16840 <ul>
16841 <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>
16842 <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>
16843 </ul>
16844 </li>
16845 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16846 <ul>
16847 <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>
16848 <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>
16849 </ul>
16850 </li>
16851 </ul>
16852 </div>
16853
16854 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
16855 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
16856 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
16857 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
16858 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
16859 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
16860
16861 !! end
16862
16863 !! test
16864 Single-line or multiline-comments can follow headings
16865 !! options
16866 parsoid=wt2html,wt2wt
16867 !! wikitext
16868 ==foo==<!---->
16869 ==bar==<!--c1-->
16870 ==baz==<!--
16871 c2
16872 c3-->
16873 !! html
16874 <h2><span class="mw-headline" id="foo">foo</span></h2>
16875 <h2><span class="mw-headline" id="bar">bar</span></h2>
16876 <h2><span class="mw-headline" id="baz">baz</span></h2>
16877
16878 !! end
16879
16880 !! test
16881 T3219 URL next to image (broken)
16882 !! wikitext
16883 http://example.com[[File:Foobar.jpg]]
16884 !! html/php
16885 <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>
16886 </p>
16887 !! html/parsoid
16888 <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>
16889 !!end
16890
16891 !! test
16892 T3186 news: in the middle of text
16893 !! wikitext
16894 http://en.wikinews.org/wiki/Wikinews:Workplace
16895 !! html
16896 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
16897 </p>
16898 !!end
16899
16900
16901 !! test
16902 Namespaced link must have a title
16903 !! wikitext
16904 [[Project:]]
16905 !! html
16906 <p>[[Project:]]
16907 </p>
16908 !!end
16909
16910 !! test
16911 Namespaced link must have a title (bad fragment version)
16912 !! wikitext
16913 [[Project:#fragment]]
16914 !! html
16915 <p>[[Project:#fragment]]
16916 </p>
16917 !!end
16918
16919
16920 ###
16921 ### HTML tags and HTML attributes
16922 ###
16923
16924 !! test
16925 div with no attributes
16926 !! wikitext
16927 <div>HTML rocks</div>
16928 !! html
16929 <div>HTML rocks</div>
16930
16931 !! end
16932
16933 !! test
16934 div with double-quoted attribute
16935 !! wikitext
16936 <div id="rock">HTML rocks</div>
16937 !! html
16938 <div id="rock">HTML rocks</div>
16939
16940 !! end
16941
16942 !! test
16943 div with single-quoted attribute
16944 !! wikitext
16945 <div id='rock'>HTML rocks</div>
16946 !! html
16947 <div id="rock">HTML rocks</div>
16948
16949 !! end
16950
16951 !! test
16952 div with unquoted attribute
16953 !! wikitext
16954 <div id=rock>HTML rocks</div>
16955 !! html
16956 <div id="rock">HTML rocks</div>
16957
16958 !! end
16959
16960 !! test
16961 div with illegal double attributes
16962 !! wikitext
16963 <div id="a" id="b">HTML rocks</div>
16964 !! html
16965 <div id="b">HTML rocks</div>
16966
16967 !!end
16968
16969 !! test
16970 div with empty attribute value, space before equals
16971 !! options
16972 parsoid=wt2html,html2html
16973 !! wikitext
16974 <div class =>HTML rocks</div>
16975 !! html/php
16976 <div class="">HTML rocks</div>
16977
16978 !! html/parsoid
16979 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16980 !! end
16981
16982 !! test
16983 div with multiple empty attribute values
16984 !! options
16985 parsoid=wt2html,html2html
16986 !! wikitext
16987 <div id= title=>HTML rocks</div>
16988 !! html/php
16989 <div id="title.3D">HTML rocks</div>
16990
16991 !! html/parsoid
16992 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16993 !! end
16994
16995 !! test
16996 table with multiple empty attribute values
16997 !! options
16998 parsoid=wt2html,html2html
16999 !! wikitext
17000 {| title= id=
17001 | hi
17002 |}
17003 !! html/php
17004 <table title="id=">
17005 <tr>
17006 <td> hi
17007 </td></tr></table>
17008
17009 !! html/parsoid
17010 <table title="id=">
17011 <tbody><tr><td> hi</td></tr>
17012 </tbody></table>
17013 !! end
17014
17015 !! test
17016 div with braces in attribute value
17017 !! wikitext
17018 <div title="{}">Foo</div>
17019 !! html/php
17020 <div title="&#123;&#125;">Foo</div>
17021
17022 !! html/parsoid
17023 <div title="{}">Foo</div>
17024 !! end
17025
17026 !! test
17027 div with empty attribute value, no space before equals
17028 !! options
17029 parsoid=wt2html,html2html
17030 !! wikitext
17031 <div class=>HTML rocks</div>
17032 !! html/php
17033 <div class="">HTML rocks</div>
17034
17035 !! html/parsoid
17036 <div class="">HTML rocks</div>
17037 !! end
17038
17039 !! test
17040 HTML multiple attributes correction
17041 !! wikitext
17042 <p class="error" class="awesome">Awesome!</p>
17043 !! html
17044 <p class="awesome">Awesome!</p>
17045
17046 !!end
17047
17048 !! test
17049 Table multiple attributes correction
17050 !! wikitext
17051 {|
17052 !+ class="error" class="awesome"| status
17053 |}
17054 !! html
17055 <table>
17056 <tr>
17057 <th class="awesome"> status
17058 </th></tr></table>
17059
17060 !!end
17061
17062 !! test
17063 DIV IN UPPERCASE
17064 !! wikitext
17065 <DIV ID="x">HTML ROCKS</DIV>
17066 !! html
17067 <div id="x">HTML ROCKS</div>
17068
17069 !!end
17070
17071 !! test
17072 Non-ASCII pseudo-tags are rendered as text
17073 !! wikitext
17074 <khyô>
17075 !! html
17076 <p>&lt;khyô&gt;
17077 </p>
17078 !! end
17079
17080 !! test
17081 Pseudo-tag with URL 'name' renders as url link
17082 !! wikitext
17083 <http://example.com/>
17084 !! html
17085 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17086 </p>
17087 !! end
17088
17089 !! test
17090 text with amp in the middle of nowhere
17091 !! wikitext
17092 Remember AT&T?
17093 !! html
17094 <p>Remember AT&amp;T?
17095 </p>
17096 !! end
17097
17098 !! test
17099 text with character entity: eacute
17100 !! wikitext
17101 I always thought &eacute; was a cute letter.
17102 !! html
17103 <p>I always thought &#233; was a cute letter.
17104 </p>
17105 !! html+tidy
17106 <p>I always thought é was a cute letter.</p>
17107 !! end
17108
17109 !! test
17110 text with entity-escaped character entity-like string: eacute
17111 !! wikitext
17112 I always thought &amp;eacute; was a cute letter.
17113 !! html
17114 <p>I always thought &amp;eacute; was a cute letter.
17115 </p>
17116 !! end
17117
17118 !! test
17119 text with undefined character entity: xacute
17120 !! wikitext
17121 I always thought &xacute; was a cute letter.
17122 !! html
17123 <p>I always thought &amp;xacute; was a cute letter.
17124 </p>
17125 !! end
17126
17127 !! test
17128 HTML5 tags
17129 !! wikitext
17130 <data value="5">five</data>
17131 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17132 <mark>This highlighted text</mark>
17133 !! html
17134 <p><data value="5">five</data>
17135 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17136 <mark>This highlighted text</mark>
17137 </p>
17138 !! end
17139
17140 !! test
17141 HTML tag with leading space is parsed as text
17142 !! wikitext
17143 < div>foo< /div>
17144 !! html
17145 <p>&lt; div&gt;foo&lt; /div&gt;
17146 </p>
17147 !! end
17148
17149 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17150 ## the HTML5 parsing spec.
17151 !! test
17152 Element with broken attribute syntax
17153 !! options
17154 parsoid=wt2html
17155 !! wikitext
17156 <div style=" style="123">hi</div>
17157 <div =>ho</div>
17158 !! html/php
17159 <div style="123">hi</div>
17160 <div>ho</div>
17161
17162 !! html/parsoid
17163 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17164 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17165 !! end
17166
17167 ###
17168 ### Nesting tests (see T43545, T52604, T53081)
17169 ###
17170
17171 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17172 # Note that html2wt is considerably more difficult if we use <b> in
17173 # the test case, instead of <small>
17174 !! test
17175 Ensure that HTML adoption agency algorithm is properly implemented.
17176 !! wikitext
17177 <small>X<small>Y</small>Z</small>
17178 !! html
17179 <p><small>X<small>Y</small>Z</small>
17180 </p>
17181 !! end
17182
17183 # This was T43545 in the PHP parser.
17184 # Note that tidy doesn't handle this correctly.
17185 !! test
17186 Nesting of <kbd>
17187 !! wikitext
17188 <kbd>X<kbd>Y</kbd>Z</kbd>
17189 !! html
17190 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17191 </p>
17192 !! end
17193
17194 # The following cases were T53081 in the PHP parser.
17195 # Note that there are some other nestable tags (b, i, etc) which are
17196 # not covered; see T53081 for discussion.
17197
17198 # Note that tidy doesn't handle this correctly.
17199 !! test
17200 Nesting of <em>
17201 !! wikitext
17202 <em>X<em>Y</em>Z</em>
17203 !! html
17204 <p><em>X<em>Y</em>Z</em>
17205 </p>
17206 !! end
17207
17208 # Note that tidy doesn't handle this correctly.
17209 !! test
17210 Nesting of <strong>
17211 !! wikitext
17212 <strong>X<strong>Y</strong>Z</strong>
17213 !! html
17214 <p><strong>X<strong>Y</strong>Z</strong>
17215 </p>
17216 !! end
17217
17218 !! test
17219 Nesting of <q>
17220 !! wikitext
17221 <q>X<q>Y</q>Z</q>
17222 !! html+tidy
17223 <p><q>X<q>Y</q>Z</q></p>
17224 !! end
17225
17226 # Note that tidy doesn't handle this correctly.
17227 !! test
17228 Nesting of <ruby>
17229 !! wikitext
17230 <ruby>X<ruby>Y</ruby>Z</ruby>
17231 !! html
17232 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17233 </p>
17234 !! end
17235
17236 # Note that tidy doesn't handle this correctly.
17237 !! test
17238 Nesting of <bdo>
17239 !! wikitext
17240 <bdo>X<bdo>Y</bdo>Z</bdo>
17241 !! html
17242 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17243 </p>
17244 !! end
17245
17246
17247 ###
17248 ### Media links
17249 ###
17250
17251 !! test
17252 Media link
17253 !! wikitext
17254 [[Media:Foobar.jpg]]
17255 [[Media:Video.ogv]]
17256 [[:Media:Video.ogv]]
17257 !! html/php
17258 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17259 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17260 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17261 </p>
17262 !! html/parsoid
17263 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17264 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17265 <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>
17266 !! end
17267
17268 !! test
17269 Media link with text
17270 !! wikitext
17271 [[Media:Foobar.jpg|A neat file to look at]]
17272 !! html/php
17273 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17274 </p>
17275 !! html/parsoid
17276 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17277 !! end
17278
17279 # FIXME: this is still bad HTML tag nesting
17280 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17281 !! test
17282 Media link with nasty text
17283 !! wikitext
17284 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17285 !! html/php
17286 <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>
17287
17288 !! html+php/tidy
17289 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
17290 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
17291 !! html/parsoid
17292 <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>
17293
17294 !! end
17295
17296 !! test
17297 Media link to nonexistent file (T3702)
17298 !! wikitext
17299 [[Media:No such.jpg]]
17300 [[Media:No_such file.jpg]]
17301 !! html/php
17302 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17303 <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>
17304 </p>
17305 !! html/parsoid
17306 <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>
17307 <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>
17308 !! end
17309
17310 !! test
17311 Image link to nonexistent file (T3850 - good)
17312 !! wikitext
17313 [[File:No_such.jpg]]
17314 !! html/php
17315 <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>
17316 </p>
17317 !! html/parsoid
17318 <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>
17319 !! end
17320
17321 !! test
17322 :Image link to nonexistent file (T3850 - bad)
17323 !! wikitext
17324 [[:Image:No such.jpg]]
17325 !! html/php
17326 <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>
17327 </p>
17328 !! html/parsoid
17329 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17330 !! end
17331
17332 !! test
17333 Character reference normalization in link text (T3938)
17334 !! wikitext
17335 [[Main Page|this&that]]
17336 !! html
17337 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17338 </p>
17339 !!end
17340
17341 !! article
17342 אַ
17343 !! text
17344 Test for unicode normalization
17345
17346 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17347 !! endarticle
17348
17349 !! test
17350 (T21451) Links should refer to the normalized form.
17351 !! wikitext
17352 [[&#xFB2E;]]
17353 [[&#x5d0;&#x5b7;]]
17354 [[&#x5d0;ַ]]
17355 [[א&#x5b7;]]
17356 [[אַ]]
17357 !! html
17358 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17359 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17360 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17361 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17362 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17363 </p>
17364 !! end
17365
17366 !! test
17367 Empty attribute crash test (T4067)
17368 !! wikitext
17369 <font color="">foo</font>
17370 !! html
17371 <p><font color="">foo</font>
17372 </p>
17373 !! end
17374
17375 !! test
17376 Empty attribute crash test single-quotes (T4067)
17377 !! wikitext
17378 <font color=''>foo</font>
17379 !! html
17380 <p><font color="">foo</font>
17381 </p>
17382 !! end
17383
17384 !! test
17385 Attribute test: equals, then nothing
17386 !! options
17387 parsoid=wt2html,html2html
17388 !! wikitext
17389 <font color=>foo</font>
17390 !! html/php
17391 <p><font color="">foo</font>
17392 </p>
17393 !! html/parsoid
17394 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17395 !! end
17396
17397 !! test
17398 Attribute test: unquoted value
17399 !! options
17400 parsoid=wt2html,html2html
17401 !! wikitext
17402 <font color=x>foo</font>
17403 !! html/php
17404 <p><font color="x">foo</font>
17405 </p>
17406 !! html/parsoid
17407 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17408 !! end
17409
17410 !! test
17411 Attribute test: unquoted but illegal value (hash)
17412 !! wikitext
17413 <font color=#x>foo</font>
17414 !! html
17415 <p><font color="#x">foo</font>
17416 </p>
17417 !! end
17418
17419 # Parsoid does not serialize to empty attribute syntax,
17420 # so wt2wt and html2wt cases are skipped
17421 !! test
17422 Attribute test: no value (T54330)
17423 !! options
17424 parsoid=wt2html,html2html
17425 !! wikitext
17426 <font color>foo</font>
17427 !! html/php
17428 <p><font color="">foo</font>
17429 </p>
17430 !! html/parsoid
17431 <p><font color="">foo</font></p>
17432 !! end
17433
17434 !! test
17435 T4095: link with three closing brackets
17436 !! wikitext
17437 [[Main Page]]]
17438 !! html/php
17439 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17440 </p>
17441 !! html/parsoid
17442 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17443 !! end
17444
17445 !! test
17446 T4095: link with pipe and three closing brackets
17447 !! wikitext
17448 [[Main Page|link]]]
17449 !! html/php
17450 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17451 </p>
17452 !! html/parsoid
17453 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17454 !! end
17455
17456 !! test
17457 T4095: link with pipe and three closing brackets, version 2
17458 !! wikitext
17459 [[Main Page|[http://example.com/]]]
17460 !! html/php
17461 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17462 </p>
17463 !! html/parsoid
17464 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17465 !! end
17466
17467
17468 ###
17469 ### Safety
17470 ###
17471
17472 !! article
17473 Template:Dangerous attribute
17474 !! text
17475 " onmouseover="alert(document.cookie)
17476 !! endarticle
17477
17478 !! article
17479 Template:Dangerous style attribute
17480 !! text
17481 border-size: expression(alert(document.cookie))
17482 !! endarticle
17483
17484 !! article
17485 Template:Div style
17486 !! text
17487 <div style="float: right; {{{1}}}">Magic div</div>
17488 !! endarticle
17489
17490 !! test
17491 T4304: HTML attribute safety (safe template; regression T4309)
17492 !! wikitext
17493 <div title="{{test}}"></div>
17494 !! html/php
17495 <div title="This is a test template"></div>
17496
17497 !! html/parsoid
17498 <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>
17499 !! end
17500
17501 # Parsoid has enough context to handle this case
17502 !! test
17503 T4304: HTML attribute safety (dangerous template; 2309)
17504 !! wikitext
17505 <div title="{{dangerous attribute}}"></div>
17506 !! html/php
17507 <div title=""></div>
17508
17509 !! html/parsoid
17510 <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>
17511 !! end
17512
17513 !! test
17514 T4304: HTML attribute safety (dangerous style template; 2309)
17515 !! wikitext
17516 <div style="{{dangerous style attribute}}"></div>
17517 !! html/php
17518 <div style="/* insecure input */"></div>
17519
17520 !! html/parsoid
17521 <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>
17522 !! end
17523
17524 !! test
17525 T4304: HTML attribute safety (safe parameter; 2309)
17526 !! wikitext
17527 {{div style|width: 200px}}
17528 !! html/php
17529 <div style="float: right; width: 200px">Magic div</div>
17530
17531 !! html/parsoid
17532 <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>
17533 !! end
17534
17535 !! test
17536 T4304: HTML attribute safety (unsafe parameter; 2309)
17537 !! wikitext
17538 {{div style|width: expression(alert(document.cookie))}}
17539 !! html/php
17540 <div style="/* insecure input */">Magic div</div>
17541
17542 !! html/parsoid
17543 <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>
17544 !! end
17545
17546 ## Parsoid output here differs; needs investigation.
17547 !! test
17548 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17549 !! wikitext
17550 {{div style|"><script>alert(document.cookie)</script>}}
17551 !! html
17552 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17553
17554 !! end
17555
17556 ## Parsoid output here differs; needs investigation.
17557 !! test
17558 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17559 !! wikitext
17560 {{div style|" ><script>alert(document.cookie)</script>}}
17561 !! html
17562 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17563
17564 !! end
17565
17566 !! test
17567 T4304: HTML attribute safety (link)
17568 !! wikitext
17569 <div title="[[Main Page]]"></div>
17570 !! html
17571 <div title="&#91;&#91;Main Page]]"></div>
17572
17573 !! end
17574
17575 !! test
17576 T4304: HTML attribute safety (italics)
17577 !! wikitext
17578 <div title="''foobar''"></div>
17579 !! html
17580 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17581
17582 !! end
17583
17584 !! test
17585 T4304: HTML attribute safety (bold)
17586 !! wikitext
17587 <div title="'''foobar'''"></div>
17588 !! html
17589 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17590
17591 !! end
17592
17593 !! test
17594 T4304: HTML attribute safety (ISBN)
17595 !! wikitext
17596 <div title="ISBN 1234567890"></div>
17597 !! html
17598 <div title="&#73;SBN 1234567890"></div>
17599
17600 !! end
17601
17602 !! test
17603 T4304: HTML attribute safety (RFC)
17604 !! wikitext
17605 <div title="RFC 1234"></div>
17606 !! html
17607 <div title="&#82;FC 1234"></div>
17608
17609 !! end
17610
17611 !! test
17612 T4304: HTML attribute safety (PMID)
17613 !! wikitext
17614 <div title="PMID 1234567890"></div>
17615 !! html
17616 <div title="&#80;MID 1234567890"></div>
17617
17618 !! end
17619
17620 !! test
17621 T4304: HTML attribute safety (web link)
17622 !! wikitext
17623 <div title="http://example.com/"></div>
17624 !! html
17625 <div title="http&#58;//example.com/"></div>
17626
17627 !! end
17628
17629 !! test
17630 T4304: HTML attribute safety (named web link)
17631 !! wikitext
17632 <div title="[http://example.com/ link]"></div>
17633 !! html
17634 <div title="&#91;http&#58;//example.com/ link]"></div>
17635
17636 !! end
17637
17638 !! test
17639 T5244: HTML attribute safety (extension; safe)
17640 !! wikitext
17641 <div style="<nowiki>background:blue</nowiki>"></div>
17642 !! html/php
17643 <div style="background:blue"></div>
17644
17645 !! html/parsoid
17646 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17647 !! end
17648
17649 !! test
17650 T5244: HTML attribute safety (extension; unsafe)
17651 !! wikitext
17652 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17653 !! html/php
17654 <div style="/* insecure input */"></div>
17655
17656 !! html/parsoid
17657 <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>
17658 !! end
17659
17660 # More MSIE fun discovered by Tom Gilder
17661
17662 !! test
17663 MSIE CSS safety test: spurious slash
17664 !! wikitext
17665 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17666 !! html/php
17667 <div style="/* insecure input */">evil</div>
17668
17669 !! html/parsoid
17670 <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>
17671 !! end
17672
17673 !! test
17674 MSIE CSS safety test: hex code
17675 !! wikitext
17676 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17677 !! html/php
17678 <div style="/* insecure input */">evil</div>
17679
17680 !! html/parsoid
17681 <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>
17682 !! end
17683
17684 !! test
17685 MSIE CSS safety test: comment in url
17686 !! wikitext
17687 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17688 !! html/php
17689 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17690
17691 !! html/parsoid
17692 <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>
17693 !! end
17694
17695 !! test
17696 MSIE CSS safety test: comment in expression
17697 !! wikitext
17698 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17699 !! html/php
17700 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17701
17702 !! html/parsoid
17703 <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>
17704 !! end
17705
17706 !! test
17707 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17708 !! wikitext
17709 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17710 !! html/php
17711 <p style="/* invalid control char */">A</p>
17712
17713 !! html/parsoid
17714 <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>
17715 !! end
17716
17717 !! test
17718 MSIE 6 CSS safety test: Fullwidth (T57332)
17719 !! wikitext
17720 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17721 <div style="top:EXPRESSION(alert())">B</div>
17722 !! html/php
17723 <p style="/* insecure input */">A</p>
17724 <div style="/* insecure input */">B</div>
17725
17726 !! html/parsoid
17727 <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>
17728 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17729 !! end
17730
17731 !! test
17732 MSIE 6 CSS safety test: IPA extensions (T57332)
17733 !! wikitext
17734 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17735 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17736 !! html/php
17737 <div style="/* insecure input */">A</div>
17738 <p style="/* insecure input */">B</p>
17739
17740 !! html/parsoid
17741 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17742 <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>
17743 !! end
17744
17745 !! test
17746 MSIE 6 CSS safety test: sup/sub script (T57332)
17747 !! wikitext
17748 <div style="background-image:url⁽javascript:alert())">A</div>
17749 <div style="background-image:url₍javascript:alert())">B</div>
17750 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17751 !! html/php
17752 <div style="/* insecure input */">A</div>
17753 <div style="/* insecure input */">B</div>
17754 <p style="/* insecure input */">C</p>
17755
17756 !! html/parsoid
17757 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17758 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17759 <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>
17760 !! end
17761
17762 !! test
17763 Opera -o-link CSS
17764 !! options
17765 parsoid=wt2html,html2html
17766 !! wikitext
17767 <div
17768 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;"
17769 style="-o-link:attr(title);-o-link-source:current">X</div>
17770 !! html/php
17771 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17772
17773 !! html/parsoid
17774 <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>
17775 !! end
17776
17777 !! test
17778 MSIE 6 CSS safety test: Repetition markers (T57332)
17779 !! wikitext
17780 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17781 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17782 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17783 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17784 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17785 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17786 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17787 !! html/php
17788 <p style="/* insecure input */">A</p>
17789 <p style="/* insecure input */">B</p>
17790 <p style="/* insecure input */">C</p>
17791 <p style="/* insecure input */">D</p>
17792 <p style="/* insecure input */">E</p>
17793 <p style="/* insecure input */">F</p>
17794 <p style="/* insecure input */">G</p>
17795
17796 !! html/parsoid
17797 <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>
17798 <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>
17799 <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>
17800 <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>
17801 <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>
17802 <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>
17803 <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>
17804 !! end
17805
17806 !! test
17807 Table attribute legitimate extension
17808 !! wikitext
17809 {|
17810 !+ style="<nowiki>color:blue</nowiki>"| status
17811 |}
17812 !! html
17813 <table>
17814 <tr>
17815 <th style="color:blue"> status
17816 </th></tr></table>
17817
17818 !!end
17819
17820 !! test
17821 Table attribute safety
17822 !! wikitext
17823 {|
17824 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
17825 |}
17826 !! html
17827 <table>
17828 <tr>
17829 <th style="/* insecure input */"> status
17830 </th></tr></table>
17831
17832 !! end
17833
17834 !! test
17835 CSS line continuation 1
17836 !! wikitext
17837 <div style="background-image: u\&#10;rl(test.jpg);"></div>
17838 !! html
17839 <div style="/* insecure input */"></div>
17840
17841 !! end
17842
17843 !! test
17844 CSS line continuation 2
17845 !! wikitext
17846 <div style="background-image: u\&#13;rl(test.jpg); "></div>
17847 !! html
17848 <div style="/* invalid control char */"></div>
17849
17850 !! end
17851
17852 !! article
17853 Template:Identity
17854 !! text
17855 {{{1}}}
17856 !! endarticle
17857
17858 !! test
17859 Expansion of multi-line templates in attribute values (T8255)
17860 !! wikitext
17861 <div style="background: {{identity|#00FF00}}">-</div>
17862 !! html
17863 <div style="background: #00FF00">-</div>
17864
17865 !! end
17866
17867 !! test
17868 Expansion of multi-line templates in attribute values (T8255 sanity check)
17869 !! wikitext
17870 <div style="background:
17871 #00FF00">-</div>
17872 !! html/php
17873 <div style="background: #00FF00">-</div>
17874
17875 !! html/parsoid
17876 <div style="background:
17877 #00FF00">-</div>
17878 !! end
17879
17880 !! test
17881 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
17882 !! wikitext
17883 <div style="background: &#10;#00FF00">-</div>
17884 !! html
17885 <div style="background: &#10;#00FF00">-</div>
17886
17887 !! end
17888
17889 !! test
17890 Tags which are hidden from Tidy cannot pass through the Sanitizer
17891 !! wikitext
17892 <mw:toc><script>alert();</script></mw:toc>
17893 !! html+tidy
17894 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
17895 !! end
17896
17897 ###
17898 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
17899 ###
17900
17901 !! test
17902 Parser hook: empty input
17903 !! wikitext
17904 <tag></tag>
17905 !! html/php
17906 <pre>
17907 ''
17908 array (
17909 )
17910 </pre>
17911
17912 !! html/parsoid
17913 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17914 !! end
17915
17916 ## Don't expect parsoid to rt this form.
17917 !! test
17918 Parser hook: empty input using terminated empty elements
17919 !! options
17920 parsoid=wt2html,html2html
17921 !! wikitext
17922 <tag/>
17923 !! html/php
17924 <pre>
17925 NULL
17926 array (
17927 )
17928 </pre>
17929
17930 !! html/parsoid
17931 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17932 !! end
17933
17934 !! test
17935 Parser hook: empty input using terminated empty elements (space before)
17936 !! wikitext
17937 <tag />
17938 !! html/php
17939 <pre>
17940 NULL
17941 array (
17942 )
17943 </pre>
17944
17945 !! html/parsoid
17946 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
17947 !! end
17948
17949 !! test
17950 Parser hook: basic input
17951 !! wikitext
17952 <tag>input</tag>
17953 !! html/php
17954 <pre>
17955 'input'
17956 array (
17957 )
17958 </pre>
17959
17960 !! html/parsoid
17961 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17962 !! end
17963
17964 ## Don't expect parsoid to rt this form.
17965 !! test
17966 Parser hook: case insensitive
17967 !! options
17968 parsoid=wt2html,html2html
17969 !! wikitext
17970 <TAG>input</TAG>
17971 !! html/php
17972 <pre>
17973 'input'
17974 array (
17975 )
17976 </pre>
17977
17978 !! html/parsoid
17979 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17980 !! end
17981
17982 ## Don't expect parsoid to rt this form.
17983 !! test
17984 Parser hook: case insensitive, redux
17985 !! options
17986 parsoid=wt2html,html2html
17987 !! wikitext
17988 <TaG>input</TAg>
17989 !! html/php
17990 <pre>
17991 'input'
17992 array (
17993 )
17994 </pre>
17995
17996 !! html/parsoid
17997 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
17998 !! end
17999
18000 !! test
18001 Parser hook: nested tags
18002 !! wikitext
18003 <tag><tag></tag></tag>
18004 !! html/php
18005 <pre>
18006 '<tag>'
18007 array (
18008 )
18009 </pre>&lt;/tag&gt;
18010
18011 !! html/parsoid
18012 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18013 !! end
18014
18015 !! test
18016 Parser hook: basic arguments
18017 !! wikitext
18018 <tag width="200" height="100" depth="50" square=""></tag>
18019 !! html/php
18020 <pre>
18021 ''
18022 array (
18023 'width' => '200',
18024 'height' => '100',
18025 'depth' => '50',
18026 'square' => '',
18027 )
18028 </pre>
18029
18030 !! html/parsoid
18031 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18032 !! end
18033
18034 ## Don't expect parsoid to rt this form.
18035 !! test
18036 Parser hook: basic arguments, variations
18037 !! options
18038 parsoid=wt2html,html2html
18039 !! wikitext
18040 <tag width=200 height = "100" depth = '50' square></tag>
18041 !! html/php
18042 <pre>
18043 ''
18044 array (
18045 'width' => '200',
18046 'height' => '100',
18047 'depth' => '50',
18048 'square' => '',
18049 )
18050 </pre>
18051
18052 !! html/parsoid
18053 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18054 !! end
18055
18056 !! test
18057 Parser hook: argument containing a forward slash (T7344)
18058 !! wikitext
18059 <tag filename="/tmp/bla"></tag>
18060 !! html/php
18061 <pre>
18062 ''
18063 array (
18064 'filename' => '/tmp/bla',
18065 )
18066 </pre>
18067
18068 !! html/parsoid
18069 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18070 !! end
18071
18072 ## Don't expect parsoid to rt this form.
18073 !! test
18074 Parser hook: empty input using terminated empty elements (T4374)
18075 !! options
18076 parsoid=wt2html,html2html
18077 !! wikitext
18078 <tag foo=bar/>text
18079 !! html/php
18080 <pre>
18081 NULL
18082 array (
18083 'foo' => 'bar',
18084 )
18085 </pre>text
18086
18087 !! html/parsoid
18088 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18089 !! end
18090
18091 ## </tag> should be output literally since there is no matching tag that begins it
18092 ## Don't expect parsoid to rt this form.
18093 !! test
18094 Parser hook: basic arguments using terminated empty elements (T4374)
18095 !! options
18096 parsoid=wt2html
18097 !! wikitext
18098 <tag width=200 height = "100" depth = '50' square/>
18099 other stuff
18100 </tag>
18101 !! html/php
18102 <pre>
18103 NULL
18104 array (
18105 'width' => '200',
18106 'height' => '100',
18107 'depth' => '50',
18108 'square' => '',
18109 )
18110 </pre>
18111 <p>other stuff
18112 &lt;/tag&gt;
18113 </p>
18114 !! html/parsoid
18115 <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
18116 &lt;/tag></p>
18117 !! end
18118
18119 ## Don't expect parsoid to rt this form.
18120 !! test
18121 Parser hook: Don't allow unclosed extension tags
18122 !! options
18123 parsoid=wt2html
18124 !! wikitext
18125 test <tag>123
18126
18127 this is a '''test'''
18128 !! html/php
18129 <p>test &lt;tag&gt;123
18130 </p><p>this is a <b>test</b>
18131 </p>
18132 !! html/parsoid
18133 <p>test &lt;tag>123</p>
18134
18135 <p>this is a <b>test</b></p>
18136 !! end
18137
18138 ###
18139 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18140 ###
18141
18142 !! test
18143 Parser hook: static parser hook not inside a comment
18144 !! wikitext
18145 <statictag>hello, world</statictag>
18146
18147 <statictag action="flush" />
18148 !! html/php
18149 <p><br />
18150 hello, world
18151 </p>
18152 !! html/parsoid
18153 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18154 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18155 !! end
18156
18157 !! test
18158 Parser hook: static parser hook inside a comment
18159 !! wikitext
18160 <!-- <statictag>hello, world</statictag> -->
18161 <statictag action="flush" />
18162 !! html/php
18163 <p><br />
18164 </p>
18165 !! html/parsoid
18166 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18167 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18168 !! end
18169
18170 # Nested template calls; this case was broken by Parser.php rev 1.506,
18171 # since reverted.
18172
18173 !! article
18174 Template:One-parameter
18175 !! text
18176 (My parameter is: {{{1}}})
18177 !! endarticle
18178
18179 !! article
18180 Template:Map-one-parameter
18181 !! text
18182 {{{{{1}}}|{{{2}}}}}
18183 !! endarticle
18184
18185 !! test
18186 Nested template calls
18187 !! wikitext
18188 {{Map-one-parameter|One-parameter|param}}
18189 !! html
18190 <p>(My parameter is: param)
18191 </p>
18192 !! end
18193
18194
18195 ###
18196 ### Sanitizer
18197 ###
18198
18199 # HTML+Tidy effectively strips out the empty tags completely
18200 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
18201 # which Tidy would have done for the PHP parser had there been content inside it.
18202 !! test
18203 Sanitizer: Closing of open tags
18204 !! wikitext
18205 <s></s><table></table>
18206 !! html
18207 <s></s><table></table>
18208
18209 !! html/parsoid
18210 <p><s></s></p><table></table>
18211 !! end
18212
18213 !! test
18214 Sanitizer: Closing of open but not closed tags
18215 !! wikitext
18216 <s>foo
18217 !! html
18218 <p><s>foo</s>
18219 </p>
18220 !! end
18221
18222 !! test
18223 Sanitizer: Closing of closed but not open tags
18224 !! options
18225 parsoid=wt2html
18226 !! wikitext
18227 </s>
18228 !! html/php+tidy
18229 !! html/parsoid
18230 !! end
18231
18232 !! test
18233 Sanitizer: Closing of closed but not open table tags
18234 !! options
18235 parsoid=wt2html
18236 !! wikitext
18237 Table not started</td></tr></table>
18238 !! html/php+tidy
18239 <p>Table not started</p>
18240 !! html/parsoid
18241 <p>Table not started</p>
18242 !! end
18243
18244 !! test
18245 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18246 !! wikitext
18247 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18248 !! html/php
18249 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18250 </p>
18251 !! html/parsoid
18252 <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>
18253 !! end
18254
18255 # In HTML5, the restrictions are that id must contain at least one character,
18256 # and must not contain any space characters.
18257 !! test
18258 Sanitizer: Validating the contents of the id attribute (T6515)
18259 !! options
18260 disabled
18261 !! wikitext
18262 <br id="" /><br id="a space" />
18263 !! html
18264 Something ...
18265 !! end
18266
18267 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18268 !! test
18269 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18270 !! options
18271 disabled
18272 !! wikitext
18273 <br id="foo" /><br id="foo" />
18274 !! html
18275 Something need to be done. foo-2 ?
18276 !! end
18277
18278 !! test
18279 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18280 !! wikitext
18281 <div itemscope>
18282 <meta itemprop="hello" content="world">
18283 <meta http-equiv="refresh" content="5">
18284 <meta itemprop="hello" http-equiv="refresh" content="5">
18285 <link itemprop="hello" href="{{SERVER}}">
18286 <link rel="stylesheet" href="{{SERVER}}">
18287 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18288 </div>
18289 !! html
18290 <div itemscope="">
18291 <p> <meta itemprop="hello" content="world" />
18292 &lt;meta http-equiv="refresh" content="5"&gt;
18293 <meta itemprop="hello" content="5" />
18294 <link itemprop="hello" href="http&#58;//example.org" />
18295 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18296 <link itemprop="hello" href="http&#58;//example.org" />
18297 </p>
18298 </div>
18299
18300 !! end
18301
18302 !! test
18303 Sanitizer: Strip comments from CSS attributes
18304 !! options
18305 parsoid=wt2html,wt2wt
18306 !! wikitext
18307 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18308 !! html/php
18309 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18310 </p>
18311 !! html/parsoid
18312 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18313 !! end
18314
18315 !! test
18316 Language converter: output gets cut off unexpectedly (T7757)
18317 !! options
18318 language=zh
18319 !! wikitext
18320 this bit is safe: }-
18321
18322 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18323
18324 then we get cut off here: }-
18325
18326 all additional text is vanished
18327 !! html/php
18328 <p>this bit is safe: }-
18329 </p><p>but if we add a conversion instance: xxx
18330 </p><p>then we get cut off here: }-
18331 </p><p>all additional text is vanished
18332 </p>
18333 !! html/parsoid
18334 <p>this bit is safe: }-</p>
18335 <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>
18336 <p>then we get cut off here: }-</p>
18337 <p>all additional text is vanished</p>
18338 !! end
18339
18340 !! test
18341 Self closed html pairs (T7487)
18342 !! wikitext
18343 <center><font id="bug" />Centered text</center>
18344 <div><font id="bug2" />In div text</div>
18345 !! html+tidy
18346 <center><font id="bug"></font>Centered text</center>
18347 <div><font id="bug2"></font>In div text</div>
18348 !! end
18349
18350 #
18351 #
18352 #
18353
18354 !! test
18355 Punctuation: nbsp before exclamation
18356 !! wikitext
18357 C'est grave !
18358 !! html
18359 <p>C'est grave&#160;!
18360 </p>
18361 !! end
18362
18363 !! test
18364 Punctuation: CSS !important (T13874)
18365 !! wikitext
18366 <div style="width:50% !important">important</div>
18367 !! html
18368 <div style="width:50% !important">important</div>
18369
18370 !!end
18371
18372 !! test
18373 Punctuation: CSS ! important (T13874; with space after)
18374 !! wikitext
18375 <div style="width:50% ! important">important</div>
18376 !! html
18377 <div style="width:50% ! important">important</div>
18378
18379 !!end
18380
18381 !! test
18382 HTML bullet list, closed tags (T7497)
18383 !! wikitext
18384 <ul>
18385 <li>One</li>
18386 <li>Two</li>
18387 </ul>
18388 !! html/php
18389 <ul>
18390 <li>One</li>
18391 <li>Two</li>
18392 </ul>
18393
18394 !! html/parsoid
18395 <ul data-parsoid='{"stx":"html"}'>
18396 <li data-parsoid='{"stx":"html"}'>One</li>
18397 <li data-parsoid='{"stx":"html"}'>Two</li>
18398 </ul>
18399
18400 !! end
18401
18402 !! test
18403 HTML bullet list, unclosed tags (T7497)
18404 !! wikitext
18405 <ul>
18406 <li>One
18407 <li>Two
18408 </ul>
18409 !! html/php+tidy
18410 <ul>
18411 <li>One</li>
18412 <li>Two</li>
18413 </ul>
18414 !! html/parsoid
18415 <ul data-parsoid='{"stx":"html"}'>
18416 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18417 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18418 </ul>
18419
18420 !! end
18421
18422 !! test
18423 HTML ordered list, closed tags (T7497)
18424 !! wikitext
18425 <ol>
18426 <li>One</li>
18427 <li>Two</li>
18428 </ol>
18429 !! html/php
18430 <ol>
18431 <li>One</li>
18432 <li>Two</li>
18433 </ol>
18434
18435 !! html/parsoid
18436 <ol data-parsoid='{"stx":"html"}'>
18437 <li data-parsoid='{"stx":"html"}'>One</li>
18438 <li data-parsoid='{"stx":"html"}'>Two</li>
18439 </ol>
18440
18441 !! end
18442
18443 !! test
18444 HTML ordered list, unclosed tags (T7497)
18445 !! options
18446 !! wikitext
18447 <ol>
18448 <li>One
18449 <li>Two
18450 </ol>
18451 !! html/php+tidy
18452 <ol>
18453 <li>One</li>
18454 <li>Two</li>
18455 </ol>
18456 !! html/parsoid
18457 <ol data-parsoid='{"stx":"html"}'>
18458 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18459 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18460 </ol>
18461
18462 !! end
18463
18464 !! test
18465 HTML nested bullet list, closed tags (T7497)
18466 !! wikitext
18467 <ul>
18468 <li>One</li>
18469 <li>Two:
18470 <ul>
18471 <li>Sub-one</li>
18472 <li>Sub-two</li>
18473 </ul>
18474 </li>
18475 </ul>
18476 !! html/php
18477 <ul>
18478 <li>One</li>
18479 <li>Two:
18480 <ul>
18481 <li>Sub-one</li>
18482 <li>Sub-two</li>
18483 </ul>
18484 </li>
18485 </ul>
18486
18487 !! html/parsoid
18488 <ul data-parsoid='{"stx":"html"}'>
18489 <li data-parsoid='{"stx":"html"}'>One</li>
18490 <li data-parsoid='{"stx":"html"}'>Two:
18491 <ul data-parsoid='{"stx":"html"}'>
18492 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18493 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18494 </ul>
18495 </li>
18496 </ul>
18497 !! end
18498
18499 !! test
18500 HTML nested bullet list, open tags (T7497)
18501 !! wikitext
18502 <ul>
18503 <li>One
18504 <li>Two:
18505 <ul>
18506 <li>Sub-one
18507 <li>Sub-two
18508 </ul>
18509 </ul>
18510 !! html/php+tidy
18511 <ul>
18512 <li>One</li>
18513 <li>Two:
18514 <ul>
18515 <li>Sub-one</li>
18516 <li>Sub-two</li>
18517 </ul>
18518 </li>
18519 </ul>
18520 !! html/parsoid
18521 <ul>
18522 <li>One
18523 </li>
18524 <li>Two:
18525 <ul>
18526 <li>Sub-one
18527 </li>
18528 <li>Sub-two
18529 </li>
18530 </ul>
18531 </li>
18532 </ul>
18533
18534 !! end
18535
18536 !! test
18537 HTML nested ordered list, closed tags (T7497)
18538 !! wikitext
18539 <ol>
18540 <li>One</li>
18541 <li>Two:
18542 <ol>
18543 <li>Sub-one</li>
18544 <li>Sub-two</li>
18545 </ol>
18546 </li>
18547 </ol>
18548 !! html
18549 <ol>
18550 <li>One</li>
18551 <li>Two:
18552 <ol>
18553 <li>Sub-one</li>
18554 <li>Sub-two</li>
18555 </ol>
18556 </li>
18557 </ol>
18558
18559 !! end
18560
18561 !! test
18562 HTML nested ordered list, open tags (T7497)
18563 !! wikitext
18564 <ol>
18565 <li>One
18566 <li>Two:
18567 <ol>
18568 <li>Sub-one
18569 <li>Sub-two
18570 </ol>
18571 </ol>
18572 !! html/php
18573 <ol>
18574 <li>One
18575 <li>Two:
18576 <ol>
18577 <li>Sub-one
18578 <li>Sub-two
18579 </ol>
18580 </ol>
18581
18582 !! html/parsoid
18583 <ol>
18584 <li>One
18585 </li>
18586 <li>Two:
18587 <ol>
18588 <li>Sub-one
18589 </li>
18590 <li>Sub-two
18591 </li>
18592 </ol>
18593 </li>
18594 </ol>
18595
18596 !! end
18597
18598 !! test
18599 HTML ordered list item with parameters oddity
18600 !! wikitext
18601 <ol><li id="fragment">One</li>
18602 </ol>
18603 !! html
18604 <ol><li id="fragment">One</li>
18605 </ol>
18606
18607 !! end
18608
18609 # parsoid doesn't explicitly mark autonumbered links, see T55505
18610 !!test
18611 T7918: autonumbering
18612 !! wikitext
18613 [http://first/] [http://second] [ftp://ftp]
18614
18615 ftp://inlineftp
18616
18617 [mailto:enclosed@mail.tld With target]
18618
18619 [mailto:enclosed@mail.tld]
18620
18621 mailto:inline@mail.tld
18622 !! html/php
18623 <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>
18624 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18625 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18626 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18627 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18628 </p>
18629 !! html/parsoid
18630 <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>
18631 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
18632 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
18633 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
18634 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18635 !! end
18636
18637
18638 #
18639 # Security and HTML correctness
18640 # From Nick Jenkins' fuzz testing
18641 #
18642
18643 !! test
18644 Fuzz testing: Parser13
18645 !! wikitext
18646 {|
18647 | http://a|
18648 !! html
18649 <table>
18650 <tr>
18651 <td>
18652 </td>
18653 </tr>
18654 </table>
18655
18656 !! end
18657
18658 !! test
18659 Fuzz testing: Parser14
18660 !! wikitext
18661 == onmouseover= ==
18662 http://__TOC__
18663 !! html
18664 <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>
18665 http://<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
18666 <ul>
18667 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18668 </ul>
18669 </div>
18670
18671
18672 !! html+tidy
18673 <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>
18674 <p>http://</p>
18675 <div id="toc" class="toc">
18676 <div class="toctitle">
18677 <h2>Contents</h2>
18678 </div>
18679 <ul>
18680 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18681 </ul>
18682 </div>
18683 <p></p>
18684 !! end
18685
18686 !! test
18687 Fuzz testing: Parser14-table
18688 !! options
18689 parsoid=wt2html,html2html
18690 !! wikitext
18691 ==a==
18692 {| STYLE=__TOC__
18693 !! html
18694 <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>
18695 <table style="&#95;_TOC&#95;_">
18696 <tr><td></td></tr>
18697 </table>
18698
18699 !! html+tidy
18700 <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>
18701 <table style="__TOC__">
18702 <tr>
18703 <td></td>
18704 </tr>
18705 </table>
18706 !! html/parsoid
18707 <h2>a</h2>
18708 <table style="__TOC__"></table>
18709 !! end
18710
18711 # Known to produce bogus xml (extra </td>)
18712 !! test
18713 Fuzz testing: Parser16
18714 !! wikitext
18715 {|
18716 !https://||||||
18717 !! html
18718 <table>
18719 <tr>
18720 <th>https://</th>
18721 <th></th>
18722 <th></th>
18723 <th>
18724 </td>
18725 </tr>
18726 </table>
18727
18728 !! html+tidy
18729 <table>
18730 <tr>
18731 <th>https://</th>
18732 <th></th>
18733 <th></th>
18734 <th></th>
18735 </tr>
18736 </table>
18737 !! end
18738
18739 !! test
18740 Fuzz testing: Parser21
18741 !! wikitext
18742 {|
18743 ! irc://{{ftp://a" onmouseover="alert('hello world');"
18744 |
18745 !! html
18746 <table>
18747 <tr>
18748 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18749 </th>
18750 <td>
18751 </td>
18752 </tr>
18753 </table>
18754
18755 !! end
18756
18757 !! test
18758 Fuzz testing: Parser22
18759 !! wikitext
18760 http://===r:::https://b
18761
18762 {|
18763 !! html
18764 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18765 </p>
18766 <table>
18767 <tr><td></td></tr>
18768 </table>
18769
18770 !! end
18771
18772 # Known to produce bad XML for now
18773 !! test
18774 Fuzz testing: Parser24
18775 !! options
18776 parsoid=wt2html
18777 !! wikitext
18778 {|
18779 {{{|
18780 <u CLASS=
18781 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18782 <br style="onmouseover='alert(document.cookie);' " />
18783
18784 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18785 |
18786 !! html/php
18787 <table>
18788 {{{|
18789 <u class="&#124;">}}}} &gt;
18790 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
18791
18792 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18793 <tr>
18794 <td></u>
18795 </td>
18796 </tr>
18797 </table>
18798
18799 !! html/parsoid
18800 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
18801 <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>"}'/>}}}} >
18802 <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}'>
18803
18804
18805
18806 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
18807 !! end
18808
18809 # Note: the current result listed for this is not what the original one was,
18810 # but the original bug was JavaScript injection, which is fixed in any case.
18811 # It's not clear that the original result listed was any more correct than the
18812 # current one. Original result:
18813 # <p>{{{|
18814 # </p>
18815 # <li class="&#124;&#124;">
18816 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18817 !!test
18818 Fuzz testing: Parser25 (T8055)
18819 !! wikitext
18820 {{{
18821 |
18822 <LI CLASS=||
18823 >
18824 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
18825 !! html/php
18826 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
18827 </p>
18828 !! html/parsoid
18829 <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"]}'>
18830 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
18831 !! end
18832
18833 !!test
18834 Fuzz testing: URL adjacent extension (with space, clean)
18835 !! wikitext
18836 http://example.com <nowiki>junk</nowiki>
18837 !! html/php
18838 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
18839 </p>
18840 !! html/parsoid
18841 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
18842 !! end
18843
18844 !!test
18845 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
18846 !! wikitext
18847 http://example.com<nowiki>junk</nowiki>
18848 !! html/php
18849 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
18850 </p>
18851 !! html/parsoid
18852 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
18853 !! end
18854
18855 !! test
18856 Fuzz testing: URL adjacent extension (no space, dirty; pre)
18857 !! wikitext
18858 http://example.com<pre>junk</pre>
18859 !! html/php
18860 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
18861
18862 !! html/php+tidy
18863 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
18864 <pre>
18865 junk
18866 </pre>
18867 !! html/parsoid
18868 <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>
18869 !! end
18870
18871 !! test
18872 Fuzz testing: image with bogus manual thumbnail
18873 !! wikitext
18874 [[Image:foobar.jpg|thumbnail= ]]
18875 !! html/php
18876 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
18877
18878 !! html/parsoid
18879 <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>
18880 !! end
18881
18882 !! test
18883 Fuzz testing: encoded newline in generated HTML replacements (T8577)
18884 !! wikitext
18885 <pre dir="&#10;"></pre>
18886 !! html/php
18887 <pre dir="&#10;"></pre>
18888
18889 !! html/parsoid
18890 <pre typeof="mw:Extension/pre" about="#mwt2" dir="&amp;#10;" data-mw='{"name":"pre","attrs":{"dir":"&amp;#10;"},"body":{"extsrc":""}}'></pre>
18891 !! end
18892
18893 !! test
18894 Parsing optional HTML elements (T8171)
18895 !! options
18896 !! wikitext
18897 <table>
18898 <tr>
18899 <td> Some tabular data</td>
18900 <td> More tabular data ...
18901 <td> And yet som tabular data</td>
18902 </tr>
18903 </table>
18904 !! html
18905 <table>
18906 <tr>
18907 <td> Some tabular data</td>
18908 <td> More tabular data ...
18909 </td><td> And yet som tabular data</td>
18910 </tr>
18911 </table>
18912
18913 !! end
18914
18915 !! test
18916 Correct handling of <td>, <tr> (T8171)
18917 !! options
18918 !! wikitext
18919 <table>
18920 <tr>
18921 <td> Some tabular data</td>
18922 <td> More tabular data ...</td>
18923 <td> And yet som tabular data</td>
18924 </tr>
18925 </table>
18926 !! html
18927 <table>
18928 <tr>
18929 <td> Some tabular data</td>
18930 <td> More tabular data ...</td>
18931 <td> And yet som tabular data</td>
18932 </tr>
18933 </table>
18934
18935 !! end
18936
18937
18938 !! test
18939 Parsing crashing regression (fr:JavaScript)
18940 !! wikitext
18941 </body></x>
18942 !! html
18943 <p>&lt;/body&gt;&lt;/x&gt;
18944 </p>
18945 !! end
18946
18947 !! test
18948 Inline wiki vs wiki block nesting
18949 !! wikitext
18950 '''Bold paragraph
18951
18952 New wiki paragraph
18953 !! html
18954 <p><b>Bold paragraph</b>
18955 </p><p>New wiki paragraph
18956 </p>
18957 !! end
18958
18959 # FIXME: The current php output is documented
18960 # and desired output is the parsoid target.
18961 !! test
18962 Inline HTML vs wiki block nesting
18963 !! wikitext
18964 <b>Bold paragraph
18965
18966 New wiki paragraph
18967 !! html/php
18968 <p><b>Bold paragraph
18969 </p><p>New wiki paragraph</b>
18970 </p>
18971 !! html/parsoid
18972 <p><b>Bold paragraph</b>
18973 </p><p>New wiki paragraph
18974 </p>
18975 !! end
18976
18977 # Original result was this:
18978 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
18979 # </p>
18980 # While that might be marginally more intuitive, maybe, the six-apostrophe
18981 # construct is clearly pathological and the result stated here (which is what
18982 # the parser actually does) is about as reasonable as anything.
18983 !!test
18984 Mixing markup for italics and bold
18985 !! options
18986 !! wikitext
18987 '''bold''''''bold''bolditalics'''''
18988 !! html
18989 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
18990 </p>
18991 !! end
18992
18993
18994 !! article
18995 Xyzzyx
18996 !! text
18997 Article for special page transclusion test
18998 !! endarticle
18999
19000 !! test
19001 Special page transclusion
19002 !! options
19003 !! wikitext
19004 {{Special:Prefixindex/Xyzzyx}}
19005 !! html
19006 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19007 </ul>
19008
19009 !! end
19010
19011 !! test
19012 Special page transclusion twice (T7021)
19013 !! options
19014 !! wikitext
19015 {{Special:Prefixindex/Xyzzyx}}
19016 {{Special:Prefixindex/Xyzzyx}}
19017 !! html
19018 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19019 </ul>
19020 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19021 </ul>
19022
19023 !! end
19024
19025 !! test
19026 Transclusion of default MediaWiki message
19027 !! wikitext
19028 {{MediaWiki:Mainpage}}
19029 !! html
19030 <p>Main Page
19031 </p>
19032 !! end
19033
19034 !! test
19035 Transclusion of nonexistent MediaWiki message
19036 !! wikitext
19037 {{MediaWiki:Mainpagexxx}}
19038 !! html
19039 <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>
19040 </p>
19041 !! end
19042
19043 !! test
19044 Transclusion of MediaWiki message with underscore
19045 !! wikitext
19046 {{MediaWiki:history_short}}
19047 !! html
19048 <p>History
19049 </p>
19050 !! end
19051
19052 !! test
19053 Transclusion of MediaWiki message with space
19054 !! wikitext
19055 {{MediaWiki:history short}}
19056 !! html
19057 <p>History
19058 </p>
19059 !! end
19060
19061 !! test
19062 Invalid header with following text
19063 !! wikitext
19064 = x = y
19065 !! html
19066 <p>= x = y
19067 </p>
19068 !! end
19069
19070
19071 !! test
19072 Section extraction test (section 0)
19073 !! options
19074 section=0
19075 !! wikitext
19076 start
19077 ==a==
19078 ===aa===
19079 ====aaa====
19080 ==b==
19081 ===ba===
19082 ===bb===
19083 ====bba====
19084 ===bc===
19085 ==c==
19086 ===ca===
19087 !! html/php
19088 start
19089 !! end
19090
19091 !! test
19092 Section extraction test (section 1)
19093 !! options
19094 section=1
19095 !! wikitext
19096 start
19097 ==a==
19098 ===aa===
19099 ====aaa====
19100 ==b==
19101 ===ba===
19102 ===bb===
19103 ====bba====
19104 ===bc===
19105 ==c==
19106 ===ca===
19107 !! html/php
19108 ==a==
19109 ===aa===
19110 ====aaa====
19111 !! end
19112
19113 !! test
19114 Section extraction test (section 2)
19115 !! options
19116 section=2
19117 !! wikitext
19118 start
19119 ==a==
19120 ===aa===
19121 ====aaa====
19122 ==b==
19123 ===ba===
19124 ===bb===
19125 ====bba====
19126 ===bc===
19127 ==c==
19128 ===ca===
19129 !! html/php
19130 ===aa===
19131 ====aaa====
19132 !! end
19133
19134 !! test
19135 Section extraction test (section 3)
19136 !! options
19137 section=3
19138 !! wikitext
19139 start
19140 ==a==
19141 ===aa===
19142 ====aaa====
19143 ==b==
19144 ===ba===
19145 ===bb===
19146 ====bba====
19147 ===bc===
19148 ==c==
19149 ===ca===
19150 !! html/php
19151 ====aaa====
19152 !! end
19153
19154 !! test
19155 Section extraction test (section 4)
19156 !! options
19157 section=4
19158 !! wikitext
19159 start
19160 ==a==
19161 ===aa===
19162 ====aaa====
19163 ==b==
19164 ===ba===
19165 ===bb===
19166 ====bba====
19167 ===bc===
19168 ==c==
19169 ===ca===
19170 !! html/php
19171 ==b==
19172 ===ba===
19173 ===bb===
19174 ====bba====
19175 ===bc===
19176 !! end
19177
19178 !! test
19179 Section extraction test (section 5)
19180 !! options
19181 section=5
19182 !! wikitext
19183 start
19184 ==a==
19185 ===aa===
19186 ====aaa====
19187 ==b==
19188 ===ba===
19189 ===bb===
19190 ====bba====
19191 ===bc===
19192 ==c==
19193 ===ca===
19194 !! html/php
19195 ===ba===
19196 !! end
19197
19198 !! test
19199 Section extraction test (section 6)
19200 !! options
19201 section=6
19202 !! wikitext
19203 start
19204 ==a==
19205 ===aa===
19206 ====aaa====
19207 ==b==
19208 ===ba===
19209 ===bb===
19210 ====bba====
19211 ===bc===
19212 ==c==
19213 ===ca===
19214 !! html/php
19215 ===bb===
19216 ====bba====
19217 !! end
19218
19219 !! test
19220 Section extraction test (section 7)
19221 !! options
19222 section=7
19223 !! wikitext
19224 start
19225 ==a==
19226 ===aa===
19227 ====aaa====
19228 ==b==
19229 ===ba===
19230 ===bb===
19231 ====bba====
19232 ===bc===
19233 ==c==
19234 ===ca===
19235 !! html/php
19236 ====bba====
19237 !! end
19238
19239 !! test
19240 Section extraction test (section 8)
19241 !! options
19242 section=8
19243 !! wikitext
19244 start
19245 ==a==
19246 ===aa===
19247 ====aaa====
19248 ==b==
19249 ===ba===
19250 ===bb===
19251 ====bba====
19252 ===bc===
19253 ==c==
19254 ===ca===
19255 !! html/php
19256 ===bc===
19257 !! end
19258
19259 !! test
19260 Section extraction test (section 9)
19261 !! options
19262 section=9
19263 !! wikitext
19264 start
19265 ==a==
19266 ===aa===
19267 ====aaa====
19268 ==b==
19269 ===ba===
19270 ===bb===
19271 ====bba====
19272 ===bc===
19273 ==c==
19274 ===ca===
19275 !! html/php
19276 ==c==
19277 ===ca===
19278 !! end
19279
19280 !! test
19281 Section extraction test (section 10)
19282 !! options
19283 section=10
19284 !! wikitext
19285 start
19286 ==a==
19287 ===aa===
19288 ====aaa====
19289 ==b==
19290 ===ba===
19291 ===bb===
19292 ====bba====
19293 ===bc===
19294 ==c==
19295 ===ca===
19296 !! html/php
19297 ===ca===
19298 !! end
19299
19300 !! test
19301 Section extraction test (nonexistent section 11)
19302 !! options
19303 section=11
19304 !! wikitext
19305 start
19306 ==a==
19307 ===aa===
19308 ====aaa====
19309 ==b==
19310 ===ba===
19311 ===bb===
19312 ====bba====
19313 ===bc===
19314 ==c==
19315 ===ca===
19316 !! html/php
19317 !! end
19318
19319 !! test
19320 Section extraction test with bogus heading (section 1)
19321 !! options
19322 section=1
19323 !! wikitext
19324 ==a==
19325 ==bogus== not a legal section
19326 ==b==
19327 !! html/php
19328 ==a==
19329 ==bogus== not a legal section
19330 !! end
19331
19332 !! test
19333 Section extraction test with bogus heading (section 2)
19334 !! options
19335 section=2
19336 !! wikitext
19337 ==a==
19338 ==bogus== not a legal section
19339 ==b==
19340 !! html/php
19341 ==b==
19342 !! end
19343
19344 !! test
19345 Section extraction test with comment after heading (section 1)
19346 !! options
19347 section=1
19348 !! wikitext
19349 ==a==
19350 ==b== <!-- -->
19351 ==c==
19352 !! html/php
19353 ==a==
19354 !! end
19355
19356 !! test
19357 Section extraction test with comment after heading (section 2)
19358 !! options
19359 section=2
19360 !! wikitext
19361 ==a==
19362 ==b== <!-- -->
19363 ==c==
19364 !! html/php
19365 ==b== <!-- -->
19366 !! end
19367
19368 !! test
19369 Section extraction test with bogus <nowiki> heading (section 1)
19370 !! options
19371 section=1
19372 !! wikitext
19373 ==a==
19374 ==bogus== <nowiki>not a legal section</nowiki>
19375 ==b==
19376 !! html/php
19377 ==a==
19378 ==bogus== <nowiki>not a legal section</nowiki>
19379 !! end
19380
19381 !! test
19382 Section extraction test with bogus <nowiki> heading (section 2)
19383 !! options
19384 section=2
19385 !! wikitext
19386 ==a==
19387 ==bogus== <nowiki>not a legal section</nowiki>
19388 ==b==
19389 !! html/php
19390 ==b==
19391 !! end
19392
19393 # Formerly testing for T4587, now resolved by the use of unmarked sections
19394 # instead of respecting commented sections
19395 !! test
19396 Section extraction prefixed by comment (section 1)
19397 !! options
19398 section=1
19399 !! wikitext
19400 <!-- -->==sec1==
19401 ==sec2==
19402 !! html/php
19403 ==sec2==
19404 !!end
19405
19406 !! test
19407 Section extraction prefixed by comment (section 2)
19408 !! options
19409 section=2
19410 !! wikitext
19411 <!-- -->==sec1==
19412 ==sec2==
19413 !! html/php
19414
19415 !!end
19416
19417 # Formerly testing for T4607, now resolved by the use of unmarked sections
19418 # instead of respecting HTML-style headings
19419 !! test
19420 Section extraction, mixed wiki and html (section 1)
19421 !! options
19422 section=1
19423 !! wikitext
19424 <h2>unmarked</h2>
19425 unmarked
19426 ==1==
19427 one
19428 ==2==
19429 two
19430 !! html/php
19431 ==1==
19432 one
19433 !! end
19434
19435 !! test
19436 Section extraction, mixed wiki and html (section 2)
19437 !! options
19438 section=2
19439 !! wikitext
19440 <h2>unmarked</h2>
19441 unmarked
19442 ==1==
19443 one
19444 ==2==
19445 two
19446 !! html/php
19447 ==2==
19448 two
19449 !! end
19450
19451
19452 # Formerly testing for T5342
19453 !! test
19454 Section extraction, heading surrounded by <noinclude>
19455 !! options
19456 section=1
19457 !! wikitext
19458 <noinclude>==unmarked==</noinclude>
19459 ==marked==
19460 !! html/php
19461 ==marked==
19462 !!end
19463
19464 # Test behavior of T21910
19465 !! test
19466 Sectiion with all-equals
19467 !! options
19468 section=2
19469 !! wikitext
19470 ===
19471 The line above must have a trailing space
19472 === <!--
19473 --> <!-- -->
19474 But just in case it doesn't...
19475 !! html/php
19476 === <!--
19477 --> <!-- -->
19478 But just in case it doesn't...
19479 !! end
19480
19481 !! test
19482 Section replacement test (section 0)
19483 !! options
19484 replace=0,"xxx"
19485 !! wikitext
19486 start
19487 ==a==
19488 ===aa===
19489 ====aaa====
19490 ==b==
19491 ===ba===
19492 ===bb===
19493 ====bba====
19494 ===bc===
19495 ==c==
19496 ===ca===
19497 !! html/php
19498 xxx
19499
19500 ==a==
19501 ===aa===
19502 ====aaa====
19503 ==b==
19504 ===ba===
19505 ===bb===
19506 ====bba====
19507 ===bc===
19508 ==c==
19509 ===ca===
19510 !! end
19511
19512 !! test
19513 Section replacement test (section 1)
19514 !! options
19515 replace=1,"xxx"
19516 !! wikitext
19517 start
19518 ==a==
19519 ===aa===
19520 ====aaa====
19521 ==b==
19522 ===ba===
19523 ===bb===
19524 ====bba====
19525 ===bc===
19526 ==c==
19527 ===ca===
19528 !! html/php
19529 start
19530 xxx
19531
19532 ==b==
19533 ===ba===
19534 ===bb===
19535 ====bba====
19536 ===bc===
19537 ==c==
19538 ===ca===
19539 !! end
19540
19541 !! test
19542 Section replacement test (section 2)
19543 !! options
19544 replace=2,"xxx"
19545 !! wikitext
19546 start
19547 ==a==
19548 ===aa===
19549 ====aaa====
19550 ==b==
19551 ===ba===
19552 ===bb===
19553 ====bba====
19554 ===bc===
19555 ==c==
19556 ===ca===
19557 !! html/php
19558 start
19559 ==a==
19560 xxx
19561
19562 ==b==
19563 ===ba===
19564 ===bb===
19565 ====bba====
19566 ===bc===
19567 ==c==
19568 ===ca===
19569 !! end
19570
19571 !! test
19572 Section replacement test (section 3)
19573 !! options
19574 replace=3,"xxx"
19575 !! wikitext
19576 start
19577 ==a==
19578 ===aa===
19579 ====aaa====
19580 ==b==
19581 ===ba===
19582 ===bb===
19583 ====bba====
19584 ===bc===
19585 ==c==
19586 ===ca===
19587 !! html/php
19588 start
19589 ==a==
19590 ===aa===
19591 xxx
19592
19593 ==b==
19594 ===ba===
19595 ===bb===
19596 ====bba====
19597 ===bc===
19598 ==c==
19599 ===ca===
19600 !! end
19601
19602 !! test
19603 Section replacement test (section 4)
19604 !! options
19605 replace=4,"xxx"
19606 !! wikitext
19607 start
19608 ==a==
19609 ===aa===
19610 ====aaa====
19611 ==b==
19612 ===ba===
19613 ===bb===
19614 ====bba====
19615 ===bc===
19616 ==c==
19617 ===ca===
19618 !! html/php
19619 start
19620 ==a==
19621 ===aa===
19622 ====aaa====
19623 xxx
19624
19625 ==c==
19626 ===ca===
19627 !! end
19628
19629 !! test
19630 Section replacement test (section 5)
19631 !! options
19632 replace=5,"xxx"
19633 !! wikitext
19634 start
19635 ==a==
19636 ===aa===
19637 ====aaa====
19638 ==b==
19639 ===ba===
19640 ===bb===
19641 ====bba====
19642 ===bc===
19643 ==c==
19644 ===ca===
19645 !! html/php
19646 start
19647 ==a==
19648 ===aa===
19649 ====aaa====
19650 ==b==
19651 xxx
19652
19653 ===bb===
19654 ====bba====
19655 ===bc===
19656 ==c==
19657 ===ca===
19658 !! end
19659
19660 !! test
19661 Section replacement test (section 6)
19662 !! options
19663 replace=6,"xxx"
19664 !! wikitext
19665 start
19666 ==a==
19667 ===aa===
19668 ====aaa====
19669 ==b==
19670 ===ba===
19671 ===bb===
19672 ====bba====
19673 ===bc===
19674 ==c==
19675 ===ca===
19676 !! html/php
19677 start
19678 ==a==
19679 ===aa===
19680 ====aaa====
19681 ==b==
19682 ===ba===
19683 xxx
19684
19685 ===bc===
19686 ==c==
19687 ===ca===
19688 !! end
19689
19690 !! test
19691 Section replacement test (section 7)
19692 !! options
19693 replace=7,"xxx"
19694 !! wikitext
19695 start
19696 ==a==
19697 ===aa===
19698 ====aaa====
19699 ==b==
19700 ===ba===
19701 ===bb===
19702 ====bba====
19703 ===bc===
19704 ==c==
19705 ===ca===
19706 !! html/php
19707 start
19708 ==a==
19709 ===aa===
19710 ====aaa====
19711 ==b==
19712 ===ba===
19713 ===bb===
19714 xxx
19715
19716 ===bc===
19717 ==c==
19718 ===ca===
19719 !! end
19720
19721 !! test
19722 Section replacement test (section 8)
19723 !! options
19724 replace=8,"xxx"
19725 !! wikitext
19726 start
19727 ==a==
19728 ===aa===
19729 ====aaa====
19730 ==b==
19731 ===ba===
19732 ===bb===
19733 ====bba====
19734 ===bc===
19735 ==c==
19736 ===ca===
19737 !! html/php
19738 start
19739 ==a==
19740 ===aa===
19741 ====aaa====
19742 ==b==
19743 ===ba===
19744 ===bb===
19745 ====bba====
19746 xxx
19747
19748 ==c==
19749 ===ca===
19750 !!end
19751
19752 !! test
19753 Section replacement test (section 9)
19754 !! options
19755 replace=9,"xxx"
19756 !! wikitext
19757 start
19758 ==a==
19759 ===aa===
19760 ====aaa====
19761 ==b==
19762 ===ba===
19763 ===bb===
19764 ====bba====
19765 ===bc===
19766 ==c==
19767 ===ca===
19768 !! html/php
19769 start
19770 ==a==
19771 ===aa===
19772 ====aaa====
19773 ==b==
19774 ===ba===
19775 ===bb===
19776 ====bba====
19777 ===bc===
19778 xxx
19779 !! end
19780
19781 !! test
19782 Section replacement test (section 10)
19783 !! options
19784 replace=10,"xxx"
19785 !! wikitext
19786 start
19787 ==a==
19788 ===aa===
19789 ====aaa====
19790 ==b==
19791 ===ba===
19792 ===bb===
19793 ====bba====
19794 ===bc===
19795 ==c==
19796 ===ca===
19797 !! html/php
19798 start
19799 ==a==
19800 ===aa===
19801 ====aaa====
19802 ==b==
19803 ===ba===
19804 ===bb===
19805 ====bba====
19806 ===bc===
19807 ==c==
19808 xxx
19809 !! end
19810
19811 !! test
19812 Section replacement test with initial whitespace (T15728)
19813 !! options
19814 replace=2,"xxx"
19815 !! wikitext
19816 Preformatted initial line
19817 ==a==
19818 ===a===
19819 !! html/php
19820 Preformatted initial line
19821 ==a==
19822 xxx
19823 !! end
19824
19825
19826 !! test
19827 Section extraction, heading followed by pre with 20 spaces (T8398)
19828 !! options
19829 section=1
19830 !! wikitext
19831 ==a==
19832 a
19833 !! html/php
19834 ==a==
19835 a
19836 !! end
19837
19838 !! test
19839 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
19840 !! options
19841 section=1
19842 !! wikitext
19843 ==a==
19844 a
19845 !! html/php
19846 ==a==
19847 a
19848 !! end
19849
19850
19851 !! test
19852 Section extraction, <pre> around bogus header (T12309)
19853 !! options
19854 section=2
19855 !! wikitext
19856 == Section One ==
19857 <pre>
19858 =======
19859 </pre>
19860
19861 == Section Two ==
19862 stuff
19863 !! html/php
19864 == Section Two ==
19865 stuff
19866 !! end
19867
19868 !! test
19869 Section replacement, <pre> around bogus header (T12309)
19870 !! options
19871 replace=2,"xxx"
19872 !! wikitext
19873 == Section One ==
19874 <pre>
19875 =======
19876 </pre>
19877
19878 == Section Two ==
19879 stuff
19880 !! html/php
19881 == Section One ==
19882 <pre>
19883 =======
19884 </pre>
19885
19886 xxx
19887 !! end
19888
19889 !! test
19890 Handling of &#x0A; in URLs
19891 !! wikitext
19892 ** irc://&#x0A;a
19893 !! html/php
19894 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19895
19896 !! html/parsoid
19897 <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>
19898 !! end
19899
19900 !! test
19901 Handling of %0A in URLs
19902 !! wikitext
19903 ** irc://%0Aa
19904 !! html/php
19905 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19906
19907 !! html/parsoid
19908 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
19909 !! end
19910
19911 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
19912 !! test
19913 5 quotes, code coverage +1 line
19914 !! options
19915 parsoid=wt2html
19916 !! wikitext
19917 '''''
19918 !! html/php
19919 !! html/parsoid
19920 <p><b><i></i></b></p>
19921 !! end
19922
19923 # same html as previous, but wikitext adjusted to match parsoid html2wt
19924 # note that wt2html and html2html will put the <i> before the <b>
19925 !! test
19926 5 quotes, code coverage +1 line w/ nowiki (1)
19927 !! options
19928 parsoid=wt2wt,html2wt
19929 !! wikitext
19930 '''''<nowiki/>'''''
19931 !! html/php
19932 <p><i></i>
19933 </p>
19934 !! html/parsoid
19935 <p><b><i></i></b></p>
19936 !! end
19937
19938 # same as previous, just swapping the <i> and <b>
19939 !! test
19940 5 quotes, code coverage +1 line w/ nowiki (2)
19941 !! wikitext
19942 '''''<nowiki/>'''''
19943 !! html/php
19944 <p><i></i>
19945 </p>
19946 !! html/parsoid
19947 <p><i><b></b></i></p>
19948 !! end
19949
19950 !! test
19951 Special:Search page linking.
19952 !! wikitext
19953 {{Special:search}}
19954 !! html
19955 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
19956 </p>
19957 !! end
19958
19959 !! test
19960 {{!}} is a magic word
19961 !! wikitext
19962 {{!}} is a magic word there and {{!}} is still a magic word here
19963 | is not a magic word here but {{!}} is still a magic word here
19964 !! html/php
19965 <p>| is a magic word there and | is still a magic word here
19966 | is not a magic word here but | is still a magic word here
19967 </p>
19968 !! html/parsoid
19969 <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
19970 | 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>
19971 !! end
19972
19973 !! test
19974 Say the magic word
19975 !! options
19976 title=[[Parser test]]
19977 !! wikitext
19978 * {{PAGENAME}}
19979 * {{PAGENAMEE}}
19980 * {{FULLPAGENAME}}
19981 * {{FULLPAGENAMEE}}
19982 * {{BASEPAGENAME}}
19983 * {{BASEPAGENAMEE}}
19984 * {{SUBPAGENAME}}
19985 * {{SUBPAGENAMEE}}
19986 * {{ROOTPAGENAME}}
19987 * {{ROOTPAGENAMEE}}
19988 * {{TALKPAGENAME}}
19989 * {{TALKPAGENAMEE}}
19990 * {{SUBJECTPAGENAME}}
19991 * {{SUBJECTPAGENAMEE}}
19992 * {{NAMESPACEE}}
19993 * {{NAMESPACE}}
19994 * {{NAMESPACENUMBER}}
19995 * {{TALKSPACE}}
19996 * {{TALKSPACEE}}
19997 * {{SUBJECTSPACE}}
19998 * {{SUBJECTSPACEE}}
19999 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20000 !! html
20001 <ul><li> Parser test</li>
20002 <li> Parser_test</li>
20003 <li> Parser test</li>
20004 <li> Parser_test</li>
20005 <li> Parser test</li>
20006 <li> Parser_test</li>
20007 <li> Parser test</li>
20008 <li> Parser_test</li>
20009 <li> Parser test</li>
20010 <li> Parser_test</li>
20011 <li> Talk:Parser test</li>
20012 <li> Talk:Parser_test</li>
20013 <li> Parser test</li>
20014 <li> Parser_test</li>
20015 <li> </li>
20016 <li> </li>
20017 <li> 0</li>
20018 <li> Talk</li>
20019 <li> Talk</li>
20020 <li> </li>
20021 <li> </li>
20022 <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>
20023
20024 !! end
20025 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20026
20027 !! test
20028 Gallery with valid attributes
20029 !! wikitext
20030 <gallery type="123" summary="345">
20031 File:File:Foobar.jpg
20032 </gallery>
20033 !! html/php
20034 <ul class="gallery mw-gallery-traditional" type="123">
20035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20036 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20037 <div class="gallerytext">
20038 </div>
20039 </div></li>
20040 </ul>
20041
20042 !! html/parsoid
20043 <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"}}'>
20044 <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>
20045 </ul>
20046 !! end
20047
20048 ## Parsoid thinks the "centre" here is a property, not a caption.
20049 !! test
20050 Gallery
20051 !! options
20052 parsoid={
20053 "modes": ["wt2html"],
20054 "nativeGallery": true
20055 }
20056 !! wikitext
20057 <gallery>
20058 image1.png |
20059 image2.gif|||||
20060
20061 image3|
20062 image4 |300px| centre
20063 image5.svg| http://///////
20064 [[x|xx]]]]
20065 * image6
20066 </gallery>
20067 !! html/php
20068 <ul class="gallery mw-gallery-traditional">
20069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20070 <div class="thumb" style="height: 150px;">Image1.png</div>
20071 <div class="gallerytext">
20072 </div>
20073 </div></li>
20074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20075 <div class="thumb" style="height: 150px;">Image2.gif</div>
20076 <div class="gallerytext">
20077 </div>
20078 </div></li>
20079 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20080 <div class="thumb" style="height: 150px;">Image3</div>
20081 <div class="gallerytext">
20082 </div>
20083 </div></li>
20084 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20085 <div class="thumb" style="height: 150px;">Image4</div>
20086 <div class="gallerytext">
20087 <pre>centre
20088 </pre>
20089 </div>
20090 </div></li>
20091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20092 <div class="thumb" style="height: 150px;">Image5.svg</div>
20093 <div class="gallerytext">
20094 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20095 </p>
20096 </div>
20097 </div></li>
20098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20099 <div class="thumb" style="height: 150px;">* image6</div>
20100 <div class="gallerytext">
20101 </div>
20102 </div></li>
20103 </ul>
20104
20105 !! html/parsoid
20106 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20107 <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>
20108 <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>
20109 <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>
20110 <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>
20111 <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>
20112 <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>
20113 </ul>
20114 !! end
20115
20116 !! test
20117 Gallery (with options, html)
20118 !! options
20119 parsoid={
20120 "modes": ["wt2html", "html2html"],
20121 "nativeGallery": true
20122 }
20123 !! wikitext
20124 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20125 File:Nonexistent.jpg|caption
20126 File:Nonexistent.jpg
20127 image:foobar.jpg|some '''caption''' [[Main Page]]
20128 image:foobar.jpg
20129 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20130 </gallery>
20131 !! html/php
20132 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20133 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20134 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20135 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20136 <div class="gallerytext">
20137 <p>caption
20138 </p>
20139 </div>
20140 </div></li>
20141 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20142 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20143 <div class="gallerytext">
20144 </div>
20145 </div></li>
20146 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20147 <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>
20148 <div class="gallerytext">
20149 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20150 </p>
20151 </div>
20152 </div></li>
20153 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20154 <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>
20155 <div class="gallerytext">
20156 </div>
20157 </div></li>
20158 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20159 <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>
20160 <div class="gallerytext">
20161 <p>blabla.
20162 </p>
20163 </div>
20164 </div></li>
20165 </ul>
20166
20167 !! html/parsoid
20168 <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":{}}'>
20169 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20170 <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>
20171 <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>
20172 <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>
20173 <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>
20174 <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>
20175 </ul>
20176 !! end
20177
20178 !! test
20179 Gallery (with options, extsrc)
20180 !! options
20181 parsoid={
20182 "nativeGallery": false
20183 }
20184 !! wikitext
20185 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20186 File:Nonexistent.jpg|caption
20187 File:Nonexistent.jpg
20188 image:foobar.jpg|some '''caption''' [[Main Page]]
20189 image:foobar.jpg
20190 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20191 </gallery>
20192 !! html/php
20193 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20194 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20195 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20196 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20197 <div class="gallerytext">
20198 <p>caption
20199 </p>
20200 </div>
20201 </div></li>
20202 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20203 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20204 <div class="gallerytext">
20205 </div>
20206 </div></li>
20207 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20208 <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>
20209 <div class="gallerytext">
20210 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20211 </p>
20212 </div>
20213 </div></li>
20214 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20215 <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>
20216 <div class="gallerytext">
20217 </div>
20218 </div></li>
20219 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20220 <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>
20221 <div class="gallerytext">
20222 <p>blabla.
20223 </p>
20224 </div>
20225 </div></li>
20226 </ul>
20227
20228 !! html/parsoid
20229 <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"}}'>
20230 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20231 <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>
20232 <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>
20233 <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>
20234 <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>
20235 <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>
20236 </ul>
20237 !! end
20238
20239 !! test
20240 Gallery with link that has fragment
20241 !! options
20242 parsoid={
20243 "modes": ["wt2html", "html2html"],
20244 "nativeGallery": true
20245 }
20246 !! wikitext
20247 <gallery>
20248 image:foobar.jpg|link=Main_Page
20249 image:foobar.jpg|link=Main_Page#section
20250 image:foobar.jpg|link=Main Page#section|caption
20251 </gallery>
20252 !! html/php
20253 <ul class="gallery mw-gallery-traditional">
20254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20255 <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>
20256 <div class="gallerytext">
20257 </div>
20258 </div></li>
20259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20260 <div class="thumb" style="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>
20261 <div class="gallerytext">
20262 </div>
20263 </div></li>
20264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20265 <div class="thumb" style="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>
20266 <div class="gallerytext">
20267 <p>caption
20268 </p>
20269 </div>
20270 </div></li>
20271 </ul>
20272
20273 !! html/parsoid
20274 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20275 <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>
20276 <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>
20277 <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>
20278 </ul>
20279 !! end
20280
20281 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20282 !! test
20283 Gallery with template inside caption
20284 !! options
20285 parsoid={
20286 "nativeGallery": true
20287 }
20288 !! wikitext
20289 <gallery caption="{{echo|hi}}">
20290 File:Foobar.jpg|{{echo|ho}}
20291 </gallery>
20292 !! html/php
20293 <ul class="gallery mw-gallery-traditional">
20294 <li class='gallerycaption'>{{echo|hi}}</li>
20295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20296 <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>
20297 <div class="gallerytext">
20298 <p>ho
20299 </p>
20300 </div>
20301 </div></li>
20302 </ul>
20303
20304 !! html/parsoid
20305 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20306 <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>
20307 <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>
20308 </ul>
20309 !! end
20310
20311 !! test
20312 Gallery with wikitext inside caption
20313 !! options
20314 parsoid={
20315 "nativeGallery": true
20316 }
20317 !! wikitext
20318 <gallery>
20319 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20320 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20321 </gallery>
20322 !! html/php
20323 <ul class="gallery mw-gallery-traditional">
20324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20325 <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>
20326 <div class="gallerytext">
20327 <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>
20328 </p>
20329 </div>
20330 </div></li>
20331 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20332 <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>
20333 <div class="gallerytext">
20334 <p>This is a test template
20335 </p>
20336 </div>
20337 </div></li>
20338 </ul>
20339
20340 !! html/parsoid
20341 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20342 <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>
20343 <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>
20344 </ul>
20345 !! end
20346
20347 !! test
20348 Gallery (with showfilename option)
20349 !! options
20350 parsoid={
20351 "nativeGallery": true
20352 }
20353 !! wikitext
20354 <gallery showfilename="">
20355 File:Nonexistent.jpg|caption
20356 File:Nonexistent.jpg
20357 File:Foobar.jpg|some '''caption''' [[Main Page]]
20358 File:Foobar.jpg
20359 </gallery>
20360 !! html/php
20361 <ul class="gallery mw-gallery-traditional">
20362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20363 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20364 <div class="gallerytext">
20365 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20366 caption
20367 </p>
20368 </div>
20369 </div></li>
20370 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20371 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20372 <div class="gallerytext">
20373 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20374 </p>
20375 </div>
20376 </div></li>
20377 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20378 <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>
20379 <div class="gallerytext">
20380 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20381 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20382 </p>
20383 </div>
20384 </div></li>
20385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20386 <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>
20387 <div class="gallerytext">
20388 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20389 </p>
20390 </div>
20391 </div></li>
20392 </ul>
20393
20394 !! html/parsoid
20395 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20396 <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>
20397 <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>
20398 <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>
20399 <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>
20400 </ul>
20401 !! end
20402
20403 ## Should Parsoid be preserving these variations? See T151367
20404 !! test
20405 Gallery (with namespace-less filenames)
20406 !! options
20407 parsoid={
20408 "modes": ["wt2html", "html2html"],
20409 "nativeGallery": true
20410 }
20411 !! wikitext
20412 <gallery>
20413 File:Nonexistent.jpg
20414 Nonexistent.jpg
20415 image:foobar.jpg
20416 foobar.jpg
20417 </gallery>
20418 !! html/php
20419 <ul class="gallery mw-gallery-traditional">
20420 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20421 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20422 <div class="gallerytext">
20423 </div>
20424 </div></li>
20425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20426 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20427 <div class="gallerytext">
20428 </div>
20429 </div></li>
20430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20431 <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>
20432 <div class="gallerytext">
20433 </div>
20434 </div></li>
20435 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20436 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20437 <div class="gallerytext">
20438 </div>
20439 </div></li>
20440 </ul>
20441
20442 !! html/parsoid
20443 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20444 <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>
20445 <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>
20446 <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>
20447 <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>
20448 </ul>
20449 !! end
20450
20451 !! test
20452 Gallery override link with WikiLink (T36852)
20453 !! options
20454 parsoid={
20455 "nativeGallery": true
20456 }
20457 !! wikitext
20458 <gallery>
20459 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
20460 </gallery>
20461 !! html/php
20462 <ul class="gallery mw-gallery-traditional">
20463 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20464 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
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-parsoid='{"dsr":[0,70,2,2]}' 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="./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>
20473 </ul>
20474 !! end
20475
20476 !! test
20477 Gallery override link with absolute external link (T36852)
20478 !! options
20479 parsoid={
20480 "nativeGallery": true
20481 }
20482 !! wikitext
20483 <gallery>
20484 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20485 </gallery>
20486 !! html/php
20487 <ul class="gallery mw-gallery-traditional">
20488 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20489 <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>
20490 <div class="gallerytext">
20491 </div>
20492 </div></li>
20493 </ul>
20494
20495 !! html/parsoid
20496 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20497 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><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>
20498 </ul>
20499 !! end
20500
20501 !! test
20502 Gallery override link with absolute external link with LanguageConverter
20503 !! options
20504 language=zh
20505 !! input
20506 <gallery>
20507 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20508 </gallery>
20509 !! result
20510 <ul class="gallery mw-gallery-traditional">
20511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20512 <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>
20513 <div class="gallerytext">
20514 <p>caption
20515 </p>
20516 </div>
20517 </div></li>
20518 </ul>
20519
20520 !! end
20521
20522 !! test
20523 Gallery override link with malicious javascript (T36852)
20524 !! options
20525 parsoid={
20526 "modes": ["wt2html", "html2html"],
20527 "nativeGallery": true
20528 }
20529 !! wikitext
20530 <gallery>
20531 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20532 </gallery>
20533 !! html/php
20534 <ul class="gallery mw-gallery-traditional">
20535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20536 <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>
20537 <div class="gallerytext">
20538 </div>
20539 </div></li>
20540 </ul>
20541
20542 !! html/parsoid
20543 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20544 <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>
20545 </ul>
20546 !! end
20547
20548 # Note that parsoid uses the invalid link as a caption, PHP does not.
20549 !! test
20550 Gallery with invalid title as link (T45964)
20551 !! options
20552 parsoid={
20553 "modes": ["wt2html", "html2html"],
20554 "nativeGallery": true
20555 }
20556 !! wikitext
20557 <gallery>
20558 File:Foobar.jpg|link=<
20559 </gallery>
20560 !! html/php
20561 <ul class="gallery mw-gallery-traditional">
20562 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20563 <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>
20564 <div class="gallerytext">
20565 </div>
20566 </div></li>
20567 </ul>
20568
20569 !! html/parsoid
20570 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20571 <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>
20572 </ul>
20573 !! end
20574
20575 !! test
20576 Serialize gallery without attrs in data-mw
20577 !! options
20578 parsoid={
20579 "modes": ["html2wt"],
20580 "nativeGallery": true
20581 }
20582 !! html/parsoid
20583 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20584 <li class="gallerycaption">123</li>
20585 <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>
20586 </ul>
20587 !! wikitext
20588 <gallery caption="123">
20589 File:Test.png
20590 </gallery>
20591 !! end
20592
20593 !! test
20594 Gallery with class and style attributes
20595 !! options
20596 parsoid={
20597 "nativeGallery": true
20598 }
20599 !! wikitext
20600 <gallery class="center" style="text-align: center;">
20601 File:Foobar.jpg
20602 </gallery>
20603 !! html/php
20604 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
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-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
20614 <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>
20615 </ul>
20616 !! end
20617
20618 !! test
20619 Gallery in slideshow mode
20620 !! options
20621 parsoid={
20622 "nativeGallery": true
20623 }
20624 !! wikitext
20625 <gallery mode="slideshow" showthumbnails="">
20626 File:Foobar.jpg
20627 </gallery>
20628 !! html/php
20629 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20630 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20631 <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>
20632 <div class="gallerytext">
20633 </div>
20634 </div></li>
20635 </ul>
20636
20637 !! html/parsoid
20638 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20639 <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>
20640 </ul>
20641 !! end
20642
20643 !! test
20644 HTML Hex character encoding (spells the word "JavaScript")
20645 !! options
20646 parsoid=wt2html,wt2wt,html2html
20647 !! wikitext
20648 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20649 !! html/php
20650 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20651 </p>
20652 !! html/php+tidy
20653 <p>JavaScript</p>
20654 !! html/parsoid
20655 <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>
20656 !! end
20657
20658 !! test
20659 HTML Hex character encoding bogus encoding (T28437 regression check)
20660 !! wikitext
20661 &#xsee;&#XSEE;
20662 !! html/php
20663 <p>&amp;#xsee;&amp;#XSEE;
20664 </p>
20665 !! html/parsoid
20666 <p>&amp;#xsee;&amp;#XSEE;</p>
20667 !! end
20668
20669 !! test
20670 HTML Hex character encoding mixed case
20671 !! options
20672 parsoid=wt2html,wt2wt,html2html
20673 !! wikitext
20674 &#xEE;&#Xee;
20675 !! html/php
20676 <p>&#xee;&#xee;
20677 </p>
20678 !! html/php+tidy
20679 <p>îî</p>
20680 !! html/parsoid
20681 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20682 !! end
20683
20684 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20685 # Note that U+000C (form feed) is not a valid XML character, so
20686 # it is banned even though allowed in HTML5.
20687 !! test
20688 Illegal character references (T106578)
20689 !! wikitext
20690 ; Null: &#00;
20691 ; FF: &#xC;
20692 ; CR: &#xD;
20693 ; Control (low): &#8;
20694 ; Control (high): &#x7F; &#x9F;
20695 ; Surrogate: &#xD83D;&#xDCA9;
20696 ; This is an okay astral character: &#x1F4A9;
20697 !! html+tidy
20698 <dl>
20699 <dt>Null</dt>
20700 <dd>&amp;#00;</dd>
20701 <dt>FF</dt>
20702 <dd>&amp;#xC;</dd>
20703 <dt>CR</dt>
20704 <dd>&amp;#xD;</dd>
20705 <dt>Control (low)</dt>
20706 <dd>&amp;#8;</dd>
20707 <dt>Control (high)</dt>
20708 <dd>&amp;#x7F; &amp;#x9F;</dd>
20709 <dt>Surrogate</dt>
20710 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20711 <dt>This is an okay astral character</dt>
20712 <dd>💩</dd>
20713 </dl>
20714 !! end
20715
20716 !! test
20717 __FORCETOC__ override
20718 !! wikitext
20719 __NEWSECTIONLINK__
20720 __FORCETOC__
20721 !! html/php
20722 <p><br />
20723 </p>
20724 !! end
20725
20726 !! test
20727 ISBN code coverage
20728 !! wikitext
20729 ISBN 978-0-1234-56&#x20;789
20730 !! html
20731 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
20732 </p>
20733 !! html+tidy
20734 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
20735 !! html/parsoid
20736 <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>
20737 !! end
20738
20739 !! test
20740 ISBN followed by 5 spaces
20741 !! wikitext
20742 ISBN
20743 !! html
20744 <p>ISBN
20745 </p>
20746 !! end
20747
20748 !! test
20749 Double ISBN
20750 !! wikitext
20751 ISBN ISBN 1234567890
20752 !! html/php
20753 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20754 </p>
20755 !! html/parsoid
20756 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
20757 !! end
20758
20759 # Uppercase X and lowercase x as well
20760 !! test
20761 ISBN with an X
20762 !! wikitext
20763 ISBN 3-462-04561-X
20764 ISBN 3-462-04561-x
20765 ISBN 080442957X
20766 ISBN 080442957x
20767 ISBN 978080442957X
20768 ISBN 978080442957x
20769 !! html/php
20770 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
20771 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
20772 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
20773 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
20774 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
20775 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
20776 </p>
20777 !! html/parsoid
20778 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
20779 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
20780 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
20781 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
20782 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
20783 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
20784 !! end
20785
20786 !! test
20787 ISBN with empty prefix (parsoid test)
20788 !! wikitext
20789 ISBN 1234567890
20790 !! html/php
20791 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20792 </p>
20793 !! html/parsoid
20794 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
20795 !! end
20796
20797 !! test
20798 T24905: <abbr> followed by ISBN followed by </a>
20799 !! wikitext
20800 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
20801 !! html/php
20802 <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>
20803 </p>
20804 !! html/parsoid
20805 <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>
20806 !! end
20807
20808 !! test
20809 Double RFC
20810 !! wikitext
20811 RFC RFC 1234
20812 !! html
20813 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
20814 </p>
20815 !! end
20816
20817 !! test
20818 Double RFC with a wiki link
20819 !! wikitext
20820 RFC [[RFC 1234]]
20821 !! html
20822 <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>
20823 </p>
20824 !! end
20825
20826 !! test
20827 RFC code coverage
20828 !! wikitext
20829 RFC 983&#x20;987
20830 !! html
20831 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
20832 </p>
20833 !! html+tidy
20834 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
20835 !! end
20836
20837 !! test
20838 Centre-aligned image
20839 !! wikitext
20840 [[Image:foobar.jpg|centre]]
20841 !! html
20842 <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>
20843
20844 !!end
20845
20846 !! test
20847 None-aligned image
20848 !! wikitext
20849 [[Image:foobar.jpg|none]]
20850 !! html
20851 <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>
20852
20853 !!end
20854
20855 !! test
20856 Width + Height sized image (using px) (height is ignored)
20857 !! wikitext
20858 [[Image:foobar.jpg|640x480px]]
20859 !! html
20860 <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>
20861 </p>
20862 !!end
20863
20864 !! test
20865 Width-sized image (using px, no following whitespace)
20866 !! wikitext
20867 [[Image:foobar.jpg|640px]]
20868 !! html
20869 <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>
20870 </p>
20871 !!end
20872
20873 !! test
20874 Width-sized image (using px, with following whitespace - test regression from r39467)
20875 !! wikitext
20876 [[Image:foobar.jpg|640px ]]
20877 !! html
20878 <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>
20879 </p>
20880 !!end
20881
20882 !! test
20883 Width-sized image (using px, with preceding whitespace - test regression from r39467)
20884 !! wikitext
20885 [[Image:foobar.jpg| 640px]]
20886 !! html
20887 <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>
20888 </p>
20889 !!end
20890
20891 !! test
20892 Image with page parameter
20893 !! options
20894 djvu
20895 !! wikitext
20896 [[File:LoremIpsum.djvu|page=2]]
20897 !! html/php
20898 <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>
20899 </p>
20900 !! html/parsoid
20901 <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>
20902 !! end
20903
20904 !! test
20905 Another italics / bold test
20906 !! wikitext
20907 ''' ''x'
20908 !! html
20909 <pre>'<i> </i>x'
20910 </pre>
20911 !!end
20912
20913 # FIXME: The php output seems broken. It's interleaving some open/close tags.
20914 !! test
20915 dt/dd/dl test
20916 !! wikitext
20917 :;;;::
20918 !! html/php
20919 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
20920
20921 !! html/parsoid
20922 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
20923
20924 !!end
20925
20926 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
20927 !! test
20928 Images with the "|" character in the comment
20929 !! wikitext
20930 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
20931 !! html/php
20932 <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>
20933
20934 !! html/parsoid
20935 <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>
20936 !! end
20937
20938 !! test
20939 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
20940 !! wikitext
20941 <html><script>alert(1);</script></html>
20942 !! html
20943 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
20944 </p>
20945 !! end
20946
20947 !! test
20948 HTML with raw HTML ($wgRawHtml==true)
20949 !! options
20950 wgRawHtml=1
20951 !! wikitext
20952 <html><script>alert(1);</script></html>
20953 !! html/php
20954 <p><script>alert(1);</script>
20955 </p>
20956 !! end
20957
20958 !! test
20959 Parents of subpages, one level up
20960 !! options
20961 subpage title=[[Subpage test/L1/L2/L3]]
20962 !! wikitext
20963 [[../|L2]]
20964 !! html
20965 <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>
20966 </p>
20967 !! end
20968
20969
20970 !! test
20971 Parents of subpages, one level up, not named
20972 !! options
20973 subpage title=[[Subpage test/L1/L2/L3]]
20974 !! wikitext
20975 [[../]]
20976 !! html
20977 <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>
20978 </p>
20979 !! end
20980
20981
20982
20983 !! test
20984 Parents of subpages, two levels up
20985 !! options
20986 subpage title=[[Subpage test/L1/L2/L3]]
20987 !! wikitext
20988 [[../../|L1]]2
20989
20990 [[../../|L1]]l
20991 !! html
20992 <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
20993 </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>
20994 </p>
20995 !! end
20996
20997 !! test
20998 Parents of subpages, two levels up, without trailing slash or name.
20999 !! options
21000 subpage title=[[Subpage test/L1/L2/L3]]
21001 !! wikitext
21002 [[../..]]
21003 !! html
21004 <p>[[../..]]
21005 </p>
21006 !! end
21007
21008 !! test
21009 Parents of subpages, two levels up, with lots of extra trailing slashes.
21010 !! options
21011 subpage title=[[Subpage test/L1/L2/L3]]
21012 !! wikitext
21013 [[../../////]]
21014 !! html
21015 <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>
21016 </p>
21017 !! end
21018
21019 !! article
21020 Subpage test/L1/L2/L3Sibling
21021 !! text
21022 Sibling article
21023 !! endarticle
21024
21025 !! test
21026 Transclusion of a sibling page (one level up)
21027 !! options
21028 subpage title=[[Subpage test/L1/L2/L3]]
21029 !! wikitext
21030 {{../L3Sibling}}
21031 !! html
21032 <p>Sibling article
21033 </p>
21034 !! end
21035
21036 !! test
21037 Transclusion of a child page
21038 !! options
21039 subpage title=[[Subpage test/L1/L2]]
21040 !! wikitext
21041 {{/L3Sibling}}
21042 !! html
21043 <p>Sibling article
21044 </p>
21045 !! end
21046
21047 # This is wt2html only in Parsoid because we add <nowiki>
21048 # because of {{..}} and we don't expect to fix that to
21049 # eliminate the nowikis selective for {{..}} markup.
21050 !! test
21051 Non-transclusion because of too many up levels
21052 !! options
21053 subpage title=[[Subpage test/L1/L2/L3]]
21054 parsoid=wt2html
21055 !! wikitext
21056 {{../../../../More than parent}}
21057 !! html/php
21058 <p>{{../../../../More than parent}}
21059 </p>
21060 !! html/parsoid
21061 <p>{{../../../../More than parent}}</p>
21062 !! end
21063
21064 !! test
21065 Definition list code coverage
21066 !! wikitext
21067 ; title : def
21068 ; title : def
21069 ;title: def
21070 !! html/php
21071 <dl><dt> title &#160;</dt>
21072 <dd> def</dd>
21073 <dt> title&#160;</dt>
21074 <dd> def</dd>
21075 <dt>title</dt>
21076 <dd> def</dd></dl>
21077
21078 !! html/parsoid
21079 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21080 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21081 <dt>title</dt><dd> def</dd></dl>
21082 !! end
21083
21084 !! test
21085 Don't fall for the self-closing div
21086 !! wikitext
21087 <div>hello world</div/>
21088 !! html
21089 <div>hello world</div>
21090
21091 !! end
21092
21093 !! test
21094 MSGNW magic word
21095 !! wikitext
21096 {{MSGNW:msg}}
21097 !! html/php
21098 <p>&#91;&#91;:Template:Msg&#93;&#93;
21099 </p>
21100 !! end
21101
21102 !! test
21103 RAW magic word
21104 !! wikitext
21105 {{RAW:QUERTY}}
21106 !! html
21107 <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>
21108 </p>
21109 !! end
21110
21111 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21112 !! test
21113 Always escape literal '>' in output, not just after '<'
21114 !! wikitext
21115 ><>
21116 !! html
21117 <p>&gt;&lt;&gt;
21118 </p>
21119 !! end
21120
21121 !! test
21122 Template caching
21123 !! wikitext
21124 {{Test}}
21125 {{Test}}
21126 !! html
21127 <p>This is a test template
21128 This is a test template
21129 </p>
21130 !! end
21131
21132
21133 !! article
21134 MediaWiki:Fake
21135 !! text
21136 ==header==
21137 !! endarticle
21138
21139 !! test
21140 Inclusion of !userCanEdit() content
21141 !! wikitext
21142 {{MediaWiki:Fake}}
21143 !! html
21144 <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>
21145
21146 !! end
21147
21148
21149 !! test
21150 Out-of-order TOC heading levels
21151 !! wikitext
21152 ==2==
21153 ======6======
21154 ===3===
21155 =1=
21156 =====5=====
21157 ==2==
21158 !! html
21159 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
21160 <ul>
21161 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21162 <ul>
21163 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21164 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21165 </ul>
21166 </li>
21167 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21168 <ul>
21169 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21170 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21171 </ul>
21172 </li>
21173 </ul>
21174 </div>
21175
21176 <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>
21177 <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>
21178 <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>
21179 <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>
21180 <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>
21181 <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>
21182
21183 !! end
21184
21185
21186 !! test
21187 ISBN with a dummy number
21188 !! wikitext
21189 ISBN ---
21190 !! html
21191 <p>ISBN ---
21192 </p>
21193 !! end
21194
21195
21196 !! test
21197 ISBN with space-delimited number
21198 !! wikitext
21199 ISBN 92 9017 032 8
21200 !! html/php
21201 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21202 </p>
21203 !! html/parsoid
21204 <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>
21205 !! end
21206
21207
21208 !! test
21209 ISBN with multiple spaces, no number
21210 !! wikitext
21211 ISBN foo
21212 !! html
21213 <p>ISBN foo
21214 </p>
21215 !! end
21216
21217
21218 !! test
21219 ISBN length
21220 !! wikitext
21221 ISBN 123456789
21222
21223 ISBN 1234567890
21224
21225 ISBN 12345678901
21226 !! html/php
21227 <p>ISBN 123456789
21228 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21229 </p><p>ISBN 12345678901
21230 </p>
21231 !! html/parsoid
21232 <p>ISBN 123456789</p>
21233
21234 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21235
21236 <p>ISBN 12345678901</p>
21237 !! end
21238
21239
21240 !! test
21241 ISBN with trailing year (T9110)
21242 !! wikitext
21243 ISBN 1-234-56789-0 - 2006
21244
21245 ISBN 1 234 56789 0 - 2006
21246 !! html/php
21247 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21248 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21249 </p>
21250 !! html/parsoid
21251 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21252
21253 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21254 !! end
21255
21256
21257 !! test
21258 anchorencode
21259 !! wikitext
21260 {{anchorencode:foo bar©#%n}}
21261 !! html
21262 <p>foo_bar.C2.A9.23.25n
21263 </p>
21264 !! end
21265
21266 !! test
21267 anchorencode trims spaces
21268 !! wikitext
21269 {{anchorencode: __pretty__please__}}
21270 !! html
21271 <p>pretty_please
21272 </p>
21273 !! end
21274
21275 !! test
21276 anchorencode deals with links
21277 !! wikitext
21278 {{anchorencode: [[hello|world]] [[hi]]}}
21279 !! html
21280 <p>world_hi
21281 </p>
21282 !! end
21283
21284 !! test
21285 anchorencode deals with templates
21286 !! wikitext
21287 {{anchorencode: {{Foo}} }}
21288 !! html
21289 <p>FOO
21290 </p>
21291 !! end
21292
21293 !! test
21294 anchorencode encodes like the TOC generator: (T20431)
21295 !! wikitext
21296 === _ +:.3A%3A&&amp;]] ===
21297 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21298 __NOEDITSECTION__
21299 !! html
21300 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21301 <p>.2B:.3A.253A.26.26.5D.5D
21302 </p>
21303 !! end
21304
21305 !! test
21306 T8200: blockquotes and paragraph formatting
21307 !! wikitext
21308 <blockquote>
21309 foo
21310 </blockquote>
21311
21312 bar
21313
21314 baz
21315 !! html
21316 <blockquote>
21317 <p>foo
21318 </p>
21319 </blockquote>
21320 <p>bar
21321 </p>
21322 <pre>baz
21323 </pre>
21324 !! end
21325
21326 !! test
21327 T10293: Use of center tag ruins paragraph formatting
21328 !! wikitext
21329 <center>
21330 foo
21331 </center>
21332
21333 bar
21334
21335 baz
21336 !! html
21337 <center>
21338 <p>foo
21339 </p>
21340 </center>
21341 <p>bar
21342 </p>
21343 <pre>baz
21344 </pre>
21345 !! end
21346
21347 !!test
21348 Parsing of overlapping (improperly nested) inline html tags
21349 !! wikitext
21350 <span><s>x</span></s>
21351 !! html/php
21352 <p><span><s>x&lt;/span&gt;</s></span>
21353 </p>
21354 !! html/parsoid
21355 <p><span><s>x</s></span>
21356 </p>
21357 !!end
21358
21359 ###
21360 ### Language variants related tests
21361 ###
21362
21363 # Parsoid does not mark self-links.
21364 # Parsoid does not convert links; PHP will do any necessary redirects.
21365
21366 !! test
21367 Self-link in language variants
21368 !! options
21369 title=[[Dunav]] language=sr
21370 !! wikitext
21371 Both [[Dunav]] and [[Дунав]] are names for this river.
21372 !! html/php
21373 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21374 </p>
21375 !! html/parsoid
21376 <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>
21377 !! end
21378
21379 !! article
21380 Дуна
21381 !! text
21382 content
21383 !! endarticle
21384
21385 !! test
21386 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21387 !! options
21388 title=[[Duna]] language=sr
21389 !! wikitext
21390 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21391 !! html/php
21392 <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.
21393 </p>
21394 !! html/parsoid
21395 <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>
21396 !! end
21397
21398 !! test
21399 Link to a section of a variant of this title shouldn't be parsed as self-link
21400 !! options
21401 title=[[Duna]] language=sr
21402 !! wikitext
21403 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21404 !! html/php
21405 <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.
21406 </p>
21407 !! html/parsoid
21408 <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>
21409 !! end
21410
21411 !! test
21412 Link to pages in language variants
21413 !! options
21414 language=sr
21415 !! wikitext
21416 Main Page can be written as [[Маин Паге]]
21417 !! html/php
21418 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21419 </p>
21420 !! html/parsoid
21421 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21422 !! end
21423
21424
21425 !! test
21426 Multiple links to pages in language variants
21427 !! options
21428 language=sr
21429 !! wikitext
21430 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21431 !! html/php
21432 <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>.
21433 </p>
21434 !! html/parsoid
21435 <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>
21436 !! end
21437
21438
21439 !! test
21440 Simple template in language variants
21441 !! options
21442 language=sr
21443 !! wikitext
21444 {{тест}}
21445 !! html/php
21446 <p>This is a test template
21447 </p>
21448 !! end
21449
21450
21451 !! test
21452 Template with explicit namespace in language variants
21453 !! options
21454 language=sr
21455 !! wikitext
21456 {{Template:тест}}
21457 !! html/php
21458 <p>This is a test template
21459 </p>
21460 !! end
21461
21462
21463 !! test
21464 Basic test for template parameter in language variants
21465 !! options
21466 language=sr
21467 !! wikitext
21468 {{парамтест|param=foo}}
21469 !! html/php
21470 <p>This is a test template with parameter foo
21471 </p>
21472 !! end
21473
21474 !! test
21475 Simple category in language variants
21476 !! options
21477 language=sr cat
21478 !! wikitext
21479 [[Category:МедиаWики Усер'с Гуиде]]
21480 !! html/php
21481 cat=МедиаWики_Усер'с_Гуиде sort=
21482 !! html/parsoid
21483 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21484 !! end
21485
21486 !! article
21487 Category:分类
21488 !! text
21489 blah
21490 !! endarticle
21491
21492 !! article
21493 Category:分類
21494 !! text
21495 blah
21496 !! endarticle
21497
21498 ## We used to, but no longer wt2wt this test since the default serializer
21499 ## will normalize all categories to serialize on their own line.
21500 ## This wikitext usage is going to be fairly uncommon in production and
21501 ## selser will take care of preserving formatting in those scenarios.
21502 !! test
21503 Don't convert blue categorylinks to another variant (T35210)
21504 !! options
21505 cat
21506 language=zh
21507 parsoid=wt2html
21508 !! wikitext
21509 [[A]][[Category:分类]]
21510 !! html/php
21511 cat=分类 sort=
21512 !! html/parsoid
21513 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21514 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21515 !! end
21516
21517 !! test
21518 Stripping -{}- tags (language variants)
21519 !! options
21520 language=sr
21521 !! wikitext
21522 Latin proverb: -{Ne nuntium necare}-
21523 !! html/php
21524 <p>Latin proverb: Ne nuntium necare
21525 </p>
21526 !! html/parsoid
21527 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21528 !! end
21529
21530
21531 !! test
21532 Prevent conversion with -{}- tags (language variants)
21533 !! options
21534 language=sr variant=sr-ec
21535 !! wikitext
21536 Latinski: -{Ne nuntium necare}-
21537 !! html/php
21538 <p>Латински: Ne nuntium necare
21539 </p>
21540 !! html/parsoid
21541 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21542 !! end
21543
21544
21545 !! test
21546 Prevent conversion of text with -{}- tags (language variants)
21547 !! options
21548 language=sr variant=sr-ec
21549 !! wikitext
21550 Latinski: -{Ne nuntium necare}-
21551 !! html/php
21552 <p>Латински: Ne nuntium necare
21553 </p>
21554 !! html/parsoid
21555 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21556 !! end
21557
21558
21559 !! test
21560 Prevent conversion of links with -{}- tags (language variants)
21561 !! options
21562 language=sr variant=sr-ec
21563 !! wikitext
21564 -{[[Main Page]]}-
21565 !! html/php
21566 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21567 </p>
21568 !! html/parsoid
21569 <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>
21570 !! end
21571
21572
21573 !! test
21574 -{}- tags within headlines (within html for parserConvert())
21575 !! options
21576 language=sr variant=sr-ec
21577 !! wikitext
21578 == -{Naslov}- ==
21579
21580 Note that even an unprotected headline ID is not affected by language
21581 conversion:
21582
21583 == Latinski ==
21584 !! html/php
21585 <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>
21586 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21587 цонверсион:
21588 </p>
21589 <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>
21590
21591 !! html/parsoid
21592 <h2 id="-.7BNaslov.7D-"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21593
21594 <p>Note that even an unprotected headline ID is not affected by language
21595 conversion:</p>
21596
21597 <h2 id="Latinski">Latinski</h2>
21598 !! end
21599
21600 !! test
21601 Explicit definition of language variant alternatives
21602 !! options
21603 language=zh variant=zh-tw
21604 !! wikitext
21605 -{zh:China;zh-tw:Taiwan}-, not China
21606 !! html/php
21607 <p>Taiwan, not China
21608 </p>
21609 !! html/parsoid
21610 <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>
21611 !! end
21612
21613 !! test
21614 Filter syntax for language variants
21615 !! options
21616 language=zh variant=zh-tw
21617 !! wikitext
21618 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21619 !! html/php
21620 <p>fooblog, WEBJOURNAL, WEBLOGquux
21621 </p>
21622 !! html/parsoid
21623 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21624 !! end
21625
21626 # Note that Parsoid post-processing for language variants needs to
21627 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21628 !! test
21629 Conversion around HTML tags
21630 !! options
21631 language=sr variant=sr-ec
21632 !! wikitext
21633 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21634 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21635 !! html/php
21636 <p>
21637 <span title="ЛаCтин">ски</span>
21638 </p>
21639 !! html/parsoid
21640 <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"}]}'/>
21641 <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>
21642 !! end
21643
21644 !! test
21645 Explicit session-wise two-way language variant mapping (A flag and - flag)
21646 !! options
21647 language=zh variant=zh-tw
21648 !! wikitext
21649 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21650
21651 Taiwan is not China.
21652
21653 But -{A|zh:China; zh-tw:Taiwan}- is China,
21654
21655 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21656
21657 and -{China}- is China.
21658 !! html/php
21659 <p>This is Taiwan, but we'll forget that now.
21660 </p><p>Taiwan is not China.
21661 </p><p>But Taiwan is Taiwan,
21662 </p><p>(This should be stripped!)
21663 </p><p>and China is China.
21664 </p>
21665 !! html/parsoid
21666 <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>
21667 <p>Taiwan is not China.</p>
21668 <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>
21669 <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>
21670 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
21671 !! end
21672
21673 !! test
21674 Explicit session-wise one-way language variant mapping (A flag and - flag)
21675 !! options
21676 language=zh variant=zh-tw
21677 !! wikitext
21678 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
21679
21680 COUNTRY is China or Taiwan.
21681
21682 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
21683
21684 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21685
21686 and -{COUNTRY}- is COUNTRY.
21687 !! html/php
21688 <p>This is Taiwan, but we'll forget that now.
21689 </p><p>COUNTRY is China or Taiwan.
21690 </p><p>But Taiwan is Taiwan,
21691 </p><p>(This should be stripped!)
21692 </p><p>and COUNTRY is COUNTRY.
21693 </p>
21694 !! html/parsoid
21695 <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>
21696 <p>COUNTRY is China or Taiwan.</p>
21697 <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>
21698 <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>
21699 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
21700 !! end
21701
21702 !! test
21703 Explicit session-wise two-way language variant mapping (H flag for hide)
21704 !! options
21705 language=zh variant=zh-tw
21706 !! wikitext
21707 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
21708
21709 Taiwan is China.
21710 !! html/php
21711 <p>(This should be stripped!)
21712 </p><p>Taiwan is Taiwan.
21713 </p>
21714 !! html/parsoid
21715 <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>
21716 <p>Taiwan is China.</p>
21717 !! end
21718
21719 !! test
21720 Explicit session-wise one-way language variant mapping (H flag for hide)
21721 !! options
21722 language=zh variant=zh-tw
21723 !! wikitext
21724 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
21725
21726 COUNTRY is Taiwan or China.
21727 !! html/php
21728 <p>(This should be stripped!)
21729 </p><p>Taiwan is Taiwan or China.
21730 </p>
21731 !! html/parsoid
21732 <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>
21733 <p>COUNTRY is Taiwan or China.</p>
21734 !! end
21735
21736 ## Note that parsoid test runner does not support 'showtitle' option.
21737 !! test
21738 Adding explicit conversion rule for title (T flag)
21739 !! options
21740 language=zh variant=zh-tw showtitle
21741 !! wikitext
21742 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
21743
21744 Taiwan is China.
21745 !! html/php
21746 Taiwan
21747 <p>Should be stripped!
21748 </p><p>Taiwan is China.
21749 </p>
21750 !! html/parsoid
21751 <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>
21752 <p>Taiwan is China.</p>
21753 !! end
21754
21755 !! test
21756 Code coverage: T combined with H flag
21757 !! options
21758 language=zh variant=zh-tw showtitle
21759 !! wikitext
21760 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
21761
21762 Taiwan is China.
21763 !! html/php
21764 Taiwan
21765 <p>Should be stripped!
21766 </p><p>Taiwan is Taiwan.
21767 </p>
21768 !! html/parsoid
21769 <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>
21770 <p>Taiwan is China.</p>
21771 !! end
21772
21773 !! test
21774 Code coverage: T with no variants
21775 !! options
21776 language=zh variant=zh-tw showtitle
21777 !! wikitext
21778 -{H|zh:China; zh-tw:Taiwan}-
21779 Taiwan is China.-{T|Taiwan is China}-
21780 !! html/php
21781 Taiwan is China
21782 <p>
21783 Taiwan is Taiwan.
21784 </p>
21785 !! html/parsoid
21786 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21787 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
21788 !! end
21789
21790 !! test
21791 Code coverage: rules with no variants
21792 !! options
21793 language=zh variant=zh-tw
21794 !! wikitext
21795 -{H|zh:China; zh-tw:Taiwan}-
21796 Taiwan is China.
21797 -{H|China}-
21798 Taiwan is China.
21799 !! html/php
21800 <p>
21801 Taiwan is Taiwan.
21802
21803 Taiwan is China.
21804 </p>
21805 !! html/parsoid
21806 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
21807 Taiwan is China.
21808 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
21809 Taiwan is China.</p>
21810 !! end
21811
21812
21813 !! test
21814 Code coverage: D flag for conversion rule
21815 !! options
21816 language=zh variant=zh-tw
21817 !! wikitext
21818 -{D|zh-cn:XA; zh-tw:YA}-
21819 -{A;D|zh-cn:XB; zh-tw:YB}-
21820 -{D;H|zh-cn:XC; zh-tw:YC}-
21821
21822 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
21823
21824 -{D|0=>zh-tw:1}-
21825 -{A;D|2=>zh-tw:3}-
21826 -{D;H|4=>zh-tw:5}-
21827
21828 XA XB XC YA YB YC FOO BAR BAT 012345
21829 !! html/php
21830 <p>大陆:XA;台灣:YA;
21831
21832 大陆:XC;台灣:YC;
21833 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
21834 </p><p>0⇒台灣:1;
21835
21836 4⇒台灣:5;
21837 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
21838 </p>
21839 !! html/parsoid
21840 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
21841 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
21842 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
21843 <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>
21844 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
21845 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
21846 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
21847 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
21848 !! end
21849
21850 !! test
21851 Code coverage: N flag for conversion rule
21852 !! options
21853 language=zh variant=zh-cn
21854 !! wikitext
21855 -{N|zh-cn}-
21856
21857 -{N|zh-tw}-
21858
21859 -{N|sr-ec}-
21860 !! html/php
21861 <p>大陆
21862 </p><p>台灣
21863 </p><p>српски (ћирилица)‎
21864 </p>
21865 !! html/parsoid
21866 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
21867 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
21868 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
21869 !! end
21870
21871 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
21872 !! test
21873 Code coverage: N flag for conversion rule (wt2html only)
21874 !! options
21875 language=zh variant=zh-cn
21876 parsoid=wt2html,html2html
21877 !! wikitext
21878 -{D;N|en}-
21879 !! html/php
21880 <p>English
21881 </p>
21882 !! html/parsoid
21883 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
21884 !! end
21885
21886 !! test
21887 Testing that changing the language variant here in the tests actually works
21888 !! options
21889 language=zh variant=zh showtitle
21890 !! wikitext
21891 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21892 !! html/php
21893 China
21894 <p>Should be stripped!
21895 </p>
21896 !! html/parsoid
21897 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
21898 !! end
21899
21900 !! test
21901 Recursive conversion of alt and title attrs shouldn't clear converter state
21902 !! options
21903 language=zh variant=zh-cn
21904 showtitle
21905 !! wikitext
21906 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
21907 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
21908 !! html/php
21909 China
21910 <p>
21911 Should be stripped<span title="Exclamation">!</span>
21912 </p>
21913 !! html/parsoid
21914 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
21915 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>
21916 !! end
21917
21918 !! test
21919 T26072: more test on conversion rule for title
21920 !! options
21921 language=zh variant=zh-tw showtitle
21922 !! wikitext
21923 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
21924
21925 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
21926 !! html/php
21927 Taiwan
21928 <p>This should be stripped!
21929 </p><p>This won't take interferes with the title rule.
21930 </p>
21931 !! html/parsoid
21932 <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>
21933 <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>
21934 !! end
21935
21936 !! test
21937 Partly disable title conversion if variant == main language code
21938 !! options
21939 language=zh variant=zh title=[[ZH]] showtitle
21940 !! wikitext
21941 -{T|zh-cn:CN;zh-tw:TW}-
21942 !! html/php
21943 ZH
21944 <p>
21945 </p>
21946 !! html/parsoid
21947 <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>
21948 !! end
21949
21950 !! test
21951 Partly disable title conversion if variant == main language code, more
21952 !! options
21953 language=zh variant=zh title=[[ZH]] showtitle
21954 !! wikitext
21955 -{T|TW}-
21956 !! html/php
21957 ZH
21958 <p>
21959 </p>
21960 !! html/parsoid
21961 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
21962 !! end
21963
21964 !! test
21965 Raw output of variant escape tags (R flag)
21966 !! options
21967 language=zh variant=zh-tw
21968 !! wikitext
21969 Raw: -{R|zh:China;zh-tw:Taiwan}-
21970 !! html/php
21971 <p>Raw: zh:China;zh-tw:Taiwan
21972 </p>
21973 !! html/parsoid
21974 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
21975 !! end
21976
21977 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
21978 !! test
21979 Raw output of variant escape tags (R flag) (wt2html only)
21980 !! options
21981 language=zh variant=zh-tw
21982 parsoid=wt2html,html2html
21983 !! wikitext
21984 -{Variant}- -{D|syntax}- -{D;R|options}-
21985 !! html/php
21986 <p>Variant syntax options
21987 </p>
21988 !! html/parsoid
21989 <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>
21990 !! end
21991
21992 !! test
21993 Nested markup inside raw output of variant escape tags (R flag)
21994 !! options
21995 language=zh variant=zh-tw
21996 !! wikitext
21997 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
21998 !! html/php
21999 <p>Nested raw: nested Taiwan nested
22000 </p>
22001 !! html/parsoid
22002 <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>
22003 !! end
22004
22005 !! test
22006 Nested markup and spaces inside raw output of variant escape tags (R flag)
22007 !! options
22008 language=zh variant=zh-tw
22009 !! wikitext
22010 X-{ outer -{ inner }- outer }-X
22011 !! html/php
22012 <p>X outer inner outer X
22013 </p>
22014 !! html/parsoid
22015 <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>
22016 !! end
22017
22018 !! test
22019 Templates inside raw output of variant escape tags (R flag)
22020 !! options
22021 language=zh variant=zh-tw
22022 !! wikitext
22023 Nested raw: -{R|nested {{echo|hi}} templates}-
22024 !! html/php
22025 <p>Nested raw: nested hi templates
22026 </p>
22027 !! html/parsoid
22028 <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>
22029 !! end
22030
22031 !! test
22032 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22033 !! options
22034 language=zh variant=zh-cn
22035 !! input
22036 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22037 !! html/php
22038 <p>0
22039 </p>
22040 !! html/parsoid
22041 <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>
22042 !! end
22043
22044 !! test
22045 Conversion rules from [numeric-only string] to [something else] (T48634)
22046 !! options
22047 language=zh variant=zh-cn
22048 !! input
22049 -{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
22050 !! html/php
22051 <p>D12345EE12345
22052 </p>
22053 !! html/parsoid
22054 <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>
22055 !! end
22056
22057 !! test
22058 Two-way converter rule entries with an empty value should be ignored (T53551)
22059 !! options
22060 language=zh variant=zh-cn
22061 !! input
22062 -{H|zh-cn:foo;zh-tw:;}-foobar
22063 !! html/php
22064 <p>foobar
22065 </p>
22066 !! html/parsoid
22067 <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>
22068 !! end
22069
22070 !! test
22071 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22072 !! options
22073 language=zh variant=zh-cn
22074 !! input
22075 -{H|=>zh-cn:foo;}-foobar
22076 !! html/php
22077 <p>foobar
22078 </p>
22079 !! html/parsoid
22080 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22081 !! end
22082
22083 !! test
22084 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22085 !! options
22086 language=zh variant=zh-cn
22087 !! input
22088 -{H|}-foobar
22089 !! html/php
22090 <p>foobar
22091 </p>
22092 !! html/parsoid
22093 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22094 !! end
22095
22096 !! test
22097 Nested using of manual convert syntax
22098 !! options
22099 language=zh variant=zh-hk
22100 !! wikitext
22101 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22102 !! html/php
22103 <p>Nested: Hello Hong Kong!
22104 </p>
22105 !! html/parsoid
22106 <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>
22107 !! end
22108
22109 !! test
22110 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22111 !! options
22112 language=zh variant=zh-cn
22113 !! wikitext
22114 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22115 !! html/php
22116 <p><span title="X">A</span>
22117 </p>
22118 !! html/parsoid
22119 <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>
22120 !! end
22121
22122 !! test
22123 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22124 !! options
22125 language=zh variant=zh-cn
22126 !! wikitext
22127 -{<span title="-{X}-">A</span>}-
22128 !! html/php+disabled
22129 <p><span title="X">A</span>
22130 </p>
22131 !! html/parsoid
22132 <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>
22133 !! end
22134
22135 # Parsoid and PHP disagree on how to parse this example: Parsoid
22136 # insists that the content of a language converter element be a valid
22137 # DOM fragment or attribute string
22138 !! test
22139 Language converter markup with block content
22140 !! options
22141 language=zh variant=zh-cn
22142 !! wikitext
22143 <span>a-{b<div>c}-d
22144
22145 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22146
22147 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22148 !! html/php+tidy
22149 <p><span>ab</span></p>
22150 <div><span>cd <span>ab</span></span>
22151 <div><span>cd <span>ad</span></span></div>
22152 </div>
22153 !! html/parsoid
22154 <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>
22155
22156 <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>
22157
22158 <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>
22159 !! end
22160
22161 !! test
22162 LanguageConverter selser (1)
22163 !! options
22164 language=zh variant=zh-cn
22165 parsoid={
22166 "modes": ["wt2wt", "selser"],
22167 "changes": [
22168 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22169 ]
22170 }
22171 !! wikitext
22172 -{raw}-
22173 !! wikitext/edited
22174 -{edited}-
22175 !! end
22176
22177 !! test
22178 LanguageConverter selser (2)
22179 !! options
22180 language=zh variant=zh-cn
22181 parsoid={
22182 "modes": ["wt2wt", "selser"],
22183 "changes": [
22184 ["span[class='x']", "contents", "text", "-{foo}-"],
22185 ["a", "contents", "text", "-{"],
22186 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22187 ]
22188 }
22189 !! wikitext
22190 <span class="x">TEXT1</span>
22191 [http://example.com TEXT2]
22192 [[Foo|TEXT3]]
22193 {{echo|TEXT4}}
22194 !! wikitext/edited
22195 <span class="x"><nowiki>-{foo}-</nowiki></span>
22196 [http://example.com -{]
22197 [[Foo|<nowiki>-{</nowiki>]]
22198 {{1x|<nowiki>-{</nowiki>}}
22199 !! end
22200
22201 # Tests LanguageVariantText in ConstrainedText
22202 !! test
22203 LanguageConverter selser (3)
22204 !! options
22205 language=zh variant=zh-cn
22206 parsoid={
22207 "modes": ["wt2wt", "selser"],
22208 "changes": [
22209 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22210 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22211 ]
22212 }
22213 !! wikitext
22214 {|
22215 |-
22216 |<span>Foo</span>
22217 |}
22218 !! wikitext/edited
22219 {|
22220 |-
22221 |<nowiki/>-{edited}-
22222 |}
22223 !! end
22224
22225 # Tests LanguageVariantText._fromSelser
22226 !! test
22227 LanguageConverter selser (4)
22228 !! options
22229 language=zh variant=zh-cn
22230 parsoid={
22231 "modes": ["wt2wt", "selser"],
22232 "changes": [
22233 ["td > span.x", "remove"]
22234 ]
22235 }
22236 !! wikitext
22237 {|
22238 |-
22239 |<span class="x">Foo</span>-{Bar}-
22240 ||<span class="x">Foo</span>-{Bar}-
22241 |}
22242 !! wikitext/edited
22243 {|
22244 |-
22245 |<nowiki/>-{Bar}-
22246 ||-{Bar}-
22247 |}
22248 !! end
22249
22250 # Since Parsoid is starting to emit canonical wikitext for links,
22251 # [http://example.com http://example.com] will not RT back to that
22252 # form anymore.
22253 # Parsoid does not language-convert links (it is done in a
22254 # post-processing step)
22255 !! test
22256 Proper conversion of text in external links
22257 !! options
22258 language=sr variant=sr-ec
22259 parsoid=wt2html
22260 !! wikitext
22261 http://www.google.com
22262 gopher://www.google.com
22263 [http://www.google.com http://www.google.com]
22264 [gopher://www.google.com gopher://www.google.com]
22265 [https://www.google.com irc://www.google.com]
22266 [ftp://www.google.com www.google.com/ftp://dir]
22267 [//www.google.com www.google.com]
22268 !! html/php
22269 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22270 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22271 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22272 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22273 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22274 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22275 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22276 </p>
22277 !! html/parsoid
22278 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22279 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22280 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
22281 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
22282 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
22283 <a rel="mw:ExtLink" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22284 <a rel="mw:ExtLink" href="//www.google.com">www.google.com</a></p>
22285 !! end
22286
22287 !! test
22288 Do not convert roman numbers to language variants
22289 !! options
22290 language=sr variant=sr-ec
22291 !! wikitext
22292 Fridrih IV je car.
22293 !! html/php
22294 <p>Фридрих IV је цар.
22295 </p>
22296 !! html/parsoid
22297 <p>Fridrih IV je car.</p>
22298 !! end
22299
22300 !! test
22301 Unclosed language converter markup "-{"
22302 !! options
22303 language=sr
22304 !! wikitext
22305 -{T|hello
22306 !! html
22307 <p>-{T|hello
22308 </p>
22309 !! end
22310
22311 !! test
22312 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22313 !! options
22314 language=sr
22315 !! wikitext
22316 -{R|=&gt;}-
22317 !! html/php
22318 <p>=&gt;
22319 </p>
22320 !! html/parsoid
22321 <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>
22322 !!end
22323
22324 !! test
22325 Don't break link parsing if language converter markup is in the caption.
22326 !! options
22327 language=sr variant=sr-ec
22328 !! wikitext
22329 [[Main Page|-{R|main page}-]]
22330 !! html/php
22331 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22332 </p>
22333 !! html/parsoid
22334 <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>
22335 !! end
22336
22337 !! test
22338 T146304: Don't break template parsing if language converter markup is in the parameter.
22339 !! options
22340 language=sr variant=sr-ec
22341 !! wikitext
22342 {{echo|-{R|foo}-}}
22343 !! html/php
22344 <p>foo
22345 </p>
22346 !! html/parsoid
22347 <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>
22348 !! end
22349
22350 !! test
22351 T146305: Don't break image parsing if language converter markup is in the caption.
22352 !! options
22353 language=sr
22354 !! wikitext
22355 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22356 !! html/php
22357 <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>
22358
22359 !! html/parsoid
22360 <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>
22361 !! end
22362
22363 !! test
22364 T146305: Don't break image parsing if nested language converter markup is in the caption.
22365 !! options
22366 language=zh variant=zh-cn
22367 !! wikitext
22368 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22369 !! html/php
22370 <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>
22371
22372 !! html/parsoid
22373 <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>
22374 !! end
22375
22376 # XXX html2wt disabled because rich markup in alt is not preserved.
22377 !! test
22378 Don't break gallery if language converter markup is inside.
22379 !! options
22380 language=zh
22381 !! wikitext
22382 <gallery>
22383 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22384 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22385 </gallery>
22386 !! html/php
22387 <ul class="gallery mw-gallery-traditional">
22388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22389 <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>
22390 <div class="gallerytext">
22391 <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>
22392 </p>
22393 </div>
22394 </div></li>
22395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22396 <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>
22397 <div class="gallerytext">
22398 <p>This is a test template
22399 </p>
22400 </div>
22401 </div></li>
22402 </ul>
22403
22404 !! html/parsoid
22405 <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"}}'>
22406 <li class="gallerybox">
22407 <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>
22408 <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>
22409 </li>
22410 <li class="gallerybox">
22411 <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>
22412 <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>
22413 </li>
22414 </ul>
22415 !! end
22416
22417 !! test
22418 T153135: Don't break list handling if language converter markup is in the item.
22419 !! options
22420 language=zh variant=zh-cn
22421 !! wikitext
22422 ;-{zh-cn:AAA;zh-tw:BBB}-
22423 ;-{R|foo:bar}-
22424 !! html/php
22425 <dl><dt>AAA</dt>
22426 <dt>foo:bar</dt></dl>
22427
22428 !! html/parsoid
22429 <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>
22430 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22431 </dl>
22432 !! end
22433
22434 // Note that parsoid does not protect colons unless language converter
22435 // markup is properly nested, because it is a backtracking parser.
22436 !! test
22437 T153135: Unclosed markup in definition list (code coverage)
22438 !! options
22439 language=zh variant=zh-cn
22440 !! wikitext
22441 ;<b>foo:bar
22442 ;-{zh-cn:AAA
22443 !! html/php+tidy
22444 <dl>
22445 <dt><b>foo:bar</b></dt>
22446 <dt><b>-{zh-cn:AAA</b></dt>
22447 </dl>
22448 !! html/parsoid
22449 <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}'>
22450 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22451 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22452 </b></dl>
22453 !! end
22454
22455 !! test
22456 T153135: Nested language converter markup in definition list (code coverage)
22457 !! options
22458 language=zh variant=zh-cn
22459 !! wikitext
22460 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22461 !! html/php
22462 <dl><dt>AAA foo:bar bat:baz</dt>
22463 <dd>def</dd></dl>
22464
22465 !! html/parsoid
22466 <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>
22467 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22468 </dl>
22469 !! end
22470
22471 # html2wt mode disabled due to <nowiki> insertion.
22472 !! test
22473 T153140: Don't break table handling if language converter markup is in the cell.
22474 !! options
22475 language=sr variant=sr-ec
22476 parsoid=wt2html,wt2wt,html2html
22477 !! wikitext
22478 {|
22479 |-
22480 | -{R|B}-
22481 |}
22482 !! html/php
22483 <table>
22484
22485 <tr>
22486 <td> B
22487 </td></tr></table>
22488
22489 !! html/parsoid
22490 <table>
22491 <tbody>
22492 <tr>
22493 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22494 </tr>
22495 </tbody>
22496 </table>
22497 !! end
22498
22499 !! test
22500 Language converter tricky html2wt cases (1)
22501 !! options
22502 language=sr
22503 parsoid=html2wt,wt2wt
22504 !! html/parsoid
22505 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22506 !! wikitext
22507 -{<nowiki>}-</nowiki>}-
22508 !! html/php
22509 <p>&#125;-
22510 </p>
22511 !! end
22512
22513 !! test
22514 Language converter tricky html2wt cases (2)
22515 !! options
22516 language=sr
22517 parsoid=html2wt,wt2wt
22518 !! html/parsoid
22519 <p>-{foo}-</p>
22520 !! wikitext
22521 <nowiki>-{foo}-</nowiki>
22522 !! html/php
22523 <p>-&#123;foo&#125;-
22524 </p>
22525 !! end
22526
22527 !! test
22528 Language converter tricky html2wt cases (3)
22529 !! options
22530 language=sr
22531 parsoid=html2wt,wt2wt
22532 !! html/parsoid
22533 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22534 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22535 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22536 !! wikitext
22537 -{R||}-
22538
22539 -{R|R|raw}-
22540
22541 -{<nowiki>-{foo}-</nowiki>}-
22542 !! html/php
22543 <p>|
22544 </p><p>R|raw
22545 </p><p>-&#123;foo&#125;-
22546 </p>
22547 !! end
22548
22549 !! test
22550 Language converter tricky html2wt cases (4)
22551 !! options
22552 language=sr
22553 parsoid=html2wt,wt2wt
22554 !! html/parsoid
22555 <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>
22556 !! wikitext
22557 -{R|{{echo|hey}}}-
22558 !! html/php
22559 <p>hey
22560 </p>
22561 !! end
22562
22563 # Note that the <nowiki> escaping added by parsoid for source text,
22564 # destination text, and language names only works on the PHP side
22565 # for *destination text*. (HTML entity escaping wouldn't work
22566 # any better.) This is probably a bug, at least for source texts.
22567 # (For language names PHP uses a precise regexp based on the languages
22568 # it currently knows have variants, which is fragile since this set
22569 # can grow/shrink over time.)
22570 !! test
22571 Language converter tricky html2wt cases (5)
22572 !! options
22573 language=zh variant=zh-cn
22574 !! html/parsoid
22575 <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>
22576 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22577 <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>
22578 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22579 <p>a:b=>c xyz</p>
22580 !! wikitext
22581 -{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
22582
22583 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22584
22585 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22586
22587 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22588
22589 a:b=>c xyz
22590 !! html/php+disabled
22591 <p>foobat;xyz=&gt;zh-cn:abc
22592 </p><p>A
22593 </p><p>0;zh-tw:bar
22594 </p><p>abc
22595 </p><p>a:b=&gt;c 0;zh-tw:bar
22596 </p>
22597 !! end
22598
22599 !! test
22600 T2529: Uncovered bullet
22601 !! wikitext
22602 * Foo {{bullet}}
22603 !! html
22604 <ul><li> Foo </li>
22605 <li> Bar</li></ul>
22606
22607 !! end
22608
22609 # Plain MediaWiki does not remove empty lists, but tidy actually does.
22610 # Templates in Wikipedia rely on this behavior, as tidy has always been
22611 # enabled there. These tests are normally run *without* tidy, so specify the
22612 # full output here.
22613 # To test realistic parsing behavior, apply a tidy-like transformation to both
22614 # the expected output and your parser's output.
22615 !! test
22616 T2529: Uncovered bullet leaving empty list, normally removed by tidy
22617 !! wikitext
22618 ******* Foo {{bullet}}
22619 !! html
22620 <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>
22621 <li> Bar</li></ul>
22622
22623 !! end
22624
22625 !! test
22626 T2529: Uncovered table already at line-start
22627 !! wikitext
22628 x
22629
22630 {{table}}
22631 y
22632 !! html
22633 <p>x
22634 </p>
22635 <table>
22636 <tr>
22637 <td> 1 </td>
22638 <td> 2
22639 </td></tr>
22640 <tr>
22641 <td> 3 </td>
22642 <td> 4
22643 </td></tr></table>
22644 <p>y
22645 </p>
22646 !! end
22647
22648 !! test
22649 T2529: Uncovered bullet in parser function result
22650 !! wikitext
22651 * Foo {{lc:{{bullet}} }}
22652 !! html
22653 <ul><li> Foo </li>
22654 <li> bar</li></ul>
22655
22656 !! end
22657
22658 !! test
22659 T7678: Double-parsed template argument
22660 !! wikitext
22661 {{lc:{{{1}}}|hello}}
22662 !! html
22663 <p>{{{1}}}
22664 </p>
22665 !! end
22666
22667 !! test
22668 T7678: Double-parsed template invocation
22669 !! wikitext
22670 {{lc:{{paramtest {{!}} param = hello }} }}
22671 !! html
22672 <p>{{paramtest | param = hello }}
22673 </p>
22674 !! end
22675
22676 !! test
22677 Case insensitivity of parser functions for non-ASCII characters (T10143)
22678 !! options
22679 language=cs
22680 title=[[Main Page]]
22681 !! wikitext
22682 {{PRVNÍVELKÉ:ěščř}}
22683 {{prvnívelké:ěščř}}
22684 {{PRVNÍMALÉ:ěščř}}
22685 {{prvnímalé:ěščř}}
22686 {{MALÁ:ěščř}}
22687 {{malá:ěščř}}
22688 {{VELKÁ:ěščř}}
22689 {{velká:ěščř}}
22690 !! html
22691 <p>Ěščř
22692 Ěščř
22693 ěščř
22694 ěščř
22695 ěščř
22696 ěščř
22697 ĚŠČŘ
22698 ĚŠČŘ
22699 </p>
22700 !! end
22701
22702 !! test
22703 Morwen/13: Unclosed link followed by heading
22704 !! wikitext
22705 [[link
22706 ==heading==
22707 !! html
22708 <p>[[link
22709 </p>
22710 <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>
22711
22712 !! end
22713
22714 !! test
22715 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
22716 !! wikitext
22717 {{foo|
22718 =heading=
22719 !! html
22720 <p>{{foo|
22721 </p>
22722 <h1><span class="mw-headline" id="heading">heading</span></h1>
22723
22724 !! end
22725
22726 !! test
22727 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
22728 !! wikitext
22729 {{foo|
22730 ==heading==
22731 !! html
22732 <p>{{foo|
22733 </p>
22734 <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>
22735
22736 !! end
22737
22738 !! test
22739 Tildes in comments
22740 !! options
22741 pst
22742 !! wikitext
22743 <!-- ~~~~ -->
22744 !! html/php
22745 <!-- ~~~~ -->
22746 !! end
22747
22748 !! test
22749 Paragraphs inside divs (no extra line breaks)
22750 !! wikitext
22751 <div>Line one
22752
22753 Line two</div>
22754 !! html
22755 <div>Line one
22756 Line two</div>
22757
22758 !! end
22759
22760 !! test
22761 Paragraphs inside divs (extra line break on open)
22762 !! wikitext
22763 <div>
22764 Line one
22765
22766 Line two</div>
22767 !! html
22768 <div>
22769 <p>Line one
22770 </p>
22771 Line two</div>
22772
22773 !! end
22774
22775 !! test
22776 Paragraphs inside divs (extra line break on close)
22777 !! wikitext
22778 <div>Line one
22779
22780 Line two
22781 </div>
22782 !! html
22783 <div>Line one
22784 <p>Line two
22785 </p>
22786 </div>
22787
22788 !! end
22789
22790 !! test
22791 Paragraphs inside divs (extra line break on open and close)
22792 !! wikitext
22793 <div>
22794 Line one
22795
22796 Line two
22797 </div>
22798 !! html
22799 <div>
22800 <p>Line one
22801 </p><p>Line two
22802 </p>
22803 </div>
22804
22805 !! end
22806
22807 !! test
22808 Nesting tags, paragraphs on lines which begin with <div>
22809 !! wikitext
22810 <div></div><strong>A
22811 B</strong>
22812 !! html/php+tidy
22813 <p><strong>A</strong></p>
22814 <p><strong>B</strong></p>
22815 !! html/parsoid
22816 <div></div>
22817 <p><strong>A
22818 B</strong>
22819 </p>
22820 !! end
22821
22822 # T8200: <blockquote> should behave like <div> with respect to line breaks
22823 !! test
22824 T8200: paragraphs inside blockquotes (no extra line breaks)
22825 !! wikitext
22826 <blockquote>Line one
22827
22828 Line two</blockquote>
22829 !! html
22830 <blockquote>Line one
22831 Line two</blockquote>
22832
22833 !! html+tidy
22834 <blockquote>
22835 <p>Line one Line two</p>
22836 </blockquote>
22837 !! end
22838
22839 !! test
22840 T8200: paragraphs inside blockquotes (extra line break on open)
22841 !! wikitext
22842 <blockquote>
22843 Line one
22844
22845 Line two</blockquote>
22846 !! html
22847 <blockquote>
22848 <p>Line one
22849 </p>
22850 Line two</blockquote>
22851
22852 !! html+tidy
22853 <blockquote>
22854 <p>Line one</p>
22855 Line two</blockquote>
22856 !! end
22857
22858 !! test
22859 T8200: paragraphs inside blockquotes (extra line break on close)
22860 !! wikitext
22861 <blockquote>Line one
22862
22863 Line two
22864 </blockquote>
22865 !! html
22866 <blockquote>Line one
22867 <p>Line two
22868 </p>
22869 </blockquote>
22870
22871 !! html+tidy
22872 <blockquote>
22873 <p>Line one</p>
22874 <p>Line two</p>
22875 </blockquote>
22876 !! end
22877
22878 !! test
22879 T8200: paragraphs inside blockquotes (extra line break on open and close)
22880 !! wikitext
22881 <blockquote>
22882 Line one
22883
22884 Line two
22885 </blockquote>
22886 !! html
22887 <blockquote>
22888 <p>Line one
22889 </p><p>Line two
22890 </p>
22891 </blockquote>
22892
22893 !! html+tidy
22894 <blockquote>
22895 <p>Line one</p>
22896 <p>Line two</p>
22897 </blockquote>
22898 !! end
22899
22900 !! test
22901 Paragraphs inside blockquotes/divs (no extra line breaks)
22902 !! wikitext
22903 <blockquote><div>Line one
22904
22905 Line two</div></blockquote>
22906 !! html
22907 <blockquote><div>Line one
22908 Line two</div></blockquote>
22909
22910 !! end
22911
22912 !! test
22913 Paragraphs inside blockquotes/divs (extra line break on open)
22914 !! wikitext
22915 <blockquote><div>
22916 Line one
22917
22918 Line two</div></blockquote>
22919 !! html
22920 <blockquote><div>
22921 <p>Line one
22922 </p>
22923 Line two</div></blockquote>
22924
22925 !! end
22926
22927 !! test
22928 Paragraphs inside blockquotes/divs (extra line break on close)
22929 !! wikitext
22930 <blockquote><div>Line one
22931
22932 Line two
22933 </div></blockquote>
22934 !! html
22935 <blockquote><div>Line one
22936 <p>Line two
22937 </p>
22938 </div></blockquote>
22939
22940 !! end
22941
22942 !! test
22943 Paragraphs inside blockquotes/divs (extra line break on open and close)
22944 !! wikitext
22945 <blockquote><div>
22946 Line one
22947
22948 Line two
22949 </div></blockquote>
22950 !! html
22951 <blockquote><div>
22952 <p>Line one
22953 </p><p>Line two
22954 </p>
22955 </div></blockquote>
22956
22957 !! end
22958
22959 !! test
22960 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
22961 !! options
22962 wgLinkHolderBatchSize=0
22963 !! wikitext
22964 [[meatball:1]]
22965 [[meatball:2]]
22966 [[meatball:3]]
22967 !! html
22968 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
22969 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
22970 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
22971 </p>
22972 !! end
22973
22974 !! test
22975 Free external link invading image caption
22976 !! wikitext
22977 [[Image:Foobar.jpg|thumb|http://x|hello]]
22978 !! html
22979 <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>
22980
22981 !! end
22982
22983 !! test
22984 T17196: localised external link numbers
22985 !! options
22986 language=fa
22987 !! wikitext
22988 [http://en.wikipedia.org/]
22989 !! html/php
22990 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
22991 </p>
22992 !! html/parsoid
22993 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
22994 !! end
22995
22996 !! test
22997 Multibyte character in padleft
22998 !! wikitext
22999 {{padleft:-Hello|7|Æ}}
23000 !! html
23001 <p>Æ-Hello
23002 </p>
23003 !! end
23004
23005 !! test
23006 Multibyte character in padright
23007 !! wikitext
23008 {{padright:Hello-|7|Æ}}
23009 !! html
23010 <p>Hello-Æ
23011 </p>
23012 !! end
23013
23014 !!test
23015 formatdate parser function
23016 !! wikitext
23017 {{#formatdate:2009-03-24}}
23018 !! html
23019 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23020 </p>
23021 !! end
23022
23023 !!test
23024 formatdate parser function, with default format
23025 !! wikitext
23026 {{#formatdate:2009-03-24|mdy}}
23027 !! html
23028 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23029 </p>
23030 !! end
23031
23032 !! test
23033 Spacing of numbers in formatted dates
23034 !! wikitext
23035 {{#formatdate:January 15}}
23036 !! html
23037 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23038 </p>
23039 !! end
23040
23041 !! test
23042 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
23043 !! options
23044 language=nl title=[[MediaWiki:Common.css]]
23045 !! wikitext
23046 {{#formatdate:2009-03-24|dmy}}
23047 !! html
23048 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23049 </p>
23050 !! end
23051
23052 #
23053 #
23054 #
23055
23056 #
23057 # Edit comments
23058 #
23059
23060 !! test
23061 Edit comment with link
23062 !! options
23063 comment
23064 !! wikitext
23065 I like the [[Main Page]] a lot
23066 !! html/php
23067 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23068 !!end
23069
23070 !! test
23071 Edit comment with link and link text
23072 !! options
23073 comment
23074 !! wikitext
23075 I like the [[Main Page|best pages]] a lot
23076 !! html/php
23077 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23078 !!end
23079
23080 !! test
23081 Edit comment with link and link text with suffix
23082 !! options
23083 comment
23084 !! wikitext
23085 I like the [[Main Page|best page]]s a lot
23086 !! html/php
23087 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23088 !!end
23089
23090 !! test
23091 Edit comment with section link (non-local, eg in history list)
23092 !! options
23093 comment title=[[Main Page]]
23094 !! wikitext
23095 /* External links */ removed bogus entries
23096 !! html/php
23097 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23098 !!end
23099
23100 !! test
23101 Edit comment with section link and text before it (non-local, eg in history list)
23102 !! options
23103 comment title=[[Main Page]]
23104 !! wikitext
23105 pre-comment text /* External links */ removed bogus entries
23106 !! html/php
23107 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>
23108 !!end
23109
23110 !! test
23111 Edit comment with section link (local, eg in diff view)
23112 !! options
23113 comment local title=[[Main Page]]
23114 !! wikitext
23115 /* External links */ removed bogus entries
23116 !! html/php
23117 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23118 !!end
23119
23120 !! test
23121 Edit comment with subpage link (T16080)
23122 !! options
23123 comment
23124 subpage
23125 title=[[Subpage test]]
23126 !! wikitext
23127 Poked at a [[/subpage]] here...
23128 !! html/php
23129 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23130 !!end
23131
23132 !! test
23133 Edit comment with subpage link and link text (T16080)
23134 !! options
23135 comment
23136 subpage
23137 title=[[Subpage test]]
23138 !! wikitext
23139 Poked at a [[/subpage|neat little page]] here...
23140 !! html/php
23141 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23142 !!end
23143
23144 !! test
23145 Edit comment with bogus subpage link in non-subpage NS (T16080)
23146 !! options
23147 comment
23148 title=[[Subpage test]]
23149 !! wikitext
23150 Poked at a [[/subpage]] here...
23151 !! html/php
23152 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...
23153 !!end
23154
23155 !! test
23156 Edit comment with bare anchor link (local, as on diff)
23157 !! options
23158 comment
23159 local
23160 title=[[Main Page]]
23161 !! wikitext
23162 [[#section]]
23163 !! html/php
23164 <a href="#section">#section</a>
23165 !! end
23166
23167 !! test
23168 Edit comment with bare anchor link (non-local, as on history)
23169 !! options
23170 comment
23171 title=[[Main Page]]
23172 !! wikitext
23173 [[#section]]
23174 !! html/php
23175 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23176 !! end
23177
23178 !! test
23179 Anchor starting with underscore
23180 !! options
23181 title=[[Foo]]
23182 !! wikitext
23183 [[#_ref|One]]
23184 !! html/php
23185 <p><a href="#_ref">One</a>
23186 </p>
23187 !! html/parsoid
23188 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23189 !! end
23190
23191 !! test
23192 Id starting with underscore
23193 !! wikitext
23194 <div id="_ref"></div>
23195 !! html/*
23196 <div id="_ref"></div>
23197
23198 !! end
23199
23200 !! test
23201 Edit comment with link with more than one pipe (T99346)
23202 !! options
23203 comment
23204 !! wikitext
23205 [[Main Page|Many|pipes]]
23206 !! html/php
23207 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23208 !! end
23209
23210 !! test
23211 Complex edit comment with link with more than one pipe (T99346)
23212 !! options
23213 comment
23214 !! wikitext
23215 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23216 !! html/php
23217 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;
23218 !! end
23219
23220 !! test
23221 Space normalisation on autocomment (T24784)
23222 !! options
23223 comment
23224 title=[[Main Page]]
23225 !! wikitext
23226 /* __hello__world__ */
23227 !! html/php
23228 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23229 !! end
23230
23231 !! test
23232 percent-encoding and + signs in comments (T28410)
23233 !! options
23234 comment
23235 !! wikitext
23236 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23237 !! html/php
23238 <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>
23239 !! end
23240
23241 # Parsoid doesn't support this yet: see T75581
23242 # but it *should* omit the 'src' attribute if the image is bad.
23243 # PHP side of tests was disabled in
23244 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23245 # because of issues in the PHP parserTests infrastructure
23246 # (but the output below is indeed what the PHP side emits)
23247 !! test
23248 Bad images - basic functionality
23249 !! wikitext
23250 [[File:Bad.jpg]]
23251 !! DISABLED/html/php
23252 !! html/parsoid
23253 <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>
23254 !! end
23255
23256 !! test
23257 Bad images - T18039: text after bad image disappears
23258 !! wikitext
23259 Foo bar
23260 [[File:Bad.jpg]]
23261 Bar foo
23262 !! DISABLED/html/php
23263 <p>Foo bar
23264 </p><p>Bar foo
23265 </p>
23266 !! html/parsoid
23267 <p>Foo bar
23268 <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>
23269 Bar foo</p>
23270 !! end
23271
23272 !! test
23273 Verify that displaytitle works (T24501) no displaytitle
23274 !! options
23275 showtitle
23276 !! config
23277 wgAllowDisplayTitle=true
23278 wgRestrictDisplayTitle=false
23279 !! wikitext
23280 this is not the the title
23281 !! html/php
23282 Parser test
23283 <p>this is not the the title
23284 </p>
23285 !! end
23286
23287 !! test
23288 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23289 !! options
23290 showtitle
23291 title=[[Screen]]
23292 !! config
23293 wgAllowDisplayTitle=true
23294 wgRestrictDisplayTitle=false
23295 !! wikitext
23296 this is not the the title
23297 {{DISPLAYTITLE:whatever}}
23298 !! html/php
23299 whatever
23300 <p>this is not the the title
23301 </p>
23302 !! end
23303
23304 !! test
23305 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23306 !! options
23307 showtitle
23308 title=[[Screen]]
23309 !! config
23310 wgAllowDisplayTitle=true
23311 wgRestrictDisplayTitle=true
23312 !! wikitext
23313 this is not the the title
23314 {{DISPLAYTITLE:whatever}}
23315 !! html/php
23316 Screen
23317 <p>this is not the the title
23318 </p>
23319 !! end
23320
23321 !! test
23322 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23323 !! options
23324 showtitle
23325 title=[[Screen]]
23326 !! config
23327 wgAllowDisplayTitle=true
23328 wgRestrictDisplayTitle=true
23329 !! wikitext
23330 this is not the the title
23331 {{DISPLAYTITLE:screen}}
23332 !! html/php
23333 screen
23334 <p>this is not the the title
23335 </p>
23336 !! end
23337
23338 !! test
23339 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23340 !! options
23341 showtitle
23342 title=[[Screen]]
23343 !! config
23344 wgAllowDisplayTitle=false
23345 !! wikitext
23346 this is not the the title
23347 {{DISPLAYTITLE:screen}}
23348 !! html/php
23349 Screen
23350 <p>this is not the the title
23351 <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>
23352 </p>
23353 !! end
23354
23355 !! test
23356 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23357 !! options
23358 showtitle
23359 title=[[Screen]]
23360 !! config
23361 wgAllowDisplayTitle=false
23362 !! wikitext
23363 this is not the the title
23364 !! html/php
23365 Screen
23366 <p>this is not the the title
23367 </p>
23368 !! end
23369
23370 !! test
23371 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23372 !! options
23373 showtitle
23374 title=[[Screen]]
23375 !! config
23376 wgAllowDisplayTitle=true
23377 wgRestrictDisplayTitle=true
23378 !! wikitext
23379 this is not the the title
23380 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23381 !! html/php
23382 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23383 <p>this is not the the title
23384 </p>
23385 !! end
23386
23387 !! test
23388 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23389 !! options
23390 showtitle
23391 title=[[Screen]]
23392 !! config
23393 wgAllowDisplayTitle=true
23394 wgRestrictDisplayTitle=true
23395 !! wikitext
23396 this is not the the title
23397 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23398 !! html/php
23399 <span style="color: red;">s</span>creen
23400 <p>this is not the the title
23401 </p>
23402 !! end
23403
23404 !! test
23405 Page status indicators: Empty name is invalid
23406 !! options
23407 showindicators
23408 !! wikitext
23409 <indicator name=" "></indicator>
23410 <indicator></indicator>
23411 !! html/php
23412 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23413 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23414 </p>
23415 !! end
23416
23417 !! test
23418 Page status indicators: Weird syntaxes that are okay
23419 !! options
23420 showindicators
23421 !! wikitext
23422 <indicator name="empty" />
23423 <indicator name="name"></indicator>
23424 !! html/php
23425 empty=
23426 name=
23427 <p><br />
23428 </p>
23429 !! end
23430
23431 !! test
23432 Page status indicators: Torture test
23433 !! options
23434 showindicators
23435 !! wikitext
23436 <indicator name="01">hello world</indicator>
23437 <indicator name="02">[[Main Page]]</indicator>
23438 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23439 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23440 <indicator name="05">* foo
23441 * bar</indicator>
23442 <indicator name="06"><nowiki>foo</nowiki></indicator>
23443 <indicator name="07"> Preformatted</indicator>
23444 <indicator name="08"><div>Broken tag</indicator>
23445 <indicator name="09">{| class=wikitable
23446 | cell
23447 |}</indicator>
23448 <indicator name="10">Two
23449
23450 paragraphs</indicator>
23451 !! html/php
23452 01=hello world
23453 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23454 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" />
23455 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>
23456 05=<ul><li> foo</li>
23457 <li> bar</li></ul>
23458
23459 06=foo
23460 07=<pre>Preformatted
23461 </pre>
23462 08=<div>Broken tag</div>
23463
23464 09=<table class="wikitable">
23465 <tr>
23466 <td> cell
23467 </td></tr></table>
23468
23469 10=<p>Two
23470 </p><p>paragraphs
23471 </p>
23472 <p><br />
23473 </p><p><br />
23474 </p><p><br />
23475 </p><p><br />
23476 </p><p><br />
23477 </p>
23478 !! end
23479
23480 !! test
23481 preload: check <noinclude> and <includeonly>
23482 !! options
23483 preload
23484 !! wikitext
23485 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23486 !! html/php
23487 Hello kind world.
23488 !! end
23489
23490 !! test
23491 preload: check <onlyinclude>
23492 !! options
23493 preload
23494 !! wikitext
23495 Goodbye <onlyinclude>Hello world</onlyinclude>
23496 !! html/php
23497 Hello world
23498 !! end
23499
23500 !! test
23501 preload: can pass tags through if we want to
23502 !! options
23503 preload
23504 !! wikitext
23505 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23506 !! html/php
23507 <includeonly>Hello world</includeonly>
23508 !! end
23509
23510 !! test
23511 preload: check that it doesn't try to do tricks
23512 !! options
23513 preload
23514 !! wikitext
23515 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23516 !! html/php
23517 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23518 !! end
23519
23520 !! test
23521 Play a bit with r67090 and T5158
23522 !! wikitext
23523 <div style="width:50% !important">&nbsp;</div>
23524 <div style="width:50%&nbsp;!important">&nbsp;</div>
23525 <div style="width:50%&#160;!important">&nbsp;</div>
23526 <div style="border : solid;">&nbsp;</div>
23527 !! html/php
23528 <div style="width:50% !important">&#160;</div>
23529 <div style="width:50% !important">&#160;</div>
23530 <div style="width:50% !important">&#160;</div>
23531 <div style="border&#160;: solid;">&#160;</div>
23532
23533 !! html/parsoid
23534 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23535 <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>
23536 <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>
23537 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23538
23539 !! end
23540
23541 !! test
23542 HTML5 data attributes
23543 !! wikitext
23544 <span data-foo="bar">Baz</span>
23545 <p data-abc-def_hij="">Quuz</p>
23546 !! html/php
23547 <p><span data-foo="bar">Baz</span>
23548 </p>
23549 <p data-abc-def_hij="">Quuz</p>
23550
23551 !! html/parsoid
23552 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23553 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23554 !! end
23555
23556 !! test
23557 Strip reserved data attributes
23558 !! wikitext
23559 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23560 !! html/php
23561 <div data-ok="fred">d</div>
23562
23563 !! html/parsoid
23564 <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>
23565 !! end
23566
23567 !! test
23568 percent-encoding and + signs in internal links (T28410)
23569 !! wikitext
23570 [[User:+%]] [[Page+title%]]
23571 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23572 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23573 [[%33%45]] [[%33%45+]]
23574 !! html/php
23575 <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>
23576 <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>
23577 <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>
23578 <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>
23579 </p>
23580 !! html/parsoid
23581 <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>
23582 <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>
23583 <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>
23584 <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>
23585 !! end
23586
23587 !! test
23588 Special characters in embedded file links (T29679)
23589 !! wikitext
23590 [[File:Contains & ampersand.jpg]]
23591 [[File:Does not exist.jpg|Title with & ampersand]]
23592 !! html/php
23593 <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>
23594 <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>
23595 </p>
23596 !! html/parsoid
23597 <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>
23598 <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>
23599 !! end
23600
23601 !! test
23602 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23603 !! wikitext
23604 Text&apos;s been normalized?
23605 !! html
23606 <p>Text&#39;s been normalized?
23607 </p>
23608 !! end
23609
23610 !! test
23611 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23612 !! wikitext
23613 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23614 !! html
23615 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23616 </p>
23617 !! end
23618
23619 !! test
23620 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23621 !! wikitext
23622 [http://www.example.org/ ideograms]
23623 !! html
23624 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23625 </p>
23626 !! end
23627
23628 !! test
23629 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23630 !! wikitext
23631 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23632 !! html
23633 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23634 </p>
23635 !! end
23636
23637 !! article
23638 Mediawiki:loop1
23639 !! text
23640 {{Identical|A}}
23641 !! endarticle
23642
23643 !! article
23644 Mediawiki:loop2
23645 !! text
23646 {{Identical|B}}
23647 !! endarticle
23648
23649 !! article
23650 Template:Identical
23651 !! text
23652 {{int:loop1}}
23653 {{int:loop2}}
23654 !! endarticle
23655
23656 !! test
23657 T33098 Template which includes system messages which includes the template
23658 !! wikitext
23659 {{Identical}}
23660 !! html
23661 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23662 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
23663 </p>
23664 !! end
23665
23666 !! test
23667 T33490 Turkish: ucfirst 'blah'
23668 !! options
23669 language=tr
23670 !! wikitext
23671 {{ucfirst:blah}}
23672 !! html
23673 <p>Blah
23674 </p>
23675 !! end
23676
23677 !! test
23678 T33490 Turkish: ucfirst 'ix'
23679 !! options
23680 language=tr
23681 !! wikitext
23682 {{ucfirst:ix}}
23683 !! html
23684 <p>İx
23685 </p>
23686 !! end
23687
23688 !! test
23689 T33490 Turkish: lcfirst 'BLAH'
23690 !! options
23691 language=tr
23692 !! wikitext
23693 {{lcfirst:BLAH}}
23694 !! html
23695 <p>bLAH
23696 </p>
23697 !! end
23698
23699 !! test
23700 T33490 Turkish: ucfırst (with a dotless i)
23701 !! options
23702 language=tr
23703 !! wikitext
23704 {{ucfırst:blah}}
23705 !! html
23706 <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>
23707 </p>
23708 !! end
23709
23710 !! test
23711 T33490 ucfırst (with a dotless i) with English language
23712 !! options
23713 language=en
23714 !! wikitext
23715 {{ucfırst:blah}}
23716 !! html
23717 <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>
23718 </p>
23719 !! end
23720
23721 # Note that Parsoid doesn't emit an explicit TOC.
23722 # Note also that the html2wt direction tends to emit an extra newline
23723 # between the __TOC__ magicword and the first heading unless *both*
23724 # the <meta> and the <h2> have a data-parsoid attribute set (even if
23725 # it's "{}").
23726
23727 !! test
23728 T28375: TOC with italics
23729 !! options
23730 title=[[Main Page]]
23731 !! wikitext
23732 __TOC__
23733 == ''Lost'' episodes ==
23734 !! html/php
23735 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23736 <ul>
23737 <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>
23738 </ul>
23739 </div>
23740
23741 <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>
23742
23743 !! html/parsoid
23744 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23745 <h2 data-parsoid='{}'> <i>Lost</i> episodes </h2>
23746 !! end
23747
23748 !! test
23749 T28375: TOC with bold
23750 !! options
23751 title=[[Main Page]]
23752 !! wikitext
23753 __TOC__
23754 == '''should be bold''' then normal text ==
23755 !! html/php
23756 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23757 <ul>
23758 <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>
23759 </ul>
23760 </div>
23761
23762 <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>
23763
23764 !! html/parsoid
23765 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23766 <h2 data-parsoid='{}'> <b>should be bold</b> then normal text </h2>
23767 !! end
23768
23769 !! test
23770 T35845: Headings become cursive in TOC when they contain an image
23771 !! options
23772 title=[[Main Page]]
23773 !! wikitext
23774 __TOC__
23775 == Image [[Image:foobar.jpg]] ==
23776 !! html/php
23777 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23778 <ul>
23779 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
23780 </ul>
23781 </div>
23782
23783 <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>
23784
23785 !! html/parsoid
23786 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23787 <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>
23788 !! end
23789
23790 !! test
23791 T35845 (2): Headings become bold in TOC when they contain a blockquote
23792 !! options
23793 title=[[Main Page]]
23794 !! wikitext
23795 __TOC__
23796 == <blockquote>Quote</blockquote> ==
23797 !! html/php
23798 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23799 <ul>
23800 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23801 </ul>
23802 </div>
23803
23804 <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>
23805
23806 !! html/php+tidy
23807 <p></p>
23808 <div id="toc" class="toc">
23809 <div class="toctitle">
23810 <h2>Contents</h2>
23811 </div>
23812 <ul>
23813 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
23814 </ul>
23815 </div>
23816 <p></p>
23817 <h2><span class="mw-headline" id="Quote"></span></h2>
23818 <blockquote>
23819 <p><span class="mw-headline" id="Quote">Quote</span></p>
23820 </blockquote>
23821 <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>
23822 !! html/parsoid
23823 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23824 <h2 data-parsoid='{}'> <blockquote>Quote</blockquote> </h2>
23825 !! end
23826
23827 !! test
23828 Unclosed tags in TOC
23829 !! options
23830 title=[[Main Page]]
23831 !! wikitext
23832 __TOC__
23833 == Proof: 2 < 3 ==
23834 <small>Hanc marginis exiguitas non caperet.</small>
23835 QED
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="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
23840 </ul>
23841 </div>
23842
23843 <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>
23844 <p><small>Hanc marginis exiguitas non caperet.</small>
23845 QED
23846 </p>
23847 !! html/parsoid
23848 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23849 <h2 data-parsoid='{}'> Proof: 2 &lt; 3 </h2>
23850 <p><small>Hanc marginis exiguitas non caperet.</small>
23851 QED</p>
23852 !! end
23853
23854 !! test
23855 Multiple tags in TOC
23856 !! wikitext
23857 __TOC__
23858 == <i>Foo</i> <b>Bar</b> ==
23859
23860 == <i>Foo</i> <blockquote>Bar</blockquote> ==
23861 !! html/php
23862 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23863 <ul>
23864 <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>
23865 <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>
23866 </ul>
23867 </div>
23868
23869 <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>
23870 <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>
23871
23872 !! html/php+tidy
23873 <p></p>
23874 <div id="toc" class="toc">
23875 <div class="toctitle">
23876 <h2>Contents</h2>
23877 </div>
23878 <ul>
23879 <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>
23880 <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>
23881 </ul>
23882 </div>
23883 <p></p>
23884 <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>
23885 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
23886 <blockquote>
23887 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
23888 </blockquote>
23889 <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>
23890 !! html/parsoid
23891 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23892 <h2 data-parsoid='{}'> <i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b> </h2>
23893 <h2> <i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote> </h2>
23894 !! end
23895
23896 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
23897 # html5 tag parsing.
23898 !! test
23899 Tags with parameters in TOC
23900 !! options
23901 parsoid=wt2html
23902 !! wikitext
23903 __TOC__
23904 == <sup class="in-h2">Hello</sup> ==
23905
23906 == <sup class="a > b">Evilbye</sup> ==
23907 !! html/php
23908 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23909 <ul>
23910 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
23911 <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>
23912 </ul>
23913 </div>
23914
23915 <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>
23916 <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>
23917
23918 !! html/parsoid
23919 <meta property="mw:PageProp/toc" />
23920 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
23921
23922 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
23923 !! end
23924
23925 !! test
23926 span tags with directionality in TOC
23927 !! wikitext
23928 __TOC__
23929 == <span dir="ltr">C++</span> ==
23930
23931 == <span dir="rtl">זבנג!</span> ==
23932
23933 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
23934
23935 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
23936
23937 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
23938 !! html/php
23939 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23940 <ul>
23941 <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>
23942 <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>
23943 <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>
23944 <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>
23945 <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>
23946 </ul>
23947 </div>
23948
23949 <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>
23950 <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>
23951 <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>
23952 <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>
23953 <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>
23954
23955 !! html/parsoid
23956 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23957 <h2 data-parsoid='{}'> <span dir="ltr">C++</span> </h2>
23958 <h2> <span dir="rtl">זבנג!</span> </h2>
23959 <h2> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </h2>
23960 <h2> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </h2>
23961 <h2> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </h2>
23962 !! end
23963
23964 !! test
23965 T74884: bdi element in ToC
23966 !! wikitext
23967 __TOC__
23968 == <bdi>test</bdi> ==
23969 !! html/php
23970 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23971 <ul>
23972 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
23973 </ul>
23974 </div>
23975
23976 <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>
23977
23978 !! html/parsoid
23979 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23980 <h2 data-parsoid='{}'> <bdi>test</bdi> </h2>
23981 !! end
23982
23983 !! test
23984 T35715: s/strike element in ToC
23985 !! wikitext
23986 __TOC__
23987 == <s>test</s> test <strike>test</strike> ==
23988 !! html/php
23989 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
23990 <ul>
23991 <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>
23992 </ul>
23993 </div>
23994
23995 <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>
23996
23997 !! html/parsoid
23998 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
23999 <h2 data-parsoid='{}'> <s>test</s> test <strike>test</strike> </h2>
24000 !! end
24001
24002 # Note that the html output does not have the <p></p>, but the
24003 # html+tidy output *does*. This is because the empty <p></p> is
24004 # removed by the sanitizer, but only when tidy is *not* enabled (!).
24005 !! test
24006 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24007 !! wikitext
24008 __TOC__
24009 == x ==
24010 !! html/php
24011 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
24012 <ul>
24013 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24014 </ul>
24015 </div>
24016
24017 <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>
24018
24019 !! html/php+tidy
24020 <p></p>
24021 <div id="toc" class="toc">
24022 <div class="toctitle">
24023 <h2>Contents</h2>
24024 </div>
24025 <ul>
24026 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24027 </ul>
24028 </div>
24029 <p></p>
24030 <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>
24031 !! html/parsoid
24032 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24033 <h2 data-parsoid='{}'> x </h2>
24034 !! end
24035
24036 !! article
24037 MediaWiki:T34057
24038 !! text
24039 == {{int:headline_sample}} ==
24040 !! endarticle
24041
24042 !! test
24043 T34057: Title needed when expanding <h> nodes.
24044 !! options
24045 title=[[Main Page]]
24046 !! wikitext
24047 {{int:T34057}}
24048 !! html
24049 <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>
24050
24051 !! end
24052
24053 !! test
24054 Strip marker in urlencode
24055 !! wikitext
24056 {{urlencode:x<nowiki/>y}}
24057 {{urlencode:x<nowiki/>y|wiki}}
24058 {{urlencode:x<nowiki/>y|path}}
24059 {{urlencode:x<pre id="one">two</pre>y}}
24060 !! html/php
24061 <p>xy
24062 xy
24063 xy
24064 xy
24065 </p>
24066 !! end
24067
24068 !! test
24069 Strip marker in lc
24070 !! wikitext
24071 {{lc:x<nowiki/>y}}
24072 !! html
24073 <p>xy
24074 </p>
24075 !! end
24076
24077 !! test
24078 Strip marker in uc
24079 !! wikitext
24080 {{uc:x<nowiki/>y}}
24081 !! html
24082 <p>XY
24083 </p>
24084 !! end
24085
24086 !! test
24087 Strip marker in formatNum
24088 !! wikitext
24089 {{formatnum:1<nowiki/>2}}
24090 {{formatnum:1<nowiki/>2|R}}
24091 !! html
24092 <p>12
24093 12
24094 </p>
24095 !! end
24096
24097 !! test
24098 Check noCommafy in formatNum
24099 !! options
24100 language=be-tarask
24101 !! wikitext
24102 {{formatnum:123456.78}}
24103 {{formatnum:123456.78|NOSEP}}
24104 !! html
24105 <p>123 456,78
24106 123456.78
24107 </p>
24108 !! end
24109
24110 !! test
24111 Wrong option for formatNum (T58199)
24112 !! wikitext
24113 {{formatnum:1,234.56|Random}}
24114 {{formatnum:1,234.56|EVERYTHING}}
24115 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24116 !! html
24117 <p>1,234.56
24118 1,234.56
24119 1,234.56
24120 </p>
24121 !! end
24122
24123 !! test
24124 Strip marker in grammar
24125 !! options
24126 language=fi
24127 !! wikitext
24128 {{grammar:elative|foo<nowiki/>bar}}
24129 !! html
24130 <p>foobarista
24131 </p>
24132 !! end
24133
24134 !! test
24135 Strip marker in padleft
24136 !! wikitext
24137 {{padleft:|2|x<nowiki/>y}}
24138 !! html
24139 <p>xy
24140 </p>
24141 !! end
24142
24143 !! test
24144 Strip marker in padright
24145 !! wikitext
24146 {{padright:|2|x<nowiki/>y}}
24147 !! html
24148 <p>xy
24149 </p>
24150 !! end
24151
24152 !! test
24153 Strip marker in anchorencode
24154 !! wikitext
24155 {{anchorencode:x<nowiki/>y}}
24156 !! html
24157 <p>xy
24158 </p>
24159 !! end
24160
24161 !! test
24162 nowiki inside link inside heading (T20295)
24163 !! wikitext
24164 ==[[foo|x<nowiki>y</nowiki>z]]==
24165 !! html
24166 <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>
24167
24168 !! end
24169
24170 !! test
24171 new support for bdi element (T33817)
24172 !! wikitext
24173 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24174 !! html
24175 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24176
24177 !!end
24178
24179 !! test
24180 Ignore pipe between table row attributes
24181 !! wikitext
24182 {|
24183 | quux
24184 |- id=foo | style='color: red'
24185 | bar
24186 |}
24187 !! html
24188 <table>
24189 <tr>
24190 <td> quux
24191 </td></tr>
24192 <tr id="foo" style="color: red">
24193 <td> bar
24194 </td></tr></table>
24195
24196 !! end
24197
24198 !!test
24199 Language parser function
24200 !! wikitext
24201 {{#language:ar}}
24202 !! html
24203 <p>العربية
24204 </p>
24205 !! end
24206
24207 !!test
24208 Padleft and padright as substr
24209 !! wikitext
24210 {{padleft:|3|abcde}}
24211 {{padright:|3|abcde}}
24212 !! html
24213 <p>abc
24214 abc
24215 </p>
24216 !! end
24217
24218 !!test
24219 Special parser function
24220 !! wikitext
24221 {{#special:RandomPage}}
24222 {{#special:BaDtItLe}}
24223 {{#special:Foobar}}
24224 !! html
24225 <p>Special:Random
24226 Special:Badtitle
24227 Special:Foobar
24228 </p>
24229 !! end
24230
24231 !!test
24232 T36939 - Case insensitive link parsing ([HttP://])
24233 !! wikitext
24234 [HttP://MediaWiki.Org/]
24235 !! html/php
24236 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24237 </p>
24238 !! html/parsoid
24239 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
24240 !! end
24241
24242 !!test
24243 T36939 - Case insensitive link parsing ([HttP:// title])
24244 !! wikitext
24245 [HttP://MediaWiki.Org/ MediaWiki]
24246 !! html
24247 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24248 </p>
24249 !! end
24250
24251 !!test
24252 T36939 - Case insensitive link parsing (HttP://)
24253 !! wikitext
24254 HttP://MediaWiki.Org/
24255 !! html/php
24256 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24257 </p>
24258 !! html/parsoid
24259 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24260 !! end
24261
24262 !!test
24263 Disable TOC
24264 !! options
24265 notoc
24266 !! wikitext
24267 Lead
24268 == Section 1 ==
24269 == Section 2 ==
24270 == Section 3 ==
24271 == Section 4 ==
24272 == Section 5 ==
24273 !! html
24274 <p>Lead
24275 </p>
24276
24277 <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>
24278 <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>
24279 <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>
24280 <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>
24281 <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>
24282
24283 !! end
24284
24285
24286 ###
24287 ### Parsoid-specific tests
24288 ### Parsoid-PHP parser incompatibilities
24289 ###
24290 !!test
24291 1. SOL-sensitive wikitext tokens as template-args
24292 !!options
24293 parsoid=wt2html,wt2wt
24294 !! wikitext
24295 {{echo|*a}}
24296 {{echo|#a}}
24297 {{echo|:a}}
24298 !! html
24299 <span about="#mwt1" typeof="mw:Transclusion">
24300 </span><ul about="#mwt1"><li>a</li>
24301 </ul>
24302 <span about="#mwt2" typeof="mw:Transclusion">
24303 </span><ol about="#mwt2"><li>a</li>
24304 </ol>
24305 <span about="#mwt3" typeof="mw:Transclusion">
24306 </span><dl about="#mwt3"><dd>a</dd>
24307 </dl>
24308 !!end
24309
24310 #### -----------------------------------------------------------------
24311 #### Parsoid-specific functionality tests
24312 #### -----------------------------------------------------------------
24313
24314 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24315 # We know wt2wt will fail, but we expect selser to pass.
24316 # Due to the nature of our testing, wt2wt and selser tests will enter the
24317 # blacklist and we'll catch selser regressions based on changes to the
24318 # blacklist entries for selser tests.
24319 !! test
24320 1. Bad treebuilder fixup of formatting elt is cleaned up
24321 !! options
24322 parsoid=wt2html,wt2wt
24323 !! wikitext
24324 {|
24325 |
24326 <small>
24327 [[Image:Foobar.jpg|right|Test]]
24328 </small>
24329 |}
24330 !! html/parsoid
24331 <table>
24332 <tbody><tr><td>
24333 <small>
24334 <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>
24335 </small>
24336 </td></tr>
24337 </tbody></table>
24338 !! end
24339
24340 !! test
24341 2. Bad treebuilder fixup of formatting elt is cleaned up
24342 !! options
24343 parsoid=wt2html,wt2wt
24344 !! wikitext
24345 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24346
24347 <small>[[Image:Foobar.jpg|right|300px]]</small>
24348 !! html/parsoid
24349
24350 <p><b>foo</b></p>
24351 <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>
24352 <p><b>bar</b></p>
24353 <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>
24354 !! end
24355
24356 !! test
24357 3. Bad treebuilder fixup of formatting elt is cleaned up
24358 !! options
24359 parsoid=wt2html,wt2wt
24360 !! wikitext
24361 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24362 !! html/parsoid
24363 <p><small><b>foo</b></small></p>
24364 <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>
24365 <p><small><b>bar</b></small></p>
24366 !! end
24367
24368 !! test
24369 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24370 !! options
24371 parsoid=wt2html,wt2wt
24372 !! wikitext
24373 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24374 !! html/parsoid
24375 <p><b><small></small></b></p>
24376 <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>
24377 <p></p>
24378 !! end
24379
24380 #### ----------------------------------------------------------------
24381 #### Parsoid-only testing of Parsoid's impl of LST
24382 #### Not implemented yet, see
24383 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24384 #### ----------------------------------------------------------------
24385
24386 ## We still need to support serializing the older format while content is stored.
24387 !! test
24388 LST Sections: Backwards compatibility
24389 !! options
24390 parsoid={
24391 "suppressErrors": true,
24392 "modes": ["html2wt"]
24393 }
24394 !! wikitext
24395 <section begin="2011-05-16" />
24396 <section end="2014-04-10 (MW 1.23wmf22)" />
24397 !! html/parsoid
24398 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24399 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24400 !! end
24401
24402 !! test
24403 LST Sections: Newfangled approach
24404 !! wikitext
24405 <section begin="2011-05-16" />
24406 <section end="2014-04-10 (MW 1.23wmf22)" />
24407 !! html/parsoid
24408 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24409 </span>
24410 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24411 </span></p>
24412 !! end
24413
24414 #--------- Test stripping of empty nodes in template content ----------
24415
24416 !! test
24417 Empty LI and TR nodes should be stripped from template content
24418 !! wikitext
24419 {{EmptyLITest}}
24420 {{EmptyTRTest}}
24421 !! html/parsoid
24422 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24423 <li>a</li>
24424 <li>b</li>
24425 </ul>
24426 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24427 <tbody>
24428 <tr>
24429 <td>foo</td>
24430 </tr>
24431 <tr>
24432 <td>bar</td>
24433 </tr>
24434 </tbody>
24435 </table>
24436 !! end
24437
24438 !! test
24439 Empty LI and TR nodes should not be stripped from top-level content
24440 !! wikitext
24441 * a
24442 *
24443 * b
24444 {|
24445 |-
24446 |-
24447 |foo
24448 |}
24449 !! html/parsoid
24450 <ul>
24451 <li> a</li>
24452 <li class='mw-empty-elt'></li>
24453 <li> b</li>
24454 </ul>
24455 <table>
24456 <tbody>
24457 <tr class='mw-empty-elt'></tr>
24458 <tr>
24459 <td>foo</td>
24460 </tr>
24461 </tbody>
24462 </table>
24463 !! end
24464
24465 !! test
24466 Empty TR nodes should not be stripped if they have any attributes set
24467 !! wikitext
24468 {{EmptyTRWithHTMLAttrTest}}
24469 !! html/parsoid
24470 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24471 <tr align='center'></tr>
24472 <tr><td>foo</td></tr>
24473 <tr align='center'></tr>
24474 <tr><td>bar</td></tr>
24475 </table>
24476 !! end
24477
24478 #### ----------------------------------------------------------------
24479 #### The following section of tests are primarily to test
24480 #### wikitext escaping capabilities of Parsoid. Given that
24481 #### escaping can be done any number of ways, the wikitext (input)
24482 #### is always adjusted to reflect how Parsoid adds nowiki
24483 #### escape tags.
24484 ####
24485 #### We are marking several tests as parsoid-only since the
24486 #### HTML in the result section is different from what the
24487 #### PHP parser generates for it.
24488 #### ----------------------------------------------------------------
24489
24490
24491 #### --------------- Headings ---------------
24492 #### 0. Unnested
24493 #### 1. Nested inside html <h1>=foo=</h1>
24494 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24495 #### 3. Nested inside html with wikitext split by html tags
24496 #### 4. No escape needed
24497 #### 5. Empty headings <h1></h1>
24498 #### 6. Heading chars in SOL context
24499 #### ----------------------------------------
24500 !! test
24501 Headings: 0. Unnested
24502 !! options
24503 parsoid=html2wt
24504 !! html/parsoid
24505 <p>=foo=</p>
24506
24507 <p> =foo=
24508 <!--cmt-->
24509 =foo=</p>
24510
24511 <p>=foo<i>a</i>=</p>
24512 !! wikitext
24513 <nowiki>=foo=</nowiki>
24514
24515 <nowiki> </nowiki>=foo=
24516 <!--cmt-->
24517 <nowiki>=foo=</nowiki>
24518
24519 =foo''a''<nowiki>=</nowiki>
24520 !!end
24521
24522 # New headings and existing headings are handled differently
24523 !! test
24524 Headings: 1. Nested inside html
24525 !! options
24526 parsoid=html2wt
24527 !! html/parsoid
24528 <h1>=foo=</h1>
24529 <h2>=foo=</h2>
24530 <h3>=foo=</h3>
24531
24532 <h1 data-parsoid=''>=foo=</h1>
24533 <h2 data-parsoid=''>=foo=</h2>
24534 <h3 data-parsoid=''>=foo=</h3>
24535 <h4 data-parsoid=''>=foo=</h4>
24536 <h5 data-parsoid=''>=foo=</h5>
24537 <h6 data-parsoid=''>=foo=</h6>
24538 !! wikitext
24539 = =foo= =
24540
24541 == =foo= ==
24542
24543 === =foo= ===
24544
24545 =<nowiki>=foo=</nowiki>=
24546 ==<nowiki>=foo=</nowiki>==
24547 ===<nowiki>=foo=</nowiki>===
24548 ====<nowiki>=foo=</nowiki>====
24549 =====<nowiki>=foo=</nowiki>=====
24550 ======<nowiki>=foo=</nowiki>======
24551
24552 !!end
24553
24554 !! test
24555 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24556 !! options
24557 parsoid=html2wt
24558 !! html/parsoid
24559 <h1>foo</h1>*bar
24560 <h1>foo</h1>=bar
24561 <h1>foo</h1>=bar=
24562 !! wikitext
24563 = foo =
24564 <nowiki>*</nowiki>bar
24565
24566 = foo =
24567 =bar
24568
24569 = foo =
24570 <nowiki>=bar=</nowiki>
24571 !!end
24572
24573 !! test
24574 Headings: 3. Nested inside html with wikitext split by html tags
24575 !! options
24576 parsoid=html2wt
24577 !! html/parsoid
24578 <h1>=<b>bold</b>foo=</h1>
24579 !! wikitext
24580 = ='''bold'''foo= =
24581 !!end
24582
24583 !! test
24584 Headings: 4a. No escaping needed (testing just h1 and h2)
24585 !! options
24586 parsoid=html2wt
24587 !! html/parsoid
24588 <h1>=foo</h1>
24589 <h1>foo=</h1>
24590 <h1> =foo= </h1>
24591 <h1>=foo= bar</h1>
24592 <h2>=foo</h2>
24593 <h2>foo=</h2>
24594 <h1>=</h1>
24595 <h1><i>=</i>foo=</h1>
24596 !! wikitext
24597 = =foo =
24598
24599 = foo= =
24600
24601 = =foo= =
24602
24603 = =foo= bar =
24604
24605 == =foo ==
24606
24607 == foo= ==
24608
24609 = = =
24610
24611 = ''=''foo= =
24612 !!end
24613
24614 !! test
24615 Headings: 4b. No escaping needed (inside p-tags)
24616 !! options
24617 parsoid=html2wt
24618 !! html/parsoid
24619 <p>===
24620 =foo= x
24621 =foo= <s></s>
24622 </p>
24623 !! wikitext
24624 ===
24625 =foo= x
24626 =foo= <s></s>
24627 !!end
24628
24629 !! test
24630 Headings: 5. Empty headings
24631 !! options
24632 parsoid=html2wt
24633 !! html/parsoid
24634 <h1 data-parsoid='{}'></h1>
24635
24636 <h2 data-parsoid='{}'></h2>
24637
24638 <h3 data-parsoid='{}'></h3>
24639
24640 <h4 data-parsoid='{}'></h4>
24641
24642 <h5 data-parsoid='{}'></h5>
24643
24644 <h6 data-parsoid='{}'></h6>
24645 !! wikitext
24646 =<nowiki/>=
24647
24648 ==<nowiki/>==
24649
24650 ===<nowiki/>===
24651
24652 ====<nowiki/>====
24653
24654 =====<nowiki/>=====
24655
24656 ======<nowiki/>======
24657 !!end
24658
24659 !! test
24660 Headings: 6a. Heading chars in SOL context (with trailing spaces)
24661 !! options
24662 parsoid=html2wt
24663 !! html/parsoid
24664 <p>=a=</p>
24665
24666 <p>=a=</p>
24667
24668 <p>=a=</p>
24669 !! wikitext
24670 <nowiki>=a=</nowiki>
24671
24672 <nowiki>=a=</nowiki>
24673
24674 <nowiki>=a=</nowiki>
24675 !!end
24676
24677 !! test
24678 Headings: 6b. Heading chars in SOL context (with trailing newlines)
24679 !! options
24680 parsoid=html2wt
24681 !! html/parsoid
24682 <p>=a=
24683 b</p>
24684
24685 <p>=a=
24686 b</p>
24687
24688 <p>=a=
24689 b</p>
24690 !! wikitext
24691 <nowiki>=a=</nowiki>
24692 b
24693
24694 <nowiki>=a=</nowiki>
24695 b
24696
24697 <nowiki>=a=</nowiki>
24698 b
24699 !!end
24700
24701 !! test
24702 Headings: 6c. Heading chars in SOL context (leading newline break)
24703 !! options
24704 parsoid=html2wt
24705 !! html/parsoid
24706 <p>a
24707 =b=</p>
24708 !! wikitext
24709 a
24710 <nowiki>=b=</nowiki>
24711 !!end
24712
24713 !! test
24714 Headings: 6d. Heading chars in SOL context (with interspersed comments)
24715 !! options
24716 parsoid=html2wt
24717 !! html/parsoid
24718 <!--c0--><p>=a=</p>
24719
24720 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
24721 !! wikitext
24722 <!--c0--><nowiki>=a=</nowiki>
24723
24724 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
24725 !!end
24726
24727 !! test
24728 Headings: 6d. Heading chars in SOL context (No escaping needed)
24729 !! options
24730 parsoid=html2wt
24731 !! html/parsoid
24732 =a=<div>b</div>
24733 !! wikitext
24734 =a=<div>b</div>
24735 !!end
24736
24737 !! test
24738 Headings: 7. Insert a newline between new content and headings
24739 !! options
24740 parsoid=html2wt
24741 !! html/parsoid
24742 <h2>NEW</h2>
24743 <p>new</p>
24744 <h2 data-parsoid='{}'>A</h2>
24745 <p data-parsoid='{}'>a</p>
24746 !! wikitext
24747 == NEW ==
24748 new
24749
24750 ==A==
24751 a
24752
24753 !! end
24754
24755 #### --------------- Lists ---------------
24756 #### 0. Outside nests (*foo, etc.)
24757 #### 1. Nested inside html <ul><li>*foo</li></ul>
24758 #### 2. Inside definition lists
24759 #### 3. Only bullets at start should be escaped
24760 #### 4. No escapes needed
24761 #### 5. No unnecessary escapes
24762 #### 6. Escape bullets in SOL position
24763 #### 7. Escape bullets in a multi-line context
24764 #### ----------------------------------------
24765
24766 !! test
24767 Lists: 0. Outside nests
24768 !! options
24769 parsoid=html2wt
24770 !! html/parsoid
24771 <p>*foo</p>
24772
24773 <p>#foo</p>
24774
24775 <p>;Foo:bar</p>
24776 !! wikitext
24777 <nowiki>*</nowiki>foo
24778
24779 <nowiki>#</nowiki>foo
24780
24781 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
24782 !!end
24783
24784 ## Making these next 3 tests Parsoid-only since they are html2wt tests
24785 ## to test wikitext escaping, and insignificant whitespace diffs
24786 ## cause PHP parser tests to barf
24787 !! test
24788 Lists: 1. Nested inside html (No unnecessary escapes)
24789 !! options
24790 parsoid=html2wt
24791 !! html/parsoid
24792 <ul>
24793 <li>*foo</li>
24794 <li>#foo</li>
24795 <li>:foo</li>
24796 <li>;foo</li>
24797 <li data-parsoid='{}'>*foo</li>
24798 <li data-parsoid='{}'>#foo</li>
24799 <li data-parsoid='{}'>:foo</li>
24800 <li data-parsoid='{}'>;foo</li>
24801 </ul>
24802
24803 <ol>
24804 <li>*foo</li>
24805 <li>#foo</li>
24806 <li>:foo</li>
24807 <li>;foo</li>
24808 <li data-parsoid='{}'>*foo</li>
24809 <li data-parsoid='{}'>#foo</li>
24810 <li data-parsoid='{}'>:foo</li>
24811 <li data-parsoid='{}'>;foo</li>
24812 </ol>
24813 !! wikitext
24814 * *foo
24815 * #foo
24816 * :foo
24817 * ;foo
24818 *<nowiki>*foo</nowiki>
24819 *<nowiki>#foo</nowiki>
24820 *<nowiki>:foo</nowiki>
24821 *<nowiki>;foo</nowiki>
24822
24823 # *foo
24824 # #foo
24825 # :foo
24826 # ;foo
24827 #<nowiki>*foo</nowiki>
24828 #<nowiki>#foo</nowiki>
24829 #<nowiki>:foo</nowiki>
24830 #<nowiki>;foo</nowiki>
24831 !!end
24832
24833 !! test
24834 Lists: 2. Inside definition lists
24835 !! options
24836 parsoid=html2wt
24837 !! html/parsoid
24838 <dl><dt>;foo</dt></dl>
24839 <dl><dt>:foo</dt></dl>
24840 <dl><dt>:foo</dt>
24841 <dd>bar</dd></dl>
24842 <dl><dd>:foo</dd></dl>
24843 !! wikitext
24844 ; ;foo
24845
24846 ; <nowiki>:foo</nowiki>
24847
24848 ; <nowiki>:foo</nowiki>
24849 : bar
24850
24851 : :foo
24852 !!end
24853
24854 !! test
24855 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
24856 !! options
24857 parsoid=html2wt
24858 !! html/parsoid
24859 <ul>
24860 <li>*foo*bar</li>
24861 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
24862 </ul>
24863 !! wikitext
24864 * *foo*bar
24865 *<nowiki>*foo</nowiki>''it''*bar
24866 !!end
24867
24868 !! test
24869 Lists: 4. No escapes needed
24870 !! options
24871 parsoid=html2wt
24872 !! html/parsoid
24873 <ul>
24874 <li>foo*bar
24875 </li>
24876 </ul>
24877 <ul>
24878 <li><i>foo</i>*bar
24879 </li>
24880 </ul>
24881 <ul>
24882 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
24883 </li>
24884 </ul>
24885 <ul>
24886 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
24887 </li>
24888 </ul>
24889 !! wikitext
24890 *foo*bar
24891
24892 *''foo''*bar
24893
24894 *[[Foo]]: bar
24895
24896 *[[Foo]]*bar
24897 !!end
24898
24899 !! test
24900 Lists: 5. No unnecessary escapes
24901 !! options
24902 parsoid=html2wt
24903 !! html/parsoid
24904 <ul><li> bar <span>[[foo]]</span></li></ul>
24905 <ul><li> =bar <span>[[foo]]</span></li></ul>
24906 <ul><li> [[bar <span>[[foo]]</span></li></ul>
24907 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
24908 <ul><li> =bar <span>foo]]</span>=</li></ul>
24909 <ul><li> <s></s>: a</li></ul>
24910 <ul><li> <i>* foo</i></li></ul>
24911
24912 !! wikitext
24913 * bar <span><nowiki>[[foo]]</nowiki></span>
24914
24915 * =bar <span><nowiki>[[foo]]</nowiki></span>
24916
24917 * [[bar <span><nowiki>[[foo]]</nowiki></span>
24918
24919 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
24920
24921 * =bar <span>foo]]</span>=
24922
24923 * <s></s>: a
24924
24925 * ''* foo''
24926 !!end
24927
24928 !! test
24929 Lists: 6. Escape bullets in SOL position
24930 !! options
24931 parsoid=html2wt
24932 !! html/parsoid
24933 <p><!--cmt-->*foo</p>
24934 !! wikitext
24935 <!--cmt--><nowiki>*</nowiki>foo
24936 !!end
24937
24938 !! test
24939 Lists: 7. Escape bullets in a multi-line context
24940 !! options
24941 parsoid=html2wt
24942 !! html/parsoid
24943 <p>a
24944 *b
24945 </p>
24946 !! wikitext
24947 a
24948 <nowiki>*</nowiki>b
24949 !!end
24950
24951 !! test
24952 Lists: 8. Escape colons only if not present in tags
24953 !! options
24954 parsoid=html2wt
24955 !! html/parsoid
24956 <dl><dt>a:b<i>c:d</i></dt></dl>
24957 !! wikitext
24958 ; <nowiki>a:b</nowiki>''c:d''
24959 !! end
24960
24961 #### --------------- HRs ---------------
24962 #### 1. Single line
24963 #### -----------------------------------
24964
24965 !! test
24966 HRs: 1. Single line
24967 !! options
24968 parsoid=html2wt
24969 !! html/parsoid
24970 <hr />----
24971 <hr />=foo=
24972 <hr />*foo
24973 !! wikitext
24974 ----<nowiki>----</nowiki>
24975 ----=foo=
24976 ----*foo
24977 !! end
24978
24979 #### --------------- Tables ---------------
24980 #### 1a. Simple example
24981 #### 1b. No escaping needed (!foo)
24982 #### 1c. No escaping needed (|foo)
24983 #### 1d. No escaping needed (|}foo)
24984 ####
24985 #### 2a. Nested in td (<td>foo|bar</td>)
24986 #### 2b. Nested in td (<td>foo||bar</td>)
24987 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
24988 ####
24989 #### 3a. Nested in th (<th>foo!bar</th>)
24990 #### 3b. Nested in th (<th>foo!!bar</th>)
24991 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
24992 ####
24993 #### 4a. Escape -
24994 #### 4b. Escape +
24995 #### 4c. No escaping needed
24996 #### --------------------------------------
24997
24998 !! test
24999 Tables: 1a. Simple example
25000 !! options
25001 parsoid=html2wt
25002 !! html/parsoid
25003 <p>{|
25004 |}
25005 </p>
25006 !! wikitext
25007 <nowiki>{|</nowiki>
25008 |}
25009 !! end
25010
25011 !! test
25012 Tables: 1b. No escaping needed
25013 !! options
25014 parsoid=html2wt
25015 !! html/parsoid
25016 <p>!foo
25017 </p>
25018 !! wikitext
25019 !foo
25020 !! end
25021
25022 !! test
25023 Tables: 1c. No escaping needed
25024 !! options
25025 parsoid=html2wt
25026 !! html/parsoid
25027 <p>|foo
25028 </p>
25029 !! wikitext
25030 |foo
25031 !! end
25032
25033 !! test
25034 Tables: 1d. No escaping needed
25035 !! options
25036 parsoid=html2wt
25037 !! html/parsoid
25038 <p>|}foo
25039 </p>
25040 !! wikitext
25041 |}foo
25042 !! end
25043
25044 !! test
25045 Tables: 2a. Nested in td
25046 !! options
25047 parsoid=html2wt
25048 !! html/parsoid
25049 <table><tbody><tr>
25050 <td>foo|bar</td></tr>
25051 <tr><td>x<div>a|b</div></td>
25052 </tbody></table>
25053 !! wikitext
25054 {|
25055 |<nowiki>foo|bar</nowiki>
25056 |-
25057 |x<div><nowiki>a|b</nowiki></div>
25058 |}
25059 !! html/php+tidy
25060 <table>
25061 <tr>
25062 <td>foo|bar</td>
25063 </tr>
25064 <tr>
25065 <td>x
25066 <div>a|b</div>
25067 </td>
25068 </tr>
25069 </table>
25070 !! end
25071
25072 !! test
25073 Tables: 2b. Nested in td
25074 !! options
25075 parsoid=html2wt
25076 !! html/parsoid
25077 <table><tbody><tr>
25078 <td>foo||bar</td>
25079 <td>a<i>b||c</i></td>
25080 <td>a<i><div>b||c</div></i></td>
25081 </tr></tbody></table>
25082 !! wikitext
25083 {|
25084 |<nowiki>foo||bar</nowiki>
25085 |a''<nowiki>b||c</nowiki>''
25086 |a''<div><nowiki>b||c</nowiki></div>''
25087 |}
25088 !! html/php
25089 <table>
25090 <tr>
25091 <td>foo||bar
25092 </td>
25093 <td>a<i>b||c</i>
25094 </td>
25095 <td>a<i><div>b||c</div></i>
25096 </td></tr></table>
25097
25098 !! end
25099
25100 !! test
25101 Tables: 2c. Nested in td -- no escaping needed
25102 !! options
25103 parsoid=html2wt
25104 !! html/*
25105 <table>
25106 <tr>
25107 <td>foo!!bar
25108 </td></tr></table>
25109
25110 !! wikitext
25111 {|
25112 |foo!!bar
25113 |}
25114 !! end
25115
25116 !! test
25117 Tables: 3a. Nested in th
25118 !! options
25119 parsoid=html2wt
25120 !! html/*
25121 <table>
25122 <tr>
25123 <th>foo!bar
25124 </th></tr></table>
25125
25126 !! wikitext
25127 {|
25128 !foo!bar
25129 |}
25130 !! end
25131
25132 !! test
25133 Tables: 3b. Nested in th
25134 !! options
25135 parsoid=html2wt
25136 !! html/parsoid
25137 <table><tbody>
25138 <tr><th>foo!!bar</th>
25139 <th><i>foo|bar</i></th>
25140 <th><i>foo!!bar</i></th>
25141 <th><i><span>foo!!bar</span></i></th>
25142 </tr></tbody></table>
25143 !! wikitext
25144 {|
25145 !<nowiki>foo!!bar</nowiki>
25146 !''<nowiki>foo|bar</nowiki>''
25147 !''<nowiki>foo!!bar</nowiki>''
25148 !''<span><nowiki>foo!!bar</nowiki></span>''
25149 |}
25150 !! html/php
25151 <table>
25152 <tr>
25153 <th>foo!!bar
25154 </th>
25155 <th><i>foo|bar</i>
25156 </th>
25157 <th><i>foo!!bar</i>
25158 </th>
25159 <th><i><span>foo!!bar</span></i>
25160 </th></tr></table>
25161
25162 !! end
25163
25164 !! test
25165 Tables: 3c. Nested in th
25166 !! options
25167 parsoid=html2wt
25168 !! html/parsoid
25169 <table><tbody>
25170 <tr><th>foo||bar</th>
25171 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25172 </tr></tbody></table>
25173 !! wikitext
25174 {|
25175 !<nowiki>foo||bar</nowiki>
25176 !<nowiki>foo||bar</nowiki>
25177 |}
25178 !! html/php
25179 <table>
25180 <tr>
25181 <th>foo||bar
25182 </th>
25183 <th>foo||bar
25184 </th></tr></table>
25185
25186 !! end
25187
25188 !! test
25189 Tables: 4a. Escape -
25190 !! options
25191 parsoid=html2wt
25192 !! html/*
25193 <table>
25194 <tr>
25195 <th>-bar
25196 </th></tr>
25197 <tr>
25198 <td>-bar
25199 </td></tr></table>
25200
25201 !! wikitext
25202 {|
25203 !-bar
25204 |-
25205 |<nowiki>-bar</nowiki>
25206 |}
25207 !! end
25208
25209 !! test
25210 Tables: 4b. Escape +
25211 !! options
25212 parsoid=html2wt
25213 !! html/*
25214 <table>
25215 <tr>
25216 <th>+bar
25217 </th></tr>
25218 <tr>
25219 <td>+bar
25220 </td></tr></table>
25221
25222 !! wikitext
25223 {|
25224 !+bar
25225 |-
25226 |<nowiki>+bar</nowiki>
25227 |}
25228 !! end
25229
25230 !! test
25231 Tables: 4c. No escaping needed
25232 !! options
25233 parsoid=html2wt
25234 !! html/parsoid
25235 <table><tbody>
25236 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25237 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25238 <tr><td>foo
25239 <p>bar|baz
25240 +bar
25241 -bar</p></td></tr>
25242 <tr><td>x
25243 <div>a|b</div></td>
25244 </tbody></table>
25245 !! wikitext
25246 {|
25247 |foo-bar
25248 |foo+bar
25249 |-
25250 |''foo''-bar
25251 |''foo''+bar
25252 |-
25253 |foo
25254 bar|baz
25255 +bar
25256 -bar
25257 |-
25258 |x
25259 <div>a|b</div>
25260 |}
25261 !! html/php
25262 <table>
25263 <tr>
25264 <td>foo-bar
25265 </td>
25266 <td>foo+bar
25267 </td></tr>
25268 <tr>
25269 <td><i>foo</i>-bar
25270 </td>
25271 <td><i>foo</i>+bar
25272 </td></tr>
25273 <tr>
25274 <td>foo
25275 <p>bar|baz
25276 +bar
25277 -bar
25278 </p>
25279 </td></tr>
25280 <tr>
25281 <td>x
25282 <div>a|b</div>
25283 </td></tr></table>
25284
25285 !! end
25286
25287 !! test
25288 Tables: 4d. No escaping needed
25289 !! options
25290 parsoid=html2wt
25291 !! html/parsoid
25292 <table>
25293 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25294 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25295 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25296 </tbody></table>
25297 !! wikitext
25298 {|
25299 |[[Foo]]-bar
25300 ||+1
25301 ||-2
25302 |}
25303 !! html/php
25304 <table>
25305 <tr>
25306 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25307 </td>
25308 <td>+1
25309 </td>
25310 <td>-2
25311 </td></tr></table>
25312
25313 !! end
25314
25315 !! test
25316 T97430: Don't emit empty nowiki pairs around marker meta tags
25317 !! options
25318 parsoid=html2wt
25319 !! html/parsoid
25320 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25321 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25322 !! wikitext
25323 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25324 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25325 !! end
25326
25327 !! test
25328 Unclosed xmlish element in table line shouldn't eat end delimiters
25329 !! options
25330 parsoid=html2wt
25331 !! html/parsoid
25332 <table>
25333 <tbody><tr><td> &lt;foo</td>
25334 <td> bar></td></tr>
25335 </tbody></table>
25336 !! wikitext
25337 {|
25338 | <foo
25339 | bar>
25340 |}
25341 !! html/php
25342 <table>
25343 <tr>
25344 <td> &lt;foo
25345 </td>
25346 <td> bar&gt;
25347 </td></tr></table>
25348
25349 !! end
25350
25351 #### --------------- Links ----------------
25352 #### 1. Quote marks in link text
25353 #### 2. Wikilinks: Escapes needed
25354 #### 3. Wikilinks: No escapes needed
25355 #### 4. Extlinks: Escapes needed
25356 #### 5. Extlinks: No escapes needed
25357 #### --------------------------------------
25358 !! test
25359 Links 1. WikiLinks: No escapes needed
25360 !! options
25361 parsoid=html2wt
25362 !! html/parsoid
25363 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25364 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25365 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25366 !! wikitext
25367 [[Foo|Foo''boo'']]
25368 [[Foo|[Foobar]]]
25369 [[Foo|x [Foobar] x]]
25370 !! html/php
25371 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25372 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25373 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25374 </p>
25375 !! end
25376
25377 !! test
25378 Links 2. WikiLinks: Escapes needed
25379 !! options
25380 parsoid=html2wt
25381 !! html/parsoid
25382 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25383 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25384 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25385 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25386 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25387 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25388 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25389 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25390 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25391 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25392 !! wikitext
25393 [[Foo|<nowiki>Foobar]</nowiki>]]
25394 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25395 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25396 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25397 [[Foo|<nowiki>|Bar</nowiki>]]
25398 [[Foo|<nowiki>]]bar</nowiki>]]
25399 [[Foo|<nowiki>[[bar</nowiki>]]
25400 [[Foo|<nowiki>x [[ y</nowiki>]]
25401 [[Foo|<nowiki>x ]] y</nowiki>]]
25402 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25403 !! html/php
25404 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25405 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25406 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25407 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25408 <a href="/wiki/Foo" title="Foo">|Bar</a>
25409 <a href="/wiki/Foo" title="Foo">]]bar</a>
25410 <a href="/wiki/Foo" title="Foo">[[bar</a>
25411 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25412 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25413 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25414 </p>
25415 !! end
25416
25417 !! test
25418 Links 3. WikiLinks: No escapes needed
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25423 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25424 !! wikitext
25425 [[Foo|[Foobar]]
25426 [[Foo|foo|bar]]
25427 !! html/php
25428 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25429 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25430 </p>
25431 !! end
25432
25433 !! test
25434 Links 4. ExtLinks: Escapes needed
25435 !! options
25436 parsoid=html2wt
25437 !! html/parsoid
25438 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25439 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25440 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25441 <p>[http://google.com]</p>
25442 <p>[http://google.com google]</p>
25443 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25444 <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>
25445 !! wikitext
25446 [http://google.com <nowiki>[google]</nowiki>]
25447 [http://google.com <nowiki>google]</nowiki>]
25448 [http://google.com <nowiki>goog] le</nowiki>]
25449
25450 <nowiki>[http://google.com]</nowiki>
25451
25452 <nowiki>[http://google.com google]</nowiki>
25453
25454 [http://google.com<nowiki>]</nowiki>
25455
25456 [{{echo|http://google.com}}<nowiki>]</nowiki>
25457 !! html/php
25458 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25459 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25460 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25461 </p><p>[http://google.com]
25462 </p><p>[http://google.com google]
25463 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25464 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25465 </p>
25466 !! end
25467
25468 !! test
25469 Links 5. ExtLinks: No escapes needed
25470 !! options
25471 parsoid=html2wt
25472 !! html/parsoid
25473 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25474 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25475 !! wikitext
25476 [http://google.com [google]
25477
25478 [[http://google.com]]
25479 !! html/php
25480 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25481 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25482 </p>
25483 !! end
25484
25485 !! test
25486 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25487 !! options
25488 parsoid=html2wt
25489 !! html/parsoid
25490 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25491 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25492 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25493 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25494 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25495 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25496 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25497 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25498 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25499 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25500 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25501 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25502 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25503 </p>
25504 !! wikitext
25505 x<nowiki/>http://example.com<nowiki/>y
25506 http://example.com<nowiki/>?x
25507 http://example.com<nowiki/>&x
25508 http://example.com<nowiki/>'x
25509 http://example.com<nowiki/>,x
25510 http://example.com<nowiki/>.x
25511 http://example.com<nowiki/>;x
25512 http://example.com<nowiki/>:x
25513 http://example.com<nowiki/>;x
25514 http://example.com<nowiki/>!x
25515 http://example.com<nowiki/>=x
25516 http://example.com<nowiki/>(x)
25517 http://example.com(x<nowiki/>)
25518 !! end
25519
25520 !! test
25521 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25522 !! options
25523 parsoid=html2wt
25524 !! html/parsoid
25525 <p>x
25526 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25527 y
25528 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25529 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25530 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25531 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25532 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25533 </p>
25534 !! wikitext
25535 x
25536 http://example.com
25537 y
25538 "http://example.com"
25539 (http://example.com)
25540 (http://example.com) foo
25541 http://example.com,
25542 http://example.com, foo
25543 !! html/php
25544 <p>x
25545 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25546 y
25547 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25548 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25549 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25550 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25551 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25552 </p>
25553 !! end
25554
25555 !! test
25556 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25557 !! options
25558 parsoid=html2wt
25559 !! html/parsoid
25560 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25561 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25562 !! wikitext
25563 http://example.com.,;:!?\
25564 -http://example.com:
25565 !! html/php
25566 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25567 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25568 </p>
25569 !! end
25570
25571 !! test
25572 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25573 !! options
25574 parsoid=html2wt
25575 !! html/parsoid
25576 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25577 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25578 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25579 !! wikitext
25580 RFC 123<nowiki/>4
25581 RFC 123<nowiki/>y
25582 X<nowiki/>RFC 123<nowiki/>y
25583 !! end
25584
25585 !! test
25586 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25591 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25592 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25593 </p>
25594 !! wikitext
25595 RFC 123?foo
25596 RFC 123&foo
25597 -RFC 123-
25598 !! html/php
25599 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
25600 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
25601 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
25602 </p>
25603 !! end
25604
25605 !! test
25606 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
25611 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25612 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
25613 !! wikitext
25614 PMID 123<nowiki/>4
25615 PMID 123<nowiki/>y
25616 X<nowiki/>PMID 123<nowiki/>y
25617 !! end
25618
25619 !! test
25620 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
25621 !! options
25622 parsoid=html2wt
25623 !! html/parsoid
25624 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
25625 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
25626 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
25627 </p>
25628 !! wikitext
25629 PMID 123?foo
25630 PMID 123&foo
25631 -PMID 123-
25632 !! html/php
25633 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
25634 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
25635 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
25636 </p>
25637 !! end
25638
25639 !! test
25640 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
25641 !! options
25642 parsoid=html2wt
25643 !! html/parsoid
25644 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
25645 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
25646 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
25647 </p>
25648 !! wikitext
25649 ISBN 1234567890<nowiki/>1
25650 ISBN 1234567890<nowiki/>x
25651 a<nowiki/>ISBN 1234567890<nowiki/>b
25652 !! end
25653
25654 !! test
25655 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
25656 !! options
25657 parsoid=html2wt
25658 !! html/parsoid
25659 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
25660 !! wikitext
25661 -ISBN 1234567890's
25662 !! html/php
25663 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
25664 </p>
25665 !! end
25666
25667 !! test
25668 Links 14. Protect link-like plain text. (Parsoid bug T78425)
25669 !! options
25670 parsoid=html2wt
25671 !! html/*
25672 <p>this is not a link: http://example.com
25673 </p>
25674 !! wikitext
25675 this is not a link: <nowiki>http://example.com</nowiki>
25676 !! end
25677
25678 !! test
25679 Links 15. Link trails can't become link prefixes.
25680 !! options
25681 language=is
25682 parsoid=html2wt
25683 !! html/parsoid
25684 <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>
25685 !! wikitext
25686 [[Söfnuður]]-[[00]]
25687 !! html/php
25688 <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>
25689 </p>
25690 !! end
25691
25692 #### --------------- Quotes ---------------
25693 #### 1. Quotes inside <b> and <i>
25694 #### 2. Link fragments separated by <i> and <b> tags
25695 #### 3. Link fragments inside <i> and <b>
25696 #### 4. No escaping needed
25697 #### --------------------------------------
25698 !! test
25699 1a. Quotes inside <b> and <i>
25700 !! options
25701 parsoid=html2wt
25702 !! html/*
25703 <p><i>'foo'</i>
25704 <i>''foo''</i>
25705 <i>'''foo'''</i>
25706 <i>foo</i>'s
25707 <b>'foo'</b>
25708 <b>''foo''</b>
25709 <b>'''foo'''</b>
25710 <b>foo'<i>bar'</i>baz</b>
25711 <b>foo</b>'s
25712 '<i>foo</i>
25713 <i>foo</i>'
25714 <i>foo'</i>'
25715 '<i>foo</i>'
25716 '<b>foo</b>
25717 <b>foo</b>'
25718 '<b>foo</b>'
25719 <i>fools'<span> errand</span></i>
25720 <i><span>fool</span>'s errand</i>
25721 '<i>foo</i> bar '<i>baz</i>
25722 a|!*#-:;+-~[]{}b'<i>x</i>
25723 </p>
25724 !! wikitext
25725 ''<nowiki/>'foo'''
25726 ''<nowiki>''foo''</nowiki>''
25727 ''<nowiki>'''foo'''</nowiki>''
25728 ''foo''<nowiki/>'s
25729 '''<nowiki/>'foo''''
25730 '''<nowiki>''foo''</nowiki>'''
25731 '''<nowiki>'''foo'''</nowiki>'''
25732 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
25733 '''foo'''<nowiki/>'s
25734 '''foo''
25735 ''foo''<nowiki/>'
25736 ''foo'''<nowiki/>'
25737 '''foo''<nowiki/>'
25738 ''''foo'''
25739 '''foo'''<nowiki/>'
25740 ''''foo'''<nowiki/>'
25741 ''fools'<span> errand</span>''
25742 ''<span>fool</span>'s errand''
25743 '<nowiki/>''foo'' bar '''baz''
25744 a|!*#-:;+-~[]{}b'''x''
25745 !! end
25746
25747 !! test
25748 1b. Quotes inside <b> and <i> with other tags on same line
25749 !! options
25750 parsoid=html2wt
25751 !! html/parsoid
25752 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25753 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
25754 <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>
25755 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
25756 '<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>
25757 '<i>foo</i> <div title="name">test</div>
25758 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
25759 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
25760 <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>
25761 </ol>
25762 !! wikitext
25763 '''a'' foo ''[[bar]]''
25764 ''a''' foo ''[[bar]]''
25765 ''a''' foo '''{{echo|[[bar]]}}'''
25766 [[foo]] x'''[[bar]]''
25767 '''foo'' <ref>test</ref>
25768 '''foo'' <div title="name">test</div>
25769 '''foo'' and <br> bar
25770 <references />
25771 !! end
25772
25773 !! test
25774 2. Link fragments separated by <i> and <b> tags
25775 !! options
25776 parsoid=html2wt
25777 !! html/parsoid
25778 <p>[[<i>foo</i>hello]]</p>
25779 <p>[[<b>foo</b>hello]]</p>
25780 !! wikitext
25781 [[''foo''<nowiki>hello]]</nowiki>
25782
25783 [['''foo'''<nowiki>hello]]</nowiki>
25784 !! end
25785
25786 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
25787 # this is one of the shortcomings of this format
25788 !! test
25789 3. Link fragments inside <i> and <b>
25790 !! options
25791 parsoid=html2wt
25792 !! html/parsoid
25793 <p><i>[[foo</i>]]</p>
25794 <p><b>[[foo</b>]]</p>
25795 !! wikitext
25796 ''[[foo''<nowiki>]]</nowiki>
25797
25798 '''[[foo'''<nowiki>]]</nowiki>
25799 !! end
25800
25801 !! test
25802 4. No escaping needed
25803 !! options
25804 parsoid=html2wt
25805 !! html/parsoid
25806 <p>'<span><i>bar</i></span>'
25807 '<span><b>bar</b></span>'
25808 'a:b'foo
25809 </p>
25810 !! wikitext
25811 '<span>''bar''</span>'
25812 '<span>'''bar'''</span>'
25813 'a:b'foo
25814 !! end
25815
25816 #### ----------- Paragraphs ---------------
25817 #### 1. No unnecessary escapes
25818 #### --------------------------------------
25819
25820 !! test
25821 1. No unnecessary escapes
25822 !! options
25823 parsoid=html2wt
25824 !! html/parsoid
25825 <p>bar <span>[[foo]]</span>
25826 </p><p>=bar <span>[[foo]]</span>
25827 </p><p>[[bar <span>[[foo]]</span>
25828 </p><p>]]bar <span>[[foo]]</span>
25829 </p><p>=bar <span>foo]]</span>=
25830 </p>
25831 !! wikitext
25832 bar <span><nowiki>[[foo]]</nowiki></span>
25833
25834 =bar <span><nowiki>[[foo]]</nowiki></span>
25835
25836 [[bar <span><nowiki>[[foo]]</nowiki></span>
25837
25838 ]]bar <span><nowiki>[[foo]]</nowiki></span>
25839
25840 =bar <span>foo]]</span><nowiki>=</nowiki>
25841 !!end
25842
25843 #### ----------------------- PRE --------------------------
25844 #### 1. Leading whitespace in SOL context should be escaped
25845 #### ------------------------------------------------------
25846 !! test
25847 1. Leading whitespace in SOL context should be escaped
25848 !! options
25849 parsoid=html2wt
25850 !! html/parsoid
25851 <p> a</p>
25852
25853 <p> a</p>
25854
25855 <p> a(tab)</p>
25856
25857 <p> a
25858 <!--cmt-->
25859 a</p>
25860
25861 <p>a
25862 b</p>
25863
25864 <p>a
25865 b</p>
25866
25867 <p>a
25868 b</p>
25869 !! wikitext
25870 <nowiki> </nowiki>a
25871
25872 <nowiki> </nowiki> a
25873
25874 a(tab)
25875
25876 <nowiki> </nowiki> a
25877 <!--cmt-->
25878 <nowiki> </nowiki>a
25879
25880 a
25881 <nowiki> </nowiki>b
25882
25883 a
25884 b
25885
25886 a
25887 b
25888 !! html/php
25889 <p> a
25890 </p><p> a
25891 </p><p> a(tab)
25892 </p><p> a
25893 a
25894 </p><p>a
25895 b
25896 </p><p>a
25897 b
25898 </p><p>a
25899 b
25900 </p>
25901 !! end
25902
25903 !! test
25904 2. Leading whitespace in non-indent-pre contexts should not be escaped
25905 !! options
25906 parsoid=html2wt
25907 !! html/parsoid
25908 <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>
25909 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
25910 <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>
25911 b</span></li>
25912 </ol>
25913 !! wikitext
25914 foo <ref>''a''
25915 b</ref>
25916 <references />
25917 !! end
25918
25919 !! test
25920 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <blockquote>
25925 <p>
25926 a
25927 <span>b</span>
25928 c</p>
25929 </blockquote>
25930 !! wikitext
25931 <blockquote>
25932 a
25933 <span>b</span>
25934 c
25935 </blockquote>
25936 !! end
25937
25938 !! test
25939 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
25940 !! options
25941 parsoid=html2wt
25942 !! html/parsoid
25943 <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>
25944 !! wikitext
25945 [[File:Foobar.jpg|thumb|caption]]
25946 !! end
25947
25948 !! test
25949 5. Nowiki escaping should account for indent-pres
25950 !! options
25951 parsoid=html2wt
25952 !! html/parsoid
25953 <pre>==foo==</pre>
25954 !! wikitext
25955 ==foo==
25956 !! end
25957
25958 !!test
25959 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
25960 !! options
25961 parsoid=html2wt
25962 !! html/parsoid
25963 <pre>
25964 * foo
25965 * bar
25966 </pre>
25967 !! wikitext
25968 * foo
25969 * bar
25970 !! end
25971
25972 #### --------------- Behavior Switches --------------------
25973
25974 !! test
25975 1. Valid behavior switches should be escaped
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 __TOC__
25980 <i>__TOC__</i>
25981 !! wikitext
25982 <nowiki>__TOC__</nowiki>
25983 ''<nowiki>__TOC__</nowiki>''
25984 !! end
25985
25986 !! test
25987 2. Invalid behavior switches should not be escaped
25988 !! options
25989 parsoid=html2wt
25990 !! html/parsoid
25991 __TOO__
25992 __|__
25993 !! wikitext
25994 __TOO__
25995 __|__
25996 !! end
25997
25998 # We use indent-pre as an indirect way to test for sol-transparent behavior.
25999 !! test
26000 Behavior switches should be SOL-transparent
26001 !! options
26002 parsoid=html2wt
26003 !! html/parsoid
26004 <meta property="mw:PageProp/toc" />
26005
26006 <!-- this one's bogus -->
26007 <pre>__TOO__</pre>
26008
26009 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26010
26011 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26012 !! wikitext
26013 __TOC__
26014
26015 <!-- this one's bogus -->
26016 __TOO__
26017
26018 __TOC__ foo
26019
26020 __TOC__
26021 bar
26022 !! end
26023
26024 #### --------------- HTML tags ---------------
26025 #### 1. a tags
26026 #### 2. other tags
26027 #### 3. multi-line html tag
26028 #### 4. extension tags
26029 #### -----------------------------------------
26030 !! test
26031 1. a tags
26032 !! options
26033 parsoid=html2wt
26034 !! html/parsoid
26035 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26036 !! wikitext
26037 <a href="http://google.com">google</a>
26038 !! end
26039
26040 !! test
26041 2. other tags
26042 !! options
26043 parsoid=html2wt
26044 !! html/parsoid
26045 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26046 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26047 <li> &lt;td&gt;</li></ul>
26048
26049 !! wikitext
26050 * <nowiki><div>foo</div></nowiki>
26051 * <nowiki><div style="color:red">foo</div></nowiki>
26052 * <nowiki><td></nowiki>
26053 !! end
26054
26055 !! test
26056 3. multi-line html tag
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <p>&lt;div
26061 &gt;foo&lt;/div
26062 &gt;
26063 </p>
26064 !! wikitext
26065 <nowiki><div
26066 >foo</div
26067 ></nowiki>
26068 !! end
26069
26070 !! test
26071 4. extension tags
26072 !! options
26073 parsoid=html2wt
26074 !! html/parsoid
26075 <p>&lt;ref&gt;foo&lt;/ref&gt;
26076 </p><p>&lt;ref&gt;bar
26077 </p><p>baz&lt;/ref&gt;
26078 </p>
26079 !! wikitext
26080 <nowiki><ref>foo</ref></nowiki>
26081
26082 <nowiki><ref>bar</nowiki>
26083
26084 baz<nowiki></ref></nowiki>
26085 !! end
26086
26087 #### --------------- Others ---------------
26088 !! test
26089 Escaping nowikis
26090 !! options
26091 parsoid=html2wt
26092 !! html/parsoid
26093 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26094 </p>
26095 !! wikitext
26096 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26097 !! end
26098
26099 ## The quote-char in the input is necessary for triggering the bug
26100 !! test
26101 (T54035) Nowiki-escaping should not get tripped by " :" in text
26102 !! options
26103 parsoid=html2wt
26104 !! html/parsoid
26105 <p>foo's bar :</p>
26106 !! wikitext
26107 foo's bar :
26108 !! end
26109
26110 #----------- End of wikitext escaping tests --------------
26111
26112 !! test
26113
26114 Tag-like HTML structures are passed through as text
26115 !! wikitext
26116 <x y>
26117
26118 <x.y>
26119
26120 <x-y>
26121
26122 1>2
26123
26124 x<y
26125
26126 a>b
26127
26128 1<d e>f
26129 !! html
26130 <p>&lt;x y&gt;
26131 </p><p>&lt;x.y&gt;
26132 </p><p>&lt;x-y&gt;
26133 </p><p>1&gt;2
26134 </p><p>x&lt;y
26135 </p><p>a&gt;b
26136 </p><p>1&lt;d e&gt;f
26137 </p>
26138 !! end
26139
26140 !! test
26141 HTML tag with necessary entities in attributes
26142 !! wikitext
26143 <span title="&amp;amp;">foo</span>
26144 !! html
26145 <p><span title="&amp;amp;">foo</span>
26146 </p>
26147 !! end
26148
26149 !! test
26150 HTML tag with 'unnecessary' entity encoding in attributes
26151 !! wikitext
26152 <span title="&amp;">foo</span>
26153 !! html
26154 <p><span title="&amp;">foo</span>
26155 </p>
26156 !! end
26157
26158 !! test
26159 HTML tag with broken attribute value quoting
26160 !! options
26161 parsoid=wt2html,html2html
26162 !! wikitext
26163 <span title="Hello world>Foo</span>
26164 !! html/php
26165 <p><span title="Hello world">Foo</span>
26166 </p>
26167 !! html/parsoid
26168 <p><span title="Hello world">Foo</span></p>
26169 !! end
26170
26171 !! test
26172 Self-closed tag with broken attribute value quoting
26173 !! options
26174 parsoid=wt2html,html2html
26175 !! wikitext
26176 <div title="Hello world />Foo
26177 !! html/php+tidy
26178 <div title="Hello world"></div>
26179 <p>Foo</p>
26180 !! html/parsoid
26181 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26182 !! end
26183
26184 !! test
26185 Table with broken attribute value quoting
26186 !! options
26187 parsoid=wt2html,html2html
26188 !! wikitext
26189 {|
26190 | title="Hello world|Foo
26191 |}
26192 !! html/php
26193 <table>
26194 <tr>
26195 <td title="Hello world">Foo
26196 </td></tr></table>
26197
26198 !! html/parsoid
26199 <table>
26200 <tr>
26201 <td title="Hello world">Foo
26202 </td></tr></table>
26203
26204 !! end
26205
26206 !! test
26207 Table with broken attribute value quoting on consecutive lines
26208 !! options
26209 parsoid=wt2html,html2html
26210 !! wikitext
26211 {|
26212 | title="Hello world|Foo
26213 | style="color:red|Bar
26214 |}
26215 !! html/php
26216 <table>
26217 <tr>
26218 <td title="Hello world">Foo
26219 </td>
26220 <td style="color:red">Bar
26221 </td></tr></table>
26222
26223 !! html/parsoid
26224 <table><tbody>
26225 <tr>
26226 <td title="Hello world">Foo
26227 </td><td style="color: red">Bar
26228 </td></tr></tbody></table>
26229
26230 !! end
26231
26232 !!test
26233 Accept empty td cell attribute
26234 !! wikitext
26235 {|
26236 | align="center" | foo || |
26237 |}
26238 !! html
26239 <table>
26240 <tr>
26241 <td align="center"> foo </td>
26242 <td>
26243 </td></tr></table>
26244
26245 !!end
26246
26247 !!test
26248 Non-empty attributes in th-cells
26249 !! wikitext
26250 {|
26251 ! Foo !! style="color: red" | Bar
26252 |}
26253 !! html
26254 <table>
26255 <tr>
26256 <th> Foo </th>
26257 <th style="color: red"> Bar
26258 </th></tr></table>
26259
26260 !!end
26261
26262 !!test
26263 Accept empty attributes in th-cells
26264 !! wikitext
26265 {|
26266 !| foo !!| bar
26267 |}
26268 !! html
26269 <table>
26270 <tr>
26271 <th> foo </th>
26272 <th> bar
26273 </th></tr></table>
26274
26275 !!end
26276
26277 !!test
26278 Empty table rows go away
26279 !! wikitext
26280 {|
26281 | Hello
26282 | there
26283 |- class="foo"
26284 |-
26285 |}
26286 !! html
26287 <table>
26288 <tr>
26289 <td> Hello
26290 </td>
26291 <td> there
26292 </td></tr>
26293
26294 </table>
26295
26296 !! end
26297
26298 ###
26299 ### Parsoid-centric tests for testing RTing of inter-element separators
26300 ### Edge cases not tested by existing parser tests and specific to
26301 ### Parsoid-specific serialization strategies.
26302 ###
26303
26304 !!test
26305 RT-ed inter-element separators should be valid separators
26306 !! wikitext
26307 {|
26308 |- [[foo]]
26309 |}
26310 !! html/php
26311 <table>
26312
26313 </table>
26314
26315 !! html/parsoid
26316 <table>
26317 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26318 </tbody></table>
26319 !!end
26320
26321 # Parsoid-only since PHP parser relies on Tidy for correct output
26322 !!test
26323 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26324 !!options
26325 parsoid
26326 !! wikitext
26327 {|
26328 |<small>foo
26329 bar
26330 |}
26331
26332 {|
26333 |<small>foo<small>
26334 |}
26335 !! html
26336 <table>
26337 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26338 <p>bar</p></small></td></tr>
26339 </tbody></table>
26340
26341 <table>
26342 <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>
26343 </tbody></table>
26344 !!end
26345
26346 # Note that the "style" attribute is really a template parameter here.
26347 # The = would have to be {{=}} if you wanted the literal.
26348 !!test
26349 Empty TD followed by TD with tpl-generated attribute
26350 !! wikitext
26351 {|
26352 |-
26353 |
26354 |{{echo|style='color:red'}}|foo
26355 |}
26356 !! html
26357 <table>
26358
26359 <tr>
26360 <td>
26361 </td>
26362 <td>foo
26363 </td></tr></table>
26364
26365 !!end
26366
26367 !!test
26368 Indented table with an empty td
26369 !! wikitext
26370 {|
26371 |-
26372 |
26373 |foo
26374 |}
26375 !! html
26376 <table>
26377
26378 <tr>
26379 <td>
26380 </td>
26381 <td>foo
26382 </td></tr></table>
26383
26384 !!end
26385
26386 ## We have some newline diffs RT-ing this edge case
26387 ## and it is not important enough -- we seem to be emitting
26388 ## at most 2 newlines after a </tr> and this is unrelated to
26389 ## the issue from T85627 that this is testing.
26390 !!test
26391 Indented table with blank lines in between (T85627)
26392 !! options
26393 parsoid=wt2html
26394 !! wikitext
26395 {|
26396 |foo
26397
26398
26399 |}
26400 !! html
26401 <table>
26402
26403 <tr>
26404 <td>foo
26405 </td></tr></table>
26406
26407 !!end
26408
26409 !!test
26410 Indented block & table
26411 !! wikitext
26412 <div>foo</div>
26413 {|
26414 |foo
26415 |}
26416 !! html/php
26417 <div>foo</div>
26418 <table>
26419 <tr>
26420 <td>foo
26421 </td></tr></table>
26422
26423 !! html/parsoid
26424 <div data-parsoid='{"stx":"html"}'>foo</div>
26425 <table><tbody>
26426 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26427 </tbody></table>
26428 !!end
26429
26430 !! test
26431 Indent and comment before table row
26432 !! wikitext
26433 {|
26434 <!--hi-->|-
26435 | there
26436 |}
26437 !! html/php
26438 <table>
26439
26440 <tr>
26441 <td> there
26442 </td></tr></table>
26443
26444 !! html/parsoid
26445 <table>
26446 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26447 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26448 </tbody></table>
26449 !! end
26450
26451 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26452 !!test
26453 Empty TR followed by a template-generated TR
26454 !!options
26455 parsoid
26456 !! wikitext
26457 {|
26458 |-
26459 {{echo|<tr><td>foo</td></tr>}}
26460 |}
26461 !! html
26462 <table>
26463 <tbody>
26464 <tr class='mw-empty-elt'></tr>
26465 <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}}]}'>
26466 <td>foo</td></tr>
26467 </tbody></table>
26468 !!end
26469
26470 ## PHP and parsoid output differ for this, and since this is primarily
26471 ## for testing Parsoid's serializer, marking this Parsoid only
26472 !!test
26473 Empty TR followed by mixed-ws-comment line should RT correctly
26474 !!options
26475 parsoid
26476 !! wikitext
26477 {|
26478 |-
26479 <!--c-->
26480 |-
26481 <!--c--> <!--d-->
26482 |}
26483 !! html
26484 <table>
26485 <tbody>
26486 <tr class='mw-empty-elt'></tr>
26487 <!--c-->
26488 <tr>
26489 <!--c--> </tr><!--d-->
26490 </tbody></table>
26491
26492 !!end
26493
26494 !!test
26495 Multi-line image caption generated by templates with/without trailing newlines
26496 !! wikitext
26497 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26498 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26499 !! html/parsoid
26500 <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>
26501 <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>
26502 !!end
26503
26504 !! test
26505 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26506 !! options
26507 parsoid=html2wt
26508 !! html/parsoid
26509 <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>
26510
26511 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26512 !! wikitext
26513 <includeonly>foo</includeonly>
26514 new para
26515
26516 [[Category:Foo]]
26517
26518 = new heading =
26519 !! end
26520
26521 ## PHP emits broken html for this, and since this is primarily
26522 ## a Parsoid serializer test, marking this Parsoid only
26523 !!test
26524 Improperly nested inline or quotes tags with whitespace in between
26525 !! wikitext
26526 <span> <s>x</span> </s>
26527 ''' ''x''' ''
26528 !! html/parsoid
26529 <p><span> <s>x</s></span><s> </s>
26530 <b> <i>x</i></b><i> </i>
26531 </p>
26532 !!end
26533
26534 !!test
26535 Encapsulate protected attributes from wt
26536 !! wikitext
26537 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26538
26539 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26540 | ok
26541 |}
26542 !! html/parsoid
26543 <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>
26544
26545 <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">
26546 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26547 </tbody></table>
26548 !!end
26549
26550 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26551 ## Having nested or stray pre tags results in the attempt to add duplicates,
26552 ## causing an assertion fail. This test tries to prevent that situation.
26553 !!test
26554 Ensure ParagraphWrapper can deal with stray closing pre tags
26555 !!options
26556 parsoid=wt2html
26557 !! wikitext
26558 plain text</pre>
26559 !! html/parsoid
26560 plain text
26561 !!end
26562
26563 !!test
26564 1. Ensure fostered text content is wrapped in element nodes
26565 !!options
26566 parsoid=wt2html
26567 !! wikitext
26568 <table>hi</table><table>ho</table>
26569 !! html/parsoid
26570 <p>hi</p>
26571 <table></table>
26572 <p>ho</p>
26573 <table></table>
26574 !!end
26575
26576 !!test
26577 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26578 !!options
26579 parsoid=wt2html,wt2wt
26580 !! wikitext
26581 <table>
26582 <tr> || ||
26583 <td> a
26584 </table>
26585 !! html/parsoid
26586 <p> || ||
26587 </p><table>
26588 <tbody><tr><td> a</td></tr>
26589 </tbody></table>
26590 !!end
26591
26592 !!test
26593 Encapsulation properly handles null DSR information from foster box
26594 !!options
26595 parsoid=wt2html,wt2wt
26596 !! wikitext
26597 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26598 !! html/parsoid
26599 <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>
26600 !!end
26601
26602 !!test
26603 1. Encapsulate foster-parented transclusion content
26604 !!options
26605 parsoid=wt2wt,wt2html
26606 !! wikitext
26607 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
26608 !! html/parsoid
26609 <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>
26610 <tbody>
26611 <tr>
26612 <td>bar</td>
26613 </tr>
26614 </tbody>
26615 </table>
26616 !!end
26617
26618 !!test
26619 2. Encapsulate foster-parented transclusion content
26620 !!options
26621 parsoid=wt2wt,wt2html
26622 !! wikitext
26623 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
26624 !! html/parsoid
26625 <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>
26626 <table>
26627 <tbody>
26628 <tr>
26629 <td>bar</td>
26630 </tr>
26631 </tbody>
26632 </table>
26633 !!end
26634
26635 !!test
26636 3. Encapsulate foster-parented transclusion content
26637 !!options
26638 parsoid=wt2wt,wt2html
26639 !! wikitext
26640 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26641 !! html/parsoid
26642 <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;]}">
26643 <p>foo</p>
26644 </div>
26645 <table>
26646 <tbody>
26647 <tr>
26648 <td>bar</td>
26649 </tr>
26650 </tbody>
26651 </table>
26652 !!end
26653
26654 !!test
26655 4. Encapsulate foster-parented transclusion content
26656 !!options
26657 parsoid=wt2wt,wt2html
26658 !! wikitext
26659 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
26660 !! html/parsoid
26661 <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;]}">
26662 <p>foo</p>
26663 </div>
26664 <table>
26665 <tbody>
26666 <tr>
26667 <td>bar</td>
26668 </tr>
26669 </tbody>
26670 </table>
26671 !!end
26672
26673 !!test
26674 5. Encapsulate foster-parented transclusion content
26675 !!options
26676 parsoid=wt2wt,wt2html
26677 !! wikitext
26678 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
26679 !! html/parsoid
26680 <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>
26681 <table>
26682 <tbody>
26683 <tr>
26684 <td>
26685 <div>
26686 <p>foo</p>
26687 </div>
26688 </td>
26689 </tr>
26690 </tbody>
26691 </table>
26692 !!end
26693
26694 !!test
26695 6. Encapsulate foster-parented transclusion content
26696 !!options
26697 parsoid=wt2wt,wt2html
26698 !! wikitext
26699 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
26700 !! html/parsoid
26701 <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>
26702 <table>
26703 <tbody>
26704 <tr>
26705 <td>
26706 <div>
26707 <p>foo</p>
26708 </div>
26709 </td>
26710 </tr>
26711 </tbody>
26712 </table>
26713 <p>ok</p>
26714 !!end
26715
26716 !!test
26717 7. Encapsulate foster-parented transclusion content
26718 !!options
26719 parsoid=wt2wt,wt2html
26720 !! wikitext
26721 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
26722 !! html/parsoid
26723 <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>
26724 <table>
26725 <tbody>
26726 <tr>
26727 <td>bar</td>
26728 </tr>
26729 </tbody>
26730 </table>
26731 !!end
26732
26733 # Note that the wt is broken on purpose: the = should be {{=}} if you
26734 # don't want it to be a template parameter key.
26735 !!test
26736 8. Encapsulate foster-parented transclusion content
26737 !!options
26738 parsoid=wt2wt,wt2html
26739 !! wikitext
26740 {{echo|a
26741 }}{|{{echo|style='color:red'}}
26742 |-
26743 |b
26744 |}
26745 !! html/parsoid
26746 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
26747 <span> </span>
26748 <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>
26749 <table>
26750 <tbody>
26751 <tr>
26752 <td>b</td>
26753 </tr>
26754 </tbody>
26755 </table>
26756 !!end
26757
26758 !!test
26759 9. Encapsulate foster-parented transclusion content
26760 !!options
26761 parsoid=wt2wt,wt2html
26762 !! wikitext
26763 <table>{{echo|hi</table>hello}}
26764 !! html/parsoid
26765 <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>
26766 !!end
26767
26768 !!test
26769 Table in fosterable position
26770 !!options
26771 parsoid=wt2html
26772 !! wikitext
26773 {{OpenTable}}
26774 <div>
26775 {|
26776 |}
26777 </div>
26778 |}
26779 !! html/parsoid
26780 <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">
26781 </span>
26782 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
26783
26784 <table>
26785 </table>
26786 !!end
26787
26788 # Parsoid only for T66747
26789 !! test
26790 Properly encapsulate empty-content transclusions in fosterable positions
26791 !! wikitext
26792 <table>
26793 {{#if:|
26794 <td>foo</td>
26795 }}
26796 </table>
26797 !! html/parsoid
26798 <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"}]]}'>
26799
26800 </table>
26801 !! end
26802
26803 !! test
26804 Always encapsulate foster box when template range is expanded to table
26805 !! options
26806 parsoid=wt2wt
26807 !! wikitext
26808 {|
26809 hello
26810 {{OpenTable}}
26811 |}
26812 !! html/parsoid
26813
26814 !! end
26815
26816 !! test
26817 T115289: Unclosed table
26818 !! wikitext
26819 {{echo|<table>}}<!--c-->[[Category:Two]]
26820 !! html/parsoid
26821 <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>
26822 !! end
26823
26824 !! test
26825 T115289: Don't migrate newlines out of tables with fostered content
26826 !! wikitext
26827 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
26828 !! html/parsoid
26829 <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>
26830 !! end
26831
26832 !! test
26833 T73074: More fostering fun
26834 !! wikitext
26835 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
26836 !! html/parsoid
26837 <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>
26838 !! end
26839
26840 !!test
26841 Support <object> element with .data attribute
26842 !!options
26843 parsoid=html2wt
26844 !! html/parsoid
26845 <object data="test.swf"></object>
26846 !! wikitext
26847 <object data="test.swf"></object>
26848 !!end
26849
26850 !! test
26851 Don't block XML namespace declaration
26852 !! wikitext
26853 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26854 !! html/php
26855 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
26856 </p>
26857 !! html/parsoid
26858 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
26859 !! end
26860
26861 # -----------------------------------------------------------------
26862 # The following section of tests are primarily to spec requirements
26863 # around Parsoid's serialization (old, new, edited content)
26864 #
26865 # All these tests are marked Parsoid html2wt and html2html only
26866 # ----------------------------------------------------------------
26867
26868 !! test
26869 Ignore rel attribute in a-tags during serialization to url-links
26870 !! options
26871 parsoid=html2wt
26872 !! html/parsoid
26873 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
26874 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
26875 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
26876 !! wikitext
26877 http://en.wikipedia.org/wiki/Foobar
26878 http://en.wikipedia.org/wiki/Foobar
26879 http://en.wikipedia.org/wiki/Foobar
26880 !! end
26881
26882 # 'mi' is a localinterwiki prefix as well as a language
26883 !! test
26884 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
26885 !! options
26886 parsoid=html2wt
26887 !! html/parsoid
26888 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
26889 !! wikitext
26890 [[Foo]]
26891 !! end
26892
26893 !! test
26894 Parsoid should accept interwiki shortcuts
26895 !! options
26896 parsoid=html2wt
26897 !! html/parsoid
26898 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
26899 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
26900 <a href='./fr:Foo'>Foo</a></p>
26901 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
26902 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
26903 <a href='fr%3AFoo'>Foo</a></p>
26904 <p><a href='FR%3AFoo'>Foo</a>
26905 <a href='./FR:Foo'>Foo</a></p>
26906 !! wikitext
26907 [[:fr:Foo|Foo]]
26908 [[:fr:Foo|Foo]]
26909 [[:fr:Foo|Foo]]
26910
26911 [[:fr:Foo|Foo]]
26912 [[:fr:Foo|Foo]]
26913 [[:fr:Foo|Foo]]
26914
26915 [[:fr:Foo|Foo]]
26916 [[:fr:Foo|Foo]]
26917 !! end
26918
26919 !! test
26920 Parsoid should not accept invalid interwiki shortcuts
26921 !! options
26922 parsoid=html2wt
26923 !! html/parsoid
26924 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
26925 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
26926 <a href='news:Foo'>Foo</a></p>
26927 !! wikitext
26928 [news:Foo Foo]
26929 [news:Foo Foo]
26930 [news:Foo Foo]
26931 !! end
26932
26933 # See T93839
26934 !! test
26935 New wikilinks should be serialized properly
26936 !! options
26937 parsoid=html2wt
26938 !! html/parsoid
26939 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
26940 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
26941 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
26942 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
26943 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
26944 !! wikitext
26945 [[Foo]]
26946 [[Foo]]
26947 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
26948 http://en.wikipedia.org/wiki/Foo
26949 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
26950 !! end
26951
26952 !! test
26953 New wiki links (href variations)
26954 !! options
26955 parsoid=html2wt
26956 !! html/parsoid
26957 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26958 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
26959 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
26960 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
26961 !! wikitext
26962 [[Foo_bar]]
26963 [[Foo_bar]]
26964 [[Foo_bar]]
26965 [[Toxine bactérienne]]
26966 !! end
26967
26968 !! test
26969 New wiki links (content string variations)
26970 !! options
26971 parsoid=html2wt
26972 !! html/parsoid
26973 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
26974 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
26975 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
26976 !! wikitext
26977 [[Foo_bar]]
26978 [[Foo bar]]
26979 [[Foo_bar|./Foo_bar]]
26980 !! end
26981
26982 !! test
26983 New category links (href variations)
26984 !! options
26985 parsoid=html2wt
26986 !! html/parsoid
26987 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
26988 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
26989 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
26990 !! wikitext
26991 [[Category:Toxine bactérienne]]
26992 [[Category:Toxine bactérienne]]
26993 [[Category:Toxine bactérienne]]
26994 !! end
26995
26996 !! test
26997 New sol transparent links don't need indent-pre nowiki protection
26998 !! options
26999 parsoid=html2wt
27000 language=de
27001 !! html/parsoid
27002 <link rel="mw:PageProp/redirect" href="./Main_Page">
27003 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27004 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27005 !! wikitext
27006 #WEITERLEITUNG [[Main Page]]
27007 <!-- this is good --> [[Category:Good]]
27008 <!-- this is great --> [[Kategorie:Great]]
27009 !! end
27010
27011 !! test
27012 New interlanguage links (href variations)
27013 !! options
27014 parsoid=html2wt
27015 !! html/parsoid
27016 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27017 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27018 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27019 !! wikitext
27020 [[es:Toxine bactérienne]]
27021 [[es:Toxine_bactérienne]]
27022 [[es:Toxine_bactérienne]]
27023 !! end
27024
27025 !! test
27026 Image: Modifying size of an image (1)
27027 !! options
27028 parsoid={
27029 "modes": ["wt2wt"],
27030 "changes": [
27031 ["img[height]", "attr", "height", "22"],
27032 ["img[width]", "attr", "width", "200"]
27033 ]
27034 }
27035 !! wikitext
27036 [[Image:Foobar.jpg|230x230px]]
27037 !! wikitext/edited
27038 [[Image:Foobar.jpg|200x200px]]
27039 !!end
27040
27041 !! test
27042 Image: Modifying size of an image (2)
27043 !! options
27044 parsoid={
27045 "modes": ["wt2wt"],
27046 "changes": [
27047 ["img[height]", "attr", "height", "100"],
27048 ["img[width]", "attr", "width", "500"]
27049 ]
27050 }
27051 !! wikitext
27052 [[Image:Foobar.jpg|230x230px]]
27053 !! wikitext/edited
27054 [[Image:Foobar.jpg|500x500px]]
27055 !!end
27056
27057 # Change in size is ignored so long as class='mw-default-size'
27058 !! test
27059 Image: Modifying size of an image (3)
27060 !! options
27061 parsoid={
27062 "modes": ["wt2wt"],
27063 "changes": [
27064 ["figure[class]", "removeClass", "mw-default-size"],
27065 ["figure img", "attr", "height", "19"],
27066 ["figure img", "attr", "width", "170"]
27067 ]
27068 }
27069 !! wikitext
27070 [[Image:Foobar.jpg|thumb]]
27071 !! wikitext/edited
27072 [[Image:Foobar.jpg|thumb|170x170px]]
27073 !!end
27074
27075 !! test
27076 Image: Modifying alignment of an image (T50665)
27077 !! options
27078 parsoid={
27079 "modes": ["wt2wt"],
27080 "changes": [
27081 ["figure[class]", "removeClass", "mw-halign-right"],
27082 ["figure[class]", "addClass", "mw-halign-left"]
27083 ]
27084 }
27085 !! wikitext
27086 [[Image:Foobar.jpg|thumb|caption|right]]
27087 !! wikitext/edited
27088 [[Image:Foobar.jpg|thumb|caption|left]]
27089 !! end
27090
27091 !! test
27092 Image: Modifying mw-default-size of an frameless image (T64805)
27093 !! options
27094 parsoid={
27095 "modes": ["wt2wt"],
27096 "changes": [
27097 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27098 ]
27099 }
27100 !! wikitext
27101 [[Image:Foobar.jpg|frameless|right]]
27102 !! wikitext/edited
27103 [[Image:Foobar.jpg|frameless|right|220x220px]]
27104 !! end
27105
27106 !! test
27107 Image: Modifying valign of an image (T51221)
27108 !! options
27109 parsoid={
27110 "modes": ["wt2wt"],
27111 "changes": [
27112 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27113 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27114 ]
27115 }
27116 !! wikitext
27117 [[File:Foobar.jpg|20px|middle]]
27118 !! wikitext/edited
27119 [[File:Foobar.jpg|20px|text-top]]
27120 !! end
27121
27122 !! test
27123 Image: Modifying alt attribute of an image (T58400)
27124 !! options
27125 parsoid={
27126 "modes": ["wt2wt"],
27127 "changes": [
27128 ["img[alt]", "attr", "alt", "some alternate edited text"]
27129 ]
27130 }
27131 !! wikitext
27132 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27133 !! wikitext/edited
27134 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27135 !!end
27136
27137 !! test
27138 Image: Modifying caption of an image
27139 !! options
27140 parsoid={
27141 "modes": ["wt2wt"],
27142 "changes": [
27143 ["figcaption", "text", "new caption"]
27144 ]
27145 }
27146 !! wikitext
27147 [[Image:Foobar.jpg|thumb|original caption]]
27148 !! wikitext/edited
27149 [[Image:Foobar.jpg|thumb|new caption]]
27150 !!end
27151
27152 !! test
27153 Image: empty alt attribute (T50924)
27154 !! options
27155 parsoid
27156 !! wikitext
27157 [[File:Foobar.jpg|thumb|alt=|bar]]
27158 !! html
27159 <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>
27160 !! end
27161
27162 !! test
27163 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27164 !! options
27165 parsoid=html2wt
27166 language=ar
27167 disabled
27168 !! html/parsoid
27169 <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>
27170 !! wikitext
27171 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27172 !! end
27173
27174 !! test
27175 Image: Block level image should have \n before and after
27176 !! wikitext
27177 123
27178 [[File:Foobar.jpg|right|thumb|150x150px]]
27179 456
27180 !! html/parsoid
27181 <p>123</p>
27182 <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>
27183 <p>456</p>
27184 !! end
27185
27186 !! test
27187 Image: New block level image should have \n before and after (existing content)
27188 !! wikitext
27189 123
27190 [[File:Foobar.jpg|right|thumb|150x150px]]
27191 456
27192 !! html/parsoid
27193 <p>123</p>
27194 <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>
27195 <p>456</p>
27196 !! end
27197
27198 !! test
27199 Image: upright option (parsoid)
27200 !! wikitext
27201 [[File:Foobar.jpg|thumb|upright|caption]]
27202 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27203 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27204 !! html/parsoid
27205 <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>
27206 <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>
27207 <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>
27208 !! end
27209
27210 !! test
27211 Image: upright option is ignored on inline and frame images (parsoid)
27212 !! wikitext
27213 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27214 !! html/parsoid
27215 <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>
27216 !! end
27217
27218 !! test
27219 Image: in template parameter with empty parameter
27220 !! wikitext
27221 {{echo|[[File:Foobar.jpg|link=]]}}
27222 !! html/parsoid
27223 <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>
27224 !! end
27225
27226 !! test
27227 Image: from basic HTML (1)
27228 !! options
27229 parsoid=html2wt
27230 !! html/parsoid
27231 <span typeof="mw:Image">
27232 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27233 </span>
27234 !! wikitext
27235 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27236 !! end
27237
27238 !! test
27239 Image: from basic HTML (2)
27240 !! options
27241 parsoid=html2wt
27242 !! html/parsoid
27243 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27244 !! wikitext
27245 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27246 !! end
27247
27248 !! test
27249 Image: from basic HTML (3)
27250 !! options
27251 parsoid=html2wt
27252 !! html/parsoid
27253 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27254 !! wikitext
27255 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27256 !! end
27257
27258 !! test
27259 Image: from basic HTML (4)
27260 !! options
27261 parsoid=html2wt
27262 !! html/parsoid
27263 <img src="./File:Foobar.jpg">
27264 !! wikitext
27265 [[File:Foobar.jpg|link=]]
27266 !! end
27267
27268 !! test
27269 Image: Invalid title as link
27270 !! wikitext
27271 [[File:Foobar.jpg|link=<]]
27272 !! html/php
27273 <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>
27274 </p>
27275 !! html/parsoid
27276 <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>
27277 !! end
27278
27279 !! test
27280 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27281 !! options
27282 parsoid=html2wt
27283 !! html/parsoid
27284 <ul>
27285 <li><p>foo</p></li>
27286 </ul>
27287 !! wikitext
27288 * foo
27289 !! end
27290
27291 !! test
27292 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27293 !! options
27294 parsoid=html2wt
27295 !! html/parsoid
27296 <ul> <li>foo</li></ul>
27297 !! wikitext
27298 * foo
27299 !! end
27300
27301 !! test
27302 Don't strip leading whitespace when handling indent-pre suppressing tags
27303 !! options
27304 parsoid=html2wt
27305 !! html/parsoid
27306 <table>
27307 <tr><td> indented row</td></tr>
27308 </table>
27309 <blockquote><p>
27310 <b>This is very bold of you!</b>
27311 </p>
27312 <table><tr><td>
27313 indented cell (no pre-wrapping!)
27314 </td></tr></table>
27315 </blockquote>
27316 <p>foo</p>
27317 <div>bar</div>
27318 !! wikitext
27319 {|
27320 | indented row
27321 |}
27322 <blockquote>
27323 '''This is very bold of you!'''
27324
27325 {|
27326 |
27327 indented cell (no pre-wrapping!)
27328 |}
27329 </blockquote>
27330 foo
27331 <div>bar</div>
27332 !! end
27333
27334 !! test
27335 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27336 !! options
27337 parsoid=html2wt
27338 !! html/parsoid
27339 <p>foo</p>
27340 <span>bar</span>
27341
27342 <span>foo2
27343 </span>bar2
27344
27345 <div>foo</div>
27346 <span>bar</span>
27347
27348 <div>
27349 <span>foo</span>
27350 </div>
27351 !! wikitext
27352 foo
27353
27354 <span>bar</span>
27355
27356 <span>foo2
27357 <nowiki> </nowiki></span>bar2
27358
27359 <div>foo</div>
27360 <nowiki> </nowiki><span>bar</span>
27361
27362 <div>
27363 <nowiki> </nowiki><span>foo</span>
27364 </div>
27365 !! end
27366
27367 !! test
27368 Lists: Dont insert newlines in a serialized list item.
27369 !! options
27370 parsoid=html2wt
27371 !! html/parsoid
27372 <ul><li>a<br>b</li><li>c</li></ul>
27373 !! wikitext
27374 * a<br>b
27375 * c
27376 !! end
27377
27378 !! test
27379 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27380 !! options
27381 parsoid={
27382 "modes": ["html2wt"],
27383 "scrubWikitext": false
27384 }
27385 !! html/parsoid
27386 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27387 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27388
27389 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27390 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27391
27392 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27393
27394 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27395 !! wikitext
27396 == hello there [[Category:A1]] ==
27397
27398 == [[Category:A2]] hi pal ==
27399
27400 == <!--foo--> [[Category:A3]] how goes it ==
27401
27402 == it goes well [[Category:A4]] <!--bar--> ==
27403
27404 ==howdy [[Category:A5]]==
27405
27406 == __TOC__ ok ==
27407 !! end
27408
27409 !! test
27410 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27411 !! options
27412 parsoid={
27413 "modes": ["html2wt"],
27414 "scrubWikitext": true
27415 }
27416 !! html/parsoid
27417 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27418 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27419
27420 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27421 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27422
27423 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27424 !! wikitext
27425 == hello there ==
27426 [[Category:A1]]
27427 [[Category:A2]]
27428
27429 == hi pal ==
27430
27431 <!--foo--> [[Category:A3]]
27432
27433 == how goes it ==
27434
27435 == it goes well ==
27436 [[Category:A4]] <!--bar-->
27437
27438 __TOC__
27439
27440 == ok ==
27441 !! end
27442
27443 !! test
27444 Headings: Don't hoist metas that come from templates
27445 !! options
27446 parsoid={
27447 "modes": ["html2wt"],
27448 "scrubWikitext": true
27449 }
27450 !! html/parsoid
27451 <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>
27452 !! wikitext
27453 == {{echo|foo [[Category:Foo]]}} ==
27454 !! end
27455
27456 !! test
27457 Headings: Category in ref isn't hoisted
27458 !! options
27459 parsoid={
27460 "modes": ["html2wt"],
27461 "scrubWikitext": true
27462 }
27463 !! html/parsoid
27464 <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>
27465
27466 <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>
27467 !! wikitext
27468 == foo <ref>bar
27469 [[Category:Baz]] </ref> ==
27470
27471 <references />
27472 !! end
27473
27474 !! test
27475 Parsoid: Serialize positional parameters with = in them as named parameter
27476 !! options
27477 parsoid=html2wt
27478 !! html/parsoid
27479 <p about="#mwt1" typeof="mw:Transclusion"
27480 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27481
27482 <p about="#mwt1" typeof="mw:Transclusion"
27483 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27484
27485 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27486 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27487 <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>
27488 !! wikitext
27489 {{echo|1=f=oo}}
27490
27491 {{echo|1=f=oo|2=bar}}
27492
27493 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27494 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27495 {{echo|<nowiki>f=oo</nowiki>|bar}}
27496 !! end
27497
27498 !! test
27499 Parsoid: Serialize positional parameters with = in extlink as named parameter
27500 !! options
27501 parsoid=html2wt
27502 !! html/parsoid
27503 <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>
27504 !! wikitext
27505 {{echo|1=http://stuff?is=ok}}
27506 !! end
27507
27508 !! test
27509 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27510 !! options
27511 parsoid=html2wt
27512 !! html/parsoid
27513 <div>a<p>b</p></div>
27514 <div>a
27515 <p>b</p></div>
27516 <div>
27517 a
27518 <p>b</p></div>
27519 !! wikitext
27520 <div>a
27521 b
27522 </div>
27523 <div>a
27524 b
27525 </div>
27526 <div>
27527 a
27528
27529 b
27530 </div>
27531 !! end
27532
27533 !! test
27534 Substrings resembling wikitext in hrefs should not get nowiki escapes
27535 !! options
27536 parsoid=html2wt
27537 !! html/parsoid
27538 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27539 !! wikitext
27540 [[Foo''bar''baz]]
27541 !! end
27542
27543 !! test
27544 Enforce single-line context in the serializer
27545 !! options
27546 parsoid=html2wt
27547 !! html/parsoid
27548 <h2>testing
27549 123</h2>
27550
27551 <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">
27552 </span><span about="#mwt1">you</span> </h2>
27553
27554 <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>
27555
27556 <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
27557 there</span></li></ol>
27558
27559 <ul><li>asd
27560 sdf</li></ul>
27561
27562 <ul><li>foo
27563 bar
27564 baz</li>
27565 <li>foo <b>bar</b>
27566 baz</li></ul>
27567
27568 <dl><dt>hi
27569 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27570 ho</dd></dl>
27571
27572 <dl><dd> <table>
27573 <tbody><tr><td> ha
27574 ha
27575 ha</td></tr>
27576 </tbody></table></dd></dl>
27577 !! wikitext
27578 == testing 123 ==
27579
27580 == hi {{bogus|there
27581 you}} ==
27582
27583 == foo <ref>hello
27584 there</ref> ==
27585
27586 <references />
27587
27588 * asd sdf
27589
27590 * foo bar baz
27591 * foo '''bar''' baz
27592
27593 ; hi ho : hi ho
27594
27595 : {|
27596 | ha
27597 ha
27598 ha
27599 |}
27600 !! end
27601
27602 !! test
27603 Serialize new placeholder space without spans
27604 !! options
27605 parsoid=html2wt
27606 !! html/parsoid
27607 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
27608
27609 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
27610
27611 <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>
27612 !! wikitext
27613 foo : bar
27614
27615 foo : bar
27616
27617 <ref>foo : bar</ref>ok
27618 !! end
27619
27620
27621 #-----------------------
27622 # Tag minimization tests
27623 #-----------------------
27624
27625 !! test
27626 1. I/B quote minimization: wikitext-only tags should be combined
27627 !! options
27628 parsoid=html2wt
27629 !! html/parsoid
27630 <p><i>A</i><i>B</i></p>
27631 <p><b>A</b><b>B</b></p>
27632 <p><i>A</i><b><i>B</i></b></p>
27633 <p><b>A</b><i><b>B</b></i></p>
27634 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
27635 <p><i><b>A</b></i><i><b>B</b></i></p>
27636 <p><i><b>A</b></i><b><i>B</i></b></p>
27637 <p><b><i>A</i></b><i><b>B</b></i></p>
27638 !! wikitext
27639 ''AB''
27640
27641 '''AB'''
27642
27643 ''A'''B'''''
27644
27645 '''A''B'''''
27646
27647 '''A''BC''D'''
27648
27649 '''''AB'''''
27650
27651 '''''AB'''''
27652
27653 '''''AB'''''
27654 !! end
27655
27656 !! test
27657 2. I/B quote minimization: wikitext and html tags should not be combined
27658 !! options
27659 parsoid=html2wt
27660 !! html/parsoid
27661 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
27662 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
27663 !! wikitext
27664 ''A''<i>B</i>
27665
27666 ''A''<nowiki/>'''<i>B</i>'''
27667 !! end
27668
27669 !! test
27670 3. I/B quote minimization: templated content stops minimization
27671 !! options
27672 parsoid=html2wt
27673 !! html/parsoid
27674 <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>
27675 <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>
27676 !! wikitext
27677 ''A''{{echo|''B''}}
27678
27679 ''A''{{echo|'''''B'''''}}
27680 !! end
27681
27682 !! test
27683 4. I/B quote minimization: new content should be mimimized with adjacent old content
27684 !! options
27685 parsoid=html2wt
27686 !! html/parsoid
27687 <p><i>A</i><i>B</i></p>
27688 <p><b>A</b><b>B</b></p>
27689 <p><i>A</i><b><i>B</i></b></p>
27690 !! wikitext
27691 ''AB''
27692
27693 '''AB'''
27694
27695 ''A'''B'''''
27696 !! end
27697
27698 !! test
27699 5a. Merge adjacent quote nodes if they've been edited
27700 !! options
27701 parsoid={
27702 "modes": ["wt2wt", "selser"],
27703 "changes": [
27704 ["p", "contents", "remove", ":contains('b')"]
27705 ]
27706 }
27707 !! wikitext
27708 ''a''b''c''
27709 !! wikitext/edited
27710 ''ac''
27711 !! end
27712
27713 !! test
27714 5b. Merge adjacent quote nodes if they've been edited
27715 !! options
27716 parsoid={
27717 "modes": ["wt2wt", "selser"],
27718 "changes": [
27719 ["#x", "remove"]
27720 ]
27721 }
27722 !! wikitext
27723 ''a''<span id="x">b</span>''c''
27724 !! wikitext/edited
27725 ''ac''
27726 !! end
27727
27728 !! test
27729 1. Merge adjacent link nodes as long as at least one element is new
27730 !! options
27731 parsoid={
27732 "modes": ["html2wt"],
27733 "scrubWikitext": true
27734 }
27735 !! html/parsoid
27736 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27737 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27738 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
27739 !! wikitext
27740 [[Football]]
27741 [[Football]]
27742 [[Football|Foot]][[Football|ball]]
27743 !! end
27744
27745 !! test
27746 2. Merge adjacent link nodes and enable additional normalizations
27747 !! options
27748 parsoid={
27749 "modes": ["html2wt"],
27750 "scrubWikitext": true
27751 }
27752 !! html/parsoid
27753 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
27754 !! wikitext
27755 [[Football|''Football'']]
27756 !! end
27757
27758 !! test
27759 3. Don't merge adjacent link nodes if scrubWikitext is false
27760 !! options
27761 parsoid={
27762 "modes": ["html2wt"],
27763 "scrubWikitext": false
27764 }
27765 !! html/parsoid
27766 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
27767 !! wikitext
27768 [[Football|Foot]][[Football|ball]]
27769 !! end
27770
27771 #------------------------------
27772 # End of tag minimization tests
27773 #------------------------------
27774
27775 !!test
27776 T56262: New entities
27777 !! options
27778 parsoid=html2wt
27779 !! html/parsoid
27780 <span typeof="mw:Entity">&nbsp;</span>
27781 !! wikitext
27782 &nbsp;
27783 !! end
27784
27785 ## Note that there is no wikitext output for 'unknownproperty' ##
27786 ## Unknown magic words are silently dropped ##
27787
27788 !! test
27789 Magic words
27790 !! options
27791 parsoid=html2wt
27792 !! html/parsoid
27793 <meta property='mw:PageProp/toc' />
27794 <meta property='mw:PageProp/notoc' />
27795 <meta property='mw:PageProp/forcetoc' />
27796 <meta property='mw:PageProp/index' />
27797 <meta property='mw:PageProp/noindex' />
27798 <meta property='mw:PageProp/nogallery' />
27799 <meta property='mw:PageProp/noeditsection' />
27800 <meta property='mw:PageProp/notitleconvert' />
27801 <meta property='mw:PageProp/nocontentconvert' />
27802 <meta property='mw:PageProp/unknownproperty' />
27803 !! wikitext
27804 __TOC__
27805 __NOTOC__
27806 __FORCETOC__
27807 __INDEX__
27808 __NOINDEX__
27809 __NOGALLERY__
27810 __NOEDITSECTION__
27811 __NOTITLECONVERT__
27812 __NOCONTENTCONVERT__
27813 !! end
27814
27815 !! test
27816 Consecutive <pre>s should not get merged
27817 !! options
27818 parsoid=html2wt,html2html
27819 !! html/parsoid
27820 <pre>a</pre><pre>b</pre>
27821
27822 <pre>c
27823 </pre><pre>
27824 d</pre>
27825
27826 <pre>e
27827
27828 </pre><pre>
27829
27830 f</pre>
27831 !! wikitext
27832 a
27833
27834 b
27835
27836 c
27837
27838 d
27839
27840 e
27841
27842
27843
27844 f
27845 !! end
27846
27847 !! test
27848 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
27849 !! options
27850 parsoid=html2wt
27851 !! html/parsoid
27852 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
27853 !! wikitext
27854 [[Special:BookSources/1234567890|ISBN 1234567895]]
27855 !! end
27856
27857 !! test
27858 Edited RFC links not serializable as RFC links should serialize as extlinks
27859 !! options
27860 parsoid=html2wt
27861 !! html/parsoid
27862 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
27863 !! wikitext
27864 [//tools.ietf.org/html/rfc123 New RFC]
27865 !! end
27866
27867 !! test
27868 Edited PMID links not serializable as PMID links should serialize as extlinks
27869 !! options
27870 parsoid=html2wt
27871 !! html/parsoid
27872 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
27873 !! wikitext
27874 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
27875 !! end
27876
27877 !! test
27878 WTS of autolinks with trailing/surrounding context
27879 !! options
27880 parsoid=html2wt
27881 !! html/parsoid
27882 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
27883 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
27884 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
27885 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
27886 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
27887 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
27888 !! wikitext
27889 http://cscott.net'''foo'''
27890
27891 http://cscott.net<b>foo</b>
27892
27893 '''http://cscott.net'''
27894
27895 '''http://cscott.net '''
27896
27897 '''http://cscott.net<nowiki/>x'''
27898
27899 http://cscott.net<nowiki/>x
27900 !! end
27901
27902 !! test
27903 WTS of autolinks with nowikis (round-trip)
27904 !! wikitext
27905 x<nowiki/>http://cscott.net<nowiki/>x
27906 !! html/parsoid
27907 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
27908 !! end
27909
27910 # this is the "easy" test because it leaves in place all the
27911 # data-parsoid information indicating this is an autolink
27912 !! test
27913 WTS of autolinks with escapes (editing)
27914 !! options
27915 parsoid={
27916 "modes": ["wt2wt"],
27917 "changes": [
27918 [ "span", "remove" ]
27919 ]
27920 }
27921 !! wikitext
27922 x<nowiki/>http://cscott.net<nowiki/>x
27923 !! wikitext/edited
27924 x<nowiki/>http://cscott.net<nowiki/>x
27925 !! end
27926
27927 !! test
27928 WTS of edited autolink-like text (T103364)
27929 !! options
27930 parsoid={
27931 "modes": ["wt2wt"],
27932 "changes": [
27933 [ "span[typeof]", "removeAttr", "typeof" ]
27934 ]
27935 }
27936 !! wikitext
27937 Not a link: <nowiki>http://example.com</nowiki>.
27938 !! wikitext/edited
27939 Not a link: <span><nowiki>http://example.com</nowiki></span>.
27940 !! end
27941
27942 !! test
27943 WTS of newly-authored autolink-like text (T103364)
27944 !! options
27945 parsoid=html2wt
27946 !! html/parsoid
27947 <p>http://example.com is not a link.</p>
27948 !! wikitext
27949 <nowiki>http://example.com</nowiki> is not a link.
27950 !! end
27951
27952 !! test
27953 WTS of autolink-like text after an autolink (T108563)
27954 !! options
27955 parsoid=html2wt
27956 !! html/parsoid
27957 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
27958 !! wikitext
27959 http://example.com <nowiki>http://example.com</nowiki> is not a link.
27960 !! end
27961
27962 !! test
27963 Magic links inside links (not autolinked)
27964 !! wikitext
27965 [[Foo|http://example.com]]
27966 [[Foo|RFC 1234]]
27967 [[Foo|PMID 1234]]
27968 [[Foo|ISBN 123456789x]]
27969
27970 [http://foo.com http://example.com]
27971 [http://foo.com RFC 1234]
27972 [http://foo.com PMID 1234]
27973 [http://foo.com ISBN 123456789x]
27974 !! html+tidy
27975 <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>
27976 <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>
27977 !! html/parsoid
27978 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
27979 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
27980 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
27981 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
27982
27983 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
27984 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
27985 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
27986 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
27987 !! end
27988
27989 !! test
27990 Magic links inside image captions (autolinked)
27991 !! wikitext
27992 [[File:Foobar.jpg|thumb|http://example.com]]
27993 [[File:Foobar.jpg|thumb|RFC 1234]]
27994 [[File:Foobar.jpg|thumb|PMID 1234]]
27995 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
27996 !! html+tidy
27997 <div class="thumb tright">
27998 <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>
27999 <div class="thumbcaption">
28000 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28001 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
28002 </div>
28003 </div>
28004 <div class="thumb tright">
28005 <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>
28006 <div class="thumbcaption">
28007 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28008 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
28009 </div>
28010 </div>
28011 <div class="thumb tright">
28012 <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>
28013 <div class="thumbcaption">
28014 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28015 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
28016 </div>
28017 </div>
28018 <div class="thumb tright">
28019 <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>
28020 <div class="thumbcaption">
28021 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
28022 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
28023 </div>
28024 </div>
28025 !! html/parsoid
28026 <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>
28027 <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>
28028 <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>
28029 <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>
28030 !! end
28031
28032 !! test
28033 WTS of magic word text (T109371)
28034 !! options
28035 parsoid=html2wt
28036 !! html/parsoid
28037 <p>RFC 1234</p>
28038 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28039 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28040 !! wikitext
28041 <nowiki>RFC 1234</nowiki>
28042
28043 [http://foo.com RFC 1234]
28044
28045 [[Foo|RFC 1234]]
28046 !! end
28047
28048 !! test
28049 Edited Redirect link should emit a non-piped wikitext link
28050 !! options
28051 parsoid=html2wt
28052 !! html/parsoid
28053 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28054 !! wikitext
28055 #REDIRECT [[Bar]]
28056 !! end
28057
28058 !! test
28059 T75121: Infer extension name from typeOf if data-mw is not present
28060 !! options
28061 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28062 !! html/parsoid
28063 <div typeOf="mw:Extension/foo"></div>
28064 !! wikitext
28065 <foo />
28066 !! end
28067
28068 # Note that the <p> wrapping isn't present in PHP parser output
28069 # The important thing for this test is that P-wrapping doesn't
28070 # interfere with the <nowiki> protection for leading - in <td>
28071 # (which isn't necessary for <th>).
28072 !! test
28073 T88318: p-wrapped dash in table.
28074 !! options
28075 parsoid=html2wt,wt2wt
28076 !! html/parsoid
28077 <table><tbody>
28078 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28079 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28080 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28081 </tbody></table>
28082 !! wikitext
28083 {|
28084 !-
28085 !-
28086 |-
28087 |<nowiki>-</nowiki>
28088 |<nowiki>- </nowiki>
28089 |-
28090 |<small>-</small>
28091 |<br>
28092 -
28093 |<br>
28094 -
28095 |}
28096 !! html/php+tidy
28097 <table>
28098 <tr>
28099 <th>-</th>
28100 <th>-</th>
28101 </tr>
28102 <tr>
28103 <td>-</td>
28104 <td>-</td>
28105 </tr>
28106 <tr>
28107 <td><small>-</small></td>
28108 <td><br />
28109 <p>-</p>
28110 </td>
28111 <td><br />
28112 <p>-</p>
28113 </td>
28114 </tr>
28115 </table>
28116 !! end
28117
28118 !! test
28119 T149209: WTS: Handle newlines in table cells properly
28120 !! options
28121 parsoid=html2wt
28122 !! html/parsoid
28123 <table>
28124 <tbody>
28125 <tr><td>a
28126 b
28127 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
28128 <tr><td><p>x</p>
28129 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28130 </tbody></table>
28131 <table>
28132 <tbody>
28133 <tr><th>a
28134 b
28135 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
28136 <tr><th><p>x</h>
28137 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
28138 </tbody></table>
28139 !! wikitext
28140 {|
28141 |a
28142 b
28143 |c
28144 |-
28145 |x
28146 {{!}}y
28147 |}
28148 {|
28149 !a
28150 b
28151 !c
28152 |-
28153 !x
28154 !y
28155 |}
28156 !! end
28157
28158 !! test
28159 T149209: Selser: Handle newlines in table cells properly
28160 !! options
28161 parsoid={
28162 "modes": ["selser"],
28163 "changes": [
28164 [ "#h1", "html", "a\nb\n" ],
28165 [ "#h2", "html", "a\nb\n" ],
28166 [ "#c1", "html", "a\nb\n" ],
28167 [ "#c2", "html", "<p>a</p>" ],
28168 [ "#c3", "html", "<p>a</p>" ],
28169 [ "#c4", "html", "edit-me<p>a</p>" ]
28170 ]
28171 }
28172 !! wikitext
28173 {|
28174 ! id="h1" |edit-me!!1
28175 |-
28176 ! id="h2" |edit-me||2
28177 |-
28178 | id="c1" |edit-me||3
28179 |-
28180 | id="c2" |edit-me||4
28181 |-
28182 | id="c3" |edit-me||p||q||r
28183 |-
28184 | id="c4" |edit-me||p||q||r
28185 |}
28186 !! wikitext/edited
28187 {|
28188 ! id="h1" |a
28189 b
28190 !1
28191 |-
28192 ! id="h2" |a
28193 b
28194 !2
28195 |-
28196 | id="c1" |a
28197 b
28198 |3
28199 |-
28200 | id="c2" |a
28201 |4
28202 |-
28203 | id="c3" |a
28204 |p||q||r
28205 |-
28206 | id="c4" |edit-me
28207 a
28208 |p||q||r
28209 |}
28210 !! end
28211
28212 !! test
28213 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28214 !! options
28215 parsoid=html2wt
28216 !! html/parsoid
28217 <table id='mwAb'>
28218 <td id='mwAc'>foo</td>
28219 <td id='serialize-this'>bar</td>
28220 </table>
28221 !! wikitext
28222 {|
28223 |foo
28224 | id="serialize-this" |bar
28225 |}
28226 !! end
28227
28228 !! test
28229 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28230 !! options
28231 parsoid=html2wt
28232 !! html/parsoid
28233 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28234 !! wikitext
28235 <div id="hello">ok</div>
28236 !! end
28237
28238 !! test
28239 WTS change modes
28240 !! options
28241 parsoid={
28242 "modes": ["wt2wt"],
28243 "changes": [
28244 [ "#xyz", "before", "<b>before</b> stuff " ],
28245 [ "#xyz", "after", " stuff <i>after</i>" ],
28246 [ "#xyz", "html", "x <b>y</b> z" ]
28247 ]
28248 }
28249 !! wikitext
28250 <span id="xyz">hello</span>
28251 !! wikitext/edited
28252 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28253 !! end
28254
28255 !! test
28256 Never serialize a-tag as html, regardless of what data-parsoid has to say
28257 !! options
28258 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28259 !! html/parsoid
28260 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28261 !! wikitext
28262 [[Foo]]
28263 !! end
28264
28265 ## SSS FIXME: This is broken output nevertheless.
28266 ## What might be a reasonable non-broken output for this?
28267 ## This is an edge case unlikely to be seen in production
28268 ## that I am not wasting more time on this right now.
28269 !! test
28270 Never serialize a-tag as html, no matter what attributes it has
28271 !! options
28272 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28273 !! html/parsoid
28274 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28275 !! wikitext
28276 [http://boo.org http://boohoo.org]
28277 !! end
28278
28279 # Misnested is an indication that selser can reuse the source but these have
28280 # shown to sneak through on occasion. See T101768.
28281 # The original wikitext here is: [http://test.com [[one]] two three]
28282 !! test
28283 Strip span tags added to mark misnested links
28284 !! options
28285 parsoid=html2wt
28286 !! html/parsoid
28287 <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>
28288 !! wikitext
28289 [http://test.com][[one]] two three
28290 !! end
28291
28292 !! test
28293 Catch regression when unpacking misnested links
28294 !! options
28295 parsoid=wt2html
28296 !! wikitext
28297 {{echo|hi}}[http://example.com [[ho]]]
28298 !! html/parsoid
28299 <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>
28300 !! end
28301
28302 !! test
28303 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28304 !! options
28305 parsoid=html2wt
28306 !! html/parsoid
28307 <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|}"]}'>
28308 <tbody><tr><td>d
28309 </td></tr>
28310 </tbody></table>
28311 !! wikitext
28312 {{echo|a}}
28313 {|{{echo|c
28314 {{!}}d
28315 }}
28316 |}
28317 !! end
28318
28319 ## This test verifies the presence and computation of this attribute indirectly
28320 ## by making an edit and ensuring that the serialization is correct (which it would be
28321 ## only if firstWikitextNode is properly set).
28322 !! test
28323 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28324 !! options
28325 parsoid= {
28326 "modes": ["wt2wt"],
28327 "changes": [
28328 [ "div#x", "remove" ],
28329 [ "div", "before", "<div>new</div>" ]
28330 ]
28331 }
28332 !! wikitext
28333 <div id="x">foo</div>
28334 {|
28335 {{echo|<div>boo</div>
28336 {{!}}b}}
28337 |c
28338 |}
28339 !! wikitext/edited
28340
28341 <div>new</div>
28342 {|
28343 {{echo|<div>boo</div>
28344 {{!}}b}}
28345 |c
28346 |}
28347 !! end
28348
28349 # --------------------------------------------
28350 # Tests spec'ing wikitext serialization norms |
28351 # --------------------------------------------
28352
28353 !! test
28354 Serialize multi-line indent-pre starting with wikitext syntax
28355 !! options
28356 parsoid=html2wt
28357 !! html/parsoid
28358 <pre>* 1
28359 ** 2
28360 * 3</pre>
28361 !! wikitext
28362 * 1
28363 ** 2
28364 * 3
28365 !! end
28366
28367 !! test
28368 1. Categories should always be serialized on their own line
28369 !! options
28370 parsoid=html2wt
28371 !! html/parsoid
28372 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28373 !! wikitext
28374 foo
28375 [[Category:Foo]]
28376 bar
28377 !! end
28378
28379 !! test
28380 2. Categories that are part of templates should not introduce a line break
28381 !! wikitext
28382 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28383 !! html/parsoid
28384 <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>
28385 !! end
28386
28387 # Careful while editing these next 2 tests. There are \u200f characters
28388 # before and after the <link> tags in the HTML and following some
28389 # of the categories in wikitext
28390 # Do not remove these characters in edits.
28391 #
28392 # As part of the serialization, these bidi characters will get stripped.
28393 !! test
28394 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28395 !! options
28396 parsoid={
28397 "modes": ["html2wt"],
28398 "scrubWikitext": true
28399 }
28400 !! html/parsoid
28401 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28402 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28403 !! wikitext
28404 [[קטגוריה:טקסים]]
28405 [[קטגוריה: שיטות משפט]]
28406 !! end
28407
28408 !! test
28409 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28410 !! options
28411 parsoid={
28412 "modes": ["html2wt"],
28413 "scrubWikitext": true
28414 }
28415 !! html/parsoid
28416 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28417 !! wikitext
28418 [[קטגוריה:טקסים]]
28419 ‏y
28420 !! end
28421
28422 !! test
28423 Lists: Add space after bullets
28424 !! options
28425 parsoid=html2wt
28426 !! html/parsoid
28427 <ul>
28428 <li>foo</li>
28429 <li> bar</li>
28430 <li><span> baz</span></li>
28431 </ul>
28432 !! wikitext
28433 * foo
28434 * bar
28435 * <span> baz</span>
28436 !! end
28437
28438 !! test
28439 1. Headings: Add space before/after == (T53744)
28440 !! options
28441 parsoid=html2wt
28442 !! html/parsoid
28443 <h2>foo</h2>
28444 <h2> bar</h2>
28445 <h2>baz </h2>
28446 <h2><span> baz</span></h2>
28447 !! wikitext
28448 == foo ==
28449
28450 == bar ==
28451
28452 == baz ==
28453
28454 == <span> baz</span> ==
28455 !! end
28456
28457 !! test
28458 2. Headings: Add space before/after == even after hoisted content
28459 !! options
28460 parsoid={
28461 "modes": ["html2wt"],
28462 "scrubWikitext": true
28463 }
28464 !! html/parsoid
28465 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28466 !! wikitext
28467 [[Category:A2]]
28468
28469 == ok ==
28470 !! end
28471
28472 !! test
28473 1. Headings: suppress newly created empty headings
28474 !! options
28475 parsoid={
28476 "modes": ["html2wt"],
28477 "scrubWikitext": true
28478 }
28479 !! html/parsoid
28480 <h2></h2>
28481 !! wikitext
28482 !! end
28483
28484 !! test
28485 2. Headings: don't suppress empty headings if scrubWikitext is false
28486 !! options
28487 parsoid=html2wt
28488 !! html/parsoid
28489 <h2></h2>
28490 !! wikitext
28491 ==<nowiki/>==
28492 !! end
28493
28494 !! test
28495 3. Headings: suppress empty headings on edits
28496 !! options
28497 parsoid={
28498 "modes": ["selser"],
28499 "scrubWikitext": true,
28500 "changes": [
28501 [ "#x", "remove"]
28502 ]
28503 }
28504 !! wikitext
28505 ==<span id="x">foo</span>==
28506 !! wikitext/edited
28507 !! end
28508
28509 !! test
28510 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28511 !! options
28512 parsoid={
28513 "modes": ["html2wt"],
28514 "scrubWikitext": true
28515 }
28516 !! html/parsoid
28517 <h2>foo<br/>bar</h2>
28518 <h2>foo <span><br/>bar</span> baz</h2>
28519 !! wikitext
28520 == foo bar ==
28521
28522 == foo <span> bar</span> baz ==
28523 !! end
28524
28525 !! test
28526 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28527 !! options
28528 parsoid={
28529 "modes": ["html2wt"],
28530 "scrubWikitext": false
28531 }
28532 !! html/parsoid
28533 <h2>foo<br/>bar</h2>
28534 !! wikitext
28535 == foo<br> bar ==
28536 !! end
28537
28538 !! test
28539 1. WT Quote Tags: suppress newly created empty style tags
28540 !! options
28541 parsoid={
28542 "modes": ["html2wt"],
28543 "scrubWikitext": true
28544 }
28545 !! html/parsoid
28546 <i></i><b></b>
28547 !! wikitext
28548 !! end
28549
28550 !! test
28551 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28552 !! options
28553 parsoid=html2wt
28554 !! html/parsoid
28555 <i></i><b></b>
28556 !! wikitext
28557 ''<nowiki/>'''''<nowiki/>'''
28558 !! end
28559
28560 !! test
28561 3. WT Quote Tags: suppress empty style tags on edits
28562 !! options
28563 parsoid={
28564 "modes": ["selser"],
28565 "scrubWikitext": true,
28566 "changes": [
28567 [ "#x", "remove"]
28568 ]
28569 }
28570 !! wikitext
28571 '''<span id="x">foo</span>'''
28572 !! wikitext/edited
28573 !! end
28574
28575 !! test
28576 1. Anchors: suppress newly created empty anchors
28577 !! options
28578 parsoid={
28579 "modes": ["html2wt"],
28580 "scrubWikitext": true
28581 }
28582 !! html/parsoid
28583 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28584 !! wikitext
28585 !! end
28586
28587 !! test
28588 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28589 !! options
28590 parsoid={
28591 "modes": ["html2wt"],
28592 "scrubWikitext": false
28593 }
28594 !! html/parsoid
28595 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28596 !! wikitext
28597 [[Test|<nowiki/>]]
28598 !! end
28599
28600 !! test
28601 3. Anchors: suppress empty anchors on edits
28602 !! options
28603 parsoid={
28604 "modes": ["selser"],
28605 "scrubWikitext": true,
28606 "changes": [
28607 [ "#x", "remove"]
28608 ]
28609 }
28610 !! wikitext
28611 [[Test|<span id="x">foo</span>]]
28612 !! wikitext/edited
28613 !! end
28614
28615 !! test
28616 3a. Anchors: do not suppress numbered extlinks
28617 !! options
28618 parsoid={
28619 "modes": ["wt2wt"],
28620 "scrubWikitext": true
28621 }
28622 !! wikitext
28623 [http://foo.com]
28624 !! html/parsoid
28625 <a rel="mw:ExtLink" href="http://foo.com"></a>
28626 !! end
28627
28628 !! test
28629 3b. Anchors: do not suppress numbered extlinks
28630 !! options
28631 parsoid={
28632 "modes": ["wt2wt"],
28633 "scrubWikitext": true,
28634 "changes": [
28635 [ "#x", "remove"]
28636 ]
28637 }
28638 !! wikitext
28639 [http://foo.com <span id="x">foo</span>]
28640 !! wikitext/edited
28641 [http://foo.com]
28642 !! end
28643
28644 !!test
28645 Normalizations should be restricted to edited content
28646 !!options
28647 parsoid={
28648 "modes": ["selser"],
28649 "scrubWikitext": true,
28650 "changes": [
28651 [ "h1", "before", "<i></i>"]
28652 ]
28653 }
28654 !!wikitext
28655 a
28656 = =
28657 b
28658 !!wikitext/edited
28659 a
28660 = =
28661 b
28662 !!end
28663
28664 !! test
28665 1. Multiple normalizations (html2wt)
28666 !! options
28667 parsoid={
28668 "modes": ["html2wt"],
28669 "scrubWikitext": true
28670 }
28671 !! html
28672 <h2><i></i></h2>
28673 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
28674 </a><b><i></i></b>x</p>
28675 !! wikitext
28676
28677 [[foo]]
28678 x
28679
28680 !! end
28681
28682 !! test
28683 2. Multiple normalizations (selser)
28684 !! options
28685 parsoid={
28686 "modes": ["selser"],
28687 "scrubWikitext": true,
28688 "changes": [
28689 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
28690 ]
28691 }
28692 !! wikitext
28693 <span id="x">foo</span>
28694 !! wikitext/edited
28695 <span id="x">foo</span>
28696
28697 x
28698 !! end
28699
28700 !! test
28701 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
28702 !! options
28703 parsoid={
28704 "modes": ["html2wt"],
28705 "scrubWikitext": true
28706 }
28707 !! html/parsoid
28708 <p> hi</p>
28709 <p> hello</p>
28710 !! wikitext
28711 hi
28712
28713 hello
28714 !! end
28715
28716 !! test
28717 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
28718 !! options
28719 parsoid=html2wt
28720 !! html/parsoid
28721 <p> hi</p>
28722 <p> hello</p>
28723 !! wikitext
28724 <nowiki> </nowiki>hi
28725
28726 <nowiki> </nowiki> hello
28727 !! end
28728
28729 !! test
28730 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
28731 !! options
28732 parsoid={
28733 "modes": ["html2wt"],
28734 "scrubWikitext": true
28735 }
28736 !! html/parsoid
28737 <p>Foo
28738 bar
28739 baz</p>
28740
28741 <table><tr><td>Foo
28742 bar
28743 baz bang</td></tr></table>
28744
28745 <p><!--boo--> foo
28746 bar</p>
28747
28748 <p> foo
28749 bar<span>boo</span></p>
28750 !! wikitext
28751 Foo
28752 bar
28753 baz
28754
28755 {|
28756 |Foo
28757 bar
28758 baz bang
28759 |}
28760
28761 <!--boo-->foo
28762 bar
28763
28764 foo
28765 bar<span>boo</span>
28766 !! end
28767
28768 !! test
28769 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
28770 !! options
28771 parsoid={
28772 "modes": ["selser"],
28773 "scrubWikitext": true,
28774 "changes": [
28775 [ "p", "html", " a\n b" ]
28776 ]
28777 }
28778 !! wikitext
28779 xyz
28780 !! wikitext/edited
28781 a
28782 b
28783 !! end
28784
28785 !! test
28786 1. New links that end in spaces
28787 !! options
28788 parsoid={
28789 "modes": ["html2wt"],
28790 "scrubWikitext": false
28791 }
28792 !! html/parsoid
28793 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28794 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28795 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28796 !! wikitext
28797 [[Berlin ]]<nowiki/>is the capital of Germany.
28798
28799 [[Foo ]]'''bar'''
28800
28801 [[Boston ]] is a city.
28802 !! end
28803
28804 !! test
28805 2. New links that end in spaces
28806 !! options
28807 parsoid={
28808 "modes": ["html2wt"],
28809 "scrubWikitext": true
28810 }
28811 !! html/parsoid
28812 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
28813 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
28814 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
28815 !! wikitext
28816 [[Berlin]] is the capital of Germany.
28817
28818 [[Foo]] '''bar'''
28819
28820 [[Boston]] is a city.
28821 !! end
28822
28823 !! test
28824 1. Table cells with escapable prefixes
28825 !! options
28826 parsoid={
28827 "modes": ["html2wt"],
28828 "scrubWikitext": false
28829 }
28830 !! html
28831 <table>
28832 <tr><td>a</td></tr>
28833 <tr><td>-</td></tr>
28834 <tr><td>+</td></tr>
28835 </table>
28836 !! wikitext
28837 {|
28838 |a
28839 |-
28840 |<nowiki>-</nowiki>
28841 |-
28842 |<nowiki>+</nowiki>
28843 |}
28844 !! end
28845
28846 !! test
28847 2. Table cells with escapable prefixes
28848 !! options
28849 parsoid={
28850 "modes": ["html2wt"],
28851 "scrubWikitext": true
28852 }
28853 !! html
28854 <table>
28855 <tr><td>a</td></tr>
28856 <tr><td>-</td></tr>
28857 <tr><td>+</td></tr>
28858 </table>
28859 !! wikitext
28860 {|
28861 |a
28862 |-
28863 | -
28864 |-
28865 | +
28866 |}
28867 !! end
28868
28869 !! test
28870 3a. Table cells with escapable prefixes after edits
28871 !! options
28872 parsoid={
28873 "modes": ["selser"],
28874 "scrubWikitext": true,
28875 "changes": [
28876 [ "table tbody tr:first-child td:first-child", "remove"]
28877 ]
28878 }
28879 !! wikitext
28880 {|
28881 |a||-
28882 |}
28883 !! wikitext/edited
28884 {|
28885 | -
28886 |}
28887 !! end
28888
28889 !! test
28890 3b. Table cells with escapable prefixes after edits
28891 !! options
28892 parsoid={
28893 "modes": ["selser"],
28894 "scrubWikitext": true,
28895 "changes": [
28896 [ "table tbody tr:first-child td:first-child", "html", "-" ],
28897 [ "#x", "remove" ]
28898 ]
28899 }
28900 !! wikitext
28901 {|
28902 |pqr
28903 |<span id="x">foo</span>+
28904 |}
28905 !! wikitext/edited
28906 {|
28907 | -
28908 | +
28909 |}
28910 !! end
28911
28912 # FIXME: This test will fail because
28913 # normalization doesn't realize that the id attribute
28914 # will eliminate the escapable scenario
28915 !! test
28916 4a. Table cells without escapable prefixes after edits
28917 !! options
28918 parsoid={
28919 "modes": ["selser"],
28920 "scrubWikitext": true,
28921 "changes": [
28922 [ "#x", "html", "-" ]
28923 ]
28924 }
28925 !! wikitext
28926 {|
28927 | id="x" |abcd
28928 |}
28929 !! wikitext/edited
28930 {|
28931 | id="x" |-
28932 |}
28933 !! end
28934
28935 ## This tests normalizer's ability to discriminate between
28936 ## cells having identical content.
28937 !! test
28938 4b. Table cells without escapable prefixes after edits
28939 !! options
28940 parsoid={
28941 "modes": ["selser"],
28942 "scrubWikitext": true,
28943 "changes": [
28944 [ "td", "html", "-" ]
28945 ]
28946 }
28947 !! wikitext
28948 {|
28949 |a||b
28950 |}
28951 !! wikitext/edited
28952 {|
28953 | -||-
28954 |}
28955 !! end
28956
28957 ## This tests normalizer's ability to not be tripped by
28958 ## comments (and whitespace)
28959 !! test
28960 4c. Table cells without escapable prefixes after edits
28961 !! options
28962 parsoid={
28963 "modes": ["selser"],
28964 "scrubWikitext": true,
28965 "changes": [
28966 [ "table tbody tr td:first-child", "remove" ]
28967 ]
28968 }
28969 !! wikitext
28970 {|
28971 |-
28972 <!--foo--> |a||-
28973 |}
28974 !! wikitext/edited
28975 {|
28976 |-
28977 <!--foo--> | -
28978 |}
28979 !! end
28980
28981 ## This tests normalizer's ability to handle HTML cells
28982 !! test
28983 4d. Table cells without escapable prefixes after edits
28984 !! options
28985 parsoid={
28986 "modes": ["selser"],
28987 "scrubWikitext": true,
28988 "changes": [
28989 [ "td", "html", "-" ]
28990 ]
28991 }
28992 !! wikitext
28993 <table>
28994 <tr><td>a</td></tr>
28995 </table>
28996 !! wikitext/edited
28997 <table>
28998 <tr><td>-</td></tr>
28999 </table>
29000 !! end
29001
29002 ## T111151 Remove font elements without attributes
29003 !! test
29004 5a. font tags without attributes should be dropped in scrubWikitext mode
29005 !! options
29006 parsoid={
29007 "modes": ["html2wt"],
29008 "scrubWikitext": true
29009 }
29010 !! html
29011 <font>foo</font>
29012 <font><font>bar</font></font>
29013 <font class="x">boo</font>
29014 !! wikitext
29015 foo
29016 bar
29017 <font class="x">boo</font>
29018 !! end
29019
29020 !! test
29021 5b. font tags should not be dropped without scrubWikitext being enabled
29022 !! options
29023 parsoid={
29024 "modes": ["html2wt"],
29025 "scrubWikitext": false
29026 }
29027 !! html
29028 <font>foo</font>
29029 !! wikitext
29030 <font>foo</font>
29031 !! end
29032
29033 !! test
29034 Escape nowiki DOM elements
29035 !! options
29036 parsoid=html2wt
29037 !! html/parsoid
29038 <nowiki><i>foo</i></nowiki>
29039 !! wikitext
29040 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29041 !! end
29042
29043 # This is meant to be an interim fix while we go about figuring out
29044 # how to not introduce these trailing <nowiki/>s in the first place.
29045 !! test
29046 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29047 !! options
29048 parsoid=html2wt
29049 !! html/parsoid
29050 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29051 y</p>
29052 <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>
29053 <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>
29054 !! wikitext
29055 x
29056 y
29057
29058 {{echo|
29059 1 = <nowiki/>}}
29060
29061 {{echo|
29062 1 = <nowiki/>
29063 }}
29064 !! end
29065
29066 # ---------------------------------------------------
29067 # End of tests spec'ing wikitext serialization norms |
29068 # ---------------------------------------------------
29069
29070 # T104032
29071 !! test
29072 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29073 !! options
29074 parsoid=html2wt
29075 !! html/parsoid
29076 a<p>b</p>
29077 <b>c</b><p>d</p>
29078 <table><tr>
29079 <td>a<p>b</p></td>
29080 <td><b>c</b><p>d</p></td>
29081 </tr></table>
29082 !! wikitext
29083 a
29084
29085 b
29086
29087 '''c'''
29088
29089 d
29090 {|
29091 |a
29092 b
29093 |'''c'''
29094 d
29095 |}
29096 !! end
29097
29098 !! test
29099 Anchor without href scenarios
29100 !! options
29101 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29102 !! html/parsoid
29103 <a class="bc"></a>
29104 <a class="no">dice</a>
29105 <a name="foo"></a>
29106 !! wikitext
29107
29108 dice
29109 <span name="foo"></span>
29110 !! end
29111
29112 !! test
29113 New transclusion added after a list should be serialized after the list
29114 !! options
29115 parsoid=html2wt
29116 !! html/parsoid
29117 <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>
29118 !! wikitext
29119 * a
29120 {{echo|foo}}
29121 !! end
29122
29123 # -----------------------------------------------------------------
29124 # End of section for Parsoid-only html2wt tests for serialization
29125 # of new content
29126 # -----------------------------------------------------------------
29127
29128 # -----------------------------------------------------------------
29129 # The following section of tests are primarily to spec behavior of
29130 # the selective serializer. All these tests have manual selser
29131 # changes. The automated selser changes for all tests handle the
29132 # wide variation of changes, but these tests here capture specs
29133 # deterministically.
29134 # ----------------------------------------------------------------
29135
29136 ## T90517
29137 !! test
29138 Selser: New comments should not be lost
29139 !! options
29140 parsoid={
29141 "modes": ["selser"],
29142 "changes": [
29143 [ "#a", "after", "<!--c1-->" ],
29144 [ "#b", "before", "<!--c2-->" ]
29145 ]
29146 }
29147 !! wikitext
29148 <span id="a">a</span>
29149
29150 <span id="b">b</span>
29151 !! wikitext/edited
29152 <span id="a">a</span><!--c1-->
29153
29154 <!--c2--><span id="b">b</span>
29155 !! end
29156
29157 ## T89383
29158 !! test
29159 Selser: Check for validity of DSR before using it
29160 !! options
29161 parsoid={
29162 "modes": ["selser"],
29163 "changes": [
29164 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29165 ]
29166 }
29167 !! wikitext
29168 <span id="a">a</span>
29169 !! wikitext/edited
29170 {{DISPLAYTITLE:foo}}
29171 <span id="a">a</span>
29172 !! end
29173
29174 !! test
29175 1. DOMDiff: Changes to <ref> content should be looked up using id
29176 !! options
29177 parsoid={
29178 "modes": ["selser"],
29179 "changes": [
29180 ["#X", "after", "bar"],
29181 ["#Y", "after", "baz"]
29182 ]
29183 }
29184 !! wikitext
29185 X <ref><span id="X">foo</span></ref>
29186 Y <ref name="a" />
29187 <references>
29188 <ref name="a"><span id="Y">foo</span></ref>
29189 </references>
29190 !! wikitext/edited
29191 X <ref><span id="X">foo</span>bar</ref>
29192 Y <ref name="a" />
29193 <references>
29194 <ref name="a"><span id="Y">foo</span>baz</ref>
29195 </references>
29196 !! end
29197
29198 !! test
29199 2. DOMDiff: Changes to <ref> content should be looked up using id
29200 !! options
29201 parsoid={
29202 "modes": ["selser"],
29203 "changes": [
29204 ["#Z", "after", "bar"]
29205 ]
29206 }
29207 !! wikitext
29208 A <ref>foo bar for a</ref>
29209 B <ref group="X" name="b" />
29210
29211 <references />
29212
29213 <references group="X">
29214 <ref name="b"><span id="Z">foo</span></ref>
29215 </references>
29216 !! wikitext/edited
29217 A <ref>foo bar for a</ref>
29218 B <ref group="X" name="b" />
29219
29220 <references />
29221
29222 <references group="X">
29223 <ref name="b"><span id="Z">foo</span>bar</ref>
29224 </references>
29225 !! end
29226
29227 !! test
29228 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29229 !! options
29230 parsoid={
29231 "modes": ["selser"],
29232 "changes": [
29233 [ "div:first-child", "text", "bar" ]
29234 ]
29235 }
29236 !! wikitext
29237 <div style="{{1x|color:red;}}%">foo</div>
29238 !! wikitext/edited
29239 <div style="{{1x|color:red;}}%">bar</div>
29240 !! end
29241
29242 !! test
29243 Empty LI (T49673)
29244 !! wikitext
29245 * a
29246 *
29247 *
29248 * b
29249 !! html/php+tidy
29250 <ul>
29251 <li>a</li>
29252 <li class="mw-empty-elt"></li>
29253 <li class="mw-empty-elt"></li>
29254 <li>b</li>
29255 </ul>
29256 !! end
29257
29258 !! test
29259 Thumbnail output
29260 !! wikitext
29261 [[File:Thumb.png|thumb]]
29262 !! html/php+tidy
29263 <div class="thumb tright">
29264 <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>
29265 <div class="thumbcaption">
29266 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
29267 </div>
29268 </div>
29269 </div>
29270 !! end
29271
29272 !! test
29273 unclosed internal link XSS (T137264)
29274 !! wikitext
29275 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29276 !! html/php
29277 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29278 </p>
29279 !! html/parsoid
29280 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29281 !! end
29282
29283 # Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
29284 # (Parsoid doesn't support $wgRawHtml==true)
29285 !! test
29286 Validating that <style> isn't eaten by tidy (T167349)
29287 !! options
29288 wgRawHtml=1
29289 !! wikitext
29290 <div class="foo">
29291 <html><style>.foo::before { content: "<foo>"; }</style></html>
29292 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style></html>
29293 </div>
29294 !! html/php+tidy
29295 <div class="foo">
29296 <style>.foo::before { content: "<foo>"; }</style>
29297 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29298 </div>
29299 !! end
29300
29301 !! test
29302 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29303 !! wikitext
29304 == A&B&amp;C&amp;amp;D&amp;amp;amp;E ==
29305 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29306 !! html/php
29307 <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>
29308 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29309 </p>
29310 !! end
29311
29312 !! test
29313 Decoding of HTML entities in indicator names for IDs (T104196)
29314 !! options
29315 showindicators
29316 !! wikitext
29317 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29318 !! html/php
29319 1&2&3&amp;4&amp;amp;5=Indicator
29320
29321 !! end
29322
29323 !! test
29324 HTML5 ids: fallback to legacy
29325 !! config
29326 wgFragmentMode=[ 'html5', 'legacy' ]
29327 !! wikitext
29328 == Foo bar ==
29329
29330 == foo Bar ==
29331
29332 == Тест ==
29333
29334 == Тест ==
29335
29336 == тест ==
29337
29338 == Hey < # " > % : ' ==
29339 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29340
29341 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29342
29343 <!-- These two links should produce identical HTML -->
29344 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29345
29346 !! html/php
29347 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29348 <ul>
29349 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29350 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29351 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29352 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29353 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29354 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29355 </ul>
29356 </div>
29357
29358 <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>
29359 <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>
29360 <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>
29361 <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>
29362 <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>
29363 <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>
29364 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29365 </p><p>💩 <span id="💩"></span>
29366 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29367 </p>
29368 !! end
29369
29370 !! test
29371 HTML5 ids: legacy with a fallback to modern
29372 !! config
29373 wgFragmentMode=[ 'legacy', 'html5' ]
29374 !! wikitext
29375 == Foo bar ==
29376
29377 == foo Bar ==
29378
29379 == Тест ==
29380
29381 == Тест ==
29382
29383 == тест ==
29384
29385 == Hey < # " > % : ' ==
29386 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29387
29388 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29389
29390 <!-- These two links should produce identical HTML -->
29391 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29392
29393 !! html/php
29394 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29395 <ul>
29396 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29397 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29398 <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>
29399 <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>
29400 <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>
29401 <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>
29402 </ul>
29403 </div>
29404
29405 <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>
29406 <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>
29407 <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>
29408 <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>
29409 <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>
29410 <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>
29411 <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>
29412 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
29413 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
29414 </p>
29415 !! end
29416
29417 !! test
29418 HTML5 ids: no legacy
29419 !! config
29420 wgFragmentMode=[ 'html5' ]
29421 !! wikitext
29422 == Foo bar ==
29423
29424 == foo Bar ==
29425
29426 == Тест ==
29427
29428 == Тест ==
29429
29430 == тест ==
29431
29432 == Hey < # " > % : ' ==
29433 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29434
29435 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29436
29437 <!-- These two links should produce identical HTML -->
29438 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29439
29440 !! html/php
29441 <div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
29442 <ul>
29443 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29444 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29445 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29446 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29447 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29448 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
29449 </ul>
29450 </div>
29451
29452 <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>
29453 <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>
29454 <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>
29455 <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>
29456 <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>
29457 <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>
29458 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_'">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
29459 </p><p>💩 <span id="💩"></span>
29460 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29461 </p>
29462 !! end